Repository navigation
v3.0.1 Earlier checks
All pre-v3 users should upgrade.
v3.0.0 users who upgrade will benefit from earlier checks.
- CloudFormation: The main target subnet must be in the designated VPC, and the IDs of the backup and main subnet must differ. (Two subnets in the same availability zone will be caught later in the resource creation sequence.)
- Terraform: The backup subnet, and any custom security groups, will not be found if they are in a VPC different from that of the main subnet. If none of the specified custom security group matches, generic security groups will be created instead.
In addition to a new Terraform wrapper with detailed instructions (enjoy!), v3 includes changes to the...
CVpn CloudFormation template
-
Remove the
-Endpointsuffix from theNametag value for VPN endpoint. This might be a breaking change for some users. -
Rename the
ClientSecGrpIdParamPathparameter toSsmParamPath. This might be a breaking change for some users. If you set a non-default value, you must use the new parameter name. -
Preserve the CloudWatch log group after the stack is deleted (other than in the case of an immediate rollback). This might be a breaking change for some users, because the log group has a custom
LogGroupNameequal to the stack name. Delete the old log group before recreating the stack with the same stack name. -
Add a missing default for
BackupTargetSubnetId. If you explicitly set this to the empty string, you can now remove that setting. -
Output the endpoint ID, via a Parameter Store parameter.
-
Optional stack policy to prevent some impossible updates.
CVpnPrereq CloudFormation template
-
Fix a permissions error that would have prevented KMS encryption of CloudWatch log groups when the deployment role was in use.
-
Output the name of the deployment role.
-
Optional stack policy to prevent replacing or deleting the deployment role in a stack update. (Sadly, there seems to be no good way to prevent deleting the stack itself, while the main stack is still referencing the deployment role. Ideas?)
ReadMe
- Shorter introduction
- Cost table for easy comparison
- More foldable
<detail>blocks - Bullet points for installation sub-steps
- Sample on/off schedules cover mainland USA, Canada time zones
Why Terraform?
I will gradually be adding Terraform wrappers to my open-source projects, in hopes of reaching additional users. My projects remain CloudFormation-first. CloudFormation offers the right balance for startups, small companies, and individual users.
- No extra software to install and update
- Comprehensive support (infrastructure-as-code + AWS resources) available as part of your existing AWS Support plan
- A bias toward simplicity and use of AWS idioms
- Easy distribution: new users can download a single template file and create a stack in the AWS Console (with a one-click button if I were willing to pay the S3 retrieval charges!)
- Easy installation at scale, across multiple regions and AWS accounts, via CloudFormation StackSets
In this particular application, the cost-saving trick of creating and deleting the VPN endpoint associations on a schedule wouldn't be feasible with Terraform. Each change would require calling out to Terraform and getting approval for a plan.
The Terraform wrapper nevertheless demonstrates some benefits of that system, involving data sources:
- References to tags to avoid tight coupling
- Verification that resources exist
Terraform expressions are nice to have, but as you can see from the code, the possibility of arbitrary conditional expressions, of missing values (try, etc.), and of lists of unknown cardinality, creates endless complexity when we write, test, debug, and read/interpret infrastructure-as-code templates.
You might be impressed that a Terraform user need only specify the ID of one subnet, from which all the other inputs needed to create a VPN are derived. Such economy is only possible after you've:
- dedicated a system to running Terraform,
- secured it (unfortunately, Terraform runs with full AWS administrative privileges in the vast majority of installations), and
- set up a Terraform backend to store state.
The balance between simplicity and complexity is up to you.
My recommendation is to use CloudFormation for AWS resources, placing the priority on the many and close interrelationships between those resources. Use whatever infrastructure-as-code system you like for other kinds of resources, noting that there are fewer and weaker interrelationships between pure AWS resources and other kinds of resources. AWS Systems Manager (SSM) Parameter Store works well for those kinds of external dependencies. I like
Alternative Ways to Share Data Between Configurations, which, incidentally, is from HashiCorp's own Terraform remote state documentation.