@@ -491,6 +491,42 @@ func TestAccComposerEnvironment_ComposerV2(t *testing.T) {
491491 })
492492}
493493
494+ func TestAccComposerEnvironment_UpdateComposerV2ImageVersion (t * testing.T ) {
495+ t .Parallel ()
496+
497+ envName := fmt .Sprintf ("%s-%d" , testComposerEnvironmentPrefix , acctest .RandInt (t ))
498+ network := fmt .Sprintf ("%s-%d" , testComposerNetworkPrefix , acctest .RandInt (t ))
499+ subnetwork := network + "-1"
500+
501+ acctest .VcrTest (t , resource.TestCase {
502+ PreCheck : func () { acctest .AccTestPreCheck (t ) },
503+ ProtoV5ProviderFactories : acctest .ProtoV5ProviderFactories (t ),
504+ CheckDestroy : testAccComposerEnvironmentDestroyProducer (t ),
505+ Steps : []resource.TestStep {
506+ {
507+ Config : testAccComposerEnvironment_composerV250 (envName , network , subnetwork ),
508+ },
509+ {
510+ Config : testAccComposerEnvironment_composerV260 (envName , network , subnetwork ),
511+ },
512+ {
513+ ResourceName : "google_composer_environment.test" ,
514+ ImportState : true ,
515+ ImportStateVerify : true ,
516+ },
517+ // This is a terrible clean-up step in order to get destroy to succeed,
518+ // due to dangling firewall rules left by the Composer Environment blocking network deletion.
519+ // TODO(dzarmola): Remove this check if firewall rules bug gets fixed by Composer.
520+ {
521+ PlanOnly : true ,
522+ ExpectNonEmptyPlan : false ,
523+ Config : testAccComposerEnvironment_composerV260 (envName , network , subnetwork ),
524+ Check : testAccCheckClearComposerEnvironmentFirewalls (t , network ),
525+ },
526+ },
527+ })
528+ }
529+
494530func TestAccComposerEnvironment_UpdateComposerV2ResilienceMode (t * testing.T ) {
495531 t .Parallel ()
496532
@@ -2145,6 +2181,74 @@ resource "google_compute_subnetwork" "test" {
21452181` , envName , network , subnetwork )
21462182}
21472183
2184+ func testAccComposerEnvironment_composerV250 (envName , network , subnetwork string ) string {
2185+ return fmt .Sprintf (`
2186+ resource "google_composer_environment" "test" {
2187+ name = "%s"
2188+ region = "us-east1"
2189+
2190+ config {
2191+ node_config {
2192+ network = google_compute_network.test.self_link
2193+ subnetwork = google_compute_subnetwork.test.self_link
2194+ }
2195+
2196+ software_config {
2197+ image_version = "composer-2.5.0-airflow-2.6.3"
2198+ }
2199+ }
2200+ }
2201+
2202+ resource "google_compute_network" "test" {
2203+ name = "%s"
2204+ auto_create_subnetworks = false
2205+ }
2206+
2207+ resource "google_compute_subnetwork" "test" {
2208+ name = "%s"
2209+ ip_cidr_range = "10.2.0.0/16"
2210+ region = "us-east1"
2211+ network = google_compute_network.test.self_link
2212+ private_ip_google_access = true
2213+ }
2214+
2215+ ` , envName , network , subnetwork )
2216+ }
2217+
2218+ func testAccComposerEnvironment_composerV260 (envName , network , subnetwork string ) string {
2219+ return fmt .Sprintf (`
2220+ resource "google_composer_environment" "test" {
2221+ name = "%s"
2222+ region = "us-east1"
2223+
2224+ config {
2225+ node_config {
2226+ network = google_compute_network.test.self_link
2227+ subnetwork = google_compute_subnetwork.test.self_link
2228+ }
2229+
2230+ software_config {
2231+ image_version = "composer-2.6.0-airflow-2.6.3"
2232+ }
2233+ }
2234+ }
2235+
2236+ resource "google_compute_network" "test" {
2237+ name = "%s"
2238+ auto_create_subnetworks = false
2239+ }
2240+
2241+ resource "google_compute_subnetwork" "test" {
2242+ name = "%s"
2243+ ip_cidr_range = "10.2.0.0/16"
2244+ region = "us-east1"
2245+ network = google_compute_network.test.self_link
2246+ private_ip_google_access = true
2247+ }
2248+
2249+ ` , envName , network , subnetwork )
2250+ }
2251+
21482252func testAccComposerEnvironment_composerV2HighResilience (envName , network , subnetwork string ) string {
21492253 return fmt .Sprintf (`
21502254resource "google_composer_environment" "test" {
0 commit comments