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

Unable to run terraform plan or apply with files from this git #53

Closed
evolart opened this issue Jan 6, 2022 · 14 comments · Fixed by #54 or #57
Closed

Unable to run terraform plan or apply with files from this git #53

evolart opened this issue Jan 6, 2022 · 14 comments · Fixed by #54 or #57

Comments

@evolart
Copy link

evolart commented Jan 6, 2022

I am getting the following errors when trying to run terraform plan or terraform apply. I did some digging in the terraform documentation for the terraform-aws-modules/eks/aws module and it looks like subnets, workers_group_defaults, and worker_groups all are not options anymore?

Errors when running plan or apply:

│ Error: Unsupported argument
│
│   on eks-cluster.tf line 5, in module "eks":
│    5:   subnets         = module.vpc.private_subnets
│
│ An argument named "subnets" is not expected here.

│ Error: Unsupported argument
│
│   on eks-cluster.tf line 15, in module "eks":
│   15:   workers_group_defaults = {
│
│ An argument named "workers_group_defaults" is not expected here.

│ Error: Unsupported argument
│
│   on eks-cluster.tf line 19, in module "eks":
│   19:   worker_groups = [
│
│ An argument named "worker_groups" is not expected here.
@jonathanmeier5
Copy link

jonathanmeier5 commented Jan 6, 2022

Same issue this morning.

To add a bit more color:

Initially, terraform init failed with:

Initializing provider plugins...
- Reusing previous version of hashicorp/aws from the dependency lock file
- Reusing previous version of hashicorp/random from the dependency lock file
- Reusing previous version of hashicorp/local from the dependency lock file
- Finding hashicorp/tls versions matching ">= 2.2.0"...
- Reusing previous version of hashicorp/cloudinit from the dependency lock file
- Reusing previous version of hashicorp/null from the dependency lock file
- Reusing previous version of hashicorp/kubernetes from the dependency lock file
- Installing hashicorp/cloudinit v2.2.0...
- Installed hashicorp/cloudinit v2.2.0 (signed by HashiCorp)
- Installing hashicorp/null v3.1.0...
- Installed hashicorp/null v3.1.0 (signed by HashiCorp)
- Installing hashicorp/kubernetes v2.6.1...
- Installed hashicorp/kubernetes v2.6.1 (signed by HashiCorp)
- Installing hashicorp/random v3.1.0...
- Installed hashicorp/random v3.1.0 (signed by HashiCorp)
- Installing hashicorp/local v2.1.0...
- Installed hashicorp/local v2.1.0 (signed by HashiCorp)
- Installing hashicorp/tls v3.1.0...
- Installed hashicorp/tls v3.1.0 (signed by HashiCorp)
╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/aws: locked
│ provider registry.terraform.io/hashicorp/aws 3.63.0 does not match configured version
│ constraint >= 3.15.0, >= 3.20.0, >= 3.64.0; must use terraform init -upgrade to allow
│ selection of new versions

So I deleted the lock file.

After deleting the lock file terraform init worked fine.

Generated lock file here.

Then I get the same error as above.

And here's the version info:

terraform --version
Terraform v1.1.2
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v3.70.0
+ provider registry.terraform.io/hashicorp/cloudinit v2.2.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.7.1
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/tls v3.1.0

@im2nguyen
Copy link
Collaborator

👋 Hello! Thanks for submitting this issue. I've reran terraform init -upgrade to resolve this issue.

Can you test it out? Thank you!

@jabadia
Copy link

jabadia commented Jan 6, 2022

I'm still having the same issue:

With a fresh clone of the repo (latest commit = a0d30b0):

$ terraform init
Initializing modules...
Downloading registry.terraform.io/terraform-aws-modules/eks/aws 18.0.1 for eks...
- eks in .terraform/modules/eks
- eks.eks_managed_node_group in .terraform/modules/eks/modules/eks-managed-node-group
- eks.eks_managed_node_group.user_data in .terraform/modules/eks/modules/_user_data
- eks.fargate_profile in .terraform/modules/eks/modules/fargate-profile
- eks.self_managed_node_group in .terraform/modules/eks/modules/self-managed-node-group
- eks.self_managed_node_group.user_data in .terraform/modules/eks/modules/_user_data
Downloading registry.terraform.io/terraform-aws-modules/vpc/aws 3.2.0 for vpc...
- vpc in .terraform/modules/vpc

Initializing the backend...

Initializing provider plugins...
- Reusing previous version of hashicorp/null from the dependency lock file
- Reusing previous version of hashicorp/kubernetes from the dependency lock file
- Reusing previous version of hashicorp/aws from the dependency lock file
- Reusing previous version of hashicorp/random from the dependency lock file
- Reusing previous version of hashicorp/local from the dependency lock file
- Reusing previous version of hashicorp/tls from the dependency lock file
- Reusing previous version of hashicorp/cloudinit from the dependency lock file
- Installing hashicorp/null v3.1.0...
- Installed hashicorp/null v3.1.0 (signed by HashiCorp)
- Installing hashicorp/kubernetes v2.7.1...
- Installed hashicorp/kubernetes v2.7.1 (signed by HashiCorp)
- Installing hashicorp/aws v3.70.0...
- Installed hashicorp/aws v3.70.0 (signed by HashiCorp)
- Installing hashicorp/random v3.1.0...
- Installed hashicorp/random v3.1.0 (signed by HashiCorp)
- Installing hashicorp/local v2.1.0...
- Installed hashicorp/local v2.1.0 (signed by HashiCorp)
- Installing hashicorp/tls v3.1.0...
- Installed hashicorp/tls v3.1.0 (signed by HashiCorp)
- Installing hashicorp/cloudinit v2.2.0...
- Installed hashicorp/cloudinit v2.2.0 (signed by HashiCorp)

Terraform has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
$ terraform plan
╷
│ Error: Required plugins are not installed
│
│ The installed provider plugins are not consistent with the packages selected in the dependency lock file:
│   - registry.terraform.io/hashicorp/template: there is no package for registry.terraform.io/hashicorp/template 2.2.0 cached in .terraform/providers
│   - registry.terraform.io/terraform-aws-modules/http: there is no package for registry.terraform.io/terraform-aws-modules/http 2.4.1 cached in .terraform/providers
│
│ Terraform uses external plugins to integrate with a variety of different infrastructure services. To download the plugins required for
│ this configuration, run:
│   terraform init
╵
$ terraform --version
Terraform v1.1.2
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v3.70.0
+ provider registry.terraform.io/hashicorp/cloudinit v2.2.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.7.1
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/template v2.2.0
+ provider registry.terraform.io/hashicorp/tls v3.1.0
+ provider registry.terraform.io/terraform-aws-modules/http v2.4.1

If I delete .terraform.lock.hcl and .terraform dir, and run terraform init again:

$ rm .terraform.lock.hcl
$ rm -rf .terraform
$ terraform init
Initializing modules...
Downloading registry.terraform.io/terraform-aws-modules/eks/aws 18.0.1 for eks...
- eks in .terraform/modules/eks
- eks.eks_managed_node_group in .terraform/modules/eks/modules/eks-managed-node-group
- eks.eks_managed_node_group.user_data in .terraform/modules/eks/modules/_user_data
- eks.fargate_profile in .terraform/modules/eks/modules/fargate-profile
- eks.self_managed_node_group in .terraform/modules/eks/modules/self-managed-node-group
- eks.self_managed_node_group.user_data in .terraform/modules/eks/modules/_user_data
Downloading registry.terraform.io/terraform-aws-modules/vpc/aws 3.2.0 for vpc...
- vpc in .terraform/modules/vpc

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/null versions matching "3.1.0"...
- Finding hashicorp/kubernetes versions matching ">= 2.0.1"...
- Finding hashicorp/aws versions matching ">= 3.15.0, >= 3.20.0, >= 3.64.0"...
- Finding hashicorp/tls versions matching ">= 2.2.0"...
- Finding hashicorp/cloudinit versions matching ">= 2.0.0"...
- Finding hashicorp/random versions matching "3.1.0"...
- Finding hashicorp/local versions matching "2.1.0"...
- Installing hashicorp/null v3.1.0...
- Installed hashicorp/null v3.1.0 (signed by HashiCorp)
- Installing hashicorp/kubernetes v2.7.1...
- Installed hashicorp/kubernetes v2.7.1 (signed by HashiCorp)
- Installing hashicorp/aws v3.70.0...
- Installed hashicorp/aws v3.70.0 (signed by HashiCorp)
- Installing hashicorp/tls v3.1.0...
- Installed hashicorp/tls v3.1.0 (signed by HashiCorp)
- Installing hashicorp/cloudinit v2.2.0...
- Installed hashicorp/cloudinit v2.2.0 (signed by HashiCorp)
- Installing hashicorp/random v3.1.0...
- Installed hashicorp/random v3.1.0 (signed by HashiCorp)
- Installing hashicorp/local v2.1.0...
- Installed hashicorp/local v2.1.0 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
$ terraform plan
╷
│ Error: Unsupported argument
│
│   on eks-cluster.tf line 5, in module "eks":
│    5:   subnets         = module.vpc.private_subnets
│
│ An argument named "subnets" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│   on eks-cluster.tf line 15, in module "eks":
│   15:   workers_group_defaults = {
│
│ An argument named "workers_group_defaults" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│   on eks-cluster.tf line 19, in module "eks":
│   19:   worker_groups = [
│
│ An argument named "worker_groups" is not expected here.
╵
$ terraform --version
Terraform v1.1.2
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v3.70.0
+ provider registry.terraform.io/hashicorp/cloudinit v2.2.0
+ provider registry.terraform.io/hashicorp/kubernetes v2.7.1
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/tls v3.1.0

@evolart
Copy link
Author

evolart commented Jan 6, 2022

👋 Hello! Thanks for submitting this issue. I've reran terraform init -upgrade to resolve this issue.

Can you test it out? Thank you!

@im2nguyen same issue as @jabadia reported above after clearing my files and pulling down your repo again. I end up with the following after the issues with the lock file are resolved.

╷
│ Error: Unsupported argument
│
│   on eks-cluster.tf line 5, in module "eks":
│    5:   subnets         = module.vpc.private_subnets
│
│ An argument named "subnets" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│   on eks-cluster.tf line 15, in module "eks":
│   15:   workers_group_defaults = {
│
│ An argument named "workers_group_defaults" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│   on eks-cluster.tf line 19, in module "eks":
│   19:   worker_groups = [
│
│ An argument named "worker_groups" is not expected here.

@jabadia
Copy link

jabadia commented Jan 6, 2022

I found a temporary workaround: fix the version of eks module. I guess version 18 recently released breaks this code.

module "eks" {
  source          = "terraform-aws-modules/eks/aws"
  version         = "17.24.0"
  ...

@jonathanmeier5
Copy link

👋 Hello! Thanks for submitting this issue. I've reran terraform init -upgrade to resolve this issue.

Can you test it out? Thank you!

@im2nguyen Thanks for the quick follow up, we really appreciate it!

I removed the repo locally and re-cloned. Running on your new main I am still encountering some issues.

First, when running terraform plan after terraform init I get this:

[0][~/Projects/terraform-toolkit/learn-terraform-provision-eks-cluster(main:a0d30b0)]
[meierj@Jonathans-MacBook-Pro-2]$ terraform plan
╷
│ Error: Required plugins are not installed
│
│ The installed provider plugins are not consistent with the packages selected in the
│ dependency lock file:
│   - registry.terraform.io/terraform-aws-modules/http: there is no package for registry.terraform.io/terraform-aws-modules/http 2.4.1 cached in .terraform/providers
│   - registry.terraform.io/hashicorp/template: there is no package for registry.terraform.io/hashicorp/template 2.2.0 cached in .terraform/providers
│
│ Terraform uses external plugins to integrate with a variety of different infrastructure
│ services. To download the plugins required for this configuration, run:
│   terraform init

If I run this it resolves the missing provider issue:

rm .terraform.lock.hcl
terraform init -upgrade

However, then I get the issue described by @evolart and @jabadia :

$ terraform plan
╷
│ Error: Unsupported argument
│
│   on eks-cluster.tf line 5, in module "eks":
│    5:   subnets         = module.vpc.private_subnets
│
│ An argument named "subnets" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│   on eks-cluster.tf line 15, in module "eks":
│   15:   workers_group_defaults = {
│
│ An argument named "workers_group_defaults" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│   on eks-cluster.tf line 19, in module "eks":
│   19:   worker_groups = [
│
│ An argument named "worker_groups" is not expected here.

@evolart
Copy link
Author

evolart commented Jan 6, 2022

I found a temporary workaround: fix the version of eks module. I guess version 18 recently released breaks this code.

module "eks" {
  source          = "terraform-aws-modules/eks/aws"
  version         = "17.24.0"
  ...

Confirm this does fix the issue for me. The recent flurry of updates to the EKS module seem to have broken a lot of examples out there including the one on A Cloud Guru's hands-on lab for EKS using Terraform.

@danvau7
Copy link

danvau7 commented Jan 6, 2022

I found a temporary workaround: fix the version of eks module. I guess version 18 recently released breaks this code.

module "eks" {
  source          = "terraform-aws-modules/eks/aws"
  version         = "17.24.0"
  ...

Confirm this does fix the issue for me. The recent flurry of updates to the EKS module seem to have broken a lot of examples out there including the one on A Cloud Guru's hands-on lab for EKS using Terraform.

Am having this exact issue now. This fixed one of the two errors I was getting, but one remains. The error is:

│ The installed provider plugins are not consistent with the packages selected in the dependency lock file:
│   - registry.terraform.io/hashicorp/template: there is no package for registry.terraform.io/hashicorp/template 2.2.0 cached in .terraform/providers

@danvau7
Copy link

danvau7 commented Jan 6, 2022

FOUND IT. Issue is the .terraform.lock.hcl, which is used for supply chain security, seems to be out of date. Currently looking for how to upgrade it, but for a quick fix just delete it for now.

@evolart
Copy link
Author

evolart commented Jan 6, 2022

FOUND IT. Issue is the .terraform.lock.hcl, which is used for supply chain security, seems to be out of date. Currently looking for how to upgrade it, but for a quick fix just delete it for now.

Correct I should have been more thorough in my last message. The full fix appears to be:

  1. Delete the .terraform.lock.hcl file.
  2. Delete the .terraform folder if you have already run terraform init before these troubleshooting steps.
  3. Update the eks-cluster.tf to specifically use version 17.24.0 as shown below before finally running your through the init, plan, apply steps.
module "eks" {
  source          = "terraform-aws-modules/eks/aws"
  version         = "17.24.0"

@jabadia
Copy link

jabadia commented Jan 6, 2022

I opened a new issue to give it more visibility.

@im2nguyen
Copy link
Collaborator

Currently working on it! Having trouble with getting the 18.0.4 module to work, but raised an issue (terraform-aws-modules/terraform-aws-eks#1750)

@im2nguyen
Copy link
Collaborator

Tested and merged! Please let me know if you're still experiencing the issue 😄

@saeedsafavi26
Copy link

I have the same problem with version = "19.15.3"
Error: Unsupported argument │ │ on eks-cluster.tf line 31, in module "eks": │ 31: worker_groups = [ An argument named "worker_groups" is not expected here.

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