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_cloudfront_function Always store DEVELOPMENT stage etag in state #19697

Merged
merged 7 commits into from
Nov 8, 2021

Conversation

fularac
Copy link

@fularac fularac commented Jun 7, 2021

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 #19529

Output from acceptance testing:

I'm unable to complete the acceptance test in our AWS account due to mixture of IAM/auto-compliance issues.

$ make testacc TESTARGS='-run=TestAccAWSCloudfrontFunction_'                                                                                                      <aws:GR_GG_COF_AWS_SharedTech_DigiTech_QA_Developer>
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSCloudfrontFunction_ -timeout 180m
=== RUN   TestAccAWSCloudfrontFunction_basic
=== PAUSE TestAccAWSCloudfrontFunction_basic
=== RUN   TestAccAWSCloudfrontFunction_disappears
=== PAUSE TestAccAWSCloudfrontFunction_disappears
=== RUN   TestAccAWSCloudfrontFunction_Publish
=== PAUSE TestAccAWSCloudfrontFunction_Publish
=== RUN   TestAccAWSCloudfrontFunction_Associated
=== PAUSE TestAccAWSCloudfrontFunction_Associated
=== RUN   TestAccAWSCloudfrontFunction_Update_Code
=== PAUSE TestAccAWSCloudfrontFunction_Update_Code
=== RUN   TestAccAWSCloudfrontFunction_Update_Comment
=== PAUSE TestAccAWSCloudfrontFunction_Update_Comment
=== CONT  TestAccAWSCloudfrontFunction_basic
=== CONT  TestAccAWSCloudfrontFunction_Update_Code
=== CONT  TestAccAWSCloudfrontFunction_Publish
=== CONT  TestAccAWSCloudfrontFunction_Associated
=== CONT  TestAccAWSCloudfrontFunction_disappears
=== CONT  TestAccAWSCloudfrontFunction_Update_Comment
--- PASS: TestAccAWSCloudfrontFunction_disappears (13.89s)
--- PASS: TestAccAWSCloudfrontFunction_basic (16.49s)
--- PASS: TestAccAWSCloudfrontFunction_Publish (27.04s)
--- PASS: TestAccAWSCloudfrontFunction_Update_Code (29.25s)
--- PASS: TestAccAWSCloudfrontFunction_Update_Comment (30.28s)
=== CONT  TestAccAWSCloudfrontFunction_Associated
    resource_aws_cloudfront_function_test.go:196: Step 1/4 error: After applying this test step, the plan was not empty.
        stdout:
        
        
        An execution plan has been generated and is shown below.
        Resource actions are indicated with the following symbols:
          ~ update in-place
        
        Terraform will perform the following actions:
        
          # aws_cloudfront_distribution.test will be updated in-place
          ~ resource "aws_cloudfront_distribution" "test" {
                arn                            = "arn:aws:cloudfront::xx:distribution/E1XJP46I396XD3"
                caller_reference               = "terraform-20210607151550952800000001"
                domain_name                    = "d1v6gisxon7rsz.cloudfront.net"
                enabled                        = true
                etag                           = "E2Q2KXK69GHXX1"
                hosted_zone_id                 = "Z2FDTNDATAQYW2"
                http_version                   = "http2"
                id                             = "E1XJP46I396XD3"
                in_progress_validation_batches = 0
                is_ipv6_enabled                = false
                last_modified_time             = "2021-06-07 15:16:11.405 +0000 UTC"
                price_class                    = "PriceClass_All"
                retain_on_delete               = true
                status                         = "Deployed"
                tags_all                       = {}
                trusted_key_groups             = [
                    {
                        enabled = false
                        items   = []
                    },
                ]
                trusted_signers                = [
                    {
                        enabled = false
                        items   = []
                    },
                ]
                wait_for_deployment            = true
        
                default_cache_behavior {
                    allowed_methods        = [
                        "DELETE",
                        "GET",
                        "HEAD",
                        "OPTIONS",
                        "PATCH",
                        "POST",
                        "PUT",
                    ]
                    cached_methods         = [
                        "GET",
                        "HEAD",
                    ]
                    compress               = false
                    default_ttl            = 0
                    max_ttl                = 0
                    min_ttl                = 0
                    smooth_streaming       = false
                    target_origin_id       = "myCustomOrigin"
                    trusted_key_groups     = []
                    trusted_signers        = []
                    viewer_protocol_policy = "allow-all"
        
                    forwarded_values {
                        headers                 = []
                        query_string            = false
                        query_string_cache_keys = []
        
                        cookies {
                            forward           = "all"
                            whitelisted_names = []
                        }
                    }
        
                    function_association {
                        event_type   = "viewer-request"
                        function_arn = "arn:aws:cloudfront::xx:function/tf-acc-test-8024688582040317178"
                    }
                }
        
              - logging_config {
                  - bucket          = "xxx" -> null
                  - include_cookies = false -> null
                  - prefix          = "xxx" -> null
                }
        
                origin {
                    connection_attempts = 3
                    connection_timeout  = 10
                    domain_name         = "www.example.com"
                    origin_id           = "myCustomOrigin"
        
                    custom_origin_config {
                        http_port                = 80
                        https_port               = 443
                        origin_keepalive_timeout = 5
                        origin_protocol_policy   = "http-only"
                        origin_read_timeout      = 30
                        origin_ssl_protocols     = [
                            "SSLv3",
                            "TLSv1",
                        ]
                    }
                }
        
                restrictions {
                    geo_restriction {
                        locations        = [
                            "CA",
                            "DE",
                            "GB",
                            "US",
                        ]
                        restriction_type = "whitelist"
                    }
                }
        
                viewer_certificate {
                    cloudfront_default_certificate = true
                    minimum_protocol_version       = "TLSv1"
                }
            }
        
        Plan: 0 to add, 1 to change, 0 to destroy.
