Skip to content

Commit

Permalink
feat: upgrade aws provider (#241)
Browse files Browse the repository at this point in the history
* feat: update aws acl

* feat: update bucket acl

update bucket acl to match with aws provide 4.x

* feat: update aws provide to 4.x

* fix: update output type

* feat: update aws provider version. to 4.x

* fix: remove depends on

* fix: fix index

* feat: update change log

* Update CHANGELOG.md

---------

Co-authored-by: Abhimanyu Gupta <[email protected]>
  • Loading branch information
githubjianli and abhimanyugupta07 authored Nov 16, 2023
1 parent 4dd9d8c commit 0e3c40d
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
### Changed
- Changed `k8s` API to work with provider 2.x
- Changed Terraform `map` to `tomap` to make it work with newer TF provider(The map function was deprecated in Terraform v0.12 and is no longer available).
- Upgrade AWS provider to `4.x`.

## [6.19.1] - 2023-08-25
### Fixed
Expand Down
4 changes: 2 additions & 2 deletions ouputs.tf
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
output "hms_readonly_load_balancers" {
value = var.hms_instance_type == "k8s" && var.enable_vpc_endpoint_services ? kubernetes_service.hms_readonly[0].status.0.load_balancer.0.ingress.0.hostname : []
value = var.hms_instance_type == "k8s" && var.enable_vpc_endpoint_services ? [kubernetes_service.hms_readonly[0].status.0.load_balancer.0.ingress.0.hostname] : []
}

output "hms_readwrite_load_balancers" {
value = var.hms_instance_type == "k8s" && var.enable_vpc_endpoint_services ? kubernetes_service.hms_readwrite[0].status.0.load_balancer.0.ingress.0.hostname : []
value = var.hms_instance_type == "k8s" && var.enable_vpc_endpoint_services ? [kubernetes_service.hms_readwrite[0].status.0.load_balancer.0.ingress.0.hostname] : []
}

output "managed_database_host" {
Expand Down
7 changes: 7 additions & 0 deletions s3-other.tf
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ resource "aws_s3_bucket_ownership_controls" "apiary_inventory_bucket" {
}
}

resource "aws_s3_bucket_acl" "apiary_inventory_bucket" {
count = var.s3_enable_inventory == true ? 1 : 0
depends_on = [aws_s3_bucket_ownership_controls.apiary_inventory_bucket[0]]
bucket = aws_s3_bucket.apiary_inventory_bucket[0].id
acl = "private"
}

resource "aws_s3_bucket" "apiary_managed_logs_bucket" {
count = local.enable_apiary_s3_log_management ? 1 : 0
bucket = local.apiary_s3_logs_bucket
Expand Down
9 changes: 8 additions & 1 deletion s3.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ resource "aws_s3_bucket" "apiary_data_bucket" {
for schema in local.schemas_info : "${schema["schema_name"]}" => schema
}
bucket = each.value["data_bucket"]
acl = "private"
request_payer = "BucketOwner"
policy = local.bucket_policy_map[each.key]
tags = merge(tomap({"Name"=each.value["data_bucket"]}),
Expand Down Expand Up @@ -123,6 +122,14 @@ resource "aws_s3_bucket_ownership_controls" "apiary_bucket" {
}
}

resource "aws_s3_bucket_acl" "apiary_data_bucket" {
for_each = {
for schema in local.schemas_info : "${schema["schema_name"]}" => schema
}
bucket = aws_s3_bucket.apiary_data_bucket[each.key].id
acl = "private"
}

resource "aws_s3_bucket_notification" "data_events" {
for_each = var.enable_data_events ? {
for schema in local.schemas_info : "${schema["schema_name"]}" => schema if lookup(schema, "enable_data_events_sqs", "0") == "0"
Expand Down
2 changes: 1 addition & 1 deletion version.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ terraform {
}
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
version = "~> 4.0"
}
}
}

0 comments on commit 0e3c40d

Please sign in to comment.