Gruntwork Newsletter, May 2020

Once a month, we send out a newsletter to all Gruntwork customers that describes all the updates we’ve made in the last month, news in the DevOps industry, and important security updates. Note that many of the links below go to private repos in the Gruntwork Infrastructure as Code Library and Reference Architecture that are only accessible to customers.

In the last couple months, we’ve released a guide to using Gruntwork with Terraform Cloud and Terraform Enterprise, created a new module for Amazon’s Elastic File Store (EFS), added PrivateLink support to keep AWS API calls within your VPC network, added support for managing secrets in Terragrunt using Mozilla SOPS, did a podcast interview with SE Radio, and made a huge number of other fixes and improvements.

As always, if you have any questions or need help, email us at support@gruntwork.io!

Gruntwork Updates

undefined

How to use Gruntwork with Terraform Cloud and Terraform Enterprise

Motivation:**** Gruntwork customers love saving time by using the Gruntwork IaC Library to do the heavy lifting of building production-grade cloud infrastructure. Many in the Terraform community have enjoyed using Terragrunt for its ability to keep your code and variables, CLI args, etc DRY, and for better support when applying changes across multiple accounts/modules/environments. HashiCorp customers love using Terraform Cloud (TFC) and/or Terraform Enterprise (TFE) for its browser-based controls, support for teams, and remote execution features. Fortunately, in this case, you can have your cake, and eat it too! Gruntwork and Terragrunt are compatible with Terraform Cloud and Terraform Enterprise.

Solution: We’ve written a blog post that shows you how to use Gruntwork’s Terrraform modules with TFC/TFE and even how to integrate Terragrunt with TFC/TFE. We’ve also updated our guide, How to Use the Gruntwork Infrastructure as Code Library, with all the details you need to set the integration up for yourself. Take a look and let us know what you think!

undefined

New module: Amazon Elastic File System (EFS)

Motivation: Amazon’s Elastic File System (EFS) gives you a managed, scalable, elastic NFS file system in the cloud. It’s an easy way to create a hard-disk that’s shared across many EC2 instances, but we did not have any module to deploy and manage EFS as code.

Solution: We’ve added a new efs module to module-data-storage! This makes it easy to use EFS in just a few lines of code:

module "efs" {
source = "git::git@github.com:gruntwork-io/module-data-storage.git//modules/efs?ref=v0.12.15"
name              = "example-efs"
vpc_id            = data.aws_vpc.default.id
subnet_ids        = data.aws_subnet_ids.default.ids
}

A huge thank you to Jesse Bye for contributing this new module!

What to do about it: Try out the new efs module and let us know what you think!

undefined

New module: PrivateLink for VPCs

Motivation: By default, any API calls you make to AWS go over the public Internet, even if you make those API calls from within a VPC in your AWS account. You can keep those API calls more private by routing them entirely within your VPC using VPC Endpoints (which are built into the Gruntwork VPC modules), but VPC Endpoints only support S3 and DynamoDB. For all other AWS services, you need to use PrivateLink, a separate (paid) service, which our VPC module did not support.

Solution: We’ve added a new vpc-interface-endpoint module to module-vpc which you can use to enable PrivateLink for AWS services in your VPC. Here’s an example of how to use the module to enable PrivateLink for all calls to AWS EC2 APIs:

module "vpc" {
source = "git::git@github.com:gruntwork-io/module-vpc.git//modules/vpc-app?ref=v0.8.7"
vpc_name   = "example-vpc"
aws_region = "us-east-1"
cidr_block = "10.0.0.0/16"
}
module "vpc_endpoint_ec2_example" {
source = "git::git@github.com:gruntwork-io/module-vpc.git//modules/vpc-interface-endpoint?ref=v0.8.7"
vpc_id     = module.vpc.vpc_id
subnet_ids = module.vpc.private_app_subnet_ids
# Enable PrivateLink for EC2
enable_ec2_endpoint = true
}

Note that using PrivateLink incurs an extra fee per hour per AZ where PrivateLink is deployed and per GB of data processed, so make sure to check the pricing page before enabling it for all services!

What to do about it: If you want an extra layer of privacy for your AWS API calls, try out the new vpc-interface-endpoint module and let us know what you think!

undefined

Manage secrets in Terragrunt using Mozilla SOPS

