Skip to content

Commit fd24a26

Browse files
Upgrade DCL to v1.31.0 (#7109) (#5084)
Signed-off-by: Modular Magician <[email protected]> Signed-off-by: Modular Magician <[email protected]>
1 parent ef1cbd6 commit fd24a26

File tree

5 files changed

+104
-40
lines changed

5 files changed

+104
-40
lines changed

.changelog/7109.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
```release-note:enhancement
2+
container: added update support for `google_container_aws_node_pool` `tags` field
3+
```
4+
```release-note:enhancement
5+
container: added `google_container_aws_node_pool` `autoscaling_metrics_collection` field
6+
```

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ go 1.18
33

44
require (
55
cloud.google.com/go/bigtable v1.17.0
6-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.30.0
6+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.31.0
77
github.com/apparentlymart/go-cidr v1.1.0
88
github.com/client9/misspell v0.3.4
99
github.com/davecgh/go-spew v1.1.1

go.sum

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
6363
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
6464
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM=
6565
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs=
66-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.28.0 h1:QRloCSdH4JGX5H4wie8D4WeM4/TaqniVf/d/hnkrqLo=
67-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.28.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
68-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.29.0 h1:RmGDbvUWkRLYyWngSad04GR4LAnqflbXvzI1iBO2+rU=
69-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.29.0 h1:RmGDbvUWkRLYyWngSad04GR4LAnqflbXvzI1iBO2+rU=
70-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.29.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
71-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.29.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
72-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.29.1-0.20221217025133-b2d522d3684b h1:RgZjFUQKRCJV61R5emEFGhDOX84D0BPZG+p/E0hilSk=
73-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.29.1-0.20221217025133-b2d522d3684b h1:RgZjFUQKRCJV61R5emEFGhDOX84D0BPZG+p/E0hilSk=
74-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.29.1-0.20221217025133-b2d522d3684b/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
75-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.29.1-0.20221217025133-b2d522d3684b/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
76-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.30.0 h1:1DMSUzQO2osKXy03/xZmr5n8bMlW3RyMhHR2JpkkVzY=
77-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.30.0 h1:1DMSUzQO2osKXy03/xZmr5n8bMlW3RyMhHR2JpkkVzY=
78-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.30.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
79-
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.30.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
66+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.31.0 h1:4Orb9zAllU52CUtZfKu9OWYyDK6neeBt2ye6NKqAfOg=
67+
github.com/GoogleCloudPlatform/declarative-resource-client-library v1.31.0/go.mod h1:pL2Qt5HT+x6xrTd806oMiM3awW6kNIXB/iiuClz6m6k=
8068
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
8169
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
8270
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=

google-beta/resource_container_aws_node_pool.go

Lines changed: 81 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ func ContainerAwsNodePoolConfigSchema() *schema.Resource {
195195
Description: "The name of the AWS IAM role assigned to nodes in the pool.",
196196
},
197197

198+
"autoscaling_metrics_collection": {
199+
Type: schema.TypeList,
200+
Optional: true,
201+
Description: "Optional. Configuration related to CloudWatch metrics collection on the Auto Scaling group of the node pool. When unspecified, metrics collection is disabled.",
202+
MaxItems: 1,
203+
Elem: ContainerAwsNodePoolConfigAutoscalingMetricsCollectionSchema(),
204+
},
205+
198206
"image_type": {
199207
Type: schema.TypeString,
200208
Computed: true,
@@ -264,7 +272,6 @@ func ContainerAwsNodePoolConfigSchema() *schema.Resource {
264272
"tags": {
265273
Type: schema.TypeMap,
266274
Optional: true,
267-
ForceNew: true,
268275
Description: "Optional. Key/value metadata to assign to each underlying AWS resource. Specify at most 50 pairs containing alphanumerics, spaces, and symbols (.+-=_:@/). Keys can be up to 127 Unicode characters. Values can be up to 255 Unicode characters.",
269276
Elem: &schema.Schema{Type: schema.TypeString},
270277
},
@@ -292,6 +299,25 @@ func ContainerAwsNodePoolConfigConfigEncryptionSchema() *schema.Resource {
292299
}
293300
}
294301

302+
func ContainerAwsNodePoolConfigAutoscalingMetricsCollectionSchema() *schema.Resource {
303+
return &schema.Resource{
304+
Schema: map[string]*schema.Schema{
305+
"granularity": {
306+
Type: schema.TypeString,
307+
Required: true,
308+
Description: "The frequency at which EC2 Auto Scaling sends aggregated data to AWS CloudWatch. The only valid value is \"1Minute\".",
309+
},
310+
311+
"metrics": {
312+
Type: schema.TypeList,
313+
Optional: true,
314+
Description: "The metrics to enable. For a list of valid metrics, see https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnableMetricsCollection.html. If you specify granularity and don't specify any metrics, all metrics are enabled.",
315+
Elem: &schema.Schema{Type: schema.TypeString},
316+
},
317+
},
318+
}
319+
}
320+
295321
func ContainerAwsNodePoolConfigInstancePlacementSchema() *schema.Resource {
296322
return &schema.Resource{
297323
Schema: map[string]*schema.Schema{
@@ -715,18 +741,19 @@ func expandContainerAwsNodePoolConfig(o interface{}) *containeraws.NodePoolConfi
715741
}
716742
obj := objArr[0].(map[string]interface{})
717743
return &containeraws.NodePoolConfig{
718-
ConfigEncryption: expandContainerAwsNodePoolConfigConfigEncryption(obj["config_encryption"]),
719-
IamInstanceProfile: dcl.String(obj["iam_instance_profile"].(string)),
720-
ImageType: dcl.StringOrNil(obj["image_type"].(string)),
721-
InstancePlacement: expandContainerAwsNodePoolConfigInstancePlacement(obj["instance_placement"]),
722-
InstanceType: dcl.StringOrNil(obj["instance_type"].(string)),
723-
Labels: checkStringMap(obj["labels"]),
724-
ProxyConfig: expandContainerAwsNodePoolConfigProxyConfig(obj["proxy_config"]),
725-
RootVolume: expandContainerAwsNodePoolConfigRootVolume(obj["root_volume"]),
726-
SecurityGroupIds: expandStringArray(obj["security_group_ids"]),
727-
SshConfig: expandContainerAwsNodePoolConfigSshConfig(obj["ssh_config"]),
728-
Tags: checkStringMap(obj["tags"]),
729-
Taints: expandContainerAwsNodePoolConfigTaintsArray(obj["taints"]),
744+
ConfigEncryption: expandContainerAwsNodePoolConfigConfigEncryption(obj["config_encryption"]),
745+
IamInstanceProfile: dcl.String(obj["iam_instance_profile"].(string)),
746+
AutoscalingMetricsCollection: expandContainerAwsNodePoolConfigAutoscalingMetricsCollection(obj["autoscaling_metrics_collection"]),
747+
ImageType: dcl.StringOrNil(obj["image_type"].(string)),
748+
InstancePlacement: expandContainerAwsNodePoolConfigInstancePlacement(obj["instance_placement"]),
749+
InstanceType: dcl.StringOrNil(obj["instance_type"].(string)),
750+
Labels: checkStringMap(obj["labels"]),
751+
ProxyConfig: expandContainerAwsNodePoolConfigProxyConfig(obj["proxy_config"]),
752+
RootVolume: expandContainerAwsNodePoolConfigRootVolume(obj["root_volume"]),
753+
SecurityGroupIds: expandStringArray(obj["security_group_ids"]),
754+
SshConfig: expandContainerAwsNodePoolConfigSshConfig(obj["ssh_config"]),
755+
Tags: checkStringMap(obj["tags"]),
756+
Taints: expandContainerAwsNodePoolConfigTaintsArray(obj["taints"]),
730757
}
731758
}
732759

@@ -735,18 +762,19 @@ func flattenContainerAwsNodePoolConfig(obj *containeraws.NodePoolConfig) interfa
735762
return nil
736763
}
737764
transformed := map[string]interface{}{
738-
"config_encryption": flattenContainerAwsNodePoolConfigConfigEncryption(obj.ConfigEncryption),
739-
"iam_instance_profile": obj.IamInstanceProfile,
740-
"image_type": obj.ImageType,
741-
"instance_placement": flattenContainerAwsNodePoolConfigInstancePlacement(obj.InstancePlacement),
742-
"instance_type": obj.InstanceType,
743-
"labels": obj.Labels,
744-
"proxy_config": flattenContainerAwsNodePoolConfigProxyConfig(obj.ProxyConfig),
745-
"root_volume": flattenContainerAwsNodePoolConfigRootVolume(obj.RootVolume),
746-
"security_group_ids": obj.SecurityGroupIds,
747-
"ssh_config": flattenContainerAwsNodePoolConfigSshConfig(obj.SshConfig),
748-
"tags": obj.Tags,
749-
"taints": flattenContainerAwsNodePoolConfigTaintsArray(obj.Taints),
765+
"config_encryption": flattenContainerAwsNodePoolConfigConfigEncryption(obj.ConfigEncryption),
766+
"iam_instance_profile": obj.IamInstanceProfile,
767+
"autoscaling_metrics_collection": flattenContainerAwsNodePoolConfigAutoscalingMetricsCollection(obj.AutoscalingMetricsCollection),
768+
"image_type": obj.ImageType,
769+
"instance_placement": flattenContainerAwsNodePoolConfigInstancePlacement(obj.InstancePlacement),
770+
"instance_type": obj.InstanceType,
771+
"labels": obj.Labels,
772+
"proxy_config": flattenContainerAwsNodePoolConfigProxyConfig(obj.ProxyConfig),
773+
"root_volume": flattenContainerAwsNodePoolConfigRootVolume(obj.RootVolume),
774+
"security_group_ids": obj.SecurityGroupIds,
775+
"ssh_config": flattenContainerAwsNodePoolConfigSshConfig(obj.SshConfig),
776+
"tags": obj.Tags,
777+
"taints": flattenContainerAwsNodePoolConfigTaintsArray(obj.Taints),
750778
}
751779

752780
return []interface{}{transformed}
@@ -779,6 +807,34 @@ func flattenContainerAwsNodePoolConfigConfigEncryption(obj *containeraws.NodePoo
779807

780808
}
781809

810+
func expandContainerAwsNodePoolConfigAutoscalingMetricsCollection(o interface{}) *containeraws.NodePoolConfigAutoscalingMetricsCollection {
811+
if o == nil {
812+
return containeraws.EmptyNodePoolConfigAutoscalingMetricsCollection
813+
}
814+
objArr := o.([]interface{})
815+
if len(objArr) == 0 || objArr[0] == nil {
816+
return containeraws.EmptyNodePoolConfigAutoscalingMetricsCollection
817+
}
818+
obj := objArr[0].(map[string]interface{})
819+
return &containeraws.NodePoolConfigAutoscalingMetricsCollection{
820+
Granularity: dcl.String(obj["granularity"].(string)),
821+
Metrics: expandStringArray(obj["metrics"]),
822+
}
823+
}
824+
825+
func flattenContainerAwsNodePoolConfigAutoscalingMetricsCollection(obj *containeraws.NodePoolConfigAutoscalingMetricsCollection) interface{} {
826+
if obj == nil || obj.Empty() {
827+
return nil
828+
}
829+
transformed := map[string]interface{}{
830+
"granularity": obj.Granularity,
831+
"metrics": obj.Metrics,
832+
}
833+
834+
return []interface{}{transformed}
835+
836+
}
837+
782838
func expandContainerAwsNodePoolConfigInstancePlacement(o interface{}) *containeraws.NodePoolConfigInstancePlacement {
783839
if o == nil {
784840
return nil

website/docs/r/container_aws_node_pool.html.markdown

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ The `autoscaling` block supports:
232232

233233
The `config` block supports:
234234

235+
* `autoscaling_metrics_collection` -
236+
(Optional)
237+
Optional. Configuration related to CloudWatch metrics collection on the Auto Scaling group of the node pool. When unspecified, metrics collection is disabled.
238+
235239
* `config_encryption` -
236240
(Required)
237241
The ARN of the AWS KMS key used to encrypt node pool configuration.
@@ -304,6 +308,16 @@ The `max_pods_constraint` block supports:
304308

305309

306310

311+
The `autoscaling_metrics_collection` block supports:
312+
313+
* `granularity` -
314+
(Required)
315+
The frequency at which EC2 Auto Scaling sends aggregated data to AWS CloudWatch. The only valid value is "1Minute".
316+
317+
* `metrics` -
318+
(Optional)
319+
The metrics to enable. For a list of valid metrics, see https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_EnableMetricsCollection.html. If you specify granularity and don't specify any metrics, all metrics are enabled.
320+
307321
The `instance_placement` block supports:
308322

309323
* `tenancy` -

0 commit comments

Comments
 (0)