Skip to content

Fix role name case sensitivity causing state mismatch on Splunk Cloud#230

Open
raman1236 wants to merge 1 commit into
splunk:masterfrom
raman1236:fix/role-name-case-sensitivity
Open

Fix role name case sensitivity causing state mismatch on Splunk Cloud#230
raman1236 wants to merge 1 commit into
splunk:masterfrom
raman1236:fix/role-name-case-sensitivity

Conversation

@raman1236

Copy link
Copy Markdown

Description

Fixes #87

When a role is created with uppercase characters in the name property using splunk_authorization_roles, Splunk Cloud lowercases the role name on the server side. The Terraform state file saves the resource with the original case from the .tf file. On subsequent applies, Terraform cannot find the role because the name comparison is case-sensitive.

Changes

  • Add StateFunc to the name attribute to normalize it to lowercase in state
  • Use strings.EqualFold for case-insensitive name matching in getAuthorizationRolesByName
  • Store the lowercased role name as the resource ID in authorizationRolesCreate

Impact

This is a backward-compatible fix. Existing roles with lowercase names are unaffected. Roles created with uppercase characters will now be correctly tracked in state using the server-normalized (lowercase) name.

Splunk server lowercases role names on creation. When a role is created
with uppercase characters, subsequent reads fail to find the role because
the comparison uses exact case matching against the lowercased server-side
name.

Fix:
- Add StateFunc to lowercase the name attribute in state
- Use strings.EqualFold for case-insensitive name matching in read
- Store lowercased role name as the resource ID

Fixes splunk#87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

case sensitivity issue with role creation

2 participants