cloudposse / cloudposse/terraform-aws-codebuild
module file_system_locations dynamic block issue
- Dominant language
- HCL
- Stars
- 123
- Forks
- 130
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
When using the cloudposse/codebuild/aws module to create a CodeBuild project with EFS, the module dynamically generates the file_system_locations block incorrectly.
The dynamic block is currently defined as:
```
dynamic "file_system_locations" {
for_each = length(var.file_system_locations) > 0 ? [""] : []
content {
identifier = lookup(file_system_locations.value, "identifier", null)
location = lookup(file_system_locations.value, "location", null)
mount_options = lookup(file_system_locations.value, "mount_options", null)
mount_point = lookup(file_system_locations.value, "mount_point", null)
type = lookup(file_system_locations.value, "type", null)
}
}
```
This causes Terraform plan/apply failures when var.file_system_locations is non-empty, producing errors like:
`│ Invalid value for "inputMap" parameter: lookup() requires a map as the first argument.`
### Expected Behavior
Properly iterate over each map in the list using the dynamic "file_system_locations" block.
Populate the identifier, location, mount_point, mount_options, and type fields in the aws_codebuild_project resource without throwing errors.
Example of a potential working approach:
```
dynamic "file_system_locations" {
for_each = var.file_system_locations
content {
identifier = file_system_locations.value.identifier
location = file_system_locations.value.location
mount_point = file_system_locations.value.mount_point
mount_options = file_system_locations.value.mount_options
type = file_system_locations.value.type
}
}
```
### Steps to Reproduce
Use the cloudposse/codebuild/aws module.
Pass a non-empty list to file_system_locations:
file_system_locations = [
{
identifier = "efs-mnt"
location = "fs-0f084142226a99a4b.efs.eu-north-1.amazonaws.com:/"
mount_point = "/mnt/efs"
mount_options = "nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2"
type = "EFS"
}
]
### Screenshots
### Environment
OS: macOS 15.2
Terraform: 1.5.7
Module version: 2.0.2
### Additional Context
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.