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

Add include body for lambda function association #5681

Conversation

parabolic
Copy link
Contributor

@parabolic parabolic commented Aug 26, 2018

Changes proposed in this pull request:

Adding support for IncludeBody option to the lambda_function_association in cloudfront which is not supported by the terraform-provider-aws for using the lamda@edge implementation.

Here's an excerpt form the documentation:

"LambdaFunctionAssociations": {
  "Quantity": 
  "Items": [
  {
     "LambdaFunctionARN": "string",
      "EventType": "viewer-request"|"viewer-response"|"origin-request"|"origin-response",
      "IncludeBody": true|false
   }
   ...
   ]
},
  • add the include_body parameter in the lambda_function_association in the cloudfront resource and set the default to false.

Example taken from the web console can be seen here:
image

Output from acceptance testing:

please note that I had to manually adjust the timeout to 1000m because the tests where timing out due to cloudfront being slow

make testacc TESTARGS='-run=TestAccAWSCloudFrontDistribution'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -run=TestAccAWSCloudFrontDistribution -timeout 1000m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAWSCloudFrontDistribution_importBasic
--- PASS: TestAccAWSCloudFrontDistribution_importBasic (828.70s)
=== RUN   TestAccAWSCloudFrontDistribution_S3Origin
--- PASS: TestAccAWSCloudFrontDistribution_S3Origin (805.78s)
=== RUN   TestAccAWSCloudFrontDistribution_S3OriginWithTags
--- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (1028.92s)
=== RUN   TestAccAWSCloudFrontDistribution_customOrigin
--- PASS: TestAccAWSCloudFrontDistribution_customOrigin (830.72s)
=== RUN   TestAccAWSCloudFrontDistribution_multiOrigin
--- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (1021.48s)
=== RUN   TestAccAWSCloudFrontDistribution_orderedCacheBehavior
--- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (964.56s)
=== RUN   TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (2.29s)
=== RUN   TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (2.09s)
=== RUN   TestAccAWSCloudFrontDistribution_noOptionalItemsConfig
--- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (832.29s)
=== RUN   TestAccAWSCloudFrontDistribution_HTTP11Config
--- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (748.69s)
=== RUN   TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig
--- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (804.62s)
=== RUN   TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig
--- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (919.45s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	8789.627s
...

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/cloudfront Issues and PRs that pertain to the cloudfront service. labels Aug 27, 2018
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.

LGTM, thanks @parabolic! 🚀

12 tests passed (all tests)
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName (1.36s)
--- PASS: TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID (1.49s)
--- PASS: TestAccAWSCloudFrontDistribution_S3Origin (1512.80s)
--- PASS: TestAccAWSCloudFrontDistribution_HTTP11Config (1513.44s)
--- PASS: TestAccAWSCloudFrontDistribution_noOptionalItemsConfig (1513.56s)
--- PASS: TestAccAWSCloudFrontDistribution_S3OriginWithTags (1516.36s)
--- PASS: TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig (1516.43s)
--- PASS: TestAccAWSCloudFrontDistribution_orderedCacheBehavior (1518.41s)
--- PASS: TestAccAWSCloudFrontDistribution_importBasic (1520.43s)
--- PASS: TestAccAWSCloudFrontDistribution_customOrigin (1521.48s)
--- PASS: TestAccAWSCloudFrontDistribution_multiOrigin (1521.63s)
--- PASS: TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig (1522.50s)

@bflad bflad added this to the v1.36.0 milestone Sep 12, 2018
@bflad bflad merged commit 5228cd1 into hashicorp:master Sep 12, 2018
bflad added a commit that referenced this pull request Sep 12, 2018
@parabolic
Copy link
Contributor Author

parabolic commented Sep 12, 2018

🎉 Great, thanks @bflad!

@bflad
Copy link
Contributor

bflad commented Sep 13, 2018

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

@ghost
Copy link

ghost commented Apr 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 and limited conversation to collaborators Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/cloudfront Issues and PRs that pertain to the cloudfront service.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants