Last active
November 15, 2018 22:46
-
-
Save nikhedonia/361ac9f862b7dc5a56c39092baf8f99e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
provider "aws" { | |
region = "eu-west-1" | |
} | |
terraform { | |
backend "s3" { # will handle correctly multiple workspaces | |
bucket = "project" | |
region = "eu-west-1" | |
key = "project/terraform.tfstate" | |
dynamodb_table = "project-terraform-lock" # to prevent race conditions, table needs to be created manually | |
} | |
} | |
data "terraform_remote_state" "network" { | |
backend = "s3" # bucket needs to be created manually | |
config { | |
bucket = "tf-project" | |
key = "project/terraform.tfstate" | |
region = "eu-west-1" # make sure terraform has permissions | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "common_tags" { | |
default = { | |
ServiceName = "platform" | |
Team = "[email protected]" | |
} | |
} | |
resource "aws_subnet" "private" { | |
tags = "${merge( | |
var.common_tags, | |
map("Name", "PriSubnet1"), | |
map("Network", "Private"), | |
)}" | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { # select a workspace using `terraform workspace select $NAME` | |
domains { | |
dev = "dev.mydomain.com" | |
prod = "prod.mydomain.com" | |
} | |
domain = "${local.domains[terraform.workspace]}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/skyscrapers/terraform-bluegreen