diff --git a/terraform-modules/aws/postgres/README.md b/terraform-modules/aws/postgres/README.md index fe8e5a889..0aef94519 100644 --- a/terraform-modules/aws/postgres/README.md +++ b/terraform-modules/aws/postgres/README.md @@ -35,11 +35,13 @@ No resources. | [name](#input\_name) | The DB name to create. If omitted, no database is created initially | `string` | `null` | no | | [parameters](#input\_parameters) | A list of DB parameters (map) to apply | `list(map(string))` |
[| no | | [password](#input\_password) | Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file | `string` | `null` | no | +| [private\_subnets](#input\_private\_subnets) | A list of private subnets | `list(any)` | n/a | yes | | [storage\_encrypted](#input\_storage\_encrypted) | Specifies whether the DB instance is encrypted | `bool` | `true` | no | | [storage\_type](#input\_storage\_type) | One of 'standard' (magnetic), 'gp2' (general purpose SSD), or 'io1' (provisioned IOPS SSD). The default is 'io1' if iops is specified, 'gp2' if not. | `string` | `"gp2"` | no | | [tags](#input\_tags) | n/a | `map(any)` |
{
"name": "autovacuum",
"value": 1
},
{
"name": "client_encoding",
"value": "utf8"
}
]
{| no | | [username](#input\_username) | Username for the master DB user | `string` | `null` | no | -| [vpc](#input\_vpc) | VPC where the rds and security group will be created | `any` | n/a | yes | +| [vpc\_cidr\_block](#input\_vpc\_cidr\_block) | The CIDR block of the VPC | `any` | n/a | yes | +| [vpc\_id](#input\_vpc\_id) | The ID of the VPC | `any` | n/a | yes | ## Outputs diff --git a/terraform-modules/aws/postgres/main.tf b/terraform-modules/aws/postgres/main.tf index ec9988fae..5b0d67738 100644 --- a/terraform-modules/aws/postgres/main.tf +++ b/terraform-modules/aws/postgres/main.tf @@ -4,7 +4,7 @@ module "security_group" { name = "${var.identifier}-${var.name}" description = "PostgreSQL security group" - vpc_id = var.vpc.outputs.vpc_id + vpc_id = var.vpc_id # ingress ingress_with_cidr_blocks = [ @@ -14,7 +14,7 @@ module "security_group" { protocol = "tcp" description = "PostgreSQL access from within VPC" - cidr_blocks = var.vpc.outputs.vpc_cidr_block + cidr_blocks = var.vpc_cidr_block }, ] @@ -47,7 +47,7 @@ module "db" { port = 5432 multi_az = true - subnet_ids = var.vpc.outputs.private_subnets + subnet_ids = var.private_subnets vpc_security_group_ids = [module.security_group.security_group_id] maintenance_window = var.maintenance_window diff --git a/terraform-modules/aws/postgres/variables.tf b/terraform-modules/aws/postgres/variables.tf index ca8bc4b5e..33399c42c 100644 --- a/terraform-modules/aws/postgres/variables.tf +++ b/terraform-modules/aws/postgres/variables.tf @@ -1,6 +1,16 @@ -variable "vpc" { - description = "VPC where the rds and security group will be created" +variable "vpc_id" { + description = "The ID of the VPC" } + +variable "vpc_cidr_block" { + description = "The CIDR block of the VPC" +} + +variable "private_subnets" { + description = "A list of private subnets" + type = list(any) +} + variable "identifier" { description = "The name of the RDS instance, if omitted, Terraform will assign a random, unique identifier" type = string diff --git a/terraform-modules/aws/vpc/main.tf b/terraform-modules/aws/vpc/main.tf index 69f21de0d..24862b4da 100644 --- a/terraform-modules/aws/vpc/main.tf +++ b/terraform-modules/aws/vpc/main.tf @@ -17,12 +17,12 @@ module "vpc" { public_subnet_tags = { "kubernetes.io/cluster/${var.cluster_name}" = "shared" - "kubernetes.io/role/elb" = "1" + "kubernetes.io/role/elb" = "1" } private_subnet_tags = { "kubernetes.io/cluster/${var.cluster_name}" = "shared" - "kubernetes.io/role/internal-elb" = "1" + "kubernetes.io/role/internal-elb" = "1" } tags = var.tags
"ops_env": "staging",
"ops_managed_by": "terraform",
"ops_owners": "devops",
"ops_source_repo": "kubernetes-ops",
"ops_source_repo_path": "terraform-module/aws/postgres"
}