Skip to content

Instantly share code, notes, and snippets.

@tom-butler
Created January 31, 2017 00:43
Show Gist options
  • Save tom-butler/41fb533e89032f0f3e48d539f2098607 to your computer and use it in GitHub Desktop.
Save tom-butler/41fb533e89032f0f3e48d539f2098607 to your computer and use it in GitHub Desktop.
Terraform to only reference the resource that exists
# Assuming either name_1 or name_2 exists (using a count = 0)
# The following can be used to pass an attribute from the resource that was created
"${coalesce(
join("", resource.name.*.id),
join("", resource.name_2.*.id)
)}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment