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

aws_db_instance - instance always created in default VPC #294

Closed
wilb opened this issue Sep 15, 2014 · 4 comments
Closed

aws_db_instance - instance always created in default VPC #294

wilb opened this issue Sep 15, 2014 · 4 comments

Comments

@wilb
Copy link

wilb commented Sep 15, 2014

Hi there,

I'm trying to provision an RDS instance within a VPC I've created within my terraform, however I don't seem to be able to do so - the instance gets created in my default AWS VPC and I get the error:

"aws_db_instance.XX-XX: Error: Error creating DB Instance: InvalidParameterCombination: DB Instance is in vpc-d7XXXXXX, but Ec2 Security Group sg-a9XXXXXX is in vpc-d5XXXXXX"

My test config is as follows:

resource "aws_db_instance" "XXXXXXXX" {
identifier = "XXXXXXXX"
engine = "mysql"
engine_version = "5.5.38"
instance_class = "db.m1.small"
multi_az = true
allocated_storage = "50"
name = "XXXXXXXX"
username = "root"
password = "XXXXXXXX"
vpc_security_group_ids = [ "${aws_security_group.XXXXXXXX.id}" ]
backup_retention_period = 7
}

I envisaged that by specifying "vpc_security_group_ids" to match a security group within the VPC that would dictate where the instance was created, but this doesn't appear to be the case.

The VPC in question is created succesfully and I'm creating EC2 resources in it without issue. Currently using terraform 0.2.2, not tested with a master build yet.

@wilb
Copy link
Author

wilb commented Sep 15, 2014

Is this due to a lack of DB subnet groups being created for the VPC? I don't see a way to manually enforce the creation of these when defining a VPC or subnet.

I have just reapplied my config without the RDS step in place and gone through the creation process via the AWS web console - it looks like I manually need to create a DB subnet group before I can proceed with the RDS creation in that VPC... so I've tried manually creating the subnet group, re-enabled the RDS part of my config and tried to reapply but again I get the same error message.

Am I just trying to do something that isn't yet supported?

@buth
Copy link
Contributor

buth commented Sep 15, 2014

Subnet groups have not been supported in a released version yet; added them in pull request #295.

@wilb
Copy link
Author

wilb commented Sep 16, 2014

Aah cool, I'll build it and give it a go. Thanks.

@wilb
Copy link
Author

wilb commented Sep 16, 2014

Awesome - working exactly as expected. I'll not close the bug as obviously its an issue until your PR is merged.

Thanks 👍

@wilb wilb closed this as completed Sep 16, 2014
@ghost ghost locked and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants