rancher / quickstart

380 stars 335 forks source link

security_groups = [aws_security_group.rancher_sg_allowall.name] Error #147

Closed dotancohen81 closed 2 years ago

dotancohen81 commented 3 years ago

need to change to:

security_groups = [aws_security_group.rancher_sg_allowall.id]

see here: https://github.com/hashicorp/terraform/issues/575

bashofmann commented 3 years ago

What is the error you are seeing? From the issue you referenced it seems, that the security group should be referenced by name, which is exactly what the module is doing.

I also just tested it, and it works great for me.

Giglium commented 3 years ago

I've encountered the same error today and I've resolved the error reference the security group by id, as @dotancohen81 suggested.

Full error log:

$ terraform apply --auto-approve
tls_private_key.global_key: Creating...
tls_private_key.global_key: Creation complete after 0s [id=xxx]
local_file.ssh_public_key_openssh: Creating...
local_file.ssh_public_key_openssh: Creation complete after 0s [id=xxx]
local_file.ssh_private_key_pem: Creating...
local_file.ssh_private_key_pem: Creation complete after 0s [id=xxx]
aws_key_pair.quickstart_key_pair: Creating...
aws_security_group.rancher_sg_allowall: Creating...
aws_key_pair.quickstart_key_pair: Creation complete after 1s [id=rancher-xxx]
aws_security_group.rancher_sg_allowall: Creation complete after 2s [id=sg-xxx]
aws_instance.rancher_server: Creating...

Error: Error launching source instance: InvalidGroup.NotFound: The security group 'rancher-allowall' does not exist in VPC xxx status code: 400, request id: xxx

Maybe this error it's relates to the fact that I do not have a default VPC on my AWS account. As a workaround to this, I hardcoded the vpc_id on aws_security_group resource and the subnet_id on aws_instance resources.

@bashofmann I hope this information will maybe be helpful to figure out the problem.

Environment information Windows 10 Terraform 0.14.4 Using rancher quickstart commit d9e3e57 (latest)

bashofmann commented 2 years ago

This is only an issue, if you do not use/have a default VPC. Adapting this module to use other VPCs is tracked in https://github.com/rancher/quickstart/issues/126.