Fix role name case sensitivity causing state mismatch on Splunk Cloud#230
Open
raman1236 wants to merge 1 commit into
Open
Fix role name case sensitivity causing state mismatch on Splunk Cloud#230raman1236 wants to merge 1 commit into
raman1236 wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #87
When a role is created with uppercase characters in the
nameproperty usingsplunk_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.tffile. On subsequent applies, Terraform cannot find the role because the name comparison is case-sensitive.Changes
StateFuncto thenameattribute to normalize it to lowercase in statestrings.EqualFoldfor case-insensitive name matching ingetAuthorizationRolesByNameauthorizationRolesCreateImpact
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.