--- FAIL: TestAccAWSCloudfrontFunction_Associated (181.74s)
FAIL
FAIL    github.com/terraform-providers/terraform-provider-aws/aws       183.484s
FAIL
make: *** [testacc] Error 1

@fularac fularac requested a review from a team as a code owner June 7, 2021 15:24
@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label Jun 7, 2021
@github-actions github-actions bot added service/cloudfront Issues and PRs that pertain to the cloudfront service. needs-triage Waiting for first response or review from a maintainer. labels Jun 7, 2021
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @fularac 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@breathingdust breathingdust added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 31, 2021
@Rondineli
Copy link

Any idea when this will be merged/released?

@fularac
Copy link
Author

fularac commented Oct 11, 2021

This was labeled as an enhancement, when this should be considered a bug. This is due to manual modification of cloudfront functions resulting in the provider not being able to modify the cloudfront function. @breathingdust

@zhelding
Copy link
Contributor

Pull request #21306 has significantly refactored the AWS Provider codebase. As a result, most PRs opened prior to the refactor now have merge conflicts that must be resolved before proceeding.

Specifically, PR #21306 relocated the code for all AWS resources and data sources from a single aws directory to a large number of separate directories in internal/service, each corresponding to a particular AWS service. This separation of code has also allowed for us to simplify the names of underlying functions -- while still avoiding namespace collisions.

We recognize that many pull requests have been open for some time without yet being addressed by our maintainers. Therefore, we want to make it clear that resolving these conflicts in no way affects the prioritization of a particular pull request. Once a pull request has been prioritized for review, the necessary changes will be made by a maintainer -- either directly or in collaboration with the pull request author.

For a more complete description of this refactor, including examples of how old filepaths and function names correspond to their new counterparts: please refer to issue #20000.

For a quick guide on how to amend your pull request to resolve the merge conflicts resulting from this refactor and bring it in line with our new code patterns: please refer to our Service Package Refactor Pull Request Guide.

@breathingdust breathingdust added bug Addresses a defect in current functionality. and removed enhancement Requests to existing resources that expand the functionality or scope. labels Oct 20, 2021
@fularac
Copy link
Author

fularac commented Oct 27, 2021

Got access to a sandbox account now acceptance testing is 💯

