Currently, group mappers are organized according to their IDs in the database, and that is the order they will have in the state file.
This makes it so that even if your mappers are the same as they are in the state but unordered they will show up in the plan as an update. This happens at least when the realm was already created and the group has been imported. It would be interese
To give an example of the problem:
1- Create group resource and variable:
resource "keycloak_group" "example_group" {
realm_id = var.realm_id
name = var.group.name
attributes = var.group.attributes
}
variable "group" {
type = any
}
group = {
name="example_group"
attributes = "attribute1##attribute2##attribute3"
}
Run apply. If you are lucky the attributes will be created in the database in the same order you created them. But this will probably not happen. If you run terraform plan again. You may see something like this:
My suggestion is to order the attributes that terraforms receives when refreshing the state (e.g. alphabetically) and order the inputs from the user in the same way.
I am available to create a PR since this is a fix we require.
Currently, group mappers are organized according to their IDs in the database, and that is the order they will have in the state file. This makes it so that even if your mappers are the same as they are in the state but unordered they will show up in the plan as an update. This happens at least when the realm was already created and the group has been imported. It would be interese To give an example of the problem: 1- Create group resource and variable:
Run apply. If you are lucky the attributes will be created in the database in the same order you created them. But this will probably not happen. If you run
terraform plan
again. You may see something like this:My suggestion is to order the attributes that terraforms receives when refreshing the state (e.g. alphabetically) and order the inputs from the user in the same way.
I am available to create a PR since this is a fix we require.