Our monthly newsletter lists the updates we’ve made to our code over the last month (we recently started publishing the newsletter on our blog). There are several types of updates you may want to incorporate:
Terraform updates
If you are using Gruntwork’s Terraform modules, then in your infrastructure-modules
repo, you most likely have some Terraform code that uses a Gruntwork module similar to this:
module "vpc" {
source = "git::git@github.com:gruntwork-io/module-vpc.git//modules/vpc-app?ref=v0.3.2"
# ... (other params omitted) ...
}
When we release a new version of the relevant module—in this case, vpc-app
—we will publish it at a new version number, such as v0.3.3
or v0.4.0
. To incorporate these changes into your code, you will need to:
- Bump the version number for the module in your
infrastructure-modules
repo.
- Apply any other changes described in the release notes (e.g., see the module-vpc releases page).
- Test the change. Typically, you do this by deploying the new code in a sandbox environment.
- If things work well, release a new version of your
infrastructure-modules
repo (i.e., by creating a new git tag).
- Use the new version of
infrastructure-modules
in the corresponding terraform.tfvars
files in infrastructure-live
. Typically, you’d deploy the new version first in pre-prod environments (e.g., stage), check that everything works well, and if it does, deploy the exact same code in prod.
Other types of updates
If you are using other types of Gruntwork modules, such as ssh-iam for managing SSH access with IAM groups, you are probably installing those modules in your AMIs in a Packer template via the Gruntwork Installer:
{
"provisioners": [{
{
"type": "shell",
"inline": [
"gruntwork-install --binary-name 'ssh-iam' --repo 'https://github.com/gruntwork-io/module-security' --tag v0.6.6"
]
}]
}
When we release a new version of ssh-iam
, you’ll want to bump the corresponding version number in the tag
parameter of that Packer template, build a new AMI (by using packer build
), and deploy that AMI in each environment (as always, testing first in pre-prod before prod) by plugging the new AMI ID into the corresponding terraform.tfvars
files in infrastructure-live
.
Please note that some modules offer zero-downtime deployment for AMIs just by running terragrunt apply
: e.g., the asg-rolling-deploy will deploy a new AMI in your ASG automatically when you run apply
. However, with other modules, you may need extra steps. For example, with the ecs-cluster module, after running apply
, you need to run a the roll-out-ecs-cluster-update.py
script (instructions) to deploy new ECS nodes and migrate the Docker containers to them.