Repository navigation
fix(terraform): add keycloak grant dependencies - #337
Draft
kruchkovnik15-dot wants to merge 1 commit into
Draft
kruchkovnik15-dot wants to merge 1 commit into
kruchkovnik15-dot wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Related to #201.
The Keycloak grants use literal role and schema names, so Terraform cannot infer dependencies on the resources that create them. Grant operations can therefore run before the role or schema exists, consistent with the first-apply failure reported in #201.
This change replaces those literals in all three grant resources with references to
postgresql_role.service_user.nameandpostgresql_schema.keycloak_schema.name, establishing the required creation order. Names and privileges remain unchanged.Validation performed locally against a fresh PostgreSQL 14 database in Docker, using Terraform 1.4.6, PostgreSQL provider 1.22.0, and random provider 3.6.0:
terraform fmt -check main.tfpassed.terraform init -backend=falseandterraform validatepassed.This test used the isolated Keycloak configuration with a local superuser connection and an empty schema. The original failure on the unmodified code has not been reproduced, and the full environment configuration has not been tested. No Greenstand infrastructure or remote state was accessed or changed.
Keeping this PR as a draft pending maintainer review.