Search code examples
emraws-cloudformationterraform

Can we add\attach security group to Terraform aws_cloudformation_stack resource


I am using Terraform to provision emr . In order to do so i am calling resource "aws_cloudformation_stack" and then attaching cloudformation template to launch an EMR. its working now i want my EMR to have 22 inbound port open for ssh connection.

please see reference https://www.terraform.io/docs/providers/aws/r/cloudformation_stack.html

i can do this by attaching a security group . could somebody please let me know how can i do this?


Solution

  • You should probably be able to handle this by creating the security group via Terraform, referencing it as a dependency to make sure it's created before the cloudformation stack and then providing the security group ID to the cloudformation template as a variable.