Skip to content

Commit

Permalink
remove requirement form zone field in composer config.node_config (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
kubasieron committed Oct 20, 2021
1 parent 55d2caa commit 5ce8f78
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ func resourceComposerEnvironment() *schema.Resource {
Schema: map[string]*schema.Schema{
"zone": {
Type: schema.TypeString,
Required: true,
Optional: true,
Computed: true,
ForceNew: true,
DiffSuppressFunc: compareSelfLinkOrResourceName,
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-*.*.*.`,
Expand Down Expand Up @@ -1740,9 +1741,6 @@ func expandComposerEnvironmentMachineType(v interface{}, d *schema.ResourceData,

fv, err := ParseMachineTypesFieldValue(v.(string), d, config)
if err != nil {
if requiredZone == "" {
return "", err
}

// Try to construct machine type with zone/project given in config.
project, err := getProject(d, config)
Expand Down Expand Up @@ -2029,4 +2027,4 @@ func versionsEqual(old, new string) (bool, error) {
return false, err
}
return o.Equal(n), nil
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,10 @@ resource "google_composer_environment" "test" {
region = "us-central1"
config {
node_config {
network = google_compute_network.test.self_link
subnetwork = google_compute_subnetwork.test.self_link
zone = "us-central1-a"
network = google_compute_network.test.self_link
subnetwork = google_compute_subnetwork.test.self_link
zone = "us-central1-a"
machine_type = "n1-standard-1"
}
}
}
Expand Down Expand Up @@ -982,43 +983,50 @@ locals {
}
resource "google_composer_environment" "test" {
name = "%s"
region = "europe-west3"
region = "us-central1"

config {
node_config {
network = google_compute_network.test.self_link
subnetwork = google_compute_subnetwork.test.self_link
}

software_config {
image_version = local.matching_images[0]
}

maintenance_window {
start_time = "2019-08-01T01:00:00Z"
end_time = "2019-08-01T07:00:00Z"
recurrence = "FREQ=WEEKLY;BYDAY=TU,WE"
start_time = "2019-08-01T01:00:00Z"
end_time = "2019-08-01T07:00:00Z"
recurrence = "FREQ=WEEKLY;BYDAY=TU,WE"
}

workloads_config {
scheduler {
cpu = 1.25
memory_gb = 2.5
storage_gb = 5.4
count = 2
cpu = 1.25
memory_gb = 2.5
storage_gb = 5.4
count = 2
}
web_server {
cpu = 1.75
memory_gb = 3.0
storage_gb = 4.4
cpu = 1.75
memory_gb = 3.0
storage_gb = 4.4
}
worker {
cpu = 0.5
memory_gb = 2.0
storage_gb = 3.4
min_count = 2
max_count = 5
cpu = 0.5
memory_gb = 2.0
storage_gb = 3.4
min_count = 2
max_count = 5
}
}
environment_size = "ENVIRONMENT_SIZE_MEDIUM"
environment_size = "ENVIRONMENT_SIZE_MEDIUM"
private_environment_config {
enable_private_endpoint = true
cloud_composer_network_ipv4_cidr_block = "10.3.192.0/24"
master_ipv4_cidr_block = "172.16.194.0/23"
cloud_sql_ipv4_cidr_block = "10.3.224.0/20"
enable_private_endpoint = true
cloud_composer_network_ipv4_cidr_block = "10.3.192.0/24"
master_ipv4_cidr_block = "172.16.194.0/23"
cloud_sql_ipv4_cidr_block = "10.3.224.0/20"
}
}

Expand All @@ -1033,7 +1041,8 @@ resource "google_compute_subnetwork" "test" {
name = "%s"
ip_cidr_range = "10.2.0.0/16"
region = "us-central1"
network = google_compute_network.test.self_link
network = google_compute_network.test.self_link
private_ip_google_access = true
}

`, envName, network, subnetwork)
Expand Down

0 comments on commit 5ce8f78

Please sign in to comment.