Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add status output field to google_cloudfunctions_function to resource and data source. #14574

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/7913.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
cloudfunctions: added `status` attribute to the `google_cloudfunctions_function` resource and data source
```
2 changes: 2 additions & 0 deletions google/data_source_google_cloudfunctions_function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
},
},
Expand Down
9 changes: 9 additions & 0 deletions google/resource_cloudfunctions_function.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,11 @@ func ResourceCloudFunctionsFunction() *schema.Resource {
},
},
},
"status": {
Type: schema.TypeString,
Computed: true,
Description: `Describes the current stage of a deployment.`,
},
},
UseJSONNumber: true,
}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions google/resource_cloudfunctions_function_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down