Provider
In preparation. This page describes the target interface to gather your feedback; nothing is usable yet.
apiVersion | tofu.stackngo.io/v1alpha1 |
kind | Provider |
| Applied by | sng apply (upcoming) |
| Used by | Workspace.spec.providers[].name |
What it is for
Declare an OpenTofu provider's configuration (endpoint, region, credentials) once and reuse
it in all the tenant's Workspaces. Secret attributes never leave the tenant's secrets.
Guide: Providers.
Minimal example
apiVersion: tofu.stackngo.io/v1alpha1
kind: Provider
metadata:
name: aws-eu
spec:
type: aws
config: {region: eu-west-3}
envFrom:
- secretRef: {name: aws-credentials}
Complete annotated example
apiVersion: tofu.stackngo.io/v1alpha1
kind: Provider
metadata:
name: ovh-gra
spec:
type: ovh # ^[a-z][a-z0-9_-]*$
source: ovh/ovh # compared with the module's required_providers
version: "~> 1.6" # informational
alias: gra # for several configurations of the same type
config: # non-secret attributes, written as is
endpoint: ovh-eu
configFrom: # secret attributes: one sensitive variable per attribute
- attribute: application_key
secretRef: {name: ovh-credentials, key: application_key}
- attribute: application_secret
secretRef: {name: ovh-credentials, key: application_secret}
envFrom: # environment variables of the run
- secretRef: {name: ovh-extra-env}
Fields
Validation rules: type follows ^[a-z][a-z0-9_-]*$, alias follows ^[a-z_][a-z0-9_]*$,
source has the form owner/name; configFrom entries are keyed by attribute
(no duplicates).
Provider
Provider : configuration d'un provider OpenTofu, citée par nom dans les Workspace.
| Champ | Description | Défaut | Validation |
|---|---|---|---|
apiVersion string | tofu.stackngo.io/v1alpha1 | ||
kind string | Provider | ||
metadata ObjectMeta | Seul metadata.name est à renseigner (nom de la ressource dans votre tenant). | ||
spec ProviderSpec | |||
status ProviderStatus |
ProviderSpec
ProviderSpec : configuration d'un provider OpenTofu pour les Workspace de votre tenant.
| Champ | Description | Défaut | Validation |
|---|---|---|---|
type string | Type : nom local du provider, celui du bloc provider "<type>" (ex. ovh, aws). | Pattern: ^[a-z][a-z0-9_-]*$ | |
source string | Source : adresse du provider (ex. ovh/ovh, hashicorp/aws), contrôlée contre les required_providers du module. Absent = aucun contrôle. | Pattern: ^([a-z0-9.-]+/)?[a-z0-9_-]+/[a-z0-9_-]+$ Optional: {} | |
version string | Version : contrainte attendue, informative (avertissement si le module diffère). | Optional: {} | |
alias string | Alias : bloc provider aliasé (provider = <type>.<alias> dans le module). | Pattern: ^[a-z_][a-z0-9_]*$ Optional: {} | |
config JSON | Config : attributs non secrets du bloc provider (objet JSON). | Type: object Optional: {} | |
configFrom ProviderSecretAttr array | ConfigFrom : attributs secrets, injectés par variable sensible. | Optional: {} | |
envFrom ProviderEnvFrom array | EnvFrom : variables d'environnement de l'exécution, lues dans des secrets. | Optional: {} |
ProviderStatus
ProviderStatus : état observé.
| Champ | Description | Défaut | Validation |
|---|---|---|---|
observedGeneration integer | Dernière version du manifeste prise en compte par la plateforme. | Optional: {} | |
conditions Condition array | Conditions : Ready (tous les secrets et clés référencés existent). | Optional: {} | |
inputsHash string | InputsHash : empreinte de la spec et des secrets référencés ; un changement relance les Workspace qui utilisent ce Provider. | Optional: {} |
ProviderSecretAttr
ProviderSecretAttr : attribut du bloc provider lu dans un secret de votre tenant.
| Champ | Description | Défaut | Validation |
|---|---|---|---|
attribute string | Attribute : nom de l'attribut HCL (ex. application_secret). | Pattern: ^[a-z_][a-z0-9_]*$ | |
secretRef SecretKeyRef | SecretRef : secret et clé de la valeur. |
ProviderEnvFrom
ProviderEnvFrom : secret dont chaque clé devient une variable d'environnement de l'exécution (identifiants lus nativement par le provider, ex. AWS_ACCESS_KEY_ID).
| Champ | Description | Défaut | Validation |
|---|---|---|---|
secretRef LocalObjectReference | Secret de votre tenant dont toutes les clés sont fournies au Provider comme variables d'environnement. |
SecretKeyRef
SecretKeyRef : une clé d'un secret de votre tenant.
| Champ | Description | Défaut | Validation |
|---|---|---|---|
name string | Nom du Secret de votre tenant. | MinLength: 1 | |
key string | Clé du Secret qui contient la valeur. | MinLength: 1 |
Status and conditions
| Condition | Meaning |
|---|---|
Ready | All referenced secrets exist and carry the expected keys |
status.inputsHash changes when a referenced secret changes: the Workspaces that mention the
Provider then replay a run.
What happens when you delete
A Provider does not run anything by itself. Deleting it while a Workspace mentions it leaves
that Workspace in error at the next run (ProviderMismatch or missing secret).
Common errors
ProviderMismatchon the Workspace:typeorsourcedoes not match the module.- Credentials ignored: the provider reads its credentials from the environment (the
awscase): useenvFrom, notconfigFrom.