Skip to content

Commit 2e54049

Browse files
Backport 1639 release/v9 (#1642)
Co-authored-by: Krunal Hingu <[email protected]>
1 parent 97e8f04 commit 2e54049

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

rancher2/schema_cluster_eks_config_v2.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,12 @@ func clusterEKSConfigV2NodeGroupsLaunchTemplateFields() map[string]*schema.Schem
5151
},
5252
"name": {
5353
Type: schema.TypeString,
54-
Optional: true,
55-
Computed: true,
54+
Required: true,
5655
Description: "The EKS node group launch template name",
5756
},
5857
"version": {
5958
Type: schema.TypeInt,
60-
Optional: true,
61-
Computed: true,
59+
Required: true,
6260
Description: "The EKS node group launch template version",
6361
},
6462
}

rancher2/structure_cluster_eks_config_v2.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,19 @@ import (
66

77
// Flatteners
88

9-
func flattenClusterEKSConfigV2NodeGroupsLaunchTemplate(in *managementClient.LaunchTemplate, p []interface{}) []interface{} {
9+
func flattenClusterEKSConfigV2NodeGroupsLaunchTemplate(in *managementClient.LaunchTemplate) []interface{} {
1010
if in == nil {
1111
return nil
1212
}
1313
obj := map[string]interface{}{}
14-
if len(p) != 0 && p[0] != nil {
15-
obj = p[0].(map[string]interface{})
16-
}
14+
1715
if in.ID != nil && len(*in.ID) > 0 {
1816
obj["id"] = *in.ID
1917
}
2018
if in.Name != nil && len(*in.Name) > 0 {
2119
obj["name"] = *in.Name
2220
}
23-
if in.Version != nil {
21+
if in.Version != nil && *in.Version > 0 {
2422
obj["version"] = int(*in.Version)
2523
}
2624

@@ -63,11 +61,7 @@ func flattenClusterEKSConfigV2NodeGroups(input []managementClient.NodeGroup, p [
6361
obj["labels"] = toMapInterface(in.Labels)
6462
}
6563
if in.LaunchTemplate != nil {
66-
v, ok := obj["launch_template"].([]interface{})
67-
if !ok {
68-
v = []interface{}{}
69-
}
70-
obj["launch_template"] = flattenClusterEKSConfigV2NodeGroupsLaunchTemplate(in.LaunchTemplate, v)
64+
obj["launch_template"] = flattenClusterEKSConfigV2NodeGroupsLaunchTemplate(in.LaunchTemplate)
7165
}
7266
if in.MaxSize != nil {
7367
obj["max_size"] = int(*in.MaxSize)

0 commit comments

Comments
 (0)