Skip to content

Commit

Permalink
[Composer] Reveal cloud_data_lineage_integration to GA. (#11619)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahidalgob authored Sep 24, 2024
1 parent 8d575cd commit fba00e3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ var (
"config.0.software_config.0.image_version",
"config.0.software_config.0.python_version",
"config.0.software_config.0.scheduler_count",
<% unless version == "ga" -%>
"config.0.software_config.0.cloud_data_lineage_integration",
<% unless version == "ga" -%>
"config.0.software_config.0.web_server_plugins_mode",
<% end -%>
}
Expand Down Expand Up @@ -497,7 +497,6 @@ func ResourceComposerEnvironment() *schema.Resource {
Computed: true,
Description: `The number of schedulers for Airflow. This field is supported for Cloud Composer environments in versions composer-1.*.*-airflow-2.*.*.`,
},
<% unless version == "ga" -%>
"cloud_data_lineage_integration": {
Type: schema.TypeList,
Optional: true,
Expand All @@ -515,6 +514,7 @@ func ResourceComposerEnvironment() *schema.Resource {
},
},
},
<% unless version == "ga" -%>
"web_server_plugins_mode": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -1318,7 +1318,6 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{})
}
}

<% unless version == "ga" -%>
if d.HasChange("config.0.software_config.0.cloud_data_lineage_integration") {
patchObj := &composer.Environment{
Config: &composer.EnvironmentConfig{
Expand All @@ -1333,7 +1332,6 @@ func resourceComposerEnvironmentUpdate(d *schema.ResourceData, meta interface{})
return err
}
}
<% end -%>

if d.HasChange("config.0.software_config.0.airflow_config_overrides") {
patchObj := &composer.Environment{
Expand Down Expand Up @@ -2002,8 +2000,8 @@ func flattenComposerEnvironmentConfigSoftwareConfig(softwareCfg *composer.Softwa
transformed["pypi_packages"] = softwareCfg.PypiPackages
transformed["env_variables"] = softwareCfg.EnvVariables
transformed["scheduler_count"] = softwareCfg.SchedulerCount
<% unless version == "ga" -%>
transformed["cloud_data_lineage_integration"] = flattenComposerEnvironmentConfigSoftwareConfigCloudDataLineageIntegration(softwareCfg.CloudDataLineageIntegration)
<% unless version == "ga" -%>
if softwareCfg.WebServerPluginsMode == "PLUGINS_DISABLED"{
transformed["web_server_plugins_mode"] = "DISABLED"
} else if softwareCfg.WebServerPluginsMode == "PLUGINS_ENABLED"{
Expand All @@ -2015,7 +2013,6 @@ func flattenComposerEnvironmentConfigSoftwareConfig(softwareCfg *composer.Softwa
return []interface{}{transformed}
}

<% unless version == "ga" -%>
func flattenComposerEnvironmentConfigSoftwareConfigCloudDataLineageIntegration(cloudDataLineageIntegration *composer.CloudDataLineageIntegration) interface{} {
if cloudDataLineageIntegration == nil {
return nil
Expand All @@ -2026,7 +2023,6 @@ func flattenComposerEnvironmentConfigSoftwareConfigCloudDataLineageIntegration(c

return []interface{}{transformed}
}
<% end -%>

func flattenComposerEnvironmentConfigMasterAuthorizedNetworksConfig(masterAuthNetsCfg *composer.MasterAuthorizedNetworksConfig) interface{} {
if masterAuthNetsCfg == nil {
Expand Down Expand Up @@ -2740,13 +2736,13 @@ func expandComposerEnvironmentConfigSoftwareConfig(v interface{}, d *schema.Reso
transformed.EnvVariables = expandComposerEnvironmentConfigSoftwareConfigStringMap(original, "env_variables")
transformed.SchedulerCount = int64(original["scheduler_count"].(int))

<% unless version == "ga" -%>
transformedCloudDataLineageIntegration, err := expandComposerEnvironmentConfigSoftwareConfigCloudDataLineageIntegration(original["cloud_data_lineage_integration"], d, config)
if err != nil {
return nil, err
}
transformed.CloudDataLineageIntegration = transformedCloudDataLineageIntegration

<% unless version == "ga" -%>
if original["web_server_plugins_mode"].(string) == "DISABLED"{
transformed.WebServerPluginsMode = "PLUGINS_DISABLED"
} else if original["web_server_plugins_mode"].(string) == "ENABLED"{
Expand All @@ -2767,7 +2763,6 @@ func expandComposerEnvironmentConfigSoftwareConfigStringMap(softwareConfig map[s
return map[string]string{}
}

<% unless version == "ga" -%>
func expandComposerEnvironmentConfigSoftwareConfigCloudDataLineageIntegration(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) (*composer.CloudDataLineageIntegration, error) {
l := v.([]interface{})
if len(l) == 0 {
Expand All @@ -2781,7 +2776,6 @@ func expandComposerEnvironmentConfigSoftwareConfigCloudDataLineageIntegration(v

return transformed, nil
}
<% end -%>

func validateComposerEnvironmentPypiPackages(v interface{}, k string) (ws []string, errors []error) {
if v == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2200,11 +2200,9 @@ resource "google_composer_environment" "test" {

software_config {
image_version = "composer-2-airflow-2"
<% unless version == "ga" -%>
cloud_data_lineage_integration {
enabled = true
}
<% end -%>
}

workloads_config {
Expand Down Expand Up @@ -2672,11 +2670,9 @@ resource "google_composer_environment" "test" {

software_config {
image_version = "composer-2-airflow-2"
<% unless version == "ga" -%>
cloud_data_lineage_integration {
enabled = false
}
<% end -%>
}

workloads_config {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1037,8 +1037,7 @@ The following arguments are supported:
major Cloud Composer or Apache Airflow versions (from `1.x.x` to `2.x.x`). To do so, create a new environment.

* `cloud_data_lineage_integration` -
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html),
Cloud Composer environments in versions composer-2.1.2-airflow-*.*.* and newer)
(Optional, Cloud Composer environments in versions composer-2.1.2-airflow-*.*.* and newer)
The configuration for Cloud Data Lineage integration. Structure is
[documented below](#nested_cloud_data_lineage_integration_c2).

Expand Down Expand Up @@ -1465,8 +1464,7 @@ The following arguments are supported:
**Important**: In-place upgrade for Composer 3 is not yet supported.

* `cloud_data_lineage_integration` -
(Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html),
Cloud Composer environments in versions composer-2.1.2-airflow-*.*.* and later)
(Optional, Cloud Composer environments in versions composer-2.1.2-airflow-*.*.* and later)
The configuration for Cloud Data Lineage integration. Structure is
[documented below](#nested_cloud_data_lineage_integration_c3).

Expand Down

0 comments on commit fba00e3

Please sign in to comment.