From c98363857166f52c0072d816f9ab2e8b1d6da6ab Mon Sep 17 00:00:00 2001 From: Conner McCall Date: Thu, 20 Aug 2020 07:33:33 -0500 Subject: [PATCH] change: initial commit contains sloped.me domain records and backend configuration --- .gitignore | 32 ++++++++++++ remote-backend/README.md | 6 +++ remote-backend/main.tf | 97 ++++++++++++++++++++++++++++++++++++ remote-backend/out.tfplan | Bin 0 -> 4489 bytes remote-backend/provider.tf | 4 ++ remote-backend/variables.tf | 18 +++++++ remote-backend/versions.tf | 4 ++ route53/outputs.tf | 4 ++ route53/provider.tf | 15 ++++++ route53/sloped-me.tf | 87 ++++++++++++++++++++++++++++++++ route53/vars.tf | 8 +++ 11 files changed, 275 insertions(+) create mode 100644 .gitignore create mode 100644 remote-backend/README.md create mode 100644 remote-backend/main.tf create mode 100644 remote-backend/out.tfplan create mode 100644 remote-backend/provider.tf create mode 100644 remote-backend/variables.tf create mode 100644 remote-backend/versions.tf create mode 100644 route53/outputs.tf create mode 100644 route53/provider.tf create mode 100644 route53/sloped-me.tf create mode 100644 route53/vars.tf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1eed3c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +### Terraform ### +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log + +# Ignore any .tfvars files that are generated automatically for each Terraform run. Most +# .tfvars files are managed as part of configuration and so should be included in +# version control. +# +# example.tfvars + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* +plan +out.plan +terraform.tfvars diff --git a/remote-backend/README.md b/remote-backend/README.md new file mode 100644 index 0000000..f5667a6 --- /dev/null +++ b/remote-backend/README.md @@ -0,0 +1,6 @@ +# tf-backend-support +These files are used to prepare our terraform backend environment. They create an S3 bucket for storing terraform remote state, another S3 bucket for storing logs of the changes to terraform state for auditing purposes, and creates a DynamoDB table used by terraform for locking and consistency. These configs are only run once to initialize the environment, so these resources are available for the rest of our terraform configs to store remote state and handle locking for to allow for safe use across a team. + +NOTE: there is a known issue with the DynamoDB table disabled ttl attribute, +but you can still `terraform apply` config updates to the two s3 buckets even with this error: +https://github.com/terraform-providers/terraform-provider-aws/issues/10304 diff --git a/remote-backend/main.tf b/remote-backend/main.tf new file mode 100644 index 0000000..90b9f3d --- /dev/null +++ b/remote-backend/main.tf @@ -0,0 +1,97 @@ +# Get the AWS accountID +data "aws_caller_identity" "current" { +} + + +# Create S3 buckets for logging and tfstate +resource "aws_s3_bucket" "tflogs" { + bucket = var.s3bucketlogs + acl = "log-delivery-write" + + tags = { + Name = var.s3bucketlogs + "ManagedBy" = "terraform" + } + + # Enable server-side encryption by default + server_side_encryption_configuration { + rule { + apply_server_side_encryption_by_default { + sse_algorithm = "AES256" + } + } + } +} + +resource "aws_s3_bucket" "tfstate" { + bucket = var.s3bucketstate + + tags = { + Name = var.s3bucketstate + "ManagedBy" = "terraform" + } + + logging { + target_bucket = aws_s3_bucket.tflogs.id + target_prefix = "log/" + } + + versioning { + enabled = true + } + + lifecycle { + prevent_destroy = true + } + + # Enable server-side encryption by default + server_side_encryption_configuration { + rule { + apply_server_side_encryption_by_default { + sse_algorithm = "AES256" + } + } + } +} + +resource "aws_s3_bucket_policy" "tfstate" { + bucket = aws_s3_bucket.tfstate.id + policy = <7f|}1iW;Y)JVuBL_#E_1nKThQ4m4GAqJ38 zBm_SA-Su6Ob?<%7I)9w?zGt6(o*idzhz1aY6o7R(fN3PUfNQ`6U<15h?k-kt2KpcX znn(-Axf9ZqcVK+njyuP`7fd=$!jIP2W5^!0NMZk1KjjpDzgPJE*Fe=P--+Se_vUZUR zds#!oo(2-TTDb43;BlLn#}sVp^c60-@XBGe#nxD1t=iXR^(bbli1?!BuvVXov<6?1 zMj~~+_OKkTMPp6BXMvL8%J4DyF{7%Qwla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