@@ -29,7 +29,16 @@ func TestAccCloudFunctions2Function_update(t *testing.T) {
2929 ImportStateVerifyIgnore : []string {"location" , "build_config.0.source.0.storage_source.0.object" , "build_config.0.source.0.storage_source.0.bucket" },
3030 },
3131 {
32- Config : testAccCloudFunctions2Function_updated (context ),
32+ Config : testAccCloudFunctions2Function_test_update (context ),
33+ },
34+ {
35+ ResourceName : "google_cloudfunctions2_function.terraform-test2" ,
36+ ImportState : true ,
37+ ImportStateVerify : true ,
38+ ImportStateVerifyIgnore : []string {"location" , "build_config.0.source.0.storage_source.0.object" , "build_config.0.source.0.storage_source.0.bucket" },
39+ },
40+ {
41+ Config : testAccCloudFunctions2Function_test_redeploy (context ),
3342 },
3443 {
3544 ResourceName : "google_cloudfunctions2_function.terraform-test2" ,
@@ -83,7 +92,49 @@ resource "google_cloudfunctions2_function" "terraform-test2" {
8392` , context )
8493}
8594
86- func testAccCloudFunctions2Function_updated (context map [string ]interface {}) string {
95+ func testAccCloudFunctions2Function_test_update (context map [string ]interface {}) string {
96+ return Nprintf (`
97+ resource "google_storage_bucket" "bucket" {
98+ provider = google-beta
99+ name = "tf-test-cloudfunctions2-function-bucket%{random_suffix}"
100+ location = "US"
101+ uniform_bucket_level_access = true
102+ }
103+
104+ resource "google_storage_bucket_object" "object" {
105+ provider = google-beta
106+ name = "function-source.zip"
107+ bucket = google_storage_bucket.bucket.name
108+ source = "%{zip_path}"
109+ }
110+
111+ resource "google_cloudfunctions2_function" "terraform-test2" {
112+ provider = google-beta
113+ name = "tf-test-test-function%{random_suffix}"
114+ location = "us-central1"
115+ description = "an updated function"
116+
117+ build_config {
118+ runtime = "nodejs12"
119+ entry_point = "helloHttp"
120+ source {
121+ storage_source {
122+ bucket = google_storage_bucket.bucket.name
123+ object = google_storage_bucket_object.object.name
124+ }
125+ }
126+ }
127+
128+ service_config {
129+ max_instance_count = 1
130+ available_memory = "1536Mi"
131+ timeout_seconds = 30
132+ }
133+ }
134+ ` , context )
135+ }
136+
137+ func testAccCloudFunctions2Function_test_redeploy (context map [string ]interface {}) string {
87138 return Nprintf (`
88139resource "google_storage_bucket" "bucket" {
89140 provider = google-beta
0 commit comments