From 830c49dd03097427e76dd08f5de28d36fcc9aa13 Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Sun, 20 Mar 2022 11:38:38 +0100 Subject: [PATCH 1/2] feat: update to AWS-provider 4.x --- k8s.tf | 4 ++-- providers.tf | 4 ++++ s3.tf | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/k8s.tf b/k8s.tf index e60c1a6..3c71b51 100644 --- a/k8s.tf +++ b/k8s.tf @@ -1,4 +1,4 @@ -resource "aws_s3_bucket_object" "extra_addons" { +resource "aws_s3_object" "extra_addons" { for_each = { for a in local.addons : a.name => a } bucket = var.bucket_state_store.id key = "${var.name}-addons/${each.value.name}/v${each.value.version}.yaml" @@ -8,7 +8,7 @@ resource "aws_s3_bucket_object" "extra_addons" { metadata = {} } -resource "aws_s3_bucket_object" "addons" { +resource "aws_s3_object" "addons" { bucket = var.bucket_state_store.id key = "${var.name}-addons/addon.yaml" content = local.addons_yaml diff --git a/providers.tf b/providers.tf index 0f5bfc4..2291ac5 100644 --- a/providers.tf +++ b/providers.tf @@ -1,5 +1,9 @@ terraform { required_providers { + aws = { + source = "hashicorp/aws" + version = "~> 4.0" + } kops = { source = "eddycharly/kops" version = "~>1.21.0" diff --git a/s3.tf b/s3.tf index 9e27aca..f1c79b5 100644 --- a/s3.tf +++ b/s3.tf @@ -1,6 +1,11 @@ resource "aws_s3_bucket" "issuer" { count = var.aws_oidc_provider ? 1 : 0 bucket = "${replace(var.name, ".", "-")}-irsa-issuer" - acl = "public-read" force_destroy = true } + +resource "aws_s3_bucket_acl" "issuer" { + count = var.aws_oidc_provider ? 1 : 0 + bucket = aws_s3_bucket.issuer[count.index].id + acl = "public-read" +} From 5e5a263d569595b6951d65fa0537f5e42829c60c Mon Sep 17 00:00:00 2001 From: Joakim Olsson Date: Sun, 20 Mar 2022 17:16:19 +0100 Subject: [PATCH 2/2] fix: update examples --- examples/additional_nodes/main.tf | 4 ++++ examples/additional_nodes/provider.tf | 2 +- examples/basic/main.tf | 5 +++++ examples/basic/provider.tf | 2 +- examples/policies/main.tf | 4 ++++ examples/policies/provider.tf | 2 +- 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/examples/additional_nodes/main.tf b/examples/additional_nodes/main.tf index 718293a..8c3463b 100644 --- a/examples/additional_nodes/main.tf +++ b/examples/additional_nodes/main.tf @@ -26,5 +26,9 @@ module "k8s" { resource "aws_s3_bucket" "state-store" { bucket = "state-store" +} + +resource "aws_s3_bucket_acl" "state-store" { + bucket = aws_s3_bucket.state-store.id acl = "public-read" } diff --git a/examples/additional_nodes/provider.tf b/examples/additional_nodes/provider.tf index 9d08f1c..b10c2f6 100644 --- a/examples/additional_nodes/provider.tf +++ b/examples/additional_nodes/provider.tf @@ -21,7 +21,7 @@ terraform { aws = { source = "hashicorp/aws" - version = "~> 3.0" + version = "~> 4.0" } } } diff --git a/examples/basic/main.tf b/examples/basic/main.tf index c8433be..48e779b 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -16,5 +16,10 @@ module "k8s" { resource "aws_s3_bucket" "state-store" { bucket = "state-store" +} + +resource "aws_s3_bucket_acl" "state-store" { + bucket = aws_s3_bucket.state-store.id acl = "public-read" } + diff --git a/examples/basic/provider.tf b/examples/basic/provider.tf index 9d08f1c..b10c2f6 100644 --- a/examples/basic/provider.tf +++ b/examples/basic/provider.tf @@ -21,7 +21,7 @@ terraform { aws = { source = "hashicorp/aws" - version = "~> 3.0" + version = "~> 4.0" } } } diff --git a/examples/policies/main.tf b/examples/policies/main.tf index 0d8fe42..0d0198e 100644 --- a/examples/policies/main.tf +++ b/examples/policies/main.tf @@ -16,6 +16,10 @@ module "k8s" { resource "aws_s3_bucket" "state-store" { bucket = "state-store" +} + +resource "aws_s3_bucket_acl" "state-store" { + bucket = aws_s3_bucket.state-store.id acl = "public-read" } diff --git a/examples/policies/provider.tf b/examples/policies/provider.tf index 9d08f1c..b10c2f6 100644 --- a/examples/policies/provider.tf +++ b/examples/policies/provider.tf @@ -21,7 +21,7 @@ terraform { aws = { source = "hashicorp/aws" - version = "~> 3.0" + version = "~> 4.0" } } }