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. #7913

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,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 @@ -705,6 +710,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
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package google

import (
"fmt"
"github.com/hashicorp/terraform-provider-google/google/acctest"
"os"
"testing"

"github.com/hashicorp/terraform-provider-google/google/acctest"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
)

Expand All @@ -29,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
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,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 Expand Up @@ -390,7 +392,6 @@ func TestAccCloudFunctionsFunction_buildworkerpool(t *testing.T) {
zipFilePath := createZIPArchiveForCloudFunctionSource(t, testHTTPTriggerPath)
proj := acctest.GetTestProjectFromEnv()


defer os.Remove(zipFilePath) // clean up

VcrTest(t, resource.TestCase{
Expand Down Expand Up @@ -438,9 +439,9 @@ func TestAccCloudFunctionsFunction_pubsub(t *testing.T) {
Config: testAccCloudFunctionsFunction_pubsub(functionName, bucketName,
topicName, zipFilePath),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(funcResourceName,
"max_instances", "3000"),
),
resource.TestCheckResourceAttr(funcResourceName,
"max_instances", "3000"),
),
},
{
ResourceName: funcResourceName,
Expand Down