Skip to content

Commit

Permalink
upgrade upstream modules to support latest versions. update module in…
Browse files Browse the repository at this point in the history
…puts for additional support.
  • Loading branch information
tsaucier-sf committed Apr 23, 2024
1 parent 34b8673 commit bd7d39f
Show file tree
Hide file tree
Showing 9 changed files with 160 additions and 111 deletions.
2 changes: 1 addition & 1 deletion .terraform-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
latest:^1.4
latest:^1.7
30 changes: 17 additions & 13 deletions README.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions example/.terraform-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
latest:^1.7
124 changes: 58 additions & 66 deletions example/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | ~> 1.3 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 4.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.3, < 2.0.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.0 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.45.0 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.46.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| <a name="module_aurora"></a> [aurora](#module\_aurora) | ../ | n/a |
| <a name="module_rds_sql_server"></a> [rds\_sql\_server](#module\_rds\_sql\_server) | sourcefuse/arc-db/aws | 2.0.3 |
| <a name="module_rds_postgresql"></a> [rds\_postgresql](#module\_rds\_postgresql) | ../ | n/a |
| <a name="module_rds_sql_server"></a> [rds\_sql\_server](#module\_rds\_sql\_server) | ../ | n/a |

## Resources

Expand Down
40 changes: 31 additions & 9 deletions example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
## defaults
################################################################################
terraform {
required_version = "~> 1.3"
required_version = ">= 1.3, < 2.0.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
version = ">= 4.0"
}
}
}
Expand All @@ -27,7 +27,7 @@ data "aws_caller_identity" "this" {}
## aurora cluster
module "aurora" {
source = "../"
# version = "2.0.3"

environment = var.environment
namespace = var.namespace
region = var.region
Expand Down Expand Up @@ -55,8 +55,8 @@ module "aurora" {

## sql server rds instance
module "rds_sql_server" {
source = "sourcefuse/arc-db/aws"
version = "2.0.3"
source = "../"

environment = var.environment
namespace = var.namespace
region = var.region
Expand All @@ -72,16 +72,16 @@ module "rds_sql_server" {
rds_instance_database_user = "example_db_admin"
rds_instance_database_port = 1433
rds_instance_engine = "sqlserver-ex" // express edition.
rds_instance_engine_version = "15.00.4236.7.v1"
rds_instance_major_engine_version = "15.00"
rds_instance_db_parameter_group = "default.sqlserver-ex-15.0"
rds_instance_engine_version = "16.00.4105.2.v1"
rds_instance_major_engine_version = "16.00"
rds_instance_db_parameter_group = "default.sqlserver-ex-16.0"
rds_instance_db_parameter = []
rds_instance_db_options = []
rds_enable_custom_option_group = true
rds_instance_ca_cert_identifier = "rds-ca-2019"
rds_instance_publicly_accessible = false
rds_instance_multi_az = false
rds_instance_storage_type = "gp2"
rds_instance_storage_type = "gp3"
rds_instance_instance_class = "db.t3.small"
rds_instance_allocated_storage = 25
rds_instance_storage_encrypted = false // sql server express doesn't support encryption at rest
Expand All @@ -99,3 +99,25 @@ module "rds_sql_server" {
rds_instance_subnet_ids = data.aws_subnets.private.ids
additional_ingress_rules_rds = var.additional_ingress_rules_rds
}

## sql server rds instance
module "rds_postgresql" {
source = "../"

environment = var.environment
namespace = var.namespace
region = var.region
vpc_id = data.aws_vpc.vpc.id

account_id = data.aws_caller_identity.this.id
rds_instance_enabled = true
rds_instance_name = "postgresql-example"
enhanced_monitoring_name = "postgresql-example-enhanced-monitoring"
rds_instance_database_name = "arc"
rds_instance_database_user = "example_db_admin"

rds_instance_security_group_ids = data.aws_security_groups.db_sg.ids
rds_instance_allowed_cidr_blocks = [data.aws_vpc.vpc.cidr_block]
rds_instance_subnet_ids = data.aws_subnets.private.ids
additional_ingress_rules_rds = var.additional_ingress_rules_rds
}
17 changes: 11 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ resource "random_password" "rds_db_admin_password" {
## aurora cluster
################################################################################
module "aurora_cluster" {
source = "git::https://github.com/cloudposse/terraform-aws-rds-cluster.git?ref=1.7.0"
source = "git::https://github.com/cloudposse/terraform-aws-rds-cluster.git?ref=1.9.0"
count = var.aurora_cluster_enabled == true ? 1 : 0

name = local.aurora_cluster_name
Expand Down Expand Up @@ -164,12 +164,12 @@ module "aurora_cluster" {
storage_type = var.aurora_storage_type
iops = var.aurora_iops
copy_tags_to_snapshot = true
# enable monitoring every 30 seconds
rds_monitoring_interval = 30

rds_monitoring_interval = var.rds_monitoring_interval
performance_insights_enabled = var.performance_insights_enabled
performance_insights_kms_key_id = var.performance_insights_enabled ? coalesce(var.performance_insights_kms_key_id, aws_kms_key.aurora_cluster_kms_key[0].arn) : ""
performance_insights_retention_period = var.performance_insights_retention_period
enabled_cloudwatch_logs_exports = var.aurora_enabled_cloudwatch_logs_exports

vpc_security_group_ids = var.vpc_security_group_ids
kms_key_arn = var.kms_key_arn
Expand Down Expand Up @@ -205,7 +205,7 @@ resource "aws_security_group_rule" "additional_ingress_rules_aurora" {
## s3 db management
################################################################################
module "db_management" {
source = "git::https://github.com/cloudposse/terraform-aws-s3-bucket?ref=3.0.0"
source = "git::https://github.com/cloudposse/terraform-aws-s3-bucket?ref=4.2.0"
count = var.rds_enable_custom_option_group == true ? 1 : 0

name = "${local.rds_instance_name}-db-management"
Expand Down Expand Up @@ -361,7 +361,7 @@ resource "aws_db_instance_role_association" "this" {
################################################################################
module "rds_instance" {
count = var.rds_instance_enabled == true ? 1 : 0
source = "git::https://github.com/cloudposse/terraform-aws-rds?ref=0.40.0"
source = "git::https://github.com/cloudposse/terraform-aws-rds?ref=1.1.1"

name = local.rds_instance_name

Expand All @@ -380,6 +380,11 @@ module "rds_instance" {
deletion_protection = var.deletion_protection
iops = var.rds_instance_iops
# monitoring_role_arn = aws_iam_role.enhanced_monitoring.arn // TODO - make this conditional
enabled_cloudwatch_logs_exports = var.rds_enabled_cloudwatch_logs_exports
monitoring_interval = var.rds_monitoring_interval
performance_insights_enabled = var.performance_insights_enabled
performance_insights_kms_key_id = var.performance_insights_kms_key_id
performance_insights_retention_period = var.performance_insights_retention_period

kms_key_arn = var.rds_instance_storage_encrypted == false ? "" : var.rds_kms_key_arn_override != "" ? var.rds_kms_key_arn_override : aws_kms_key.rds_db_kms_key[0].arn
database_name = var.rds_instance_database_name
Expand All @@ -389,7 +394,7 @@ module "rds_instance" {
engine = var.rds_instance_engine
engine_version = var.rds_instance_engine_version
major_engine_version = var.rds_instance_major_engine_version
parameter_group_name = var.rds_instance_db_parameter_group
parameter_group_name = var.rds_instance_db_parameter_group_name
db_parameter_group = var.rds_instance_db_parameter_group
db_parameter = var.rds_instance_db_parameter
db_options = var.rds_instance_db_options
Expand Down
Loading

0 comments on commit bd7d39f

Please sign in to comment.