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 default values to aws_vpn_connection #17031

Merged
merged 64 commits into from
Jan 26, 2022

Conversation

shoekstra
Copy link
Contributor

@shoekstra shoekstra commented Jan 8, 2021

Hi,

This PR fixes a bug where removing fields from the resource should revert them to their documented default value, but instead sets them to their null value (in this case 0). When this happens the provider attempts to use these 0 values to update the VPN connection which results in an error, forcing the user to specify these fields and their default values, as demonstrated below:

Plan:

  ~ resource "aws_vpn_connection" "default" {
        id                                   = "vpn-0e0a..."
      - tunnel1_dpd_timeout_seconds          = 30 -> null
      - tunnel1_phase1_lifetime_seconds      = 28800 -> null
      - tunnel1_phase2_lifetime_seconds      = 3600 -> null
      - tunnel1_rekey_fuzz_percentage        = 100 -> null
      - tunnel1_rekey_margin_time_seconds    = 540 -> null
      - tunnel1_replay_window_size           = 1024 -> null
      - tunnel2_dpd_timeout_seconds          = 30 -> null
      - tunnel2_phase1_lifetime_seconds      = 28800 -> null
      - tunnel2_phase2_lifetime_seconds      = 3600 -> null
      - tunnel2_rekey_fuzz_percentage        = 100 -> null
      - tunnel2_rekey_margin_time_seconds    = 540 -> null
      - tunnel2_replay_window_size           = 1024 -> null
        # (45 unchanged attributes hidden)
    }

Apply:

Error: Error modifying vpn tunnel options: InvalidParameterValue: Invalid value specified for Phase1LifetimeSeconds.
	status code: 400, request id: ...

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

Release note for CHANGELOG:

Add documented default values to `aws_vpn_connection` resource

Closes: #21317.
Relates #20433.
Relates #22776.

This fixes a bug where removing fields from the resource should revert
them to their default value, but instead sets them to their empty value
(in this case 0). When this happens the provider attempts to use these 0
values to update the VPN connection which results in an error, forcing
the user to specify these fields and their default values.

Signed-off-by: Stephen Hoekstra <shoekstra@schubergphilis.com>
@shoekstra shoekstra requested a review from a team as a code owner January 8, 2021 21:19
@ghost ghost added size/L Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jan 8, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jan 8, 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 @shoekstra 👋

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! 😃

Base automatically changed from master to main January 23, 2021 01:00
@breathingdust breathingdust added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 16, 2021
@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.