$ make testacc TESTARGS='-run=TestAccCloudFrontFunction' PKG_NAME=internal/service/cloudfront 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/cloudfront/... -v -count 1 -parallel 20 -run=TestAccCloudFrontFunction -timeout 180m
=== RUN   TestAccCloudFrontFunctionDataSource_basic
=== PAUSE TestAccCloudFrontFunctionDataSource_basic
=== RUN   TestAccCloudFrontFunction_basic
=== PAUSE TestAccCloudFrontFunction_basic
=== RUN   TestAccCloudFrontFunction_disappears
=== PAUSE TestAccCloudFrontFunction_disappears
=== RUN   TestAccCloudFrontFunction_publish
=== PAUSE TestAccCloudFrontFunction_publish
=== RUN   TestAccCloudFrontFunction_associated
=== PAUSE TestAccCloudFrontFunction_associated
=== RUN   TestAccCloudFrontFunction_Update_code
=== PAUSE TestAccCloudFrontFunction_Update_code
=== RUN   TestAccCloudFrontFunction_Update_comment
=== PAUSE TestAccCloudFrontFunction_Update_comment
=== CONT  TestAccCloudFrontFunctionDataSource_basic
=== CONT  TestAccCloudFrontFunction_associated
=== CONT  TestAccCloudFrontFunction_Update_comment
=== CONT  TestAccCloudFrontFunction_Update_code
=== CONT  TestAccCloudFrontFunction_basic
=== CONT  TestAccCloudFrontFunction_disappears
=== CONT  TestAccCloudFrontFunction_publish
--- PASS: TestAccCloudFrontFunction_disappears (21.69s)
--- PASS: TestAccCloudFrontFunction_basic (27.53s)
--- PASS: TestAccCloudFrontFunctionDataSource_basic (27.85s)
--- PASS: TestAccCloudFrontFunction_publish (44.60s)
--- PASS: TestAccCloudFrontFunction_Update_code (50.45s)
--- PASS: TestAccCloudFrontFunction_Update_comment (50.73s)
--- PASS: TestAccCloudFrontFunction_associated (659.29s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/cloudfront 660.906s

@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/XS Managed by automation to categorize the size of a PR. labels Nov 8, 2021
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc PKG_NAME=internal/service/cloudfront TESTARGS='-run=TestAccCloudFrontFunction_\|TestAccCloudFrontFunctionDataSource_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/cloudfront/... -v -count 1 -parallel 20 -run=TestAccCloudFrontFunction_\|TestAccCloudFrontFunctionDataSource_ -timeout 180m
=== RUN   TestAccCloudFrontFunctionDataSource_basic
=== PAUSE TestAccCloudFrontFunctionDataSource_basic
=== RUN   TestAccCloudFrontFunction_basic
=== PAUSE TestAccCloudFrontFunction_basic
=== RUN   TestAccCloudFrontFunction_disappears
=== PAUSE TestAccCloudFrontFunction_disappears
=== RUN   TestAccCloudFrontFunction_publish
=== PAUSE TestAccCloudFrontFunction_publish
=== RUN   TestAccCloudFrontFunction_associated
=== PAUSE TestAccCloudFrontFunction_associated
=== RUN   TestAccCloudFrontFunction_Update_code
=== PAUSE TestAccCloudFrontFunction_Update_code
=== RUN   TestAccCloudFrontFunction_UpdateCodeAndPublish
=== PAUSE TestAccCloudFrontFunction_UpdateCodeAndPublish
=== RUN   TestAccCloudFrontFunction_Update_comment
=== PAUSE TestAccCloudFrontFunction_Update_comment
=== CONT  TestAccCloudFrontFunctionDataSource_basic
=== CONT  TestAccCloudFrontFunction_Update_code
=== CONT  TestAccCloudFrontFunction_disappears
=== CONT  TestAccCloudFrontFunction_Update_comment
=== CONT  TestAccCloudFrontFunction_publish
=== CONT  TestAccCloudFrontFunction_associated
=== CONT  TestAccCloudFrontFunction_basic
=== CONT  TestAccCloudFrontFunction_UpdateCodeAndPublish
--- PASS: TestAccCloudFrontFunction_disappears (19.92s)
--- PASS: TestAccCloudFrontFunctionDataSource_basic (20.94s)
--- PASS: TestAccCloudFrontFunction_basic (22.93s)
--- PASS: TestAccCloudFrontFunction_publish (31.52s)
--- PASS: TestAccCloudFrontFunction_UpdateCodeAndPublish (31.78s)
--- PASS: TestAccCloudFrontFunction_Update_comment (34.11s)
--- PASS: TestAccCloudFrontFunction_Update_code (34.15s)
--- PASS: TestAccCloudFrontFunction_associated (362.14s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/cloudfront	365.269s

@ewbankkit ewbankkit changed the title r/aws_cloudfont_function Always store DEVELOPMENT stage etag in state r/aws_cloudfront_function Always store DEVELOPMENT stage etag in state Nov 8, 2021
@ewbankkit ewbankkit merged commit 1baa223 into hashicorp:main Nov 8, 2021
@github-actions github-actions bot added this to the v3.65.0 milestone Nov 8, 2021
@fularac fularac deleted the b-cloudfront-function-etag branch November 8, 2021 21:19
@github-actions
Copy link

This functionality has been released in v3.65.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. Thank you!

@github-actions
Copy link

github-actions bot commented Jun 9, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 9, 2022
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. documentation Introduces or discusses updates to documentation. service/cloudfront Issues and PRs that pertain to the cloudfront service. size/M Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
5 participants