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

Update to v5.x of terraform-provider-aws #28

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions elasticache-redis/auth-token/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "secret" {
source = "github.com/thoughtbot/terraform-aws-secrets//secret?ref=v0.4.0"
source = "github.com/thoughtbot/terraform-aws-secrets//secret?ref=v0.8.0"

admin_principals = var.admin_principals
description = "Redis auth token for: ${local.full_name}"
Expand All @@ -16,7 +16,7 @@ module "secret" {
}

module "rotation" {
source = "github.com/thoughtbot/terraform-aws-secrets//secret-rotation-function?ref=v0.4.0"
source = "github.com/thoughtbot/terraform-aws-secrets//secret-rotation-function?ref=v0.8.0"

handler = "lambda_function.lambda_handler"
role_arn = module.secret.rotation_role_arn
Expand Down
2 changes: 1 addition & 1 deletion elasticache-redis/auth-token/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 = "~> 4.0"
version = "~> 5.0"
}
}
}
39 changes: 21 additions & 18 deletions elasticache-redis/replication-group/main.tf
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
resource "aws_elasticache_replication_group" "this" {
replication_group_id = coalesce(var.replication_group_id, var.name)

at_rest_encryption_enabled = var.at_rest_encryption_enabled
automatic_failover_enabled = local.replica_enabled
engine = var.engine
engine_version = var.engine_version
kms_key_id = var.kms_key == null ? module.customer_kms.kms_key_arn : var.kms_key.id
multi_az_enabled = local.replica_enabled
node_type = var.node_type
num_cache_clusters = local.instance_count
parameter_group_name = var.parameter_group_name
port = var.port
replication_group_description = var.description
security_group_ids = local.server_security_group_ids
snapshot_name = var.snapshot_name
snapshot_retention_limit = var.snapshot_retention_limit
subnet_group_name = aws_elasticache_subnet_group.this.name
transit_encryption_enabled = var.transit_encryption_enabled
at_rest_encryption_enabled = var.at_rest_encryption_enabled
automatic_failover_enabled = local.replica_enabled
description = var.description
engine = var.engine
engine_version = var.engine_version
global_replication_group_id = var.global_replication_group_id
kms_key_id = local.primary_kms_key
multi_az_enabled = local.replica_enabled
node_type = var.node_type
num_cache_clusters = local.instance_count
parameter_group_name = var.parameter_group_name
port = var.port
security_group_ids = local.server_security_group_ids
snapshot_name = var.snapshot_name
snapshot_retention_limit = var.snapshot_retention_limit
subnet_group_name = aws_elasticache_subnet_group.this.name
transit_encryption_enabled = var.transit_encryption_enabled

# Auth tokens aren't supported without TLS
auth_token = (
Expand All @@ -36,7 +37,7 @@ resource "aws_elasticache_replication_group" "this" {
}

module "customer_kms" {
source = "github.com/thoughtbot/terraform-aws-secrets//customer-managed-kms?ref=v0.7.0"
source = "github.com/thoughtbot/terraform-aws-secrets//customer-managed-kms?ref=v0.8.0"

name = var.name
}
Expand Down Expand Up @@ -229,7 +230,7 @@ data "aws_ec2_instance_type" "instance_attributes" {

locals {
instance_count = var.replica_count + 1
instance_size = split(".", var.node_type)[2]
instance_size = replace(var.node_type, "cache.", "")
instances = sort(aws_elasticache_replication_group.this.member_clusters)
owned_security_group_ids = module.server_security_group.*.id
replica_enabled = var.replica_count > 0
Expand All @@ -241,4 +242,6 @@ locals {
local.owned_security_group_ids,
local.shared_security_group_ids
)

primary_kms_key = var.enable_kms ? (var.kms_key_id == null ? module.customer_kms.kms_key_arn : var.kms_key_id) : var.kms_key_id
}
18 changes: 15 additions & 3 deletions elasticache-redis/replication-group/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ variable "at_rest_encryption_enabled" {
default = true
}

variable "kms_key" {
description = "Custom KMS key to encrypt data at rest"
type = object({ arn = string })
variable "kms_key_id" {
description = "KMS key to encrypt data at rest"
type = string
default = null
}

Expand All @@ -21,6 +21,12 @@ variable "description" {
type = string
}

variable "enable_kms" {
type = bool
description = "Enable KMS encryption"
default = true
}

variable "engine" {
type = string
description = "Elasticache database engine; defaults to Redis"
Expand All @@ -32,6 +38,12 @@ variable "engine_version" {
description = "Version for RDS database engine"
}

variable "global_replication_group_id" {
type = string
description = "The ID of the global replication group to which this replication group should belong."
default = null
}

variable "initial_auth_token" {
type = string
description = "Override the initial auth token"
Expand Down
2 changes: 1 addition & 1 deletion elasticache-redis/replication-group/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 = "~> 4.0"
version = "~> 5.0"
}
random = {
source = "hashicorp/random"
Expand Down
2 changes: 1 addition & 1 deletion kafka/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 = "~> 4.0"
version = "~> 5.0"
}
}
}
4 changes: 2 additions & 2 deletions rds-postgres/admin-login/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "secret" {
source = "github.com/thoughtbot/terraform-aws-secrets//secret?ref=v0.4.0"
source = "github.com/thoughtbot/terraform-aws-secrets//secret?ref=v0.8.0"

admin_principals = var.admin_principals
description = "Postgres password for: ${local.full_name}"
Expand All @@ -19,7 +19,7 @@ module "secret" {
}

module "rotation" {
source = "github.com/thoughtbot/terraform-aws-secrets//secret-rotation-function?ref=v0.4.0"
source = "github.com/thoughtbot/terraform-aws-secrets//secret-rotation-function?ref=v0.8.0"

handler = "lambda_function.lambda_handler"
role_arn = module.secret.rotation_role_arn
Expand Down
2 changes: 1 addition & 1 deletion rds-postgres/admin-login/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 = "~> 4.0"
version = "~> 5.0"
}
}
}
2 changes: 1 addition & 1 deletion rds-postgres/cloudwatch-alarms/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 = "~> 4.0"
version = "~> 5.0"
}
}
}
2 changes: 1 addition & 1 deletion rds-postgres/parameter-group/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 = "~> 4.0"
version = "~> 5.0"
}
}
}
4 changes: 2 additions & 2 deletions rds-postgres/primary-instance/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ resource "aws_db_instance" "this" {
}

