Skip to content

Instantly share code, notes, and snippets.

@pselle
Created July 10, 2019 17:01
Show Gist options
  • Save pselle/140c5f21c96b66f417796ed6ca000c1d to your computer and use it in GitHub Desktop.
Save pselle/140c5f21c96b66f417796ed6ca000c1d to your computer and use it in GitHub Desktop.
Example of for_each in statefile
{
"version": 4,
"terraform_version": "0.12.4",
"serial": 55,
"lineage": "7468d9d0-35f4-0178-6054-5cddfc07a1b5",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "random_pet",
"name": "no_iterator",
"provider": "provider.random",
"instances": [
{
"schema_version": 0,
"attributes": {
"id": "cuddly-doberman",
"keepers": null,
"length": 2,
"prefix": null,
"separator": "-"
},
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "random_pet",
"name": "with_count",
"each": "list",
"provider": "provider.random",
"instances": [
{
"index_key": 0,
"schema_version": 0,
"attributes": {
"id": "becoming-bat",
"keepers": null,
"length": 2,
"prefix": null,
"separator": "-"
},
"private": "bnVsbA=="
},
{
"index_key": 1,
"schema_version": 0,
"attributes": {
"id": "quiet-sloth",
"keepers": null,
"length": 2,
"prefix": null,
"separator": "-"
},
"private": "bnVsbA=="
}
]
},
{
"mode": "managed",
"type": "random_pet",
"name": "with_for_each",
"each": "map",
"provider": "provider.random",
"instances": [
{
"index_key": "a",
"schema_version": 0,
"attributes": {
"id": "humble-jay",
"keepers": null,
"length": 2,
"prefix": null,
"separator": "-"
},
"private": "bnVsbA=="
},
{
"index_key": "b",
"schema_version": 0,
"attributes": {
"id": "enabling-gannet",
"keepers": null,
"length": 2,
"prefix": null,
"separator": "-"
},
"private": "bnVsbA=="
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment