Skip to content

Commit

Permalink
chore: Stash WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs committed Jan 1, 2023
1 parent 9462b7e commit bd85174
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 229 deletions.
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@ No modules.
| [aws_rds_cluster_parameter_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_parameter_group) | resource |
| [aws_rds_cluster_role_association.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_role_association) | resource |
| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
| [aws_security_group_rule.cidr_ingress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
| [aws_security_group_rule.default_ingress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
| [aws_security_group_rule.egress](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
| [aws_security_group_rule.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) | resource |
| [random_id.snapshot_identifier](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id) | resource |
| [random_password.master_password](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
| [aws_iam_policy_document.monitoring_rds_assume_role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
Expand All @@ -269,8 +267,6 @@ No modules.
|------|-------------|------|---------|:--------:|
| <a name="input_allocated_storage"></a> [allocated\_storage](#input\_allocated\_storage) | The amount of storage in gibibytes (GiB) to allocate to each DB instance in the Multi-AZ DB cluster. (This setting is required to create a Multi-AZ DB cluster) | `number` | `null` | no |
| <a name="input_allow_major_version_upgrade"></a> [allow\_major\_version\_upgrade](#input\_allow\_major\_version\_upgrade) | Enable to allow major engine version upgrades when changing engine versions. Defaults to `false` | `bool` | `false` | no |
| <a name="input_allowed_cidr_blocks"></a> [allowed\_cidr\_blocks](#input\_allowed\_cidr\_blocks) | A list of CIDR blocks which are allowed to access the database | `list(string)` | `[]` | no |
| <a name="input_allowed_security_groups"></a> [allowed\_security\_groups](#input\_allowed\_security\_groups) | A list of Security Group ID's to allow access to | `list(string)` | `[]` | no |
| <a name="input_apply_immediately"></a> [apply\_immediately](#input\_apply\_immediately) | Specifies whether any cluster modifications are applied immediately, or during the next maintenance window. Default is `false` | `bool` | `null` | no |
| <a name="input_auto_minor_version_upgrade"></a> [auto\_minor\_version\_upgrade](#input\_auto\_minor\_version\_upgrade) | Indicates that minor engine upgrades will be applied automatically to the DB instance during the maintenance window. Default `true` | `bool` | `null` | no |
| <a name="input_autoscaling_enabled"></a> [autoscaling\_enabled](#input\_autoscaling\_enabled) | Determines whether autoscaling of the cluster read replicas is enabled | `bool` | `false` | no |
Expand All @@ -293,7 +289,7 @@ No modules.
| <a name="input_create_cluster"></a> [create\_cluster](#input\_create\_cluster) | Whether cluster should be created (affects nearly all resources) | `bool` | `true` | no |
| <a name="input_create_db_cluster_parameter_group"></a> [create\_db\_cluster\_parameter\_group](#input\_create\_db\_cluster\_parameter\_group) | Determines whether a cluster parameter should be created or use existing | `bool` | `false` | no |
| <a name="input_create_db_parameter_group"></a> [create\_db\_parameter\_group](#input\_create\_db\_parameter\_group) | Determines whether a DB parameter should be created or use existing | `bool` | `false` | no |
| <a name="input_create_db_subnet_group"></a> [create\_db\_subnet\_group](#input\_create\_db\_subnet\_group) | Determines whether to create the database subnet group or use existing | `bool` | `true` | no |
| <a name="input_create_db_subnet_group"></a> [create\_db\_subnet\_group](#input\_create\_db\_subnet\_group) | Determines whether to create the database subnet group or use existing | `bool` | `false` | no |
| <a name="input_create_monitoring_role"></a> [create\_monitoring\_role](#input\_create\_monitoring\_role) | Determines whether to create the IAM role for RDS enhanced monitoring | `bool` | `true` | no |
| <a name="input_create_random_password"></a> [create\_random\_password](#input\_create\_random\_password) | Determines whether to create random password for RDS primary cluster | `bool` | `true` | no |
| <a name="input_create_security_group"></a> [create\_security\_group](#input\_create\_security\_group) | Determines whether to create security group for RDS cluster | `bool` | `true` | no |
Expand Down Expand Up @@ -359,8 +355,7 @@ No modules.
| <a name="input_s3_import"></a> [s3\_import](#input\_s3\_import) | Configuration map used to restore from a Percona Xtrabackup in S3 (only MySQL is supported) | `map(string)` | `{}` | no |
| <a name="input_scaling_configuration"></a> [scaling\_configuration](#input\_scaling\_configuration) | Map of nested attributes with scaling properties. Only valid when `engine_mode` is set to `serverless` | `map(string)` | `{}` | no |
| <a name="input_security_group_description"></a> [security\_group\_description](#input\_security\_group\_description) | The description of the security group. If value is set to empty string it will contain cluster name in the description | `string` | `null` | no |
| <a name="input_security_group_egress_rules"></a> [security\_group\_egress\_rules](#input\_security\_group\_egress\_rules) | A map of security group egress rule definitions to add to the security group created | `map(any)` | `{}` | no |
| <a name="input_security_group_tags"></a> [security\_group\_tags](#input\_security\_group\_tags) | Additional tags for the security group | `map(string)` | `{}` | no |
| <a name="input_security_group_rules"></a> [security\_group\_rules](#input\_security\_group\_rules) | Map of security group rules to add to the cluster security group created | `any` | `{}` | no |
| <a name="input_security_group_use_name_prefix"></a> [security\_group\_use\_name\_prefix](#input\_security\_group\_use\_name\_prefix) | Determines whether the security group name (`name`) is used as a prefix | `bool` | `true` | no |
| <a name="input_serverlessv2_scaling_configuration"></a> [serverlessv2\_scaling\_configuration](#input\_serverlessv2\_scaling\_configuration) | Map of nested attributes with serverless v2 scaling properties. Only valid when `engine_mode` is set to `provisioned` | `map(string)` | `{}` | no |
| <a name="input_skip_final_snapshot"></a> [skip\_final\_snapshot](#input\_skip\_final\_snapshot) | Determines whether a final snapshot is created before the cluster is deleted. If true is specified, no snapshot is created | `bool` | `false` | no |
Expand Down
9 changes: 2 additions & 7 deletions examples/autoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ Note that this example may create resources which cost money. Run `terraform des

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.30 |
No providers.

## Modules

Expand All @@ -38,10 +36,7 @@ Note that this example may create resources which cost money. Run `terraform des

## Resources

| Name | Type |
|------|------|
| [aws_db_parameter_group.example](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_parameter_group) | resource |
| [aws_rds_cluster_parameter_group.example](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_parameter_group) | resource |
No resources.

## Inputs

Expand Down
28 changes: 7 additions & 21 deletions examples/autoscaling/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ module "aurora" {
instance_class = "db.r6g.large"
instances = { 1 = {} }

vpc_id = module.vpc.vpc_id
db_subnet_group_name = module.vpc.database_subnet_group_name
create_db_subnet_group = false
create_security_group = true
allowed_cidr_blocks = module.vpc.private_subnets_cidr_blocks
vpc_id = module.vpc.vpc_id
db_subnet_group_name = module.vpc.database_subnet_group_name
security_group_rules = {
vpc_ingress = {
cidr_blocks = module.vpc.private_subnets_cidr_blocks
}
}

autoscaling_enabled = true
autoscaling_min_capacity = 1
Expand All @@ -46,27 +48,11 @@ module "aurora" {
apply_immediately = true
skip_final_snapshot = true

db_parameter_group_name = aws_db_parameter_group.example.id
db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.example.id
enabled_cloudwatch_logs_exports = ["postgresql"]

tags = local.tags
}

resource "aws_db_parameter_group" "example" {
name_prefix = "${local.name}-aurora-db-postgres11-parameter-group"
family = "aurora-postgresql11"
description = "${local.name}-aurora-db-postgres11-parameter-group"
tags = local.tags
}

resource "aws_rds_cluster_parameter_group" "example" {
name_prefix = "${local.name}-aurora-postgres11-cluster-parameter-group"
family = "aurora-postgresql11"
description = "${local.name}-aurora-postgres11-cluster-parameter-group"
tags = local.tags
}

module "disabled_aurora" {
source = "../../"

Expand Down
16 changes: 6 additions & 10 deletions examples/global-cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ module "aurora_primary" {
instances = { for i in range(2) : i => {} }
kms_key_id = aws_kms_key.primary.arn

vpc_id = module.primary_vpc.vpc_id
db_subnet_group_name = module.primary_vpc.database_subnet_group_name
create_db_subnet_group = false
create_security_group = true
allowed_cidr_blocks = module.primary_vpc.private_subnets_cidr_blocks
vpc_id = module.primary_vpc.vpc_id
db_subnet_group_name = module.primary_vpc.database_subnet_group_name
allowed_cidr_blocks = module.primary_vpc.private_subnets_cidr_blocks

skip_final_snapshot = true

Expand All @@ -79,11 +77,9 @@ module "aurora_secondary" {
instances = { for i in range(2) : i => {} }
kms_key_id = aws_kms_key.secondary.arn

vpc_id = module.secondary_vpc.vpc_id
db_subnet_group_name = module.secondary_vpc.database_subnet_group_name
create_db_subnet_group = false
create_security_group = true
allowed_cidr_blocks = module.secondary_vpc.private_subnets_cidr_blocks
vpc_id = module.secondary_vpc.vpc_id
db_subnet_group_name = module.secondary_vpc.database_subnet_group_name
allowed_cidr_blocks = module.secondary_vpc.private_subnets_cidr_blocks

skip_final_snapshot = true

Expand Down
7 changes: 3 additions & 4 deletions examples/multi-az/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ module "aurora" {
engine = "postgres" # This uses RDS, not Aurora
engine_version = "13.7"

vpc_id = module.vpc.vpc_id
subnets = module.vpc.private_subnets
vpc_id = module.vpc.vpc_id
db_subnet_group_name = module.vpc.database_subnet_group_name

create_db_cluster_parameter_group = true
db_cluster_parameter_group_family = "postgres13"
Expand Down Expand Up @@ -60,8 +60,7 @@ module "vpc" {
private_subnets = ["10.99.3.0/24", "10.99.4.0/24", "10.99.5.0/24"]
database_subnets = ["10.99.7.0/24", "10.99.8.0/24", "10.99.9.0/24"]

create_database_subnet_group = false
enable_nat_gateway = false # Disabled NAT to be able to run this example quicker
enable_nat_gateway = false # Disabled NAT to be able to run this example quicker

tags = local.tags
}
12 changes: 7 additions & 5 deletions examples/mysql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,13 @@ module "aurora" {
}
}

vpc_id = module.vpc.vpc_id
db_subnet_group_name = module.vpc.database_subnet_group_name
create_db_subnet_group = false
create_security_group = true
allowed_cidr_blocks = module.vpc.private_subnets_cidr_blocks
vpc_id = module.vpc.vpc_id
db_subnet_group_name = module.vpc.database_subnet_group_name
security_group_rules = {
vpc_ingress = {
cidr_blocks = module.vpc.private_subnets_cidr_blocks
}
}

iam_database_authentication_enabled = true
master_password = random_password.master.result
Expand Down
14 changes: 7 additions & 7 deletions examples/postgresql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ module "aurora" {
}
}

vpc_id = module.vpc.vpc_id
db_subnet_group_name = module.vpc.database_subnet_group_name
create_db_subnet_group = false
create_security_group = true
allowed_cidr_blocks = module.vpc.private_subnets_cidr_blocks
security_group_egress_rules = {
to_cidrs = {
vpc_id = module.vpc.vpc_id
db_subnet_group_name = module.vpc.database_subnet_group_name
security_group_rules = {
vpc_ingress = {
cidr_blocks = module.vpc.private_subnets_cidr_blocks
}
egress_example = {
cidr_blocks = ["10.33.0.0/28"]
description = "Egress to corporate printer closet"
}
Expand Down
2 changes: 0 additions & 2 deletions examples/s3-import/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,8 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Type |
|------|------|
| [aws_db_parameter_group.example](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_parameter_group) | resource |
| [aws_iam_role.s3_import](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role) | resource |
| [aws_iam_role_policy.s3_import](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_role_policy) | resource |
| [aws_rds_cluster_parameter_group.example](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_parameter_group) | resource |
| [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource |
| [aws_iam_policy_document.s3_import](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
| [aws_iam_policy_document.s3_import_assume](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
Expand Down
28 changes: 7 additions & 21 deletions examples/s3-import/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ module "aurora" {
instance_class = "db.r5.large"
instances = { 1 = {} }

vpc_id = module.vpc.vpc_id
db_subnet_group_name = module.vpc.database_subnet_group_name
create_db_subnet_group = false
create_security_group = true
allowed_cidr_blocks = module.vpc.private_subnets_cidr_blocks
vpc_id = module.vpc.vpc_id
db_subnet_group_name = module.vpc.database_subnet_group_name
security_group_rules = {
vpc_ingress = {
cidr_blocks = module.vpc.private_subnets_cidr_blocks
}
}

iam_roles = {
s3_import = {
Expand All @@ -48,27 +50,11 @@ module "aurora" {

skip_final_snapshot = true

db_parameter_group_name = aws_db_parameter_group.example.id
db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.example.id
enabled_cloudwatch_logs_exports = ["audit", "error", "general", "slowquery"]

tags = local.tags
}

resource "aws_db_parameter_group" "example" {
name = "${local.name}-aurora-db-57-parameter-group"
family = "aurora-mysql5.7"
description = "${local.name}-aurora-db-57-parameter-group"
tags = local.tags
}

resource "aws_rds_cluster_parameter_group" "example" {
name = "${local.name}-aurora-57-cluster-parameter-group"
family = "aurora-mysql5.7"
description = "${local.name}-aurora-57-cluster-parameter-group"
tags = local.tags
}

################################################################################
# Supporting Resources
################################################################################
Expand Down
8 changes: 0 additions & 8 deletions examples/serverless/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,6 @@ Note that this example may create resources which cost money. Run `terraform des

| Name | Type |
|------|------|
| [aws_db_parameter_group.example_mysql](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_parameter_group) | resource |
| [aws_db_parameter_group.example_mysql8](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_parameter_group) | resource |
| [aws_db_parameter_group.example_postgresql](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_parameter_group) | resource |
| [aws_db_parameter_group.example_postgresql13](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_parameter_group) | resource |
| [aws_rds_cluster_parameter_group.example_mysql](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_parameter_group) | resource |
| [aws_rds_cluster_parameter_group.example_mysql8](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_parameter_group) | resource |
| [aws_rds_cluster_parameter_group.example_postgresql](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_parameter_group) | resource |
| [aws_rds_cluster_parameter_group.example_postgresql13](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster_parameter_group) | resource |
| [aws_rds_engine_version.postgresql](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/rds_engine_version) | data source |

## Inputs
Expand Down
Loading

0 comments on commit bd85174

Please sign in to comment.