Using Terraform to create a Swarm cluster in AWS

We'll start by redefining the environment variables we used with Packer in case you start this section in a new terminal session:

cd terraform/awsexport AWS_ACCESS_KEY_ID=[...]export AWS_SECRET_ACCESS_KEY=[...]export AWS_DEFAULT_REGION=us-east-1

Please replace [...] with the actual values.

Terraform does not force us to have any particular file structure. We can define everything in a single file. However, that does not mean that we should. Terraform configs can get big, and separation of logical sections into separate files is often a good idea. In our case, we'll have three tf files. The terraform/aws/ ( ...

Get The DevOps 2.1 Toolkit: Docker Swarm now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.