mrparkers / terraform-provider-keycloak

Terraform provider for Keycloak
https://registry.terraform.io/providers/mrparkers/keycloak/latest/docs
MIT License
594 stars 291 forks source link

DNS request on keycloak domain during plan even if initial login is set to false #877

Open 1-alex98 opened 9 months ago

1-alex98 commented 9 months ago

Terraform config

provider "keycloak" {
  client_id     = "admin-cli"
  username      = "admin"
  password      = module.keycloak-infrastructure.keycloak_password
  url           = "https://auth.${var.domain}"
  initial_login = false
}

When doing plan:

[2023-10-04T12:28:36.043Z] │ Error: error logging in: Post "https://auth.xxxx.digital/realms/master/protocol/openid-connect/token": dial tcp: lookup auth.xxxx.digital on 127.0.0.53:53: no such host

[2023-10-04T12:28:36.043Z] │ 

[2023-10-04T12:28:36.043Z] │   with module.xxx_B.keycloak_realm.realm_xxx,

[2023-10-04T12:28:36.043Z] │   on ../../modules/fargate/v1/keycloak-config.tf line 10, in resource "keycloak_realm" "realm_xxx":

[2023-10-04T12:28:36.043Z] │   10: resource "keycloak_realm" "realm_xxx" {

[2023-10-04T12:28:36.043Z] │ 

[2023-10-04T12:28:36.043Z] ╵
1-alex98 commented 9 months ago

That only happens when I was logged in before. When I delete the state it works again.

The usecase here is to change the domain of keycloak. But since plan fails the domain change is never executed in terraform. Would be nice if the post that happens there only ever happens in the apply phase.