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 Terraform Support For Cloud SQL Preferred Zone Selection Feature #6653

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
3 changes: 3 additions & 0 deletions .changelog/9468.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
composer: added `database_config.zone` field in `google_composer_environment`
```
Original file line number Diff line number Diff line change
Expand Up @@ -571,9 +571,15 @@ func ResourceComposerEnvironment() *schema.Resource {
Schema: map[string]*schema.Schema{
"machine_type": {
Type: schema.TypeString,
Required: true,
Optional: true,
Description: `Optional. Cloud SQL machine type used by Airflow database. It has to be one of: db-n1-standard-2, db-n1-standard-4, db-n1-standard-8 or db-n1-standard-16. If not specified, db-n1-standard-2 will be used.`,
},
"zone": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `Optional. Cloud SQL database preferred zone.`,
},
},
},
},
Expand Down Expand Up @@ -1429,6 +1435,7 @@ func flattenComposerEnvironmentConfigDatabaseConfig(databaseCfg *composer.Databa

transformed := make(map[string]interface{})
transformed["machine_type"] = databaseCfg.MachineType
transformed["zone"] = databaseCfg.Zone

return []interface{}{transformed}
}
Expand Down Expand Up @@ -1840,6 +1847,7 @@ func expandComposerEnvironmentConfigDatabaseConfig(v interface{}, d *schema.Reso

transformed := &composer.DatabaseConfig{}
transformed.MachineType = original["machine_type"].(string)
transformed.Zone = original["zone"].(string)

return transformed, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,9 @@ resource "google_composer_environment" "test" {
memory_gb = 2.0
count = 1
}
}
database_config {
zone = "us-east1-c"
}
environment_size = "ENVIRONMENT_SIZE_MEDIUM"
private_environment_config {
Expand Down
8 changes: 6 additions & 2 deletions website/docs/r/composer_environment.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -569,10 +569,14 @@ The `web_server_network_access_control` supports:
<a name="nested_database_config"></a>The `database_config` block supports:

* `machine_type` -
(Required)
Cloud SQL machine type used by Airflow database. It has to be one of: db-n1-standard-2,
(Optional)
Optional. Cloud SQL machine type used by Airflow database. It has to be one of: db-n1-standard-2,
db-n1-standard-4, db-n1-standard-8 or db-n1-standard-16.

* `Zone` -
(Optional)
Preferred Cloud SQL database zone.

<a name="nested_web_server_config"></a>The `web_server_config` block supports:

* `machine_type` -
Expand Down