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

resource/cloudfront_distribution: conditionally flatten cache behavior forwarded_values #14993

Merged
merged 1 commit into from
Sep 3, 2020

Conversation

anGie44
Copy link
Contributor

@anGie44 anGie44 commented Sep 2, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment 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 pull request followers and do not help prioritize the request

Closes #14986

Release note for CHANGELOG:

resource/cloudfront_distribution: Prevent panic on import 

Notes:

  • changes to prevent relevant panic:
panic: runtime error: invalid memory address or nil pointer dereference
2020-09-02T20:33:07.083+0100 [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x445734f]
2020-09-02T20:33:07.083+0100 [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5:
2020-09-02T20:33:07.083+0100 [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: goroutine 88 [running]:
2020-09-02T20:33:07.083+0100 [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: github.com/terraform-providers/terraform-provider-aws/aws.flattenForwardedValues(0x0, 0xc0015f3b00)
2020-09-02T20:33:07.083+0100 [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/cloudfront_distribution_configuration_structure.go:430 +0x2f
2020-09-02T20:33:07.083+0100 [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: github.com/terraform-providers/terraform-provider-aws/aws.flattenCacheBehavior(0xc0007b5580, 0x64a34e0)
2020-09-02T20:33:07.083+0100 [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/cloudfront_distribution_configuration_structure.go:304 +0x245
2020-09-02T20:33:07.083+0100 [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: github.com/terraform-providers/terraform-provider-aws/aws.flattenCacheBehaviors(0xc001c76a20, 0x666980e, 0x15, 0x64a34e0)
2020-09-02T20:33:07.083+0100 [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/cloudfront_distribution_configuration_structure.go:185 +0x89
2020-09-02T20:33:07.084+0100 [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5: github.com/terraform-providers/terraform-provider-aws/aws.flattenDistributionConfig(0xc0014cea00, 0xc000e330e0, 0xc001e30220, 0x0)
2020-09-02T20:33:07.084+0100 [DEBUG] plugin.terraform-provider-aws_v3.4.0_x5:   /opt/teamcity-agent/work/5d79fe75d4460a2f/src/github.com/terraform-providers/terraform-provider-aws/aws/cloudfront_distribution_configuration_structure.go:123 +0xa5b

Output from acceptance testing:

--- FAIL: TestAccAWSCloudFrontDistribution_RetainOnDelete (287.04s) --- from the test history, looks like an ongoing test failure
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (7.23s)
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (8.38s)
--- PASS: TestAccAWSCloudFrontDistribution_disappears (218.49s)
--- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_TrustedSigners (289.02s)
--- PASS: TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Headers (290.61s)
--- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Cookies_WhitelistedNames (291.17s)
--- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Headers (557.80s)
--- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (558.18s)
--- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (558.71s)
--- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (559.64s)
--- PASS: TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Cookies_WhitelistedNames (559.78s)
--- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (562.71s)
--- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (565.42s)
--- PASS: TestAccAWSCloudFrontDistribution_WaitForDeployment (570.26s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (582.37s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (590.50s)
--- PASS: TestAccAWSCloudFrontDistribution_OriginGroups (531.55s)
--- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (750.11s)
--- PASS: TestAccAWSCloudFrontDistribution_S3Origin (753.77s)
--- PASS: TestAccAWSCloudFrontDistribution_customOrigin (799.97s)
--- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (1026.09s)
--- PASS: TestAccAWSCloudFrontDistribution_Enabled (1028.85s)

@anGie44 anGie44 requested a review from a team September 2, 2020 21:27
@ghost ghost added size/XS Managed by automation to categorize the size of a PR. service/cloudfront Issues and PRs that pertain to the cloudfront service. labels Sep 2, 2020
@anGie44 anGie44 marked this pull request as draft September 2, 2020 21:30
@anGie44 anGie44 marked this pull request as ready for review September 2, 2020 22:00
@anGie44 anGie44 added crash Results from or addresses a Terraform crash or kernel panic. bug Addresses a defect in current functionality. labels Sep 2, 2020
@bflad bflad self-assigned this Sep 2, 2020
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🚀 An alternative would be handling the nil checking in the function itself but this covers the two times it is called.

Output from acceptance testing:

--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (7.57s)
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (8.88s)
--- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_TrustedSigners (233.65s)
--- PASS: TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Headers (240.33s)
--- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Cookies_WhitelistedNames (240.63s)
--- PASS: TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Cookies_WhitelistedNames (240.56s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn (269.64s)
--- PASS: TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_ConflictsWithCloudFrontDefaultCertificate (263.37s)
--- PASS: TestAccAWSCloudFrontDistribution_disappears (272.36s)
--- FAIL: TestAccAWSCloudFrontDistribution_RetainOnDelete (310.11s) # unrelated -- I'll ensure there's a covering issue
--- PASS: TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Headers (311.89s)
--- PASS: TestAccAWSCloudFrontDistribution_customOrigin (416.04s)
--- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (421.37s)
--- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (423.24s)
--- PASS: TestAccAWSCloudFrontDistribution_S3Origin (459.58s)
--- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (460.83s)
--- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (465.44s)
--- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (468.51s)
--- PASS: TestAccAWSCloudFrontDistribution_WaitForDeployment (522.61s)
--- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (584.58s)
--- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (615.03s)
--- PASS: TestAccAWSCloudFrontDistribution_Enabled (617.19s)
--- PASS: TestAccAWSCloudFrontDistribution_OriginGroups (389.25s)

@bflad bflad added this to the v3.5.0 milestone Sep 3, 2020
@bflad bflad merged commit 0139bf2 into master Sep 3, 2020
@bflad bflad deleted the b-cloudfront-distribution-forwarded-vals branch September 3, 2020 01:15
bflad added a commit that referenced this pull request Sep 3, 2020
@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. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform 0.13.1 crash on aws_cloudfront_distribution import
2 participants