Skip to content

Instantly share code, notes, and snippets.

@rafaeljesus
Created January 3, 2020 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafaeljesus/56e744aee20aae32969d31e0a3cedfea to your computer and use it in GitHub Desktop.
Save rafaeljesus/56e744aee20aae32969d31e0a3cedfea to your computer and use it in GitHub Desktop.
# variables.tf
variable "env" {
description = "env: stg or prod"
}
variable "image_name" {
type = "map"
description = "Image for container."
default = {
dev = "occollector:latest"
prod = "occollector:ubuntu"
}
}
# main.tf
resource "docker_image" "image_id" {
name = lookup(var.image_name, var.env)
}
# run it!
# terraform plan -out=tfstg_plan -var env=stg
# terraform plan -out=tfprod_plan -var env=prod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment