FusionAuth/terraform-provider-fusionauth

Error: application.data: data.developer_application: '' expected type 'string', got unconvertible type 'bool', value: 'true'

Opened this issue · 0 comments

Debug Info

  • Platform: MacOS Ventura 13.3 (M2)
  • Terraform Version: v1.6.6
  • Provider Version: v0.1.101

Issue

When moving our FusionAuth infrastructure under Terraform management, the application.data object continually causes issues regardless of any attempts to modify/exclude it.

Here is what I have tried so far to "fix" the error (in the title):

  • converting the boolean to a string (true --> "true")
  • re-adding the data object
  • removing the data object altogether, as it is not required by the provider
  • re-structuring the data object or rebuilding the application altogether
  • pushing and re-pulling from remote branch
  • using a different IDE on a different device
  • using jsonencode() or jsondecode()
  • using a lifecycle option with ignore_changes = [data]
  • using the previous provider
  • removing the data object from the already-managed tenants.tf files
  • with/without commas to separate the values in the data object

Example 1

resource "fusionauth_application" "example-app" {
    name = "example-app"
    tenant_id = fusionauth_tenant.tenant.id
    data = {
        developer_application = true,
        org_id = "id",
        org_name = "name",
    }
}

Returns the following error:

Error: application.data: data.developer_application: '' expected type 'string', got unconvertible type 'bool', value: 'true'

Example 2

resource "fusionauth_application" "example-app" {
    name = "example-app"
    tenant_id = fusionauth_tenant.tenant.id
    data = jsonencode({
        developer_application = "true"
        org_id = "id"
        org_name = "name"
    })
}

Returns the following Terraform error:

│ Error: Incorrect attribute value type
│ 
│   on applications.tf line 28, in resource "fusionauth_application" "example-app":
│   28:     data = jsonencode({
│   29:         developer_application = "true"
│   30:         org_id = "id"
│   31:         org_name = "name"
│   32:     })
│ 
│ Inappropriate value for attribute "data": map of string required.

Thoughts on this issue

I'm wondering if the provider doesn't support a JSON object type for application.data, because it seems that user.data is allowed to use jsonencode().

As mentioned, I also tried to remove the data object altogether from the application resource, as it is not required nor do I think we want to manage the data via Terraform due to various limitations anyway. (See this link). This seemed the most obvious, as it eliminates any format errors, but the error in the title was still persisting.

Please let me know what next steps should be taken, thanks!