Using map variables
If you've used maps, dictionaries, or hashes in some programming language such as Ruby, then you know what Map in Terraform is. Map is a lookup table, where you specify multiple keys with different values. You can then pick the value depending on the key. It's easier to understand it with the example.
At the moment our MightyTrousers application always uses the t2.micro instance type. These are cheap instances that are good for quick tests and development, but they are not that great for production. What we want, actually, is a way to use different instance types depending on the environment stack is deployed to. Let's assume that we have only three environments: dev, prod, and test.
First, let's move variables out of ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access