diff --git a/mmv1/third_party/terraform/resources/resource_composer_environment.go.erb b/mmv1/third_party/terraform/resources/resource_composer_environment.go.erb index 740a76c793cc..ae6a23e470d0 100644 --- a/mmv1/third_party/terraform/resources/resource_composer_environment.go.erb +++ b/mmv1/third_party/terraform/resources/resource_composer_environment.go.erb @@ -56,11 +56,11 @@ var ( "config.0.node_config", "config.0.software_config", "config.0.private_environment_config", -<% unless version == "ga" -%> "config.0.web_server_network_access_control", "config.0.database_config", "config.0.web_server_config", "config.0.encryption_config", +<% unless version == "ga" -%> "config.0.maintenance_window", <% end -%> "config.0.workloads_config", @@ -90,7 +90,6 @@ var ( "config.0.node_config.0.ip_allocation_policy.0.services_ipv4_cidr_block", } -<% unless version == "ga" -%> allowedIpRangesConfig = &schema.Resource{ Schema: map[string]*schema.Schema{ "value": { @@ -106,8 +105,6 @@ var ( }, } -<% end -%> - <% unless version == "ga" -%> cidrBlocks = &schema.Resource{ Schema: map[string]*schema.Schema{ @@ -462,7 +459,6 @@ func resourceComposerEnvironment() *schema.Resource { }, }, }, -<% unless version == "ga" -%> "web_server_network_access_control": { Type: schema.TypeList, Optional: true, @@ -482,8 +478,6 @@ func resourceComposerEnvironment() *schema.Resource { }, }, }, -<% end -%> -<% unless version == "ga" -%> "database_config": { Type: schema.TypeList, Optional: true, @@ -536,6 +530,7 @@ func resourceComposerEnvironment() *schema.Resource { }, }, }, +<% unless version == "ga" -%> "maintenance_window": { Type: schema.TypeList, Optional: true, @@ -975,7 +970,6 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{}) } } -<% unless version == "ga" -%> if d.HasChange("config.0.database_config.0.machine_type") { patchObj := &composer.Environment{Config: &composer.EnvironmentConfig{}} if config != nil { @@ -998,6 +992,7 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{}) } } +<% unless version == "ga" -%> if d.HasChange("config.0.maintenance_window") { patchObj := &composer.Environment{Config: &composer.EnvironmentConfig{}} if config != nil { @@ -1159,11 +1154,11 @@ func flattenComposerEnvironmentConfig(envCfg *composer.EnvironmentConfig) interf transformed["node_config"] = flattenComposerEnvironmentConfigNodeConfig(envCfg.NodeConfig) transformed["software_config"] = flattenComposerEnvironmentConfigSoftwareConfig(envCfg.SoftwareConfig) transformed["private_environment_config"] = flattenComposerEnvironmentConfigPrivateEnvironmentConfig(envCfg.PrivateEnvironmentConfig) -<% unless version == "ga" -%> transformed["web_server_network_access_control"] = flattenComposerEnvironmentConfigWebServerNetworkAccessControl(envCfg.WebServerNetworkAccessControl) transformed["database_config"] = flattenComposerEnvironmentConfigDatabaseConfig(envCfg.DatabaseConfig) transformed["web_server_config"] = flattenComposerEnvironmentConfigWebServerConfig(envCfg.WebServerConfig) transformed["encryption_config"] = flattenComposerEnvironmentConfigEncryptionConfig(envCfg.EncryptionConfig) +<% unless version == "ga" -%> transformed["maintenance_window"] = flattenComposerEnvironmentConfigMaintenanceWindow(envCfg.MaintenanceWindow) <% end -%> transformed["workloads_config"] = flattenComposerEnvironmentConfigWorkloadsConfig(envCfg.WorkloadsConfig) @@ -1174,7 +1169,6 @@ func flattenComposerEnvironmentConfig(envCfg *composer.EnvironmentConfig) interf return []interface{}{transformed} } -<% unless version == "ga" -%> func flattenComposerEnvironmentConfigWebServerNetworkAccessControl(accessControl *composer.WebServerNetworkAccessControl) interface{} { if accessControl == nil || accessControl.AllowedIpRanges == nil { return nil @@ -1195,9 +1189,7 @@ func flattenComposerEnvironmentConfigWebServerNetworkAccessControl(accessControl return []interface{}{webServerNetworkAccessControl} } -<% end -%> -<% unless version == "ga" -%> func flattenComposerEnvironmentConfigDatabaseConfig(databaseCfg *composer.DatabaseConfig) interface{} { if databaseCfg == nil { return nil @@ -1231,6 +1223,8 @@ func flattenComposerEnvironmentConfigEncryptionConfig(encryptionCfg *composer.En return []interface{}{transformed} } +<% unless version == "ga" -%> + func flattenComposerEnvironmentConfigMaintenanceWindow(maintenanceWindow *composer.MaintenanceWindow) interface{} { if maintenanceWindow == nil { return nil @@ -1435,16 +1429,12 @@ func expandComposerEnvironmentConfig(v interface{}, d *schema.ResourceData, conf } transformed.PrivateEnvironmentConfig = transformedPrivateEnvironmentConfig -<% unless version == "ga" -%> transformedWebServerNetworkAccessControl, err := expandComposerEnvironmentConfigWebServerNetworkAccessControl(original["web_server_network_access_control"], d, config) if err != nil { return nil, err } transformed.WebServerNetworkAccessControl = transformedWebServerNetworkAccessControl -<% end -%> - -<% unless version == "ga" -%> transformedDatabaseConfig, err := expandComposerEnvironmentConfigDatabaseConfig(original["database_config"], d, config) if err != nil { return nil, err @@ -1463,6 +1453,7 @@ func expandComposerEnvironmentConfig(v interface{}, d *schema.ResourceData, conf } transformed.EncryptionConfig = transformedEncryptionConfig +<% unless version == "ga" -%> transformedMaintenanceWindow, err := expandComposerEnvironmentConfigMaintenanceWindow(original["maintenance_window"], d, config) if err != nil { return nil, err @@ -1497,7 +1488,6 @@ func expandComposerEnvironmentConfigNodeCount(v interface{}, d *schema.ResourceD return int64(v.(int)), nil } -<% unless version == "ga" -%> func expandComposerEnvironmentConfigWebServerNetworkAccessControl(v interface{}, d *schema.ResourceData, config *Config) (*composer.WebServerNetworkAccessControl, error) { l := v.([]interface{}) if len(l) == 0 { @@ -1527,8 +1517,6 @@ func expandComposerEnvironmentConfigWebServerNetworkAccessControl(v interface{}, return transformed, nil } -<% end -%> - <% unless version == "ga" -%> func expandComposerEnvironmentConfigMasterAuthorizedNetworksConfig(v interface{}, d *schema.ResourceData, config *Config) (*composer.MasterAuthorizedNetworksConfig, error) { l := v.([]interface{}) @@ -1559,7 +1547,6 @@ func expandComposerEnvironmentConfigMasterAuthorizedNetworksConfig(v interface{} <% end -%> -<% unless version == "ga" -%> func expandComposerEnvironmentConfigDatabaseConfig(v interface{}, d *schema.ResourceData, config *Config) (*composer.DatabaseConfig, error) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { @@ -1588,9 +1575,6 @@ func expandComposerEnvironmentConfigWebServerConfig(v interface{}, d *schema.Res return transformed, nil } -<% end -%> - -<% unless version == "ga" -%> func expandComposerEnvironmentConfigEncryptionConfig(v interface{}, d *schema.ResourceData, config *Config) (*composer.EncryptionConfig, error) { l := v.([]interface{}) if len(l) == 0 || l[0] == nil { @@ -1605,6 +1589,7 @@ func expandComposerEnvironmentConfigEncryptionConfig(v interface{}, d *schema.Re return transformed, nil } +<% unless version == "ga" -%> func expandComposerEnvironmentConfigMaintenanceWindow(v interface{}, d *schema.ResourceData, config *Config) (*composer.MaintenanceWindow, error) { l := v.([]interface{}) if len(l) == 0 { diff --git a/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb b/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb index 8ca90f7377bb..f77e5a4cfc28 100644 --- a/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_composer_environment_test.go.erb @@ -173,7 +173,6 @@ func TestAccComposerEnvironment_private(t *testing.T) { }) } -<% unless version == "ga" -%> // Checks environment creation with minimum required information. func TestAccComposerEnvironment_privateWithWebServerControl(t *testing.T) { t.Parallel() @@ -222,9 +221,6 @@ func TestAccComposerEnvironment_privateWithWebServerControl(t *testing.T) { }) } -<% end -%> - -<% unless version == "ga" -%> func TestAccComposerEnvironment_withDatabaseConfig(t *testing.T) { t.Parallel() envName := fmt.Sprintf("%s-%d", testComposerEnvironmentPrefix, randInt(t)) @@ -330,6 +326,7 @@ func TestAccComposerEnvironment_withEncryptionConfig(t *testing.T) { }) } +<% unless version == "ga" -%> func TestAccComposerEnvironment_withMaintenanceWindow(t *testing.T) { t.Parallel() @@ -843,7 +840,6 @@ resource "google_compute_subnetwork" "test" { `, name, network, subnetwork) } -<% unless version == "ga" -%> func testAccComposerEnvironment_privateWithWebServerControl(name, network, subnetwork string) string { return fmt.Sprintf(` resource "google_composer_environment" "test" { @@ -948,9 +944,6 @@ resource "google_compute_subnetwork" "test" { `, name, network, subnetwork) } -<% end -%> - -<% unless version == "ga" -%> func testAccComposerEnvironment_databaseCfg(name, network, subnetwork string) string { return fmt.Sprintf(` resource "google_composer_environment" "test" { @@ -1150,6 +1143,7 @@ resource "google_compute_subnetwork" "test" { `, pid, kmsKey, name, kmsKey, network, subnetwork) } +<% unless version == "ga" -%> func testAccComposerEnvironment_maintenanceWindow(pid, envName, network, subnetwork string) string { return fmt.Sprintf(` resource "google_composer_environment" "test" { diff --git a/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown b/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown index 4beb2f7c13a4..9766e93cc6ef 100644 --- a/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/composer_environment.html.markdown @@ -291,25 +291,21 @@ The following arguments are supported: The configuration used for the Private IP Cloud Composer environment. Structure is [documented below](#nested_private_environment_config). * `web_server_network_access_control` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), - Cloud Composer 1 only) + (Optional, Cloud Composer 1 only) The network-level access control policy for the Airflow web server. If unspecified, no network-level access restrictions are applied. * `database_config` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), - Cloud Composer 1 only) + (Optional, Cloud Composer 1 only) The configuration settings for Cloud SQL instance used internally by Apache Airflow software. * `web_server_config` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), - Cloud Composer 1 only) + (Optional, Cloud Composer 1 only) The configuration settings for the Airflow web server App Engine instance. * `encryption_config` - - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html), - Cloud Composer 1 only) + (Optional, Cloud Composer 1 only) The encryption options for the Cloud Composer environment and its dependencies.