Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hashicorp/terraform-provider-aws
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2bb8d5997bee07f33f58442f9cb2aebc9e033d99
Choose a base ref
..
head repository: hashicorp/terraform-provider-aws
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4dff5c85344a5df7fd2916d180f6af52643238c2
Choose a head ref
22 changes: 20 additions & 2 deletions aws/resource_aws_eks_node_group.go
Original file line number Diff line number Diff line change
@@ -87,19 +87,21 @@ func resourceAwsEksNodeGroup() *schema.Resource {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ConflictsWith: []string{"launch_template.0.name"},
ValidateFunc: validateLaunchTemplateId,
},
"name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
ConflictsWith: []string{"launch_template.0.id"},
ValidateFunc: validateLaunchTemplateName,
},
"version": {
Type: schema.TypeString,
Optional: true,
Required: true,
ValidateFunc: validation.StringLenBetween(1, 255),
},
},
@@ -420,13 +422,29 @@ func resourceAwsEksNodeGroupUpdate(d *schema.ResourceData, meta interface{}) err

if v := d.Get("launch_template").([]interface{}); len(v) > 0 {
input.LaunchTemplate = expandEksLaunchTemplateSpecification(v)

// When returning Launch Template information, the API returns all
// fields. Since both the id and name are saved to the Terraform
// state for drift detection and the API returns the following
// error if both are present during update:
// InvalidParameterException: Either provide launch template ID or launch template name in the request.

// Remove the name if there are no changes, to prefer the ID.
if input.LaunchTemplate.Id != nil && input.LaunchTemplate.Name != nil && !d.HasChange("launch_template.0.name") {
input.LaunchTemplate.Name = nil
}

// Otherwise, remove the ID, but only if both are present still.
if input.LaunchTemplate.Id != nil && input.LaunchTemplate.Name != nil && !d.HasChange("launch_template.0.id") {
input.LaunchTemplate.Id = nil
}
}

if v, ok := d.GetOk("release_version"); ok && d.HasChange("release_version") {
input.ReleaseVersion = aws.String(v.(string))
}

if v, ok := d.GetOk("version"); ok {
if v, ok := d.GetOk("version"); ok && d.HasChange("version") {
input.Version = aws.String(v.(string))
}

Loading