Skip to content

All Realm Attributes are Overwritten on Apply #1031

@AdosH1

Description

@AdosH1

Describe the bug

When setting the realm attributes, all attributes are overwritten instead on the ones owned by the terraform provider.
This appears to be the complete opposite functionality to what is commented in the code on how this should work.

This has caused issues when extending Keycloak using realm attributes at runtime, where we lose those attributes upon terraform apply

Example fix for this issue: #1030

Version

25.0.6

Expected behavior

Terraform sets the realm attributes owned by the provider, without modifying the unmanaged attributes

Actual behavior

The provider overwrites realm attributes with only the values defined in Terraform

How to Reproduce?

  1. Define a keycloak realm and apply
resource "keycloak_realm" "myRealm" {
    ...
    attributes = {
        myCustomAttribute = "myCustomValue"
    }
  1. Define a custom realm attribute in myRealm (I did this programmatically)
  2. Reapply keycloak realm
  3. See that myCustomAttribute still exists, whereas the other custom realm attribute is gone

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions