Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keycloak update workflow #15355

Closed
bolyachevets opened this issue Feb 13, 2023 · 1 comment
Closed

Keycloak update workflow #15355

bolyachevets opened this issue Feb 13, 2023 · 1 comment
Assignees
Labels
SRE SRE team task

Comments

@bolyachevets
Copy link
Collaborator

Sync terraform configurations with manual keycloak updates using export python script via github actions.

@bolyachevets bolyachevets added the SRE SRE team task label Feb 13, 2023
@bolyachevets bolyachevets self-assigned this Feb 13, 2023
@bolyachevets
Copy link
Collaborator Author

bolyachevets commented Mar 29, 2023

Updated github actions workflow to sync keycloak configs with terraform configurations stored in bcgov-registries/keycloak-migration: https://github.com/bcgov-registries/keycloak-migration/blob/dev/.github/workflows/keycloak-sync.yml
Github Action runs a script similar to the one used during migration to determine current resource state: https://github.com/bcgov/bcros-keycloak-terraform/blob/main/kc2tf.py then it runs a script to add new resources that were added manually https://github.com/bcgov/bcros-keycloak-terraform/blob/main/get_tf_imports.py
This workflow updates attributes of resources already in terraform state, or adds new resources to terraform state. Removing resources is not covered. I believe in the near future Terraform is going to make synchronization tasks easier, as there have been a lot of changes in the last year or two driven by customer complaints, e.g.: hashicorp/terraform#26494
hashicorp/terraform#23407 hashicorp/terraform#32138

if the resource was deleted manually, then 'terraform plan' will error out:

│ Error: failed to read schema for keycloak_group.testgroup in registry.terraform.io/hashicorp/keycloak: failed to instantiate provider "registry.terraform.io/hashicorp/keycloak" to obtain schema: unavailable provider "registry.terraform.io/hashicorp/keycloak"

resource can be the removed from state manaully:

terraform state rm

@PCC199 PCC199 closed this as completed Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
SRE SRE team task
Projects
None yet
Development

No branches or pull requests

2 participants