Skip to content

Commit ad229e9

Browse files
remove requirement form zone field in composer config.node_config (#10324) (#5320) (#3745)
Signed-off-by: Modular Magician <[email protected]>
1 parent f78db13 commit ad229e9

File tree

3 files changed

+39
-29
lines changed

3 files changed

+39
-29
lines changed

.changelog/5320.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
composer: removed `config.node_config.zone` requirement on `google_composer_environment`
3+
```

google-beta/resource_composer_environment.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ func resourceComposerEnvironment() *schema.Resource {
141141
Schema: map[string]*schema.Schema{
142142
"zone": {
143143
Type: schema.TypeString,
144-
Required: true,
144+
Optional: true,
145+
Computed: true,
145146
ForceNew: true,
146147
DiffSuppressFunc: compareSelfLinkOrResourceName,
147148
Description: `The Compute Engine zone in which to deploy the VMs running the Apache Airflow software, specified as the zone name or relative resource name (e.g. "projects/{project}/zones/{zone}"). Must belong to the enclosing environment's project and region. This field is supported for Cloud Composer environments in versions composer-1.*.*-airflow-*.*.*.`,
@@ -1690,9 +1691,6 @@ func expandComposerEnvironmentMachineType(v interface{}, d *schema.ResourceData,
16901691

16911692
fv, err := ParseMachineTypesFieldValue(v.(string), d, config)
16921693
if err != nil {
1693-
if requiredZone == "" {
1694-
return "", err
1695-
}
16961694

16971695
// Try to construct machine type with zone/project given in config.
16981696
project, err := getProject(d, config)

google-beta/resource_composer_environment_test.go

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -563,9 +563,10 @@ resource "google_composer_environment" "test" {
563563
region = "us-central1"
564564
config {
565565
node_config {
566-
network = google_compute_network.test.self_link
567-
subnetwork = google_compute_subnetwork.test.self_link
568-
zone = "us-central1-a"
566+
network = google_compute_network.test.self_link
567+
subnetwork = google_compute_subnetwork.test.self_link
568+
zone = "us-central1-a"
569+
machine_type = "n1-standard-1"
569570
}
570571
}
571572
}
@@ -971,43 +972,50 @@ locals {
971972
}
972973
resource "google_composer_environment" "test" {
973974
name = "%s"
974-
region = "europe-west3"
975+
region = "us-central1"
975976
976977
config {
978+
node_config {
979+
network = google_compute_network.test.self_link
980+
subnetwork = google_compute_subnetwork.test.self_link
981+
}
982+
977983
software_config {
978984
image_version = local.matching_images[0]
979985
}
986+
980987
maintenance_window {
981-
start_time = "2019-08-01T01:00:00Z"
982-
end_time = "2019-08-01T07:00:00Z"
983-
recurrence = "FREQ=WEEKLY;BYDAY=TU,WE"
988+
start_time = "2019-08-01T01:00:00Z"
989+
end_time = "2019-08-01T07:00:00Z"
990+
recurrence = "FREQ=WEEKLY;BYDAY=TU,WE"
984991
}
992+
985993
workloads_config {
986994
scheduler {
987-
cpu = 1.25
988-
memory_gb = 2.5
989-
storage_gb = 5.4
990-
count = 2
995+
cpu = 1.25
996+
memory_gb = 2.5
997+
storage_gb = 5.4
998+
count = 2
991999
}
9921000
web_server {
993-
cpu = 1.75
994-
memory_gb = 3.0
995-
storage_gb = 4.4
1001+
cpu = 1.75
1002+
memory_gb = 3.0
1003+
storage_gb = 4.4
9961004
}
9971005
worker {
998-
cpu = 0.5
999-
memory_gb = 2.0
1000-
storage_gb = 3.4
1001-
min_count = 2
1002-
max_count = 5
1006+
cpu = 0.5
1007+
memory_gb = 2.0
1008+
storage_gb = 3.4
1009+
min_count = 2
1010+
max_count = 5
10031011
}
10041012
}
1005-
environment_size = "ENVIRONMENT_SIZE_MEDIUM"
1013+
environment_size = "ENVIRONMENT_SIZE_MEDIUM"
10061014
private_environment_config {
1007-
enable_private_endpoint = true
1008-
cloud_composer_network_ipv4_cidr_block = "10.3.192.0/24"
1009-
master_ipv4_cidr_block = "172.16.194.0/23"
1010-
cloud_sql_ipv4_cidr_block = "10.3.224.0/20"
1015+
enable_private_endpoint = true
1016+
cloud_composer_network_ipv4_cidr_block = "10.3.192.0/24"
1017+
master_ipv4_cidr_block = "172.16.194.0/23"
1018+
cloud_sql_ipv4_cidr_block = "10.3.224.0/20"
10111019
}
10121020
}
10131021
@@ -1022,7 +1030,8 @@ resource "google_compute_subnetwork" "test" {
10221030
name = "%s"
10231031
ip_cidr_range = "10.2.0.0/16"
10241032
region = "us-central1"
1025-
network = google_compute_network.test.self_link
1033+
network = google_compute_network.test.self_link
1034+
private_ip_google_access = true
10261035
}
10271036
10281037
`, envName, network, subnetwork)

0 commit comments

Comments
 (0)