When using provider functions terragrunt validate-inputs fails with the following error:
Invalid 'for' expression: Extra characters after the end of the 'for' expression. (and 1 other messages)
offending line is:
condition = var.subnet.enable_ipv6 == false || anytrue([ for prefix in self.address_prefixes: provider::assert::cidrv6(prefix) ])
Log Output
09:38:27.973 INFO Downloading Terraform configurations from file://../../../../../source into ./.terragrunt-cache/GH_-yqcqatzOk6TOWWxlk8evAns/Zl8COh10InqCrREuxj5EItMHqpM
09:38:27.978 DEBUG Copying files from . into ./.terragrunt-cache/GH_-yqcqatzOk6TOWWxlk8evAns/Zl8COh10InqCrREuxj5EItMHqpM/components/dns
09:38:27.979 DEBUG Setting working directory to ./.terragrunt-cache/GH_-yqcqatzOk6TOWWxlk8evAns/Zl8COh10InqCrREuxj5EItMHqpM/components/dns
09:38:27.979 DEBUG The file path ./.terragrunt-cache/GH_-yqcqatzOk6TOWWxlk8evAns/Zl8COh10InqCrREuxj5EItMHqpM/components/dns/provider.tf already exists, but was a previously generated file by terragrunt. Since if_exists for code generation is set to "overwrite_terragrunt", regenerating file.
09:38:27.979 DEBUG Generated file ./.terragrunt-cache/GH_-yqcqatzOk6TOWWxlk8evAns/Zl8COh10InqCrREuxj5EItMHqpM/components/dns/provider.tf.
09:38:27.980 DEBUG The file path ./.terragrunt-cache/GH_-yqcqatzOk6TOWWxlk8evAns/Zl8COh10InqCrREuxj5EItMHqpM/components/dns/remotestate.tf already exists, but was a previously generated file by terragrunt. Since if_exists for code generation is set to "overwrite_terragrunt", regenerating file.
09:38:27.980 DEBUG Generated file ./.terragrunt-cache/GH_-yqcqatzOk6TOWWxlk8evAns/Zl8COh10InqCrREuxj5EItMHqpM/components/dns/remotestate.tf.
09:38:28.078 DEBUG tfconfig.Diagnostics Invalid 'for' expression: Extra characters after the end of the 'for' expression.
/home/circleci/project/terraform/terraform.go:56 (0x100f473fd)
/home/circleci/project/cli/commands/validate-inputs/action.go:33 (0x10143de54)
/home/circleci/project/cli/commands/terraform/target.go:85 (0x10142f684)
/home/circleci/project/cli/commands/terraform/action.go:215 (0x10142f669)
/home/circleci/project/cli/commands/terraform/action.go:87 (0x10143ddf0)
/home/circleci/project/cli/commands/validate-inputs/action.go:29 (0x10143ddf1)
/home/circleci/project/cli/commands/validate-inputs/command.go:31 (0x101440368)
/home/circleci/project/cli/app.go:239 (0x101a74078)
/home/circleci/go/pkg/mod/golang.org/x/sync@v0.8.0/errgroup/errgroup.go:78 (0x100f47dd8)
/usr/local/go/src/runtime/asm_arm64.s:1222 (0x10031db74)
09:38:28.078 ERROR Invalid 'for' expression: Extra characters after the end of the 'for' expression.
09:38:28.078 ERROR Unable to determine underlying exit code, so Terragrunt will exit with error code 1
Steps To Reproduce
terraform {
required_version = "~> 1.8"
required_providers {
assert = {
source = "hashicorp/assert"
version = "~> 0.13"
}
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.8"
}
}
}
data "azurerm_subnet" "main" {
name = var.subnet.name
resource_group_name = var.subnet.resource_group_name
virtual_network_name = var.subnet.virtual_network_name
lifecycle {
postcondition {
condition = var.subnet.enable_ipv6 == false || anytrue([ for prefix in self.address_prefixes: provider::assert::cidrv6(prefix) ])
error_message = "Subnet does not contain valid IPv6 CIDR. Either use a subnet that contains a valid IPv6 CIDR or disable IPv6 support."
}
}
}
variable "subnet" {
type = object({
name = string
virtual_network_name = string
resource_group_name = string
enable_ipv6 = optional(bool, false)
})
}
Describe the bug
When using provider functions terragrunt validate-inputs fails with the following error: Invalid 'for' expression: Extra characters after the end of the 'for' expression. (and 1 other messages)
offending line is:
condition = var.subnet.enable_ipv6 == false || anytrue([ for prefix in self.address_prefixes: provider::assert::cidrv6(prefix) ])
Log Output
Steps To Reproduce
Expected behavior
terragrunt validate-inputs should run properly
Nice to haves
Versions
Additional context
Add any other context about the problem here.