stackitcloud / terraform-provider-stackit

The official Terraform provider for STACKIT
https://registry.terraform.io/providers/stackitcloud/stackit
Apache License 2.0
42 stars 14 forks source link

STACKIT Service Account Email #520

Open BackInBash opened 2 months ago

BackInBash commented 2 months ago

Hi,

why do I need to specify the Service Account Email Adresse in combination with the Access Token?

╷
│ Error: Error creating project
│ 
│   with stackit_resourcemanager_project.project-hub,
│   on 03-project.tf line 9, in resource "stackit_resourcemanager_project" "project-hub":
│    9: resource "stackit_resourcemanager_project" "project-hub" {
│ 
│ The service account e-mail cannot be empty: set it in the provider configuration or through the STACKIT_SERVICE_ACCOUNT_EMAIL or in your credentials file (default filepath is ~/.stackit/credentials.json)

Because the Service Account Email Adress is part of the JWT Token itself and could be extracted 🤔

Example Terraform Code to extract Service Account Email:

jsondecode(base64decode(split(".", var.STACKIT_SERVICE_ACCOUNT_TOKEN)[1])).email
vicentepinto98 commented 2 months ago

Hi @BackInBash , thanks for opening the issue. You are right, we could extract it from the JWT Token. We will also check if we need it at all, as it might not be required anymore. If that's the case, we'll remove this check.