magodo / terraform-provider-restful

Terraform provider to manage RESTful resources
https://registry.terraform.io/providers/magodo/restful
Mozilla Public License 2.0
16 stars 5 forks source link

0.14.0 - marshal body: Unhandled type: basetypes.DynamicValue #98

Closed theadzik closed 6 months ago

theadzik commented 6 months ago

When applying changes with newest provider version (after removing jsonencode() from body I get an error during validation stage:

│ Error: Invalid configuration
│
│   with restful_resource.project_share,
│   on main.tf line 30, in resource "restful_resource" "project_share":
│   30: resource "restful_resource" "project_share" {
│
│ marshal body: Unhandled type: basetypes.DynamicValue

Configuration snippet:

resource "restful_resource" "project_share" {
  ...
  body = [
    {
      name : azuredevops_serviceendpoint_kubernetes.this.service_endpoint_name,
      projectReference : {
        id : each.value.project_id,
        name : each.value.name
      },
      description : "Managed by Terraform"
    }
  ]
}
theadzik commented 6 months ago

That will teach me to pin the provider version 😄

magodo commented 6 months ago

@theadzik You shall author the body using regular HCL, so in your case it would be:

resource "restful_resource" "project_share" {
  ...
  body = [
    {
      name = azuredevops_serviceendpoint_kubernetes.this.service_endpoint_name,
      projectReference = {
        id = each.value.project_id,
        name = each.value.name
      },
      description = "Managed by Terraform"
    }
  ]
}
theadzik commented 6 months ago

Thanks, I derped on this one :)