You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There’s some bug in the TF registry as I noticed and hopefully can get some support from you. I created a new type def for category, it has a field that’s Set of String. The bug I encountered is, when I create a PR in our repo, GH actions keeps complaining element needs to be String, so I changed it to String, but in the master CI it then complains element needs to be Array. I have tried every possible way but maybe either I still did it wrong, or there is indeed some bug.
Type def
resource "commercetools_type" "category-exclusive-group-type" {
key = "category-exclusive-group-type"
name = { en = "Category exclusive group type" }
description = { en = "Add exclusive group field to category" }
resource_type_ids = ["category"]
field {
name = "exclusiveGroups"
label = {
en = "Exclusive group tags"
}
type {
name = "Set"
element_type {
name = "String"
}
}
}
}
I’ve tried the following way to define custom field when actually define category:
Yeah, you ran into something we need to document a bit better here; because we don't know to what to encode a custom type in the provider we only allow for a map of key values as inputs in terraform. However, the way to work around this is to provide the input value as a json string instead. So in your case that would look like this:
resource "commercetools_category" "my-category" {
key = "my-category-key"
name = {
en = "My category"
}
description = {
en = "Standard description"
}
slug = {
en = "my_category"
}
meta_title = {
en = "Meta title"
}
custom {
type_id = commercetools_type.category-exclusive-group-type.id
fields = {
exclusiveGroups = jsonencode(["group1", "group2"])
}
}
}
I will expand on the documentation to make this a bit more clear.
There’s some bug in the TF registry as I noticed and hopefully can get some support from you. I created a new type def for category, it has a field that’s Set of String. The bug I encountered is, when I create a PR in our repo, GH actions keeps complaining element needs to be String, so I changed it to String, but in the master CI it then complains element needs to be Array. I have tried every possible way but maybe either I still did it wrong, or there is indeed some bug.
Type def
I’ve tried the following way to define
custom
field when actually define category:or
or
None of them works. However using API or UI to create works, and the new type def is there:
Let me know if you need more info
The text was updated successfully, but these errors were encountered: