This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

AppRole storage projects

Each <approle>/ directory is a standalone Terraform root with its own state, plan/apply targets and fixed namespace under default/encrypted/approles. It owns the namespace, ACLs, shares and child datasets through the shared dataset module. No parent input or remote-state dependency is needed.

The shared NAS root owns accounts, the encrypted parent and appliance-wide settings. It does not load AppRole projects. Group membership creates an account; a namespace is created when its storage project is applied. Add another project only when declaring that AppRole’s storage.

Projects use the NAS operator identity, the shared connection injector and a separate backend under that identity’s tf_backend/approles/<approle> path. This separates state and lifecycle; it does not restrict TrueNAS administrator API permissions to a dataset path. The consumer AppRole receives only its own NAS account credential, not the provisioning key.

Apply the shared NAS prerequisites first, then the selected AppRole storage project. The development project owns its namespace and runner cache. VM provisioning consumes the resulting Xen Orchestra storage repository through its own development identity.

1 - Development NAS storage

This standalone Terraform root owns default/encrypted/approles/src_infra_dev, its private namespace share and the runner cache dataset/share. The namespace permits XCP-ng to traverse to the cache without connecting to the namespace share. The cache grants XCP-ng MODIFY access and limits SMB clients to its host. The reusable dataset module owns encryption inheritance and private ACL defaults. The cache share is named src_infra_dev_runner_cache: SMB names are NAS-wide, and TrueNAS forbids slashes in them.

The root has its own HTTP state backend at alwaldend.com/vault1/approles/src_infra_nas/tf_backend/approles/src_infra_dev. It authenticates as the existing NAS operator and reuses the shared NAS API connection. Its tf=approle_src_infra_dev selection chooses this backend; truenas selects the connection injector. The development AppRole does not gain NAS administrator credentials. There are no Terraform input variables or remote-state reads, and the shared NAS root does not load this project.

Under separately authorized live scope:

  1. Apply Vault NAS groups/grants, then //infra/nas/truenas:tf.apply for accounts, the shared encrypted parent and mandatory SMB encryption. Unlock the parent.
  2. Review/apply //infra/nas/approles/src_infra_dev:tf.plan/tf.apply for this namespace and cache.
  3. Apply //infra/xcp_ng/tf:tf.apply for the storage repository, then the runner VM root and Ansible for disk attachment and mounting.

Run the named targets through bazel run. Each NAS apply covers its complete root; other AppRole states are outside this project. Follow the VM provisioning guide for initial disk attachment. Formatting and offline provider validation use :tf_tests.fmt_test and :tf_tests.validate_test.

The authorized rollout created this namespace/cache and its ACLs/shares in this independent state. Its subsequent plan has no changes. If an earlier shared-state revision was applied elsewhere, reconcile its ownership before applying either root; preserve existing data.