I’m trying to use ephemeral resource azapi_resource_action and I’m encountering a peculiar behaviour, or I’m misunderstanding how ephemeral works.
In my reusable module I ‘call’ ephemeral "azapi_resource_action" "vmss_upgrade"
which does its thing from which I capture output:
# The lines 39-42 in the error output below
output "vmss_upgrade_output" {
value = {
for id, upgrade in ephemeral.azapi_resource_action.vmss_upgrade :
id => upgrade.output
}
}
In my root module, I call my reusable module.
I run terraform plan
and I’m getting this
│ Error: Ephemeral value not allowed
│
│ on vmss-manual-upgrade/outputs.tf line 39, in output "vmss_upgrade_output":
│ 39: value = {
│ 40: for id, upgrade in ephemeral.azapi_resource_action.vmss_upgrade :
│ 41: id => upgrade.output
│ 42: }
│
│ This output value is not declared as returning an ephemeral value, so it cannot be set to a
│ result derived from an ephemeral value.
I go back to the docs and correct my output
this way:
output "vmss_upgrade_output" {
value = {
for id, upgrade in ephemeral.azapi_resource_action.vmss_upgrade :
id => upgrade.output
}
ephemeral = true
}
I run terraform plan
again and now I’m getting this:
│ Error: Value not allowed in ephemeral output
│
│ on vmss-manual-upgrade/outputs.tf line 39, in output "vmss_upgrade_output":
│ 39: value = {
│ 40: for id, upgrade in ephemeral.azapi_resource_action.vmss_upgrade :
│ 41: id => upgrade.output
│ 42: }
│
│ This output value is declared as returning an ephemeral value, so it can only be set to an
│ ephemeral value.
I believe, I have a good reason to be confused, haven’t I?