Skip to content

Commit

Permalink
lifecycle_config and endpoint_config to ga (GoogleCloudPlatform#6281)
Browse files Browse the repository at this point in the history
  • Loading branch information
DrFaust92 authored and geojaz committed Jul 21, 2022
1 parent d104dd4 commit dc2d80a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,8 @@ var (
"cluster_config.0.encryption_config",
"cluster_config.0.autoscaling_config",
"cluster_config.0.metastore_config",
<% unless version == 'ga' -%>
"cluster_config.0.lifecycle_config",
"cluster_config.0.endpoint_config",
<% end -%>
}
)

Expand Down Expand Up @@ -973,7 +971,6 @@ by Dataproc`,
},
},
},
<% unless version == 'ga' -%>
"lifecycle_config": {
Type: schema.TypeList,
Optional: true,
Expand Down Expand Up @@ -1036,7 +1033,6 @@ by Dataproc`,
},
},
},
<% end -%>
},
},
},
Expand Down Expand Up @@ -1493,15 +1489,13 @@ func expandClusterConfig(d *schema.ResourceData, config *Config) (*dataproc.Clus
conf.MetastoreConfig = expandMetastoreConfig(cfg)
}

<% unless version == 'ga' -%>
if cfg, ok := configOptions(d, "cluster_config.0.lifecycle_config"); ok {
conf.LifecycleConfig = expandLifecycleConfig(cfg)
}

if cfg, ok := configOptions(d, "cluster_config.0.endpoint_config"); ok {
conf.EndpointConfig = expandEndpointConfig(cfg)
}
<% end -%>

if cfg, ok := configOptions(d, "cluster_config.0.master_config"); ok {
log.Println("[INFO] got master_config")
Expand Down Expand Up @@ -1682,7 +1676,6 @@ func expandAutoscalingConfig(cfg map[string]interface{}) *dataproc.AutoscalingCo
return conf
}

<% unless version == 'ga' -%>
func expandLifecycleConfig(cfg map[string]interface{}) *dataproc.LifecycleConfig {
conf := &dataproc.LifecycleConfig{}
if v, ok := cfg["idle_delete_ttl"]; ok {
Expand All @@ -1701,7 +1694,6 @@ func expandEndpointConfig(cfg map[string]interface{}) *dataproc.EndpointConfig {
}
return conf
}
<% end -%>

func expandMetastoreConfig(cfg map[string]interface{}) *dataproc.MetastoreConfig {
conf := &dataproc.MetastoreConfig{}
Expand Down Expand Up @@ -1872,7 +1864,6 @@ func resourceDataprocClusterUpdate(d *schema.ResourceData, meta interface{}) err
updMask = append(updMask, "config.autoscaling_config.policy_uri")
}

<% unless version == 'ga' -%>
if d.HasChange("cluster_config.0.lifecycle_config.0.idle_delete_ttl") {
idleDeleteTtl := d.Get("cluster_config.0.lifecycle_config.0.idle_delete_ttl").(string)
cluster.Config.LifecycleConfig = &dataproc.LifecycleConfig{
Expand All @@ -1894,7 +1885,6 @@ func resourceDataprocClusterUpdate(d *schema.ResourceData, meta interface{}) err

updMask = append(updMask, "config.lifecycle_config.auto_delete_time")
}
<% end -%>

if len(updMask) > 0 {
gracefulDecommissionTimeout := d.Get("graceful_decommission_timeout").(string)
Expand Down Expand Up @@ -2127,10 +2117,8 @@ func flattenClusterConfig(d *schema.ResourceData, cfg *dataproc.ClusterConfig) (
"security_config": flattenSecurityConfig(d, cfg.SecurityConfig),
"preemptible_worker_config": flattenPreemptibleInstanceGroupConfig(d, cfg.SecondaryWorkerConfig),
"metastore_config": flattenMetastoreConfig(d, cfg.MetastoreConfig),
<% unless version == 'ga' -%>
"lifecycle_config": flattenLifecycleConfig(d, cfg.LifecycleConfig),
"endpoint_config": flattenEndpointConfig(d, cfg.EndpointConfig),
<% end -%>
"lifecycle_config": flattenLifecycleConfig(d, cfg.LifecycleConfig),
"endpoint_config": flattenEndpointConfig(d, cfg.EndpointConfig),
}

if len(cfg.InitializationActions) > 0 {
Expand Down Expand Up @@ -2211,7 +2199,6 @@ func flattenAutoscalingConfig(d *schema.ResourceData, ec *dataproc.AutoscalingCo
return []map[string]interface{}{data}
}

<% unless version == 'ga' -%>
func flattenLifecycleConfig(d *schema.ResourceData, lc *dataproc.LifecycleConfig) []map[string]interface{} {
if lc == nil {
return nil
Expand All @@ -2237,7 +2224,6 @@ func flattenEndpointConfig(d *schema.ResourceData, ec *dataproc.EndpointConfig)

return []map[string]interface{}{data}
}
<% end -%>

func flattenMetastoreConfig(d *schema.ResourceData, ec *dataproc.MetastoreConfig) []map[string]interface{} {
if ec == nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ import (
"strconv"
"strings"
"testing"
<% unless version == "ga" -%>
"time"
<% end -%>

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource"
"github.com/hashicorp/terraform-plugin-sdk/v2/terraform"
Expand Down Expand Up @@ -644,7 +642,6 @@ func TestAccDataprocCluster_withOptionalComponents(t *testing.T) {
})
}

<% unless version == 'ga' -%>
func TestAccDataprocCluster_withLifecycleConfigIdleDeleteTtl(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -701,7 +698,6 @@ func TestAccDataprocCluster_withLifecycleConfigAutoDeletion(t *testing.T) {
},
})
}
<% end -%>

func TestAccDataprocCluster_withLabels(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -752,7 +748,6 @@ func TestAccDataprocCluster_withNetworkRefs(t *testing.T) {
})
}

<% unless version == 'ga' -%>
func TestAccDataprocCluster_withEndpointConfig(t *testing.T) {
t.Parallel()

Expand All @@ -773,7 +768,6 @@ func TestAccDataprocCluster_withEndpointConfig(t *testing.T) {
},
})
}
<% end -%>

