From 21f7b09b2877c5b7b93ecb8969749da5fc4671c8 Mon Sep 17 00:00:00 2001 From: shockrah Date: Thu, 5 Oct 2023 22:58:43 -0700 Subject: [PATCH] Cleaning up infra to move to project-athens management repo --- infra/acm.tf | 29 ------------------------ infra/data.tf | 4 ++++ infra/imports.tf | 0 infra/lb.tf | 6 ----- infra/s3.tf | 56 ---------------------------------------------- infra/variables.tf | 8 +------ 6 files changed, 5 insertions(+), 98 deletions(-) delete mode 100644 infra/acm.tf create mode 100644 infra/data.tf delete mode 100644 infra/imports.tf delete mode 100644 infra/lb.tf delete mode 100644 infra/s3.tf diff --git a/infra/acm.tf b/infra/acm.tf deleted file mode 100644 index f0e1242..0000000 --- a/infra/acm.tf +++ /dev/null @@ -1,29 +0,0 @@ -# Here we are creating the cert that alpha LB will use -# Keeping the resource in this project repo because -# alpha does not depend on this resource and thus is our problem - -resource "aws_acm_certificate" "website" { - domain_name = "*.temper.tv" - subject_alternative_names = [ "temper.tv" ] - validation_method = "DNS" - - lifecycle { - create_before_destroy = true - } -} - -resource "aws_route53_record" "website_cert_record" { - for_each = { - for dvo in aws_acm_certificate.website.domain_validation_options : dvo.domain_name => { - name = dvo.resource_record_name - record = dvo.resource_record_value - type = dvo.resource_record_type - } - } - name = each.value.name - type = each.value.type - records = [ each.value.record ] - zone_id = aws_route53_zone.main.id - ttl = 60 -} - diff --git a/infra/data.tf b/infra/data.tf new file mode 100644 index 0000000..77618b5 --- /dev/null +++ b/infra/data.tf @@ -0,0 +1,4 @@ +data "aws_lb" "alpha" { + arn = "arn:aws:elasticloadbalancing:us-west-1:805875567437:loadbalancer/app/alpha-lb/33dad7632a052b70" + name = "alpha-lb" +} diff --git a/infra/imports.tf b/infra/imports.tf deleted file mode 100644 index e69de29..0000000 diff --git a/infra/lb.tf b/infra/lb.tf deleted file mode 100644 index 9ba0fae..0000000 --- a/infra/lb.tf +++ /dev/null @@ -1,6 +0,0 @@ -# Fetch the Alpha LB from Project Athens - -data "aws_lb" "alpha" { - arn = var.alpha.arn - name = var.alpha.name -} diff --git a/infra/s3.tf b/infra/s3.tf deleted file mode 100644 index b3b4ec9..0000000 --- a/infra/s3.tf +++ /dev/null @@ -1,56 +0,0 @@ -resource "aws_s3_bucket" "website" { - bucket = "temper.tv" - - tags = { - Name = "temper.tv" - Description = "Static content for temper.tv" - } -} - -############################################################### -# Below are the acl components for the bucket to make it public -############################################################### - -# Enables website configuration -resource "aws_s3_bucket_website_configuration" "site" { - bucket = aws_s3_bucket.website.bucket - index_document { - suffix = "index.html" - } - - error_document { - key = "404.html" - } -} - -# Set block public access to false -resource "aws_s3_bucket_public_access_block" "site" { - bucket = aws_s3_bucket.website.bucket - - block_public_acls = false - block_public_policy = false - ignore_public_acls = false - restrict_public_buckets = false -} - - -# Set a policy on the bucket to allow reads from anywhere -resource "aws_s3_bucket_policy" "site" { - bucket = aws_s3_bucket.website.bucket - policy = jsonencode({ - Version = "2012-10-17" - Statement = [ - { - Sid = "PublicReadGetObject" - Effect = "Allow" - Principal = "*" - Action = "s3:GetObject" - Resource = [ - "arn:aws:s3:::${aws_s3_bucket.website.bucket}", - "arn:aws:s3:::${aws_s3_bucket.website.bucket}/*", - ] - } - ] - }) -} - diff --git a/infra/variables.tf b/infra/variables.tf index a4c78d5..8b13789 100644 --- a/infra/variables.tf +++ b/infra/variables.tf @@ -1,7 +1 @@ -variable "alpha" { - description = "Project Athens Alpha LB" - type = object({ - name = string - arn = string - }) -} +