When creating a commercetools_associate_role resource the array of permissions is not handled correctly. The permissions are obviously stored in a random order (or at least in a different order as the input array). When comparing the resource in commercetools with the tf spec it is always considered as different.
When applying the tf resource initially it returns:
commercetools_associate_role.my_role: Creating...
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to commercetools_associate_role.my_role, provider "provider[\"registry.terraform.io/labd/commercetools\"]" produced an unexpected new value:
│ .permissions[0]: was cty.StringVal("CreateMyCarts"), but now cty.StringVal("ViewOthersCarts").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
To Reproduce
Create a commercetools_associate_role resource with a list of permissions
Apply the change
The above mentioned error is shown
Call a terraform plan without changing something
Terraform will detect a change within the order of the permissions
Take the list of permissions from the Commercetools API and replace it within the tf file
Call a terraform plan again
Terraform will not detect any changes
Expected behavior
Order of permissions is not taken into account when comparing permissions
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# commercetools_associate_role.my_role will be created
+ resource "commercetools_associate_role" "my_role" {
+ buyer_assignable = false
+ id = (known after apply)
+ key = "my_role"
+ name = "My Role"
+ permissions = [
+ "CreateMyCarts",
+ "DeleteMyCarts",
+ "UpdateMyCarts",
+ "ViewMyCarts",
+ "CreateMyOrdersFromMyCarts",
+ "CreateMyOrdersFromMyQuotes",
+ "UpdateMyOrders",
+ "ViewMyOrders",
+ "AcceptMyQuotes",
+ "ReassignMyQuotes",
+ "RenegotiateMyQuotes",
+ "ViewMyQuotes",
+ "CreateMyQuoteRequestsFromMyCarts",
+ "UpdateMyQuoteRequests",
+ "ViewMyQuoteRequests",
+ "ViewOthersQuotes",
+ "ViewOthersCarts",
+ "CreateOrdersFromOthersCarts",
+ "CreateOrdersFromOthersQuotes",
+ "UpdateOthersOrders",
+ "ViewOthersOrders",
+ "AcceptOthersQuotes",
+ "ReassignOthersQuotes",
+ "RenegotiateOthersQuotes",
+ "ViewOthersQuotes",
+ "CreateQuoteRequestsFromOthersCarts",
+ "UpdateOthersQuoteRequests",
+ "ViewOthersQuoteRequests",
]
+ version = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
commercetools_associate_role.my_role: Creating...
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to commercetools_associate_role.my_role, provider "provider[\"registry.terraform.io/labd/commercetools\"]" produced an unexpected new value:
│ .permissions[0]: was cty.StringVal("CreateMyCarts"), but now cty.StringVal("ViewOthersCarts").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to commercetools_associate_role.my_role, provider "provider[\"registry.terraform.io/labd/commercetools\"]" produced an unexpected new value:
│ .permissions[1]: was cty.StringVal("DeleteMyCarts"), but now cty.StringVal("CreateQuoteRequestsFromOthersCarts").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to commercetools_associate_role.my_role, provider "provider[\"registry.terraform.io/labd/commercetools\"]" produced an unexpected new value:
│ .permissions[3]: was cty.StringVal("ViewMyCarts"), but now cty.StringVal("CreateMyOrdersFromMyCarts").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
Version information
Describe the bug
When creating a commercetools_associate_role resource the array of permissions is not handled correctly. The permissions are obviously stored in a random order (or at least in a different order as the input array). When comparing the resource in commercetools with the tf spec it is always considered as different.
When applying the tf resource initially it returns:
To Reproduce
terraform plan
without changing somethingterraform plan
againExpected behavior
Order of permissions is not taken into account when comparing permissions
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context