Skip to content

Instantly share code, notes, and snippets.

@sinsoku
Created May 22, 2019 10:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save sinsoku/0d0bad8329e007f6853d3ab3bfc9e09b to your computer and use it in GitHub Desktop.
resource "aws_db_instance" "db" {
count = "${terraform.workspace == "default" ? 1 : 0}"
}
resource "aws_rds_cluster" "db" {
count = "${terraform.workspace == "default" ? 0 : 1}"
}
locals {
db_endpoint = "${terraform.workspace == "default" ? aws_db_instance.db.endpoint : aws_rds_cluster.db.endpoint}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment