scylladb / terraform-provider-scylladbcloud

Terraform provider for ScyllaDB Cloud.
https://registry.terraform.io/providers/scylladb/scylladbcloud/latest
Apache License 2.0
11 stars 10 forks source link

internal/provider: add SCYLLADB_CLOUD_TOKEN env #157

Closed rjeczalik closed 4 months ago

rjeczalik commented 4 months ago

This PR adds support for reading the SCYLLADB_CLOUD_TOKEN env var.

This makes it possible to pass authentication token via env, and not require to always embed it in the terraform file.

This makes it possible to just define scylladb_cloud provider as just:

provider "scylladbcloud" { }

and pass the token with terraform execution or store it in .envrc file.

Even-though the token is marked as optional now, the behavior of failing the provider init is preserved via the ValidateDiagFunc:

╷
│ Error: token is required
│
│   with provider["registry.terraform.io/scylladb/scylladbcloud"],
│   on main.tf line 9, in provider "scylladbcloud":
│    9: provider "scylladbcloud" { }
│
│ A token must be provided to authenticate with the Scylla Cloud API.