func TestAccDataprocCluster_KMS(t *testing.T) {
t.Parallel()
Expand Down Expand Up @@ -1606,7 +1600,6 @@ resource "google_dataproc_cluster" "with_labels" {
`, rnd)
}

<% unless version == 'ga' -%>
func testAccDataprocCluster_withEndpointConfig(rnd string) string {
return fmt.Sprintf(`
resource "google_dataproc_cluster" "with_endpoint_config" {
Expand All @@ -1621,7 +1614,6 @@ resource "google_dataproc_cluster" "with_endpoint_config" {
}
`, rnd)
}
<% end -%>

func testAccDataprocCluster_withImageVersion(rnd, version string) string {
return fmt.Sprintf(`
Expand Down Expand Up @@ -1653,7 +1645,6 @@ resource "google_dataproc_cluster" "with_opt_components" {
`, rnd)
}

<% unless version == 'ga' -%>
func testAccDataprocCluster_withLifecycleConfigIdleDeleteTtl(rnd, tm string) string {
return fmt.Sprintf(`
resource "google_dataproc_cluster" "with_lifecycle_config" {
Expand Down Expand Up @@ -1683,7 +1674,6 @@ resource "google_dataproc_cluster" "with_lifecycle_config" {
}
`, rnd, tm)
}
<% end -%>

func testAccDataprocCluster_withServiceAcc(sa string, rnd string) string {
return fmt.Sprintf(`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ resource "google_dataproc_cluster" "accelerated_cluster" {
* `encryption_config` (Optional) The Customer managed encryption keys settings for the cluster.
Structure [defined below](#nested_encryption_config).

* `lifecycle_config` (Optional, Beta) The settings for auto deletion cluster schedule.
* `lifecycle_config` (Optional) The settings for auto deletion cluster schedule.
Structure [defined below](#nested_lifecycle_config).

* `endpoint_config` (Optional, Beta) The config settings for port access on the cluster.
* `endpoint_config` (Optional) The config settings for port access on the cluster.
Structure [defined below](#nested_endpoint_config).

* `metastore_config` (Optional) The config setting for metastore service with the cluster.
Expand Down

0 comments on commit dc2d80a

Please sign in to comment.