labd / terraform-provider-storyblok

Terraform provider to manage Storyblok
https://registry.terraform.io/providers/labd/storyblok/latest/docs
Mozilla Public License 2.0
2 stars 0 forks source link

schema type "multilink" ignores some parameters #74

Open fabian-kramer opened 1 month ago

fabian-kramer commented 1 month ago

Version information

Describe the bug

When specifying standard link attributes like this:

  link = {
      type                    = "multilink"
      required                = false
      translatable            = false
      position                = 3
      asset_link_type         = true
      allow_target_blank      = true
      allow_custom_attributes = false
      show_anchor             = true
      link_scope              = "{0}"
      force_link_scope        = false
      email_link_type         = false
    }

Only the allow_target_blank and force_link_scope attributes are set in Storyblok. The other values like asset_link_type and show_anchor are ignored. Based on the export from Storyblok before importing into Terraform looks like this:

        "link": {
          "type": "multilink",
          "required": false,
          "translatable": false,
          "pos": 3,
          "asset_link_type": true,
          "allow_target_blank": true,
          "allow_custom_attributes": false,
          "show_anchor": true,
          "link_scope": "{0}",
          "force_link_scope": false,
          "email_link_type": false
        },

but they are partly missing in the tfstate file:

              "link": {
                "add_https": null,
                "allow_target_blank": true,
                "asset_folder_id": null,
                "can_sync": null,
                "component_whitelist": null,
                "customize_toolbar": null,
                "datasource_slug": null,
                "default_value": null,
                "description": null,
                "disable_time": null,
                "display_name": null,
                "external_datasource": null,
                "field_type": null,
                "filetypes": null,
                "filter_content_type": null,
                "folder_slug": null,
                "force_link_scope": false,
                "image_crop": null,
                "image_height": null,
                "image_width": null,
                "keep_image_size": null,
                "keys": null,
                "link_scope": "{0}",
                "max_length": null,
                "max_options": null,
                "maximum": null,
                "min_options": null,
                "minimum": null,
                "no_translate": null,
                "options": null,
                "position": 3,
                "regex": null,
                "required": false,
                "restrict_components": null,
                "restrict_content_types": null,
                "rich_markdown": null,
                "rtl": null,
                "source": null,
                "toolbar": null,
                "tooltip": null,
                "translatable": false,
                "type": "multilink",
                "use_uuid": null
              },

As you can see, some are missing, they are always set to false if the component is modified, probably because the provider is not aware of them. I also found this issue: https://github.com/labd/terraform-provider-storyblok/issues/45 There it is stated that the anchor attribute is fixed, but unfortunately, it is not. Maybe something else broke it again?

To Reproduce

Create a resource like a button, add the link attribute and try to set one of the following to "true":

Expected behavior

The values are passed to Storyblok and can be updated.

demeyerthom commented 1 month ago

Hi @fabian-kramer. I think this is happening because these fields are not actually part of the datamodel in terraform, so terraform ignores them, and subsequently does not send them to storyblok either.

I will see if I can add the fields