8000 importing aws_cloudfront_distribution should come with the default retain_on_delete setting. · Issue #10969 · hashicorp/terraform · GitHub
[go: up one dir, main page]

Skip to content
importing aws_cloudfront_distribution should come with the default retain_on_delete setting. #10969
@kitsunde

Description

@kitsunde

terraform import on aws_cloudfront_distribution should probably import with defaults for retain_on_delete. My .tf doesn't have this setting configured.

Also I think retain_on_delete is a terraform internal setting and isn't set on AWS. However terraform will still make a remote call to apply changes if this is the only value that has changed which currently causes this behaviour: #10938, that seems unnecessary.

Terraform Version

0.8.2

Affected Resource(s)

  • aws_cloudfront_distribution

Output

$ terraform plan -target aws_cloudfront_distribution.staging
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but
will not be persisted to local or remote state storage.

aws_instance.web: Refreshing state... (ID: i-c8b0a946)
aws_cloudfront_distribution.staging: Refreshing state... (ID: EEHH5D6X39BEL)

No changes. Infrastructure is up-to-date. This means that Terraform
could not detect any differences between your configuration and
the real physical resources that exist. As a result, Terraform
doesn't need to do anything.
$ terraform state rm aws_cloudfront_distribution.staging
Item removal successful.
$ terraform import aws_cloudfront_distribution.staging EEHH5D6X39BEL
aws_cloudfront_distribution.staging: Importing from ID "EEHH5D6X39BEL"...
aws_cloudfront_distribution.staging: Import complete!
  Imported aws_cloudfront_distribution (ID: EEHH5D6X39BEL)
aws_cloudfront_distribution.staging: Refreshing state... (ID: EEHH5D6X39BEL)

Import success! The resources imported are shown above. These are
now in your Terraform state. Import does not currently generate
configuration, so you must do this next. If you do not create configuration
for the above resources, then the next `terraform plan` will mark
them for destruction.
$ terraform plan -target aws_cloudfront_distribution.staging
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but
will not be persisted to local or remote state storage.

aws_instance.web: Refreshing state... (ID: i-c8b0a946)
aws_cloudfront_distribution.staging: Refreshing state... (ID: EEHH5D6X39BEL)

The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed. Cyan entries are data sources to be read.

Note: You didn't specify an "-out" parameter to save this plan, so when
"apply" is called, Terraform can't guarantee this is what will execute.

~ aws_cloudfront_distribution.staging
    retain_on_delete: "" => "false"


Plan: 0 to add, 1 to change, 0 to destroy.

Expected Behavior

retain_on_delete is optional, but importing doesn't absorb the default behaviour.

Actual Behavior

It appears to have changed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0