Skip to content

Commit

Permalink
Move cloudrun_config from beta to GA, fix doc. (#3470) (#2037)
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored May 5, 2020
1 parent 51f2b5b commit b39e73a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 32 deletions.
3 changes: 3 additions & 0 deletions .changelog/3470.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
container: Moved `google_container_cluster.addons_config.cloudrun_config` from beta to GA.
```
44 changes: 22 additions & 22 deletions google-beta/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ var (
"addons_config.0.http_load_balancing",
"addons_config.0.horizontal_pod_autoscaling",
"addons_config.0.network_policy_config",
"addons_config.0.istio_config",
"addons_config.0.cloudrun_config",
"addons_config.0.istio_config",
"addons_config.0.dns_cache_config",
"addons_config.0.gce_persistent_disk_csi_driver_config",
"addons_config.0.kalm_config",
Expand Down Expand Up @@ -236,7 +236,7 @@ func resourceContainerCluster() *schema.Resource {
},
},
},
"istio_config": {
"cloudrun_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Expand All @@ -248,17 +248,10 @@ func resourceContainerCluster() *schema.Resource {
Type: schema.TypeBool,
Required: true,
},
"auth": {
Type: schema.TypeString,
Optional: true,
// We can't use a Terraform-level default because it won't be true when the block is disabled: true
DiffSuppressFunc: emptyOrDefaultStringSuppress("AUTH_NONE"),
ValidateFunc: validation.StringInSlice([]string{"AUTH_NONE", "AUTH_MUTUAL_TLS"}, false),
},
},
},
},
"cloudrun_config": {
"istio_config": {
Type: schema.TypeList,
Optional: true,
Computed: true,
Expand All @@ -270,6 +263,13 @@ func resourceContainerCluster() *schema.Resource {
Type: schema.TypeBool,
Required: true,
},
"auth": {
Type: schema.TypeString,
Optional: true,
// We can't use a Terraform-level default because it won't be true when the block is disabled: true
DiffSuppressFunc: emptyOrDefaultStringSuppress("AUTH_NONE"),
ValidateFunc: validation.StringInSlice([]string{"AUTH_NONE", "AUTH_MUTUAL_TLS"}, false),
},
},
},
},
Expand Down Expand Up @@ -2195,19 +2195,19 @@ func expandClusterAddonsConfig(configured interface{}) *containerBeta.AddonsConf
}
}

if v, ok := config["istio_config"]; ok && len(v.([]interface{})) > 0 {
if v, ok := config["cloudrun_config"]; ok && len(v.([]interface{})) > 0 {
addon := v.([]interface{})[0].(map[string]interface{})
ac.IstioConfig = &containerBeta.IstioConfig{
ac.CloudRunConfig = &containerBeta.CloudRunConfig{
Disabled: addon["disabled"].(bool),
Auth: addon["auth"].(string),
ForceSendFields: []string{"Disabled"},
}
}

if v, ok := config["cloudrun_config"]; ok && len(v.([]interface{})) > 0 {
if v, ok := config["istio_config"]; ok && len(v.([]interface{})) > 0 {
addon := v.([]interface{})[0].(map[string]interface{})
ac.CloudRunConfig = &containerBeta.CloudRunConfig{
ac.IstioConfig = &containerBeta.IstioConfig{
Disabled: addon["disabled"].(bool),
Auth: addon["auth"].(string),
ForceSendFields: []string{"Disabled"},
}
}
Expand Down Expand Up @@ -2616,19 +2616,19 @@ func flattenClusterAddonsConfig(c *containerBeta.AddonsConfig) []map[string]inte
}
}

if c.IstioConfig != nil {
result["istio_config"] = []map[string]interface{}{
if c.CloudRunConfig != nil {
result["cloudrun_config"] = []map[string]interface{}{
{
"disabled": c.IstioConfig.Disabled,
"auth": c.IstioConfig.Auth,
"disabled": c.CloudRunConfig.Disabled,
},
}
}

if c.CloudRunConfig != nil {
result["cloudrun_config"] = []map[string]interface{}{
if c.IstioConfig != nil {
result["istio_config"] = []map[string]interface{}{
{
"disabled": c.CloudRunConfig.Disabled,
"disabled": c.IstioConfig.Disabled,
"auth": c.IstioConfig.Auth,
},
}
}
Expand Down
12 changes: 6 additions & 6 deletions google-beta/resource_container_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1962,12 +1962,12 @@ resource "google_container_cluster" "primary" {
network_policy_config {
disabled = true
}
istio_config {
cloudrun_config {
disabled = true
auth = "AUTH_MUTUAL_TLS"
}
cloudrun_config {
istio_config {
disabled = true
auth = "AUTH_MUTUAL_TLS"
}
dns_cache_config {
enabled = false
Expand Down Expand Up @@ -2002,12 +2002,12 @@ resource "google_container_cluster" "primary" {
network_policy_config {
disabled = false
}
istio_config {
cloudrun_config {
disabled = false
auth = "AUTH_NONE"
}
cloudrun_config {
istio_config {
disabled = false
auth = "AUTH_NONE"
}
dns_cache_config {
enabled = true
Expand Down
8 changes: 4 additions & 4 deletions website/docs/r/container_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -321,13 +321,13 @@ The `addons_config` block supports:
It can only be disabled if the nodes already do not have network policies enabled.
Defaults to disabled; set `disabled = false` to enable.

* `cloudrun_config` - (Optional).
The status of the CloudRun addon. It is disabled by default.
Set `disabled = false` to enable.

* `istio_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
Structure is documented below.

* `cloudrun_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
The status of the CloudRun addon. It requires `istio_config` enabled. It is disabled by default.
Set `disabled = false` to enable. This addon can only be enabled at cluster creation time.

* `dns_cache_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)).
The status of the NodeLocal DNSCache addon. It is disabled by default.
Set `enabled = true` to enable.
Expand Down

0 comments on commit b39e73a

Please sign in to comment.