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

Terraform Version, subnet_ids Not Recognized #20

Open
joswr1ght opened this issue May 2, 2021 · 1 comment
Open

Terraform Version, subnet_ids Not Recognized #20

joswr1ght opened this issue May 2, 2021 · 1 comment

Comments

@joswr1ght
Copy link

joswr1ght commented May 2, 2021

I'm unable to get the sadcloud scripts to deploy following an error in the Cloud Trail module.

(aws) sadcloud (master) $ terraform -version
Terraform v0.15.1
on darwin_amd64
(aws) sadcloud (master) $ git log -1
commit b3de799d960c51503558af749ed41f44efd7d359 (HEAD -> master, origin/master, origin/HEAD)
Author: Rami McCarthy <[email protected]>
Date:   Tue Jun 30 16:14:33 2020 -0400

    Update README.md
(aws) sadcloud (master) $ terraform apply

... some time later:

│ Error: Error launching source instance: VPCResourceNotSpecified: The specified instance type can only be used in a VPC. A subnet ID or network interface ID is required to carry out the request.
│ 	status code: 400, request id: 2f47199d-6ed6-42ce-99e0-aa7982a5df6e
│
│   with module.ec2.aws_instance.main[0],
│   on ../modules/aws/ec2/main.tf line 18, in resource "aws_instance" "main":
│   18: resource "aws_instance" "main" {

Here is the context of the main.tf file:

(aws) sadcloud (master) $ cat -n ../modules/aws/ec2/main.tf | sed -n 17,23p
    17
    18	resource "aws_instance" "main" {
    19	  ami           = data.aws_ami.ubuntu.id
    20	  instance_type = var.disallowed_instance_type ? "t2.micro" : "t2.small"
    21	  subnet_id     = var.main_subnet_id
    22	  count         = var.disallowed_instance_type || var.instance_with_user_data_secrets || var.instance_with_public_ip ? 1 : 0
    23

I'm new to Terraform, and I'm not sure how to respond to this error. When I tried to build I get an error about the use of list() as deprecated, so I converted them to tolist() per the new API use. I've attached my diff, though it doesn't seem to be related to anything for subnets or network IDs. Any ideas? Thanks!

@joswr1ght
Copy link
Author

tolist.diff.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant