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

Support AWS Provider V5 #159

Merged
merged 6 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/release-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'docs/**'
- 'examples/**'
- 'test/**'
- 'README.*'

permissions:
contents: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-published.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ permissions:

jobs:
terraform-module:
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release.yml@main
uses: cloudposse/github-actions-workflows-terraform-module/.github/workflows/release-published.yml@main
22 changes: 9 additions & 13 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,22 @@ provider "aws" {
}

module "vpc" {
source = "cloudposse/vpc/aws"
version = "0.28.1"

cidr_block = "172.16.0.0/16"

context = module.this.context
source = "cloudposse/vpc/aws"
version = "2.1.0"
ipv4_primary_cidr_block = var.vpc_cidr_block
context = module.this.context
}

module "subnets" {
source = "cloudposse/dynamic-subnets/aws"
version = "0.40.1"

source = "cloudposse/dynamic-subnets/aws"
version = "2.3.0"
availability_zones = var.availability_zones
vpc_id = module.vpc.vpc_id
igw_id = module.vpc.igw_id
cidr_block = module.vpc.vpc_cidr_block
igw_id = [module.vpc.igw_id]
ipv4_cidr_block = [module.vpc.vpc_cidr_block]
nat_gateway_enabled = false
nat_instance_enabled = false

context = module.this.context
context = module.this.context
}

module "rds_instance" {
Expand Down
16 changes: 8 additions & 8 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ locals {
# finally, if no name is provided, and it is not a replica, we check if subnets were provided.
db_subnet_group_name = local.db_subnet_group_name_provided ? var.db_subnet_group_name : (
local.is_replica ? null : (
local.subnet_ids_provided ? join("", aws_db_subnet_group.default.*.name) : null)
local.subnet_ids_provided ? join("", aws_db_subnet_group.default[*].name) : null)
)

availability_zone = var.multi_az ? null : var.availability_zone
Expand All @@ -43,7 +43,7 @@ resource "aws_db_instance" "default" {

vpc_security_group_ids = compact(
concat(
[join("", aws_security_group.default.*.id)],
[join("", aws_security_group.default[*].id)],
max-lobur marked this conversation as resolved.
Show resolved Hide resolved
max-lobur marked this conversation as resolved.
Show resolved Hide resolved
max-lobur marked this conversation as resolved.
Show resolved Hide resolved
max-lobur marked this conversation as resolved.
Show resolved Hide resolved
max-lobur marked this conversation as resolved.
Show resolved Hide resolved
max-lobur marked this conversation as resolved.
Show resolved Hide resolved
max-lobur marked this conversation as resolved.
Show resolved Hide resolved
var.associate_security_group_ids
)
)
Expand All @@ -52,8 +52,8 @@ resource "aws_db_instance" "default" {
availability_zone = local.availability_zone

ca_cert_identifier = var.ca_cert_identifier
parameter_group_name = length(var.parameter_group_name) > 0 ? var.parameter_group_name : join("", aws_db_parameter_group.default.*.name)
option_group_name = length(var.option_group_name) > 0 ? var.option_group_name : join("", aws_db_option_group.default.*.name)
parameter_group_name = length(var.parameter_group_name) > 0 ? var.parameter_group_name : join("", aws_db_parameter_group.default[*].name)
option_group_name = length(var.option_group_name) > 0 ? var.option_group_name : join("", aws_db_option_group.default[*].name)
license_model = var.license_model
multi_az = var.multi_az
storage_type = var.storage_type
Expand Down Expand Up @@ -183,7 +183,7 @@ resource "aws_security_group_rule" "ingress_security_groups" {
to_port = var.database_port
protocol = "tcp"
source_security_group_id = var.security_group_ids[count.index]
security_group_id = join("", aws_security_group.default.*.id)
security_group_id = join("", aws_security_group.default[*].id)
}

resource "aws_security_group_rule" "ingress_cidr_blocks" {
Expand All @@ -195,7 +195,7 @@ resource "aws_security_group_rule" "ingress_cidr_blocks" {
to_port = var.database_port
protocol = "tcp"
cidr_blocks = var.allowed_cidr_blocks
security_group_id = join("", aws_security_group.default.*.id)
security_group_id = join("", aws_security_group.default[*].id)
}

resource "aws_security_group_rule" "egress" {
Expand All @@ -206,7 +206,7 @@ resource "aws_security_group_rule" "egress" {
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
security_group_id = join("", aws_security_group.default.*.id)
security_group_id = join("", aws_security_group.default[*].id)
}

module "dns_host_name" {
Expand All @@ -216,7 +216,7 @@ module "dns_host_name" {
enabled = length(var.dns_zone_id) > 0 && module.this.enabled
dns_name = var.host_name
zone_id = var.dns_zone_id
records = coalescelist(aws_db_instance.default.*.address, [""])
records = coalescelist(aws_db_instance.default[*].address, [""])

context = module.this.context
}
18 changes: 9 additions & 9 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
output "instance_id" {
value = join("", aws_db_instance.default.*.id)
value = join("", aws_db_instance.default[*].id)
description = "ID of the instance"
}

output "instance_arn" {
value = join("", aws_db_instance.default.*.arn)
value = join("", aws_db_instance.default[*].arn)
description = "ARN of the instance"
}

output "instance_address" {
value = join("", aws_db_instance.default.*.address)
value = join("", aws_db_instance.default[*].address)
description = "Address of the instance"
}

output "instance_endpoint" {
value = join("", aws_db_instance.default.*.endpoint)
value = join("", aws_db_instance.default[*].endpoint)
description = "DNS Endpoint of the instance"
}

output "subnet_group_id" {
value = join("", aws_db_subnet_group.default.*.id)
value = join("", aws_db_subnet_group.default[*].id)
description = "ID of the created Subnet Group"
}

output "security_group_id" {
value = join("", aws_security_group.default.*.id)
value = join("", aws_security_group.default[*].id)
description = "ID of the Security Group"
}

output "parameter_group_id" {
value = join("", aws_db_parameter_group.default.*.id)
value = join("", aws_db_parameter_group.default[*].id)
description = "ID of the Parameter Group"
}

output "option_group_id" {
value = join("", aws_db_option_group.default.*.id)
value = join("", aws_db_option_group.default[*].id)
description = "ID of the Option Group"
}

Expand All @@ -44,6 +44,6 @@ output "hostname" {
}

output "resource_id" {
value = join("", aws_db_instance.default.*.resource_id)
value = join("", aws_db_instance.default[*].resource_id)
description = "The RDS Resource ID of this instance."
}