From c77b03e6ac65f398a121016d4e1755f2d4678b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulo=20J=C3=BAnior=20do=20Nascimento=20Lima?= Date: Thu, 10 Mar 2022 10:17:38 -0300 Subject: [PATCH] Remove deployer dependency --- site-main/main.tf | 28 ---------------------------- site-main/variables.tf | 5 ----- site-redirect/main.tf | 24 ------------------------ site-redirect/variables.tf | 4 ---- 4 files changed, 61 deletions(-) diff --git a/site-main/main.tf b/site-main/main.tf index 103c112..4dccd07 100644 --- a/site-main/main.tf +++ b/site-main/main.tf @@ -121,34 +121,6 @@ resource "aws_s3_bucket_public_access_block" "this" { // target_prefix = "${var.log_bucket_prefix}" // } -################################################################################################################ -## Configure the credentials and access to the bucket for a deployment user -################################################################################################################ -data "template_file" "deployer_role_policy_file" { - template = file("${path.module}/deployer_role_policy.json") - - vars = { - bucket = var.bucket_name - } -} - -resource "aws_iam_policy" "site_deployer_policy" { - count = var.deployer != null ? 1 : 0 - - name = "${var.bucket_name}.deployer" - path = "/" - description = "Policy allowing to publish a new version of the website to the S3 bucket" - policy = data.template_file.deployer_role_policy_file.rendered -} - -resource "aws_iam_policy_attachment" "site-deployer-attach-user-policy" { - count = var.deployer != null ? 1 : 0 - - name = "${var.bucket_name}-deployer-policy-attachment" - users = [var.deployer] - policy_arn = aws_iam_policy.site_deployer_policy.0.arn -} - ################################################################################################################ ## Create a Cloudfront distribution for the static website ################################################################################################################ diff --git a/site-main/variables.tf b/site-main/variables.tf index b26988c..884fa4a 100644 --- a/site-main/variables.tf +++ b/site-main/variables.tf @@ -27,11 +27,6 @@ variable "duplicate-content-penalty-secret" { type = string } -variable "deployer" { - type = string - default = null -} - variable "acm-certificate-arn" { type = string } diff --git a/site-redirect/main.tf b/site-redirect/main.tf index 79e8ab3..773fa4a 100644 --- a/site-redirect/main.tf +++ b/site-redirect/main.tf @@ -83,30 +83,6 @@ resource "aws_s3_bucket_public_access_block" "this" { restrict_public_buckets = true } -################################################################################################################ -## Configure the credentials and access to the bucket for a deployment user -################################################################################################################ -data "template_file" "deployer_role_policy_file" { - template = file("${path.module}/deployer_role_policy.json") - - vars = { - bucket = "site.${replace(replace(var.domain, ".", "-"), "*", "star")}" - } -} - -resource "aws_iam_policy" "site_deployer_policy" { - name = "site.${replace(replace(var.domain, ".", "-"), "*", "star")}.deployer" - path = "/" - description = "Policy allowing to publish a new version of the website to the S3 bucket" - policy = data.template_file.deployer_role_policy_file.rendered -} - -resource "aws_iam_policy_attachment" "staging-site-deployer-attach-user-policy" { - name = "site.${replace(replace(var.domain, ".", "-"), "*", "star")}-deployer-policy-attachment" - users = [var.deployer] - policy_arn = aws_iam_policy.site_deployer_policy.arn -} - ################################################################################################################ ## Create a Cloudfront distribution for the static website ################################################################################################################ diff --git a/site-redirect/variables.tf b/site-redirect/variables.tf index 0fca8b8..6b1a637 100644 --- a/site-redirect/variables.tf +++ b/site-redirect/variables.tf @@ -15,10 +15,6 @@ variable "duplicate-content-penalty-secret" { type = string } -variable "deployer" { - type = string -} - variable "acm-certificate-arn" { type = string }