zitadel / terraform-provider-zitadel

Official Terraform provider for ZITADEL
https://zitadel.com
Apache License 2.0
21 stars 13 forks source link

Terraform provider configuration improvement #184

Open nettworker opened 1 month ago

nettworker commented 1 month ago

Preflight Checklist

Describe your problem

JWT session token has missed at Provider configuration.

Describe your ideal solution

At the moment Zitadel Terraform provider is used jwt_profile_file field for specifying full path to the private key of the service user. How it works well described in documentation - https://zitadel.com/docs/guides/integrate/service-users/private-key-jwt

All works fine when we are staying within Zitadel TF provider scope. If you want to do something outside of TF provider capabilities, you should use JWT token. For example, it may be some specific terracurl request to the Zitadel API.

Today I goes the following way:

  1. Generate JWT token as described at the link above and save result to the environment variable such as TF_VAR_ZT_TOKEN.
  2. Define TF_VAR_ZT_TOKEN inside of my TF files.
  3. Run terraform apply which do all required things with Zitadel API using JWT token.

By my understanding, Zitadel TF provider already convert the jwt private key to the jwt token. Just only one thing is required - publish this value (session jwt token) via specfic Datasource. This datasource can be named as session-token or something like that.

Version

1.2.0

Additional Context

No response