Skip to content

Commit

Permalink
Update to aws provider to v4.0+ (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
snovikov authored Apr 21, 2022
1 parent 11f5539 commit dbadd04
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 36 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module "aws_vault" {

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4 |
| <a name="provider_template"></a> [template](#provider\_template) | n/a |

<!-- TFDOCS_PROVIDER_END -->
Expand All @@ -56,7 +56,7 @@ module "aws_vault" {
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4 |

<!-- TFDOCS_REQUIREMENTS_END -->

Expand Down
4 changes: 2 additions & 2 deletions modules/consul-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ rules.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4 |
| <a name="provider_null"></a> [null](#provider\_null) | n/a |

## Modules
Expand Down
2 changes: 1 addition & 1 deletion modules/consul-cluster/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ resource "null_resource" "tags_as_list_of_maps" {
triggers = {
"key" = element(keys(var.tags), count.index)
"value" = element(values(var.tags), count.index)
"propagate_at_launch" = "true"
"propagate_at_launch" = true
}
}
37 changes: 22 additions & 15 deletions modules/consul-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,28 @@ resource "aws_autoscaling_group" "autoscaling_group" {
health_check_grace_period = var.health_check_grace_period
wait_for_capacity_timeout = var.wait_for_capacity_timeout

tags = concat(
[
{
"key" = "Name"
"value" = var.cluster_name
"propagate_at_launch" = true
},
{
"key" = var.cluster_tag_key
"value" = var.cluster_tag_value
"propagate_at_launch" = true
}
],
local.tags_asg_format,
)
dynamic "tag" {
for_each = concat(
[
{
key = "Name"
value = var.cluster_name
propagate_at_launch = true
},
{
key = var.cluster_tag_key
value = var.cluster_tag_value
propagate_at_launch = true
}
],
local.tags_asg_format,
)
content {
key = tag.value["key"]
value = tag.value["value"]
propagate_at_launch = tag.value["propagate_at_launch"]
}
}

lifecycle {
ignore_changes = [
Expand Down
2 changes: 1 addition & 1 deletion modules/consul-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3"
version = ">= 4"
}
}
required_version = ">= 0.13"
Expand Down
4 changes: 2 additions & 2 deletions modules/vault-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ machines.
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4 |
| <a name="provider_null"></a> [null](#provider\_null) | n/a |

## Modules
Expand Down
2 changes: 1 addition & 1 deletion modules/vault-cluster/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ resource "null_resource" "tags_as_list_of_maps" {
triggers = {
"key" = element(keys(var.tags), count.index)
"value" = element(values(var.tags), count.index)
"propagate_at_launch" = "true"
"propagate_at_launch" = true
}
}
27 changes: 17 additions & 10 deletions modules/vault-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,23 @@ resource "aws_autoscaling_group" "autoscaling_group" {
health_check_grace_period = var.health_check_grace_period
wait_for_capacity_timeout = var.wait_for_capacity_timeout

tags = concat(
[
{
"key" = "Name"
"value" = var.cluster_name
"propagate_at_launch" = true
}
],
local.tags_asg_format,
)
dynamic "tag" {
for_each = concat(
[
{
key = "Name"
value = var.cluster_name
propagate_at_launch = true
}
],
local.tags_asg_format,
)
content {
key = tag.value["key"]
value = tag.value["value"]
propagate_at_launch = tag.value["propagate_at_launch"]
}
}

lifecycle {
ignore_changes = [
Expand Down
2 changes: 1 addition & 1 deletion modules/vault-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3"
version = ">= 4"
}
}
required_version = ">= 0.13"
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 3"
version = ">= 4"
}
}
required_version = ">= 0.13"
Expand Down

0 comments on commit dbadd04

Please sign in to comment.