@ewbankkit ewbankkit added this to the v4.0.0 milestone Oct 26, 2021
Boran Car and others added 18 commits January 24, 2022 08:37
The data source errors out if there are no connections to return, but
should instead return an empty array and let the user decide.
Signed-off-by: Andrea Quintino <andreaquin1990@gmail.com>
Signed-off-by: Andrea Quintino <andreaquin1990@gmail.com>
Signed-off-by: Andrea Quintino <andreaquin1990@gmail.com>
Signed-off-by: Andrea Quintino <andreaquin1990@gmail.com>
Signed-off-by: Andrea Quintino <andreaquin1990@gmail.com>
Signed-off-by: dirk39 <andreaquin1990@gmail.com>
This reverts commit 068311a.
@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/eks Issues and PRs that pertain to the eks service. service/s3 Issues and PRs that pertain to the s3 service. sweeper Pertains to changes to or issues with the sweeper. size/XL Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Jan 25, 2022
@ewbankkit ewbankkit changed the base branch from main to release/4.x January 25, 2022 22:28
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 TESTARGS='-run=TestAccEC2VPNConnection_' PKG_NAME=internal/service/ec2 ACCTEST_PARALLELISM=5 
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 5  -run=TestAccEC2VPNConnection_ -timeout 180m
=== RUN   TestAccEC2VPNConnection_basic
=== PAUSE TestAccEC2VPNConnection_basic
=== RUN   TestAccEC2VPNConnection_transitGatewayID
=== PAUSE TestAccEC2VPNConnection_transitGatewayID
=== RUN   TestAccEC2VPNConnection_tunnel1InsideCIDR
=== PAUSE TestAccEC2VPNConnection_tunnel1InsideCIDR
=== RUN   TestAccEC2VPNConnection_tunnel1InsideIPv6CIDR
=== PAUSE TestAccEC2VPNConnection_tunnel1InsideIPv6CIDR
=== RUN   TestAccEC2VPNConnection_tunnel1PreSharedKey
=== PAUSE TestAccEC2VPNConnection_tunnel1PreSharedKey
=== RUN   TestAccEC2VPNConnection_tunnelOptions
=== PAUSE TestAccEC2VPNConnection_tunnelOptions
=== RUN   TestAccEC2VPNConnection_tunnelOptionsLesser
=== PAUSE TestAccEC2VPNConnection_tunnelOptionsLesser
=== RUN   TestAccEC2VPNConnection_withStaticRoutes
=== PAUSE TestAccEC2VPNConnection_withStaticRoutes
=== RUN   TestAccEC2VPNConnection_withEnableAcceleration
=== PAUSE TestAccEC2VPNConnection_withEnableAcceleration
=== RUN   TestAccEC2VPNConnection_withIPv6
=== PAUSE TestAccEC2VPNConnection_withIPv6
=== RUN   TestAccEC2VPNConnection_tags
=== PAUSE TestAccEC2VPNConnection_tags
=== RUN   TestAccEC2VPNConnection_specifyIPv4
=== PAUSE TestAccEC2VPNConnection_specifyIPv4
=== RUN   TestAccEC2VPNConnection_specifyIPv6
=== PAUSE TestAccEC2VPNConnection_specifyIPv6
=== RUN   TestAccEC2VPNConnection_disappears
=== PAUSE TestAccEC2VPNConnection_disappears
=== RUN   TestAccEC2VPNConnection_updateCustomerGatewayID
=== PAUSE TestAccEC2VPNConnection_updateCustomerGatewayID
=== RUN   TestAccEC2VPNConnection_updateVPNGatewayID
=== PAUSE TestAccEC2VPNConnection_updateVPNGatewayID
=== RUN   TestAccEC2VPNConnection_updateTransitGatewayID
=== PAUSE TestAccEC2VPNConnection_updateTransitGatewayID
=== RUN   TestAccEC2VPNConnection_vpnGatewayIDToTransitGatewayID
=== PAUSE TestAccEC2VPNConnection_vpnGatewayIDToTransitGatewayID
=== RUN   TestAccEC2VPNConnection_transitGatewayIDToVPNGatewayID
=== PAUSE TestAccEC2VPNConnection_transitGatewayIDToVPNGatewayID
=== CONT  TestAccEC2VPNConnection_basic
=== CONT  TestAccEC2VPNConnection_tags
=== CONT  TestAccEC2VPNConnection_updateVPNGatewayID
=== CONT  TestAccEC2VPNConnection_transitGatewayIDToVPNGatewayID
=== CONT  TestAccEC2VPNConnection_vpnGatewayIDToTransitGatewayID
--- PASS: TestAccEC2VPNConnection_basic (284.33s)
=== CONT  TestAccEC2VPNConnection_updateTransitGatewayID
--- PASS: TestAccEC2VPNConnection_tags (494.43s)
=== CONT  TestAccEC2VPNConnection_tunnelOptions
--- PASS: TestAccEC2VPNConnection_updateVPNGatewayID (805.29s)
=== CONT  TestAccEC2VPNConnection_withIPv6
--- PASS: TestAccEC2VPNConnection_tunnelOptions (346.44s)
=== CONT  TestAccEC2VPNConnection_withEnableAcceleration
--- PASS: TestAccEC2VPNConnection_vpnGatewayIDToTransitGatewayID (1035.74s)
=== CONT  TestAccEC2VPNConnection_withStaticRoutes
--- PASS: TestAccEC2VPNConnection_transitGatewayIDToVPNGatewayID (1057.21s)
=== CONT  TestAccEC2VPNConnection_tunnelOptionsLesser
--- PASS: TestAccEC2VPNConnection_updateTransitGatewayID (1114.26s)
=== CONT  TestAccEC2VPNConnection_disappears
--- PASS: TestAccEC2VPNConnection_withIPv6 (664.43s)
=== CONT  TestAccEC2VPNConnection_updateCustomerGatewayID
--- PASS: TestAccEC2VPNConnection_withEnableAcceleration (670.37s)
=== CONT  TestAccEC2VPNConnection_tunnel1InsideIPv6CIDR
--- PASS: TestAccEC2VPNConnection_withStaticRoutes (518.36s)
=== CONT  TestAccEC2VPNConnection_tunnel1PreSharedKey
--- PASS: TestAccEC2VPNConnection_disappears (365.02s)
=== CONT  TestAccEC2VPNConnection_tunnel1InsideCIDR
--- PASS: TestAccEC2VPNConnection_tunnel1PreSharedKey (315.87s)
=== CONT  TestAccEC2VPNConnection_transitGatewayID
--- PASS: TestAccEC2VPNConnection_tunnel1InsideCIDR (399.84s)
=== CONT  TestAccEC2VPNConnection_specifyIPv6
--- PASS: TestAccEC2VPNConnection_tunnel1InsideIPv6CIDR (662.20s)
=== CONT  TestAccEC2VPNConnection_specifyIPv4
--- PASS: TestAccEC2VPNConnection_updateCustomerGatewayID (769.15s)
--- PASS: TestAccEC2VPNConnection_transitGatewayID (612.41s)
--- PASS: TestAccEC2VPNConnection_specifyIPv6 (609.97s)
--- PASS: TestAccEC2VPNConnection_specifyIPv4 (932.94s)
--- PASS: TestAccEC2VPNConnection_tunnelOptionsLesser (2050.05s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ec2        3111.088s

@github-actions github-actions bot removed provider Pertains to the provider itself, rather than any interaction with AWS. service/eks Issues and PRs that pertain to the eks service. documentation Introduces or discusses updates to documentation. service/s3 Issues and PRs that pertain to the s3 service. sweeper Pertains to changes to or issues with the sweeper. labels Jan 26, 2022
@ewbankkit ewbankkit merged commit cc90288 into hashicorp:release/4.x Jan 26, 2022
anGie44 pushed a commit that referenced this pull request Jan 26, 2022
* Add default values to aws_vpn_connection

This fixes a bug where removing fields from the resource should revert
them to their default value, but instead sets them to their empty value
(in this case 0). When this happens the provider attempts to use these 0
values to update the VPN connection which results in an error, forcing
the user to specify these fields and their default values.

Signed-off-by: Stephen Hoekstra <shoekstra@schubergphilis.com>
anGie44 pushed a commit that referenced this pull request Jan 28, 2022
* Add default values to aws_vpn_connection

This fixes a bug where removing fields from the resource should revert
them to their default value, but instead sets them to their empty value
(in this case 0). When this happens the provider attempts to use these 0
values to update the VPN connection which results in an error, forcing
the user to specify these fields and their default values.

Signed-off-by: Stephen Hoekstra <shoekstra@schubergphilis.com>
anGie44 pushed a commit that referenced this pull request Jan 28, 2022
* Add default values to aws_vpn_connection

This fixes a bug where removing fields from the resource should revert
them to their default value, but instead sets them to their empty value
(in this case 0). When this happens the provider attempts to use these 0
values to update the VPN connection which results in an error, forcing
the user to specify these fields and their default values.

Signed-off-by: Stephen Hoekstra <shoekstra@schubergphilis.com>
anGie44 pushed a commit that referenced this pull request Jan 28, 2022
* Add default values to aws_vpn_connection

This fixes a bug where removing fields from the resource should revert
them to their default value, but instead sets them to their empty value
(in this case 0). When this happens the provider attempts to use these 0
values to update the VPN connection which results in an error, forcing
the user to specify these fields and their default values.

Signed-off-by: Stephen Hoekstra <shoekstra@schubergphilis.com>
anGie44 pushed a commit that referenced this pull request Jan 28, 2022
* Add default values to aws_vpn_connection

This fixes a bug where removing fields from the resource should revert
them to their default value, but instead sets them to their empty value
(in this case 0). When this happens the provider attempts to use these 0
values to update the VPN connection which results in an error, forcing
the user to specify these fields and their default values.

Signed-off-by: Stephen Hoekstra <shoekstra@schubergphilis.com>
anGie44 pushed a commit that referenced this pull request Jan 31, 2022
* Add default values to aws_vpn_connection

This fixes a bug where removing fields from the resource should revert
them to their default value, but instead sets them to their empty value
(in this case 0). When this happens the provider attempts to use these 0
values to update the VPN connection which results in an error, forcing
the user to specify these fields and their default values.

Signed-off-by: Stephen Hoekstra <shoekstra@schubergphilis.com>
anGie44 pushed a commit that referenced this pull request Feb 3, 2022
* Add default values to aws_vpn_connection

This fixes a bug where removing fields from the resource should revert
them to their default value, but instead sets them to their empty value
(in this case 0). When this happens the provider attempts to use these 0
values to update the VPN connection which results in an error, forcing
the user to specify these fields and their default values.

Signed-off-by: Stephen Hoekstra <shoekstra@schubergphilis.com>
@github-actions
Copy link

This functionality has been released in v4.0.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

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 May 20, 2022
@shoekstra shoekstra deleted the add_vpn_connection_defaults branch October 26, 2022 13:09
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. service/ec2 Issues and PRs that pertain to the ec2 service. size/XL 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
Development

Successfully merging this pull request may close these issues.

TF is unable to revert changes made to aws_vpn_connection in AWS Console
8 participants