Should I commit .tfstate files to Git?

There are a few reasons not to store your .tfstate files in Git: You are likely to forget to commit and push your changes after running terraform apply, so your teammates will have out-of-date .tfstate files. Also, without any locking on these state files, if two team members run Terraform at the same time on … Read more

Should .terraform.lock.hcl be included in the .gitignore file?

Per the Terraform documentation on the Dependency Lock File: Terraform automatically creates or updates the dependency lock file each time you run the terraform init command. You should include this file in your version control repository so that you can discuss potential changes to your external dependencies via code review, just as you would discuss … Read more

Terraform: Error acquiring the state lock: ConditionalCheckFailedException

Cause of Error This error usually appears when one process fails running terraform plan or terraform apply. For example if your network connection interrupts or the process is terminated before finishing. Then Terraform “thinks” that this process is still working on the infrastructure and blocks other processes from working with the same infrastructure and state … Read more

Upgrade terraform to specific version

Especially when playing around with Terraform 0.12 betas, I learned to love tfenv. After installation (via brew install tfenv on MacOS), this allows you to easily discover, install and activate any Terraform version: $ tfenv list-remote 0.12.0 0.12.0-rc1 0.12.0-beta2 0.12.0-beta1 0.12.0 0.11.14 … $ tfenv install 0.11.14 [INFO] Installing Terraform v0.11.14 [INFO] Downloading release tarball … Read more

AWS Lambda:The provided execution role does not have permissions to call DescribeNetworkInterfaces on EC2

This error is common if you try to deploy a Lambda in a VPC without giving it the required network interface related permissions ec2:DescribeNetworkInterfaces, ec2:CreateNetworkInterface, and ec2:DeleteNetworkInterface (see AWS Forum). For example, this a policy that allows to deploy a Lambda into a VPC: { “Version”: “2012-10-17”, “Statement”: [ { “Effect”: “Allow”, “Action”: [ “ec2:DescribeNetworkInterfaces”, … Read more