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

Fix vpn connection setup while tunnel cidr is used #11

Merged

Conversation

ppieprzycki
Copy link
Contributor

Hello,

I'd like to propose two changes

  • As I tried to use tunnel CIDR in my VPN setup I had a problem with creating an "aws_vpn_resource".
    This module tries creating both resources named "default" and "tunnel" for the same IPsec connection.
    Fix makes sure that the "Default" resource is not created when any of var.tunnel* variables are set.

  • The second change introduces new variable named "create_vpn_gateway_attachment".
    Idea behind is to not create an association between vGW and VPC within this module
    The other module "terraform-aws-vpc" already has logic that is responsible for creating vGW and attaching it to a VPC.
    Also, a problem arises when we configure two VPN connections and we want later delete one of them (or we have direct connect). If we delete vgw attachment we cannot further use other connection.
    The new variable is set by default to true to provide backward compatibility.

@antonbabenko
Copy link
Member

@miguelaferreira What do you think about all this?

Copy link
Contributor

@miguelaferreira miguelaferreira left a comment

Choose a reason for hiding this comment

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

The contribution in this PR is very welcome.

I've made a few comments with proposals for small adjustments to the code, and it looks overall good to me.

I've also tested the PR and got the expected results:

Apply complete! Resources: 46 added, 0 changed, 0 destroyed.

Outputs:

vpn_gateway.vpn_connection_id = vpn-0ed0e25583f2e89ce
vpn_gateway.vpn_connection_tunnel1_address = 34.247.237.2
vpn_gateway.vpn_connection_tunnel1_cgw_inside_address = 169.254.33.90
vpn_gateway.vpn_connection_tunnel1_vgw_inside_address = 169.254.33.89
vpn_gateway.vpn_connection_tunnel2_address = 54.229.206.2
vpn_gateway.vpn_connection_tunnel2_cgw_inside_address = 169.254.33.102
vpn_gateway.vpn_connection_tunnel2_vgw_inside_address = 169.254.33.101
vpn_gateway2.vpn_connection_id = vpn-058bd8b96b511877f
vpn_gateway2.vpn_connection_tunnel1_address = 34.240.59.142
vpn_gateway2.vpn_connection_tunnel1_cgw_inside_address = 169.254.34.102
vpn_gateway2.vpn_connection_tunnel1_vgw_inside_address = 169.254.34.101
vpn_gateway2.vpn_connection_tunnel2_address = 52.18.208.78
vpn_gateway2.vpn_connection_tunnel2_cgw_inside_address = 169.254.34.90
vpn_gateway2.vpn_connection_tunnel2_vgw_inside_address = 169.254.34.89

Thanks

examples/complete-dual-vpn-gateway/main.tf Outdated Show resolved Hide resolved
examples/complete-dual-vpn-gateway/main.tf Outdated Show resolved Hide resolved
main.tf Outdated Show resolved Hide resolved
@ppieprzycki
Copy link
Contributor Author

Hi
Thanks for reviewing. I've made suggested changes. Please check if they seem good.

@miguelaferreira
Copy link
Contributor

Thanks a lot for the effort @ppieprzycki 👍

@antonbabenko LGTM

@antonbabenko antonbabenko merged commit 444ff36 into terraform-aws-modules:master Sep 7, 2018
antonbabenko added a commit that referenced this pull request Sep 7, 2018
@antonbabenko
Copy link
Member

You guys ROCK! 🥇

v1.5.0 has been released.

@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 Nov 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants