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

Realm.get get's executed before dependsOn Resource is fully ready #519

Open
ChristianRaoulis opened this issue Jun 13, 2024 · 1 comment
Labels
awaiting/core Blocked on a missing bug or feature in pulumi/pulumi (except codegen) kind/bug Some behavior is incorrect or out of spec

Comments

@ChristianRaoulis
Copy link

Describe what happened

I'm deploying a Keycloak Helm Chart and load the master realm using the Realm.get method. That Realm.get method causes an

error: Preview failed: refreshing urn:pulumi:testing::softwarefactory::softwarefactory:namespaces:service-namespace$kubernetes:core/v1:Namespace$softwarefactory:keycloak$kubernetes:helm.sh/v3:Release$pulumi:providers:keycloak$keycloak:index/realm:Realm::master-realm: 1 error occurred:
    	* error logging in: error sending POST request to https://<my domain>/realms/master/protocol/openid-connect/token: 404 Not Found

when my project gets deployed

Sample program

const keycloak = new HelmRelease("keycloak-helm-chart", {
  chart:          "keycloak",
  version:        "21.0.4",
  repositoryOpts: {
    repo: "https://charts.bitnami.com/bitnami",
  },
});

const provider = new KeycloakProvider("keycloak", {
   url:          'https://<keycloak url>',
   clientId:     "admin-cli",
   realm:        "master",
   username:     "admin",
   password:     "password",
   initialLogin: false,
}, {dependsOn: keycloak, parent: keycloak});

// This one causes the 404 error since keycloak isn't fully deployed yet
const masterRealm = Realm.get("master-realm", "master", {}, {parent: provider, provider: provider, dependsOn: keycloak});

Log output

Diagnostics:
  keycloak:index:Realm (master-realm):
    error: Preview failed: refreshing urn:pulumi:testing::softwarefactory::softwarefactory:namespaces:service-namespace$kubernetes:core/v1:Namespace$softwarefactory:keycloak$kubernetes:helm.sh/v3:Release$pulumi:providers:keycloak$keycloak:index/realm:Realm::master-realm: 1 error occurred:
    	* error logging in: error sending POST request to https://<my domain>/realms/master/protocol/openid-connect/token: 404 Not Found

Affected Resource(s)

No response

Output of pulumi about

CLI          
Version      3.107.0
Go Version   go1.22.0
Go Compiler  gc

Plugins
NAME        VERSION
command     0.11.1
keycloak    5.3.2
kubernetes  4.13.1
nodejs      unknown
postgresql  3.11.1
random      4.16.2

Host     
OS       Microsoft Windows 11 Enterprise
Version  10.0.22631 Build 22631
Arch     x86_64

This project is written in nodejs: executable='C:\Users\A92615470\AppData\Local\pnpm\node.exe' version='v20.14.0'

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@ChristianRaoulis ChristianRaoulis added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jun 13, 2024
@iwahbe iwahbe added awaiting/core Blocked on a missing bug or feature in pulumi/pulumi (except codegen) and removed needs-triage Needs attention from the triage team labels Jun 14, 2024
@iwahbe
Copy link
Member

iwahbe commented Jun 14, 2024

Hi @ChristianRaoulis. I'm sorry your hitting this issue. I believe that this is a bug in the Pulumi engine, so I have opened an issue there: pulumi/pulumi#16395.

You might be able to work around the bug by faking the dependsOn relationship with an apply:

const masterRealm = Realm.get("master-realm", keycloak.chart.apply((_) => "master"), {}, {parent: provider, provider: provider, dependsOn: keycloak});

It would be even better if you could use a property of keycloak (HelmRelease) that isn't known until the resource is created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting/core Blocked on a missing bug or feature in pulumi/pulumi (except codegen) kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants