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

r/aws_instance: Update SourceDestCheck modification on new resources #1065

Merged
merged 1 commit into from
Jul 6, 2017
Merged
Changes from all commits
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
5 changes: 4 additions & 1 deletion aws/resource_aws_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,10 @@ func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error {
// If we have a new resource and source_dest_check is still true, don't modify
sourceDestCheck := d.Get("source_dest_check").(bool)

if d.HasChange("source_dest_check") || d.IsNewResource() && !sourceDestCheck {
// Because we're calling Update prior to Read, and the default value of `source_dest_check` is `true`,
// HasChange() thinks there is a diff between what is set on the instance and what is set in state. We need to ensure that
// if a diff has occured, it's not because it's a new instance.
if d.HasChange("source_dest_check") && !d.IsNewResource() || d.IsNewResource() && !sourceDestCheck {
// SourceDestCheck can only be set on VPC instances
// AWS will return an error of InvalidParameterCombination if we attempt
// to modify the source_dest_check of an instance in EC2 Classic
Expand Down