1

Is there a way I can associate existing security group to RDS that is going to be created or the only way is to recreate the security group so it can be added to the state file?

0

You can retrieve security group from data source

variable "security_group_id" {}

data "aws_security_group" "selected" {
  id = "${var.security_group_id}"
}
0

I didn't use list square brackets, the functionality is there as documented, just list brackets and group id. e.g.: vpc_security_group_ids = [ "sg-dfe8e2bf" ]

0

You can use the terraform import command to import the security group so you can reference it as a created Terraform resource.

https://www.terraform.io/docs/providers/aws/r/security_group.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.