module "customer_kms" {
source = "github.com/thoughtbot/terraform-aws-secrets//customer-managed-kms?ref=v0.7.0"
source = "github.com/thoughtbot/terraform-aws-secrets//customer-managed-kms?ref=v0.8.0"

name = var.identifier
}
Expand Down Expand Up @@ -155,5 +155,5 @@ locals {
local.shared_vpc_security_group_ids
)

primary_kms_key = var.kms_key_id == null ? module.customer_kms.kms_key_arn : var.kms_key_id
primary_kms_key = var.enable_kms ? (var.kms_key_id == null ? module.customer_kms.kms_key_arn : var.kms_key_id) : var.kms_key_id
}
6 changes: 6 additions & 0 deletions rds-postgres/primary-instance/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ variable "enabled_cloudwatch_logs_exports" {
default = []
}

variable "enable_kms" {
type = bool
description = "Enable KMS encryption"
default = true
}

variable "engine" {
type = string
description = "RDS database engine; defaults to Postgres"
Expand Down
2 changes: 1 addition & 1 deletion rds-postgres/primary-instance/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 = "~> 4.0"
version = "~> 5.0"
}
random = {
source = "hashicorp/random"
Expand Down
6 changes: 3 additions & 3 deletions rds-postgres/rds-postgres-login/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module "secret" {
source = "github.com/thoughtbot/terraform-aws-secrets//secret?ref=v0.4.0"
source = "github.com/thoughtbot/terraform-aws-secrets//secret?ref=v0.8.0"

admin_principals = var.admin_principals
description = "Postgres password for: ${local.full_name}"
Expand All @@ -9,7 +9,7 @@ module "secret" {
trust_tags = var.trust_tags

initial_value = jsonencode({
dbname = var.database.name
dbname = var.database.db_name
engine = var.database.engine
host = var.database.address
password = ""
Expand All @@ -19,7 +19,7 @@ module "secret" {
}

module "rotation" {
source = "github.com/thoughtbot/terraform-aws-secrets//secret-rotation-function?ref=v0.4.0"
source = "github.com/thoughtbot/terraform-aws-secrets//secret-rotation-function?ref=v0.8.0"

handler = "lambda_function.lambda_handler"
role_arn = module.secret.rotation_role_arn
Expand Down
2 changes: 1 addition & 1 deletion rds-postgres/rds-postgres-login/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ variable "database" {
type = object({
address = string
arn = string
db_name = string
engine = string
identifier = string
name = string
port = number
})
}
Expand Down
2 changes: 1 addition & 1 deletion rds-postgres/rds-postgres-login/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 = "~> 4.0"
version = "~> 5.0"
}
}
}
2 changes: 1 addition & 1 deletion rds-postgres/replica/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 = "~> 4.0"
version = "~> 5.0"
}
}
}
2 changes: 1 addition & 1 deletion security-group-ingress/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 = "~> 4.0"
version = "~> 5.0"
}
}
}
2 changes: 1 addition & 1 deletion security-group/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 = "~> 4.0"
version = "~> 5.0"
}
random = {
source = "hashicorp/random"
Expand Down
Loading