Skip to main content

Provider

Coming soon

In preparation. This page describes the target interface to gather your feedback; nothing is usable yet.

apiVersiontofu.stackngo.io/v1alpha1
kindProvider
Applied bysng apply (upcoming)
Used byWorkspace.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.

ChampDescriptionDéfautValidation
apiVersion stringtofu.stackngo.io/v1alpha1
kind stringProvider
metadata ObjectMetaSeul 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.

ChampDescriptionDéfautValidation
type stringType : nom local du provider, celui du bloc provider "<type>" (ex. ovh, aws).Pattern: ^[a-z][a-z0-9_-]*$
source stringSource : 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 stringVersion : contrainte attendue, informative (avertissement si le module diffère).Optional: {}
alias stringAlias : bloc provider aliasé (provider = <type>.<alias> dans le module).Pattern: ^[a-z_][a-z0-9_]*$
Optional: {}
config JSONConfig : attributs non secrets du bloc provider (objet JSON).Type: object
Optional: {}
configFrom ProviderSecretAttr arrayConfigFrom : attributs secrets, injectés par variable sensible.Optional: {}
envFrom ProviderEnvFrom arrayEnvFrom : variables d'environnement de l'exécution, lues dans des secrets.Optional: {}

ProviderStatus​

ProviderStatus : état observé.

ChampDescriptionDéfautValidation
observedGeneration integerDernière version du manifeste prise en compte par la plateforme.Optional: {}
conditions Condition arrayConditions : Ready (tous les secrets et clés référencés existent).Optional: {}
inputsHash stringInputsHash : 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.

ChampDescriptionDéfautValidation
attribute stringAttribute : nom de l'attribut HCL (ex. application_secret).Pattern: ^[a-z_][a-z0-9_]*$
secretRef SecretKeyRefSecretRef : 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).

ChampDescriptionDéfautValidation
secretRef LocalObjectReferenceSecret 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.

ChampDescriptionDéfautValidation
name stringNom du Secret de votre tenant.MinLength: 1
key stringClé du Secret qui contient la valeur.MinLength: 1

Status and conditions​

ConditionMeaning
ReadyAll 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​

  • ProviderMismatch on the Workspace: type or source does not match the module.
  • Credentials ignored: the provider reads its credentials from the environment (the aws case): use envFrom, not configFrom.

See also​