-
- Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Description
Hi,
I created the VPC using this module and according to documentation create_database_subnet_group is enabled by default. Now when I try to create RDS and try to link to VPC it fails and gets create to the default VPC. The below how i achieve this
# NETWORKING # module "vpc" { source = "terraform-aws-modules/vpc/aws" version = "1.30.0" name = "my-vpc" cidr = "10.0.0.0/16" azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"] private_subnets = ["10.0.1.0/24", "10.0.2.0/24"] public_subnets = ["10.0.101.0/24", "10.0.102.0/24"] enable_nat_gateway = false create_database_subnet_group = true tags = { Terraform = "true" Environment = "dev" } } resource "aws_db_instance" "dev" { identifier = "dev" allocated_storage = 20 storage_type = "gp2" engine = "postgres" engine_version = "9.6.6" instance_class = "db.t2.micro" name = "app" username = "abc" password = "abc" parameter_group_name = "default.postgres9.6" backup_retention_period = 7 publicly_accessible = true skip_final_snapshot = true vpc_security_group_ids = ["${module.vpc.default_security_group_id}"] db_subnet_group_name = "${module.vpc.database_subnet_group}" tags { Terraform = "true" Environment = "dev" } } But I keep on getting this error Error creating DB Instance: InvalidParameterCombination: The DB instance and EC2 security group are in different VPCs
Any help is appreciated.
Thanks
Metadata
Metadata
Assignees
Labels
No labels