Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support AWS 4.x Terraform provider #1739

Merged
2 changes: 1 addition & 1 deletion .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: terraform init
run: terraform init -get -backend=false -input=false
run: terraform init -upgrade -get -backend=false -input=false
npalm marked this conversation as resolved.
Show resolved Hide resolved
- if: contains(matrix.terraform, '1.1.')
name: check terraform formatting
run: terraform fmt -recursive -check=true -write=false
Expand Down
2 changes: 1 addition & 1 deletion modules/download-lambda/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.38"
version = "~> 4.0"
}
}
}
63 changes: 37 additions & 26 deletions modules/runner-binaries-syncer/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,55 @@ locals {

resource "aws_s3_bucket" "action_dist" {
bucket = var.distribution_bucket_name
acl = "private"
force_destroy = true
tags = var.tags
}

# Max 1 block - server_side_encryption_configuration
dynamic "server_side_encryption_configuration" {
for_each = length(keys(var.server_side_encryption_configuration)) == 0 ? [] : [var.server_side_encryption_configuration]

content {

dynamic "rule" {
for_each = length(keys(lookup(server_side_encryption_configuration.value, "rule", {}))) == 0 ? [] : [lookup(server_side_encryption_configuration.value, "rule", {})]
resource "aws_s3_bucket_acl" "action_dist_acl" {
bucket = aws_s3_bucket.action_dist.id
acl = "private"
}

content {
bucket_key_enabled = lookup(rule.value, "bucket_key_enabled", null)
resource "aws_s3_bucket_lifecycle_configuration" "bucket-config" {
bucket = aws_s3_bucket.action_dist.id

dynamic "apply_server_side_encryption_by_default" {
for_each = length(keys(lookup(rule.value, "apply_server_side_encryption_by_default", {}))) == 0 ? [] : [
lookup(rule.value, "apply_server_side_encryption_by_default", {})]
rule {
id = "lifecycle_config"
status = "Enabled"

content {
sse_algorithm = apply_server_side_encryption_by_default.value.sse_algorithm
kms_master_key_id = lookup(apply_server_side_encryption_by_default.value, "kms_master_key_id", null)
}
}
}
}
abort_incomplete_multipart_upload {
days_after_initiation = 7
}
}

lifecycle_rule {
enabled = true
abort_incomplete_multipart_upload_days = 7

transition {
days = 35
storage_class = "INTELLIGENT_TIERING"
}


}
}

resource "aws_s3_bucket_server_side_encryption_configuration" "action_dist" {
bucket = aws_s3_bucket.action_dist.id


dynamic "rule" {
for_each = length(keys(lookup(var.server_side_encryption_configuration, "rule", {}))) == 0 ? [] : [lookup(var.server_side_encryption_configuration, "rule", {})]
shashidhar087 marked this conversation as resolved.
Show resolved Hide resolved

content {
bucket_key_enabled = lookup(rule.value, "bucket_key_enabled", null)

dynamic "apply_server_side_encryption_by_default" {
for_each = length(keys(lookup(rule.value, "apply_server_side_encryption_by_default", {}))) == 0 ? [] : [
lookup(rule.value, "apply_server_side_encryption_by_default", {})]

content {
sse_algorithm = apply_server_side_encryption_by_default.value.sse_algorithm
kms_master_key_id = lookup(apply_server_side_encryption_by_default.value, "kms_master_key_id", null)
}
}
}
}
}
shashidhar087 marked this conversation as resolved.
Show resolved Hide resolved

Expand Down
10 changes: 5 additions & 5 deletions modules/runner-binaries-syncer/runner-binaries-syncer.tf
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ resource "aws_lambda_permission" "syncer" {
### Extra trigger to trigger from S3 to execute the lambda after first deployment
###################################################################################

resource "aws_s3_bucket_object" "trigger" {
bucket = aws_s3_bucket.action_dist.id
key = "triggers/${aws_lambda_function.syncer.id}-trigger.json"
source = "${path.module}/trigger.json"
source_hash = filemd5("${path.module}/trigger.json")
resource "aws_s3_object" "trigger" {
bucket = aws_s3_bucket.action_dist.id
key = "triggers/${aws_lambda_function.syncer.id}-trigger.json"
source = "${path.module}/trigger.json"
etag = filemd5("${path.module}/trigger.json")

depends_on = [aws_s3_bucket_notification.on_deploy]
}
Expand Down
2 changes: 1 addition & 1 deletion modules/runner-binaries-syncer/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.38"
version = "~> 4.0"
}
}
}
2 changes: 1 addition & 1 deletion modules/runners/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.38"
version = "~> 4.0"
}
}
}
2 changes: 1 addition & 1 deletion modules/setup-iam-permissions/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.38"
version = "~> 4.0"
}
}
}
2 changes: 1 addition & 1 deletion modules/ssm/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.38"
version = "~> 4.0"
}
}
}
2 changes: 1 addition & 1 deletion modules/webhook/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.38"
version = "~> 4.0"
}
}
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.38"
version = "~> 4.0"
}
}
}