Closed takumin closed 3 years ago
@takumin Thank you for reporting this!
I confirmed that if we have the configuration_aliases
key in the required_providers
block, the tfupdate fails to parse and silently ignores the block.
I found the root cause of this problem is a dirty hack in the tfupdate implementation due to limitations of the hcl library. We expect a literal expression here: https://github.com/minamijoyo/tfupdate/blob/v0.4.3/tfupdate/hclwrite.go#L48-L71
If my understanding is correct, the configuration_aliases
contains provider references, that is, variables in hcl and it requires a EvalContext to parse.
I think it should be fixed, but it may be quite difficult under the current technical constraints. I'm not sure how to fix it for now 🤔
I found the terraform-config-inspect
seems to parse the required_providers
block without an EvalContext
using hcl.ExprMap
. It's worth investigating.
https://github.com/hashicorp/terraform-config-inspect/pull/59
@takumin Fixed in v0.5.1 🚀
Starting with Terraform 0.15,
configuration_aliases
is available.See also 1: https://www.terraform.io/upgrade-guides/0-15.html#alternative-provider-configurations-within-modules See also 2: https://www.terraform.io/docs/language/modules/develop/providers.html#provider-aliases-within-modules
For example, the following declaration.
Are you planning to support this syntax?