Motivation: Terraform does not have great native features for managing secrets (see this issue, which has been open for ~6 years).

Solution: We’ve added support for Mozilla SOPS to Terragrunt. SOPS allows you to securely store secrets in JSON or YAML files encrypted via AWS KMS, GCP KMS, Azure Key Vault, or PGP. For example, you might have a secrets.yml with the contents:

db:
user: ENC[AES256_GCM,data:CwE4O1s=,iv:2k=,aad:o=,tag:w==]
password: ENC[AES256_GCM,data:p673w==,iv:YY=,aad:UQ=,tag:A=]

Note that the user and password are encrypted with one of the mechanisms supported by SOPS, which means it is safe to check this file into version control. You use the new sops_decrypt_file helper in your terragrunt.hcl files to automatically read the file and decrypt the contents, allowing you to pass those values to your Terraform code:

locals {
secrets = yamldecode(sops_decrypt_file("secrets.yml"))
}
inputs = {
user     = local.secrets.db.user
password = local.secrets.db.password
}

This approach allows you to avoid putting any plain text secrets directly in version control, while still managing everything as code. Note that any secrets you pass to Terraform may be stored in its state file in plain text, so make sure you store that state file in an encrypted format too (e.g., using S3 encryption)!

What to do about it: Check out the sops_decrypt_file documentation, give the new helper a try, and let us know what you think!

undefined

SE Radio podcast interview: Infrastructure as Code Best Practices

Motivation: The team at Software Engineering (SE) Radio wanted to know more about infrastructure as code.

Solution: Gruntwork co-founder Yevgeniy (Jim) Brikman did a podcast interview with SE Radio on Infrastructure as Code Best Practices. The discussion covers similarities and differences between conventional software engineering and code-driven infrastructure; factoring code into modules; layering; terraform code organization for micro-services; releases and tagging; code reviews; unit testing infrastructure; deployment of infrastructure; ownership and code structure models; and open source and re-usable libraries.

What to do about it: Listen to the Infrastructure as Code Best Practices Podcast and leave your thoughts in the comments.

undefined

Open Source Updates

Terragrunt

Terratest

cloud-nuke

kubergrunt

terraform-google-gke

terraform-google-network

terraform-aws-nomad

fetch

Gruntwork Installer

package-terraform-utilities

undefined

Other updates

module-data-storage

terraform-aws-eks

package-static-assets

module-cache

package-lambda

module-security

module-load-balancer

module-aws-monitoring

package-openvpn

module-vpc

module-ci

module-server

package-messaging

cis-compliance-aws

module-ecs

module-asg

DevOps News

EKS now supports Kubernetes version 1.16; 1.13 is deprecated

What happened: EKS now supports Kubernetes 1.16 and Kubernetes 1.13 is now considered deprecated.

Why this matters: Kubernetes 1.16 includes support for volume resizing, Windows GMSA, and Finalizer Protection for Service LoadBalancers. Also, custom resource definitions and admission webhooks have both graduated to generally available. As for Kubernetes 1.13, since EKS only supports the 3 most recent releases, 1.13 is now officially deprecated in EKS and will no longer be supported by June 30, 2020, so if you’re still using it, make sure to update ASAP!

What to do about it: We are updating terraform-aws-eks with support for 1.16 as we speak: follow PR #160 for details. Once that PR is merged, you are safe to upgrade. If you’re still on 1.13, you should update ASAP!

EFS updates: faster read operations and ECS/Fargate integration

What happened:**** AWS has made two big improvements to its Elastic File System (EFS) Service: it now supports up to 35,000 read operations per second (a 400% increase) and ECS and Fargate tasks can now mount EFS file systems.

What to do about it: Check out the documentation for EFS limits and mounting EFS Volumes for details. Also, give our new efs module announced earlier in the newsletter a try!

Vault 1.4 has been released

What happened: HashiCorp has released Vault 1.4.

Why it matters: Some of the highlights of Vault 1.4 include:

What to do about it: Try the new version out and let us know what you think!

Security Updates

Below is a list of critical security updates that may impact your services. We notify Gruntwork customers of these vulnerabilities as soon as we know of them via the Gruntwork Security Alerts mailing list. It is up to you to scan this list and decide which of these apply and what to do about them, but most of these are severe vulnerabilities, and we recommend patching them ASAP.

Rails / Ruby

Text Link