From 364f66b53e17f23df697c1c2ace258edfe800a9c Mon Sep 17 00:00:00 2001 From: sid palas Date: Thu, 27 May 2021 15:18:02 -0700 Subject: [PATCH] move dns zone to global dir --- .../file-structure/global/main.tf | 27 +++++++++++++++++++ .../file-structure/production/main.tf | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 07-managing-multiple-environments/file-structure/global/main.tf diff --git a/07-managing-multiple-environments/file-structure/global/main.tf b/07-managing-multiple-environments/file-structure/global/main.tf new file mode 100644 index 0000000..12fba71 --- /dev/null +++ b/07-managing-multiple-environments/file-structure/global/main.tf @@ -0,0 +1,27 @@ +terraform { + # Assumes s3 bucket and dynamo DB table already set up + # See /code/03-basics/aws-backend + backend "s3" { + bucket = "devops-directive-tf-state" + key = "07-managing-multiple-environments/global/terraform.tfstate" + region = "us-east-1" + dynamodb_table = "terraform-state-locking" + encrypt = true + } + + required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 3.0" + } + } +} + +provider "aws" { + region = "us-east-1" +} + +# Route53 zone is shared across staging and production +resource "aws_route53_zone" "primary" { + name = "mysuperawesomesite.com" +} \ No newline at end of file diff --git a/07-managing-multiple-environments/file-structure/production/main.tf b/07-managing-multiple-environments/file-structure/production/main.tf index 5793ada..e1061e6 100644 --- a/07-managing-multiple-environments/file-structure/production/main.tf +++ b/07-managing-multiple-environments/file-structure/production/main.tf @@ -39,7 +39,7 @@ module "web_app" { domain = "mysuperawesomesite.com" environment_name = local.environment_name instance_type = "t2.small" - create_dns_zone = true + create_dns_zone = false db_name = "${local.environment_name}mydb" db_user = "foo" db_pass = var.db_pass