Skip to content

Commit

Permalink
Support AWS Provider V5 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
max-lobur authored Jun 9, 2023
1 parent 2a2e152 commit 9fe956f
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 22 deletions.
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ Available targets:

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.0 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.2 |

Expand Down
2 changes: 1 addition & 1 deletion docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.0 |
| <a name="requirement_local"></a> [local](#requirement\_local) | >= 1.2 |

Expand Down
12 changes: 6 additions & 6 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ provider "aws" {

module "vpc" {
source = "cloudposse/vpc/aws"
version = "0.21.1"
version = "2.1.0"

cidr_block = var.vpc_cidr_block
ipv4_primary_cidr_block = var.vpc_cidr_block

context = module.this.context
}

module "subnets" {
source = "cloudposse/dynamic-subnets/aws"
version = "0.38.0"
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
nat_gateway_enabled = true
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
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.12.26"
required_version = ">= 1.0"

required_providers {
aws = {
Expand Down
22 changes: 11 additions & 11 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ locals {
enabled = module.this.enabled

count = local.enabled ? 1 : 0
id = local.enabled ? join("", aws_codedeploy_app.default.*.id) : null
name = local.enabled ? join("", aws_codedeploy_app.default.*.name) : null
group_id = local.enabled ? join("", aws_codedeploy_deployment_group.default.*.id) : null
deployment_config_name = local.enabled ? join("", aws_codedeploy_deployment_config.default.*.id) : null
deployment_config_id = local.enabled ? join("", aws_codedeploy_deployment_config.default.*.deployment_config_id) : null
id = local.enabled ? join("", aws_codedeploy_app.default[*].id) : null
name = local.enabled ? join("", aws_codedeploy_app.default[*].name) : null
group_id = local.enabled ? join("", aws_codedeploy_deployment_group.default[*].id) : null
deployment_config_name = local.enabled ? join("", aws_codedeploy_deployment_config.default[*].id) : null
deployment_config_id = local.enabled ? join("", aws_codedeploy_deployment_config.default[*].deployment_config_id) : null
auto_rollback_configuration_enabled = local.enabled && var.auto_rollback_configuration_events != null && length(var.auto_rollback_configuration_events) > 0
alarm_configuration_enabled = local.enabled && var.alarm_configuration != null
default_sns_topic_enabled = local.enabled && var.create_default_sns_topic
sns_topic_arn = local.default_sns_topic_enabled ? module.sns_topic.sns_topic.arn : var.sns_topic_arn
default_service_role_enabled = local.enabled && var.create_default_service_role
default_service_role_count = local.default_service_role_enabled ? 1 : 0
service_role_arn = local.default_service_role_enabled ? join("", aws_iam_role.default.*.arn) : var.service_role_arn
service_role_arn = local.default_service_role_enabled ? join("", aws_iam_role.default[*].arn) : var.service_role_arn
default_policy_arn = {
Server = "arn:${join("", data.aws_partition.current.*.partition)}:iam::aws:policy/service-role/AWSCodeDeployRole"
Lambda = "arn:${join("", data.aws_partition.current.*.partition)}:iam::aws:policy/service-role/AWSCodeDeployRoleForLambda"
ECS = "arn:${join("", data.aws_partition.current.*.partition)}:iam::aws:policy/AWSCodeDeployRoleForECS"
Server = "arn:${join("", data.aws_partition.current[*].partition)}:iam::aws:policy/service-role/AWSCodeDeployRole"
Lambda = "arn:${join("", data.aws_partition.current[*].partition)}:iam::aws:policy/service-role/AWSCodeDeployRoleForLambda"
ECS = "arn:${join("", data.aws_partition.current[*].partition)}:iam::aws:policy/AWSCodeDeployRoleForECS"
}
}

Expand All @@ -42,14 +42,14 @@ data "aws_partition" "current" {
resource "aws_iam_role" "default" {
count = local.default_service_role_count
name = module.this.id
assume_role_policy = join("", data.aws_iam_policy_document.assume_role.*.json)
assume_role_policy = join("", data.aws_iam_policy_document.assume_role[*].json)
tags = module.this.tags
}

resource "aws_iam_role_policy_attachment" "default" {
count = local.default_service_role_count
policy_arn = format("%s", lookup(local.default_policy_arn, var.compute_platform))
role = join("", aws_iam_role.default.*.name)
role = join("", aws_iam_role.default[*].name)
}

module "sns_topic" {
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.13"
required_version = ">= 1.0"

required_providers {
aws = {
Expand Down

0 comments on commit 9fe956f

Please sign in to comment.