Skip to content

Commit 5c42d5a

Browse files
Add status output field to google_cloudfunctions_function, update tests for resource and data source. (#7913) (#14574)
Signed-off-by: Modular Magician <[email protected]>
1 parent 45dcc18 commit 5c42d5a

4 files changed

+16
-0
lines changed

.changelog/7913.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
cloudfunctions: added `status` attribute to the `google_cloudfunctions_function` resource and data source
3+
```

google/data_source_google_cloudfunctions_function_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ func TestAccDataSourceGoogleCloudFunctionsFunction_basic(t *testing.T) {
3030
Check: resource.ComposeTestCheckFunc(
3131
acctest.CheckDataSourceStateMatchesResourceState(funcDataNameHttp,
3232
"google_cloudfunctions_function.function_http"),
33+
resource.TestCheckResourceAttr(funcDataNameHttp,
34+
"status", "ACTIVE"),
3335
),
3436
},
3537
},

google/resource_cloudfunctions_function.go

+9
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,11 @@ func ResourceCloudFunctionsFunction() *schema.Resource {
461461
},
462462
},
463463
},
464+
"status": {
465+
Type: schema.TypeString,
466+
Computed: true,
467+
Description: `Describes the current stage of a deployment.`,
468+
},
464469
},
465470
UseJSONNumber: true,
466471
}
@@ -707,6 +712,10 @@ func resourceCloudFunctionsRead(d *schema.ResourceData, meta interface{}) error
707712
return fmt.Errorf("Error setting secret_volumes: %s", err)
708713
}
709714

715+
if err := d.Set("status", function.Status); err != nil {
716+
return fmt.Errorf("Error setting status: %s", err)
717+
}
718+
710719
if function.HttpsTrigger != nil {
711720
if err := d.Set("trigger_http", true); err != nil {
712721
return fmt.Errorf("Error setting trigger_http: %s", err)

google/resource_cloudfunctions_function_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ func TestAccCloudFunctionsFunction_basic(t *testing.T) {
284284
"min_instances", "3"),
285285
resource.TestCheckResourceAttr(funcResourceName,
286286
"ingress_settings", "ALLOW_INTERNAL_ONLY"),
287+
resource.TestCheckResourceAttr(funcResourceName,
288+
"status", "ACTIVE"),
287289
testAccCloudFunctionsFunctionSource(fmt.Sprintf("gs://%s/index.zip", bucketName), &function),
288290
testAccCloudFunctionsFunctionTrigger(FUNCTION_TRIGGER_HTTP, &function),
289291
resource.TestCheckResourceAttr(funcResourceName,

0 commit comments

Comments
 (0)