Using the property of an AzureRM resource as a string in JSON within Terraform

Hi there,

I’m not sure I’ve explained this all that well but I have an AzureRM resource which takes a parameter input as JSON using JSONENCODE. I can happily pass variables into this however I want to pass the ID (as a string) from this resource property.

azurerm_backup_policy_vm.example.id

Into the JSONENCODE section.

When I try and do this using something like this:

"backupPolicyId" : {
      "value" : "${azurerm_backup_policy_vm.vm.id}",
    }

It compiles fine but just returns the literal string above.

Any thoughts ? Apologies if this is not explained well.

Hi @RoweJHR,

Can you share the entire configuration of the resource whose argument you are trying to set? That will help with sharing a useful example.