Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when data.aws_launch_template cannot find launch template #10521

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions aws/data_source_aws_launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,29 +349,10 @@ func dataSourceAwsLaunchTemplateRead(d *schema.ResourceData, meta interface{}) e
LaunchTemplateNames: []*string{aws.String(d.Get("name").(string))},
})

if isAWSErr(err, ec2.LaunchTemplateErrorCodeLaunchTemplateIdDoesNotExist, "") {
log.Printf("[WARN] launch template (%s) not found - removing from state", d.Id())
d.SetId("")
return nil
}

// AWS SDK constant above is currently incorrect
if isAWSErr(err, "InvalidLaunchTemplateId.NotFound", "") {
log.Printf("[WARN] launch template (%s) not found - removing from state", d.Id())
d.SetId("")
return nil
}

if err != nil {
return fmt.Errorf("Error getting launch template: %s", err)
}
anGie44 marked this conversation as resolved.
Show resolved Hide resolved

if dlt == nil || len(dlt.LaunchTemplates) == 0 {
log.Printf("[WARN] launch template (%s) not found - removing from state", d.Id())
d.SetId("")
return nil
}

anGie44 marked this conversation as resolved.
Show resolved Hide resolved
log.Printf("[DEBUG] Found launch template %s", d.Id())

lt := dlt.LaunchTemplates[0]
Expand Down