-
-
Notifications
You must be signed in to change notification settings - Fork 46
Description
Description
AWS Batch job definition creation fails with multiple "Unsupported attribute" errors when using EKS properties. The module incorrectly accesses attributes from eks_properties.value.pod_properties when they should be accessed directly from eks_properties.value.
⚠️ Note
Before you submit an issue, please perform the following first:
- Remove the local
.terraformdirectory (! ONLY if state is stored remotely, which hopefully you are following that best practice!):rm -rf .terraform/ - Re-initialize the project root to pull down modules:
terraform init - Re-attempt your terraform plan or apply and check if the issue still persists
Versions
- Module version [Required]: Latest
- Terraform version: 1.5.0+
- Provider version(s): AWS provider 5.0+
Reproduction Code [Required]
Steps to reproduce the behavior:
- Create a job definition with EKS properties
- Include attributes like
dns_policy,host_network,image_pull_secrets, etc. - Run
terraform planorterraform apply
Example configuration:
}
}
dns_policy = "ClusterFirst"
host_network = true
metadata = {
labels = {
environment = "test"
}
}
}
}
}Expected behavior
A job definition should be created successfully, and all EKS pod properties should be available in the AWS Console under "Pod Properties".
Actual behavior
Terraform fails with errors like:
│ Error: Unsupported attribute
│
│ on .../main.tf line 455, in resource "aws_batch_job_definition" "this":
│ 455: dns_policy = eks_properties.value.pod_properties.dns_policy
│ ├────────────────
│ │ eks_properties.value.pod_properties is object with 1 attribute "containers"
│
│ This object does not have an attribute named "dns_policy".
and similar errors for other attributes (host_network, image_pull_secrets, etc).
Terminal Output Screenshot(s)
Additional context
Root Cause
According to the module's variables.tf, only containers should be inside pod_properties. All other EKS properties (like dns_policy, host_network, image_pull_secrets, init_containers, metadata, service_account_name, share_process_namespace, volumes) should be accessed directly from eks_properties.value.
Required Fixes in main.tf
Example of required changes:
# Before
dns_policy = eks_properties.value.pod_properties.dns_policy
host_network = eks_properties.value.pod_properties.host_network
# After
dns_policy = eks_properties.value.dns_policy
host_network = eks_properties.value.host_networkAnd similarly for all other attributes.