Skip to content

feat(rabbitmq): add roles support to rabbitmq credential resource - #1726

Closed
SerseusWasTaken wants to merge 3 commits into
mainfrom
feat/rabbitmq-add-role-support
Closed

feat(rabbitmq): add roles support to rabbitmq credential resource#1726
SerseusWasTaken wants to merge 3 commits into
mainfrom
feat/rabbitmq-add-role-support

Conversation

@SerseusWasTaken

Copy link
Copy Markdown
Contributor

Description

Adds role support to stackit_rabbitmq_credential

Relates to STACKITTPR-815 and #1708

Checklist

  • Issue was linked above
  • Code format was applied: make fmt
  • Examples were added / adjusted (see examples/ directory)
  • Docs are up-to-date: make generate-docs (will be checked by CI)
  • Unit tests got implemented or updated
  • Acceptance tests got implemented or updated (see e.g. here)
  • Unit tests are passing: make test (will be checked by CI)
  • No linter issues: make lint (will be checked by CI)

@SerseusWasTaken
SerseusWasTaken requested a review from a team as a code owner August 27, 2026 13:22
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

This PR was marked as stale after 7 days of inactivity and will be closed after another 7 days of further inactivity. If this PR should be kept open, just add a comment, remove the stale label or push new commits to it.

@github-actions github-actions Bot added the Stale PR is marked as stale due to inactivity. label Sep 4, 2026
@SerseusWasTaken SerseusWasTaken added ignore-stale and removed Stale PR is marked as stale due to inactivity. labels Sep 8, 2026
Comment on lines +285 to +303
if !utils.IsUndefined(model.Roles) {
var roles []string
diags = model.Roles.ElementsAs(ctx, &roles, false)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
return
}

sdkRoles := make([]rabbitmq.CredentialsParametersRolesInner, len(roles))
for i, r := range roles {
sdkRoles[i] = rabbitmq.CredentialsParametersRolesInner(r)
}

createReq = createReq.CreateCredentialsPayload(rabbitmq.CreateCredentialsPayload{
Parameters: &rabbitmq.CredentialsParameters{
Roles: sdkRoles,
},
})
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you move this to a dedicated toCreatePayload() function, similar like we have it in other resources? For one attribute, it might be a bit too much to have a dedicated function, but I know from the past that this can escalate quickly. This makes also testing easier :)

_ resource.ResourceWithImportState = &credentialResource{}
_ resource.ResourceWithModifyPlan = &credentialResource{}

roleOptions = sdkUtils.EnumSliceToStringSlice(rabbitmq.AllowedCredentialsParametersRolesInnerEnumValues)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to move this into the Schema function, because this it only called within the function

@SerseusWasTaken

Copy link
Copy Markdown
Contributor Author

Will not be merged due to open API issues

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants