diff --git a/.changelog/7913.txt b/.changelog/7913.txt new file mode 100644 index 00000000000..8c0abefa667 --- /dev/null +++ b/.changelog/7913.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +cloudfunctions: added `status` attribute to the `google_cloudfunctions_function` resource and data source +``` diff --git a/google/data_source_google_cloudfunctions_function_test.go b/google/data_source_google_cloudfunctions_function_test.go index d994d92a07b..dad4b468b6e 100644 --- a/google/data_source_google_cloudfunctions_function_test.go +++ b/google/data_source_google_cloudfunctions_function_test.go @@ -30,6 +30,8 @@ func TestAccDataSourceGoogleCloudFunctionsFunction_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( acctest.CheckDataSourceStateMatchesResourceState(funcDataNameHttp, "google_cloudfunctions_function.function_http"), + resource.TestCheckResourceAttr(funcDataNameHttp, + "status", "ACTIVE"), ), }, }, diff --git a/google/resource_cloudfunctions_function.go b/google/resource_cloudfunctions_function.go index edc30e7c897..07d206e694d 100644 --- a/google/resource_cloudfunctions_function.go +++ b/google/resource_cloudfunctions_function.go @@ -461,6 +461,11 @@ func ResourceCloudFunctionsFunction() *schema.Resource { }, }, }, + "status": { + Type: schema.TypeString, + Computed: true, + Description: `Describes the current stage of a deployment.`, + }, }, UseJSONNumber: true, } @@ -707,6 +712,10 @@ func resourceCloudFunctionsRead(d *schema.ResourceData, meta interface{}) error return fmt.Errorf("Error setting secret_volumes: %s", err) } + if err := d.Set("status", function.Status); err != nil { + return fmt.Errorf("Error setting status: %s", err) + } + if function.HttpsTrigger != nil { if err := d.Set("trigger_http", true); err != nil { return fmt.Errorf("Error setting trigger_http: %s", err) diff --git a/google/resource_cloudfunctions_function_test.go b/google/resource_cloudfunctions_function_test.go index 17602785a1e..1e2a5d4dbd2 100644 --- a/google/resource_cloudfunctions_function_test.go +++ b/google/resource_cloudfunctions_function_test.go @@ -284,6 +284,8 @@ func TestAccCloudFunctionsFunction_basic(t *testing.T) { "min_instances", "3"), resource.TestCheckResourceAttr(funcResourceName, "ingress_settings", "ALLOW_INTERNAL_ONLY"), + resource.TestCheckResourceAttr(funcResourceName, + "status", "ACTIVE"), testAccCloudFunctionsFunctionSource(fmt.Sprintf("gs://%s/index.zip", bucketName), &function), testAccCloudFunctionsFunctionTrigger(FUNCTION_TRIGGER_HTTP, &function), resource.TestCheckResourceAttr(funcResourceName,