-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
I’m encountering Unsupported argument
errors for cpu_core_count
and cpu_threads_per_core
when using module version 5.8.0 with AWS Provider 5.100.0. This setup has worked in the past, but now fails during terraform plan
.
This appears to be related to older module versions passing CPU arguments unconditionally, even though they're no longer supported in AWS Provider v5.x. I found a similar issue in the repo that was previously closed without a resolution — I'm reopening the problem here, as it's still valid and blocking for users who can't yet upgrade to provider v6.
✋ I have searched the open/closed issues and my issue there is one issue but not resolved.
⚠️ Note
I have already tried the following:
- Removed
.terraform/
- Re-initialized with
terraform init
- Re-ran
terraform plan
Problem persists.
Versions
-
Module version: 5.8.0
-
Terraform version:
Terraform v1.5.7
-
Provider version(s):
provider registry.terraform.io/hashicorp/aws v5.100.0
Reproduction Code [Required]
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.100.0"
}
}
}
provider "aws" {
region = "us-west-2"
}
data "aws_ami" "worker_amazon_linux" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = ["amzn2-ami-hvm-*-x86_64-gp2"]
}
}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "4.0.2"
# ...
}
resource "aws_iam_instance_profile" "ec2_worker_instance_profile" {
# ...
}
resource "aws_security_group" "worker_sg" {
# ...
}
resource "aws_key_pair" "ec2_worker_key" {
# ...
}
module "ec2-instance_worker" {
source = "terraform-aws-modules/ec2-instance/aws"
version = "5.8.0"
name = "example-worker"
ami = data.aws_ami.worker_amazon_linux.id
instance_type = "t3.medium"
subnet_id = module.vpc.private_subnets[0]
associate_public_ip_address = false
iam_instance_profile = aws_iam_instance_profile.ec2_worker_instance_profile.name
vpc_security_group_ids = [aws_security_group.worker_sg.id]
key_name = aws_key_pair.ec2_worker_key.key_name
user_data = ""
user_data_replace_on_change = false
metadata_options = {
http_endpoint = "enabled"
http_put_response_hop_limit = 1
http_tokens = "required"
}
enable_volume_tags = true
tags = {
Name = "example-worker"
}
ignore_ami_changes = true
}
Run:
terraform init
terraform plan
Expected behavior
Terraform plan should complete successfully, without errors for invalid or deprecated arguments.
Actual behavior
Terraform fails with:
Error: Unsupported argument
on .terraform/modules/ec2-instance_worker/main.tf line 205, in resource "aws_instance" "ignore_ami":
cpu_threads_per_core = var.cpu_threads_per_core
An argument named "cpu_threads_per_core" is not expected here.
Error: Unsupported argument
on .terraform/modules/ec2-instance_worker/main.tf line 204, in resource "aws_instance" "ignore_ami":
cpu_core_count = var.cpu_core_count
An argument named "cpu_core_count" is not expected here.
...
Additional context
- Upgrading to module v6.0.2 or AWS Provider v6.x resolves the issue since the module removed these arguments.
- Unfortunately, I’m not ready to move to AWS Provider v6 yet.
- This is a blocker since module versions before 6.0.0 are not compatible with AWS Provider 5.x without throwing errors due to these now-invalid arguments.
Please consider making a patch release for the 5.x module line that conditionally includes cpu_*
arguments only if defined, or clarifying compatibility in the documentation.