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

Terraform 0.13.1 crash on aws_cloudfront_distribution import #14986

Closed
peterpakos opened this issue Sep 2, 2020 · 3 comments · Fixed by #14993
Closed

Terraform 0.13.1 crash on aws_cloudfront_distribution import #14986

peterpakos opened this issue Sep 2, 2020 · 3 comments · Fixed by #14993
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/cloudfront Issues and PRs that pertain to the cloudfront service.
Milestone

Comments

@peterpakos
Copy link

peterpakos commented Sep 2, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.13.1
+ provider registry.terraform.io/hashicorp/aws v3.4.0

Affected Resource(s)

  • aws_cloudfront_distribution

Terraform Configuration Files

resource "aws_cloudfront_distribution" "default" {
  origin {
    domain_name = aws_s3_bucket.default.bucket_regional_domain_name
    origin_id   = "S3-${aws_s3_bucket.default.id}"

    s3_origin_config {
      origin_access_identity = aws_cloudfront_origin_access_identity.default.cloudfront_access_identity_path
    }
  }

  enabled             = true
  is_ipv6_enabled     = false
  default_root_object = "index.html"

  aliases = [var.bucket_name]

  default_cache_behavior {
    allowed_methods  = ["GET", "HEAD"]
    cached_methods   = ["GET", "HEAD"]
    target_origin_id = "S3-${aws_s3_bucket.default.id}"

    forwarded_values {
      query_string = false

      cookies {
        forward = "none"
      }
    }

    viewer_protocol_policy = "redirect-to-https"
    min_ttl                = 0
    default_ttl            = 0
    max_ttl                = 0

    lambda_function_association {
      event_type   = "origin-request"
      include_body = false
      lambda_arn   = "arn:aws:lambda:us-east-1:225237029829:function:s3-cdn:2"
    }
  }

Debug Output

https://gist.github.com/peterpakos/83d322403fa4d9fb421f5e53392f32a3

Panic Output

https://gist.github.com/peterpakos/9b0a15f84a5e1afb9b1c136288218782

Expected Behavior

Terraform import command successful with Cloudfront Distribution successfully imported to the state file.

Actual Behavior

Terraform import command crashed.

Steps to Reproduce

  1. terraform import module.s3-cdn.aws_cloudfront_distribution.default E32EAQRW369ZYR

Important Factoids

Cloudfront Distribution E32EAQRW369ZYR contains 2 Origins:

  • S3 Origin
  • Custom Origin

It also has 2 Behaviours configured:

  • Default (*) for Custom Origin
  • Path ui/* for S3 Origin.

The latter Behaviour also has Lambda@Edge Function associated with Viewer Request.

References

@ghost ghost added the service/cloudfront Issues and PRs that pertain to the cloudfront service. label Sep 2, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 2, 2020
@anGie44 anGie44 added crash Results from or addresses a Terraform crash or kernel panic. bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 2, 2020
@bflad bflad added this to the v3.5.0 milestone Sep 3, 2020
@bflad
Copy link
Contributor

bflad commented Sep 3, 2020

Thank you so much for reporting this, @peterpakos! This may be due to changes related to the CloudFront Cache Key and Origin Request Policies since the forwarded values within the cache behaviors can now be controlled with separate CloudFront components and those simply referenced in the cache behavior. Terraform AWS Provider support for that new functionality can be tracked in #14373.

This should be fixed by #14993, which will be merged shortly and released tomorrow with version 3.5.0 of the Terraform AWS Provider. 👍

@ghost
Copy link

ghost commented Sep 3, 2020

This has been released in version 3.5.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Oct 3, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. crash Results from or addresses a Terraform crash or kernel panic. service/cloudfront Issues and PRs that pertain to the cloudfront service.
Projects
None yet
3 participants