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 "argument not expected" errors when deploying to ECS #726

Open
simonwhitaker opened this issue Jan 22, 2025 · 4 comments
Open

Comments

@simonwhitaker
Copy link

simonwhitaker commented Jan 22, 2025

I authenticated with AWS, then did:

cd deploy/terraform/ecs/default/
terraform init
terraform plan

But I get an error. Actually, each time I run terraform plan I get one of two error messages. Sometimes I get this:

$ terraform plan
╷
│ Error: Unsupported argument
│
│   on main.tf line 23, in module "dependencies":
│   23:   availability_zones = module.vpc.inner.azs
│
│ An argument named "availability_zones" is not expected here.
╵

Other times I get this:

$ terraform plan
╷
│ Error: Unsupported argument
│
│   on ../../lib/ecs/carts.tf line 8, in module "carts_service":
│    8:   vpc_cidr                        = var.vpc_cidr
│
│ An argument named "vpc_cidr" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│   on ../../lib/ecs/carts.tf line 10, in module "carts_service":
│   10:   public_subnet_ids               = var.public_subnet_ids
│
│ An argument named "public_subnet_ids" is not expected here.
╵

Environment info:

$ git rev-parse HEAD
adc57547da91f96e98fa5ab8df484474e72d09dc
$ terraform version
Terraform v1.10.4
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.84.0
+ provider registry.terraform.io/hashicorp/random v3.6.3
$ uname -a
Darwin Simons-Laptop.local 24.2.0 Darwin Kernel Version 24.2.0: Fri Dec  6 19:02:41 PST 2024; root:xnu-11215.61.5~2/RELEASE_ARM64_T6030 arm64

My AWS config looks like this:

[profile ecommerce-demo]
sso_session = sso
sso_account_id = XXXXXXXXXX
sso_role_name = AWSAdministratorAccess
# region = us-east-1
region = eu-west-1
output = json

(Flipping region from eu-west-1 to us-east-1 has no effect, I get the same errors.)

@simonwhitaker
Copy link
Author

The errors in carts.tf appear to be related to https://github.com/aws-containers/retail-store-sample-app/pull/715/files#diff-57a66f27235315a63b4e23ceda18c4b208ed4db1b2aee9e6fc552f7387514397, where those variables were removed from deploy/terraform/lib/ecs/service/variables.tf.

@simonwhitaker
Copy link
Author

simonwhitaker commented Jan 22, 2025

Actually the availability_zones variable was removed in the same PR.

@niallthomson Would removing the remaining references to those three variables be the right way to fix this?

@simonwhitaker
Copy link
Author

(Sitting in an airport right now. I'll test this and submit a PR when I'm back at my desk.)

@niallthomson
Copy link
Collaborator

Hey @simonwhitaker I noticed this myself while I was fixing up a bunch of stuff. I have a fix in a branch but its with a bunch of other changes right now.

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

2 participants