Tf modules
Reusable Terraform modules for Vault, virtual machines, storage, and Vast.ai
This project contains reusable Terraform modules for Vault configuration,
Proxmox virtual machines, backup storage, and related infrastructure. The
module collection is still in progress. The Vast.ai team module
composes managed or existing teams and project API keys while callers select
provider credentials and own secret storage.
The base image-generation module owns
constrained rentals and SSH-only or password-protected HTTPS access with at least
32 GiB VRAM. Forge and
ComfyUI modules supply native runtime
configuration and model paths. Creating a consumer does not authorize a paid rental.
The TrueNAS dataset module creates a protected child
from parent and inline config, with shared defaults, private account ownership
and optional standard SMB exports.
Links
Features
1 - Backup bucket
S3 bucket for backups
2 - DNS records
Canonical DNS declarations for Cloudflare and RouterOS
This reusable module translates an owner’s decoded dnsconfig.json through
its provider-free normalizer, then manages individual
global Cloudflare and dc1 RouterOS records with caller-provided providers.
Owners with only global records use the global entrypoint,
which needs only Cloudflare. The combined entrypoint delegates Cloudflare
resources to that same module and consumes its normalization for RouterOS.
Repository infrastructure roots may consume its Bazel source filegroups;
the child normalizer also supports provider-free inspection.
module "dns" {
source = "../../../projects/tf_modules/dns_records"
document = jsondecode(file("${path.module}/../dnsconfig.json"))
cloudflare_zone_id = var.dns_cloudflare_zone_id
enabled = var.dns_enabled
}
zone defaults to alwaldend.com. An explicit cloudflare_zone_id is optional;
when it is null or empty, enabled global records resolve exactly one Cloudflare
zone matching zone. The token must permit zone listing and reading. Disabled
ownership and declarations without global records skip this lookup.
enabled defaults to false so a prepared root owns
no provider records. Keep it true after adoption: setting it false in a state
that already owns records plans deletion and is not a rollback procedure.
Disabling ownership does not suppress provider initialization. Operational
Terraform commands still require the caller’s real provider configuration
and the owning Vault/AppRole prerequisites. In particular, the pinned
RouterOS provider probes its configured API even when no DNS records are
enabled. Use the provider-free normalizer for offline inspection.
The migration runbook
owns cutover, import, and rollback ordering. This module supplies no provider
credentials or state backend.
The input contains exactly one records object. Each stable logical key
contains one or more scalar type members and a nonempty dsp list. Supported
destinations are global, dc1, and all; repeated destinations are deduplicated.
| Type | Required member fields | Default TTL |
|---|
| A | name, address | 300 |
| AAAA | name, address | 600 |
| CNAME | name, target | 600 |
| NS | name, address | 300 |
| MX | name, target, priority | 300 |
| TXT | name, content | 300 |
Every member accepts an integer ttl from 60 through 86400 seconds. MX
priorities range from 0 through 65535. Multiple scalar values at the same
name and type use distinct logical keys; changing values never changes
resource identity. Unsupported fields and malformed members are rejected.
Names accept @, relative names, or zone-qualified names. Absolute owner
names ending with a dot must be inside the zone. CNAME, MX, and NS targets
accept @, relative names, zone-qualified names, or absolute external names
ending with a dot. Normalization lowercases domain names and omits final dots;
address and TXT bytes are preserved. relative_name is @ at the apex.
normalized_records maps logical_key/type/view to key, name,
relative_name, type, value, priority (null except MX), ttl, view,
and proxied (always false). This output remains available while disabled.
The same keys index module.global.cloudflare_dns_record.records and
module.dc1[0].routeros_ip_dns_record.records in the combined entrypoint; the global-only
entrypoint uses cloudflare_dns_record.records. import_addresses exposes
these addresses relative to the selected module, including while staged.
The pinned providers import Cloudflare
records by zone_id/record_id and RouterOS records by static IDs such as *1A.
Terraform tests use mocked providers and pinned local provider packages.
The global-only test root has no RouterOS provider dependency. Normalization
tests require no providers. Both run without network access;
they establish declaration and resource mapping behavior, not live adoption.
2.1 - DNS normalization
Provider-free canonical DNS declaration transformation
This child module owns the canonical transformation described by the
DNS module. Its document and zone inputs produce
normalized_records without a provider, backend, or managed resources.
Terraform writers and provider-free inspection consume this output.
2.2 - DNS test providers
Pinned provider packages for offline Terraform tests
The test target uses the public
rules_terraform wrapper with
the same Cloudflare, RouterOS, and Proxmox provider labels as infrastructure
targets. The shared extension owns provider versions, release URLs, and
checksums. Bazel fetches the declared archives before tests execute; Terraform
uses the wrapper’s packaged filesystem mirror without a registry fallback.
Each regression runs Terraform in a caller-owned temporary module directory.
Tests retain an explicit environment without inherited provider credentials;
provider installation and mocked lifecycles require no network access.
The targeted import regression matches the owning Proxmox provider block by
omitting pm_api_url. It checks both empty state and existing Proxmox resource
state with no credentials. Without PM_API_URL, provider validation fails
before target pruning; supplying only a loopback endpoint permits the DNS
operation. The endpoint must receive zero requests.
The test imports a built-in Terraform resource through a root map into
module.dns, checks the exact no-op import, applies that saved plan, and verifies
the next targeted plan has no changes. Existing Proxmox resource attributes
remain unchanged. An untargeted control must fail authentication before
contacting the endpoint. These checks cover provider selection and state
preservation; live DNS adoption retains its separate inventory and plan checks.
2.3 - Global DNS records
Cloudflare-only entrypoint for canonical DNS declarations
Global-only owners use this entrypoint with the shared module API
to avoid requiring RouterOS configuration. The combined module also delegates
its Cloudflare resources here, so both entrypoints share one implementation.
Normalization returns all declared views, but this entrypoint owns only global
records. Mixed-view owners use the parent module to manage dc1 as well.
Enabled global records use the explicit cloudflare_zone_id when supplied.
Otherwise, the pinned cloudflare_zone data source resolves the configured
zone name and rejects missing or ambiguous matches. This requires zone-list
and zone-read access in addition to record permissions. Disabled ownership and
declarations without global records perform no zone lookup.
The optional zone ID must be known during planning so Terraform can select
whether discovery is needed. The repository’s AL injection supplies a known
value or an empty string before Terraform starts. Zone-name discovery uses the
normalizer’s canonical name, including case and final-dot handling.
import_addresses contains global addresses relative to this entrypoint.
record_ids exposes bound Cloudflare IDs for adoption and identity checks.
3 - OpenSpec
3.1 - Specifications
3.1.1 - Dns records
3.1.1.1 - dns-records Specification
Purpose
Provide one canonical DNS transformation for project-local Terraform resources
and offline inspection, preserving declared names, values, and view ownership.
Requirements
Requirement: Normalize canonical declarations without providers
The module SHALL accept decoded owner DNS documents and a zone, flatten every
supported type member, expand and deduplicate destinations, and expose one
normalized map without provider configuration. It SHALL reject unsupported
types, destinations, malformed members, and absolute names outside the zone.
Scenario: One logical declaration has several types and destinations
- WHEN an entry contains A and AAAA with destinations all and global
- THEN normalization produces exactly four records, one per type and view
Requirement: Preserve record multiplicity and stable identities
Normalized and provider resource keys SHALL use logical declaration key, type,
and view without mutable record values. Separate logical keys SHALL preserve
multiple records at the same name and type, including MX priority and TXT values.
Explicit TTLs SHALL override the type-specific compatibility defaults.
Scenario: A record changes address
- WHEN an A member changes its address without changing its logical key
- THEN its normalized and provider resource keys remain unchanged
Requirement: Keep provider ownership explicit
The module SHALL accept provider instances from its caller and create individual
Cloudflare global and RouterOS dc1 records only when explicitly enabled. It SHALL
default to disabled provider ownership while preserving normalized outputs.
Cloudflare records SHALL remain unproxied.
Disabled ownership SHALL NOT imply that operational provider initialization
or credential prerequisites are suppressed.
Scenario: A root prepares a future migration
- WHEN a root calls the module without enabling ownership
- THEN it declares no provider record resources and still exposes every normalized declaration
3.1.2 - Project dns
3.1.2.1 - project-dns Specification
Purpose
Record the retirement of this project’s landing DNS infrastructure while
preserving its repository documentation and builds.
Requirements
Requirement: Keep landing infrastructure retired
The project SHALL have no dedicated landing DNS declaration, Terraform root, or
operational source export. Its landing page SHALL be published by the main site
under /projects/tf_modules/ instead of a dedicated hostname.
Scenario: Inspect the project after landing retirement
- WHEN the project tree is consumed
- THEN it contains no landing DNS declaration, Terraform DNS stage, or
landing build target, and the main site owns its landing page.
3.1.3 - Project tf modules
3.1.3.1 - Reusable Terraform modules
Purpose
Provide reusable infrastructure declarations for Vault, virtual machines,
storage, and related services. This baseline was observed at repository
revision 550d7e79 on 2026-09-08. The collection remains in progress according
to its README. Sources for the
representative module contracts below are the
AppRole module,
transit-key module,
backup-bucket module, and
module packaging.
These are declarative source contracts; no live provisioning is asserted.
Requirements
Requirement: Package reusable module source
The AppRole, transit-key, backup-bucket, and Proxmox VM module packages SHALL
each expose their main.tf through a same-named Bazel filegroup available to
repository subpackages.
Scenario: A repository target consumes a module
- WHEN a target depends on
//projects/tf_modules/vault_approle:vault_approle - THEN its declared source input includes the AppRole module’s
main.tf
Requirement: Associate AppRoles with Vault identities and policies
The AppRole module SHALL declare an identity entity, backend alias, internal
group, and named AppRole with configurable token and secret-ID limits. Its
role policies SHALL combine the shared and AppRole-secret policies with caller
policies and the Yandex-folder policy unless that policy is disabled for the role.
Scenario: Caller disables the Yandex-folder role policy
- WHEN
disable_yc_folder_policy is true - THEN the role’s policy list excludes the module’s Yandex-folder policy while preserving shared, AppRole-secret, and caller policies
Requirement: Separate transit encryption and decryption membership
The transit-key module SHALL declare a named Vault transit key, an encryption
policy and group, and a decryption policy and group. Decryptor member groups
SHALL also be included in the encryption group.
Scenario: A group is listed as a decryptor
- WHEN a caller adds a group ID to
decryptors_member_group_ids - THEN the module includes that group in both transit permission groups
Requirement: Declare encrypted versioned backup storage
The backup-bucket module SHALL declare a versioned Yandex storage bucket with
default KMS encryption, grant read and write permissions to the supplied
service accounts, and store bucket identifiers in the caller-selected Vault
KV v2 location.
- WHEN the caller supplies the bucket name components, folder, service accounts, and Vault destination
- THEN the declarations bind bucket encryption to the module’s KMS key and publish the bucket ID, folder ID, and bucket name to that Vault destination
4 - Pve vm qemu
Create a proxmox vm
5 - Terraform backend
Module that sets up an S3 terraform backend
6 - TrueNAS dataset
Creates a protected child dataset and its private account ownership from
parent and config. The module owns lz4 compression, atime OFF, owner-only NFSv4 ACLs and inherited encryption. Owner defaults to root; copies
follow the parent and quota is unset unless overridden. Set traverse = true for a shared traversal parent.
The caller supplies the provider and deployment authorization.
Optional smb creates a non-browsable, authenticated DEFAULT_SHARE after
filesystem ACLs are applied. A share ACL allows only its owner and MODIFY
delegates. Its name defaults to the dataset child name; hosts
restricts access to those clients and denies everyone else when nonempty.
Global SMB transport encryption remains the NAS root’s responsibility.
See the runner configuration
for a complete consumer. That AppRole project has its own state and targets.
No separate owner lookup, permission resource or share resource is needed.
Passing a parent module’s name establishes ordering. This module does not create
missing ancestors or accept nested paths as child names.
access grants named accounts MODIFY (inherited) or TRAVERSE (this path only).
Traversal-only accounts cannot connect to the dataset’s SMB share. Named owner
access is inherited so files created by delegates remain accessible to the owner.
MODIFY ACL changes apply recursively within this dataset, without crossing child
dataset mounts. The parent namespace owner must separately allow traversal to
reach a shared child; the AppRole storage project owns that grant for the runner cache.
7 - Vast.ai ComfyUI instance module
Provision a loopback ComfyUI runtime with authenticated HTTPS
This module composes the base rental
with the native Vast ComfyUI service at 127.0.0.1:18188. Supply a reviewed
vastai/comfy image. It forwards access, credential, offer, storage and connection
interfaces, retaining SSH-only access by default. workspace_directory defaults
to /workspace and is exported before native workspace initialization. For
example, /srv/imagegen places the bundled application at /srv/imagegen/ComfyUI.
Paths must be absolute and contain no traversal, whitespace or shell syntax.
Changing this boot setting is a provisioning change, not a migration of existing
models, uploads or outputs.
Terraform owns rental constraints, the initial restrictive runtime and access
bootstrap. It does not install model files, LoRAs, node packs, Python dependencies,
first-party sources or workflows. Use the shared
comfyui_tools Ansible role
for those inputs and subsequent updates without changing paid-instance startup.
The generic base retains its native provisioner interface for the separate Forge
consumer; this wrapper supplies an empty application manifest.
ComfyUI initially uses --disable-all-custom-nodes --offline; Manager and
partner API nodes are disabled, no wildcard CORS flag is supplied, and the
frontend receives ComfyUI’s restrictive offline Content-Security-Policy.
Ansible appends the installed node directories to its whitelist and manages the
COMFYUI_ARGS line in /etc/environment, marked # imagegen-ansible. Boot
preserves that marked line; otherwise it supplies the restrictive defaults.
These controls limit exposure and are not an outbound firewall.
The bundled API wrapper stays on loopback 127.0.0.1:18288, included in the
local portal inventory but never routed by the public proxy. Portal, Jupyter
and TensorBoard remain local; tunnels, synchronization and workers remain disabled.
Only the dedicated TLS and Basic-auth proxy is published in exposed mode.
module "imagegen" {
source = "../../../projects/tf_modules/vastai_instance_imagegen_comfyui"
image = "vastai/comfy:v0.44.0-cuda-12.9-py312"
workspace_directory = "/workspace"
}
runtime.json owns the baseline service, arguments, model-directory map and
application name. The deployment passes that map to Ansible, selecting
models/checkpoints for SDXL all-in-one checkpoints and the default
models/diffusion_models for standalone denoisers. LoRAs use models/loras,
ControlNet uses models/controlnet, and other kinds retain their declared paths.
The separate ephemeral evaluator also consumes this declaration; its evaluation
lifecycle continues to own its native provisioner recipe.
Vast’s source
owns the image boot contract. ComfyUI’s native arguments
own offline and node behavior. Offline Terraform fixtures cover both access
modes, alternate workspace validation, empty application provisioning and
proxy/forwarding ports. Actual image boot and GPU generation require separately
authorized live acceptance.
8 - Vast.ai Forge instance module
Native Forge settings on the shared image-generation rental
This module composes the base rental
with the native Vast Forge service at 127.0.0.1:17860. Supply a reviewed Forge
image through image. It forwards the base’s access, credential, offer, storage,
and connection interfaces, retaining SSH-only access by default.
Model kinds map below /workspace/stable-diffusion-webui-forge:
| Kind | Directory |
|---|
checkpoint | models/Stable-diffusion |
lora | models/Lora |
vae | models/VAE |
embedding | embeddings |
text_encoder | models/text_encoder |
Optional model_selection selects a declared checkpoint, native preset,
encoder/VAE modules, integer steps and cfg_scale. Native JSON config sets
both global and preset-specific keys through --ui-settings-file. Omitting it
preserves the image defaults. These creation-time settings replace a rental.
Consumers previously using the base’s Forge-specific interface must change
source to this wrapper. A live instance gains a nested module.imagegen state
address and requires an explicitly reviewed migration or replacement; changing
source is not authorization to perform either. The personal consumer’s previous
rental was destroyed before this refactor.
module "imagegen" {
source = "../../../projects/tf_modules/vastai_instance_imagegen_forge"
image = var.forge_image_reference
}
9 - Vast.ai image generation instance module
Shared Vast rentals with SSH-only or password-protected HTTPS access
This module rents one GPU with at least 32 GiB VRAM, using a caller-selected Vast-native image.
The default mode is ssh_only; exposed publishes the application through HTTPS and a
caller-supplied username/password. The caller supplies provider authentication
and secure state. The image-generation infrastructure project
generates and stores its login in Vault before creating the paid instance.
Building and testing these definitions does not deploy or rent capacity.
The shared offer declaration caps both download and upload transfer rates at
USD 0.04/GB, in addition to hourly-price and host requirements. The evaluator
inherits these same predicates; it does not maintain a second bandwidth policy.
Runtime modules
Use the Forge wrapper or
ComfyUI wrapper for application
configuration. This base owns offer selection, rental lifecycle, authentication,
and the native download manifest. Runtime wrappers own model directories,
loopback arguments, optional JSON configuration and local portal entries.
No image discovery or registry lookup runs during Terraform planning. The caller
selects an explicit published image tag; changing it replaces an existing rental.
The base supplies a plain startup script and opts into the provider’s gzip
transport. The provider owns encoding and the 16,384-byte API command limit;
the selected Vast images provide the required shell utilities.
By default no template_hash_id is sent, avoiding the stock template’s public
ports and unrelated provisioning configuration. Configure model_downloads for
automatic first-boot downloads rather than editing a public template.
An optional reviewed Vast-native template_hash_id can provide environment
settings, including model provisioning. Copy and review it first, removing
all Docker flags except literal -e NAME=value or --env NAME=value assignments.
Missing/malformed metadata, published ports, host networking, and other Docker
flags fail closed. The explicit image overrides the template image. Credentials
must never be stored in a saved/public template. Mutable scripts/URLs and
arbitrary extensions remain trusted code, outside the network guarantees below.
Access and local services
| Mode | Public application access | Authentication |
|---|
ssh_only (default) | No web port requested; Caddy disabled | Vast account SSH key and forwarding |
exposed | Only application proxy, container 7860/tcp | TLS plus HTTP Basic username/password |
Each wrapper fixes its application listener to loopback in both modes. Local tools are retained:
Instance Portal at 127.0.0.1:11111, Jupyter at 127.0.0.1:18080, and TensorBoard
at 127.0.0.1:16006. Access them through SSH forwarding to the corresponding
internal port. They are not published by the proxy. These local management
interfaces can provide unauthenticated shell/file access, so only trusted local
processes and SSH users belong on this instance.
Cloudflare tunnel management, Syncthing (including outbound relays), and the
serverless worker are disabled. Other bundled services retain their native defaults. The inspected ComfyUI image declares diagnostic 3000/tcp in its Docker metadata;
the instance test runner is explicitly disabled and no publish-all flag is used. The module requests only the SSH service, plus
-p 7860:7860 in exposed mode. Verify actual listeners during live acceptance;
reviewed provisioning code can still start additional listeners or outbound traffic.
Exposed mode requires web_password with 32–64 alphanumeric characters and a
web_username starting with a letter and containing letters, digits, or underscores
(maximum 64 characters). Generate a random password in the caller. The restricted
alphabet prevents shell substitution. The dedicated proxy hashes the password
with bcrypt, authenticates every path, and has no portal, URL-token/cookie bypass,
plaintext redirect, access log, or Caddy admin API. HTTP/3 is disabled. Missing
or invalid TLS files fail proxy startup instead of falling back to plaintext.
It uses the selected image’s bundled Caddy, not an additional downloaded proxy.
Portal/CLI auto-updates are disabled so boot uses the selected image’s bundled
services. Startup controls service exposure; it is not an outbound firewall or a
privacy audit of arbitrary application code and extensions. Credentials occur
in sensitive onstart, are sent to Vast, and remain in Terraform state/history.
There are no password outputs; restrict the Vault-backed state accordingly.
Compose
Compose a runtime wrapper rather than configuring the low-level runtime contract
here. Package its filegroup in the consuming Terraform target’s data, and select
//projects/vastai_terraform_provider:provider. Both wrappers forward the base’s
rental inputs and connection outputs. No Vault resources belong in these shared
modules; callers generate and persist their own login before rental creation.
Offer selection requests one verified datacenter NVIDIA GPU, an amd64 host with
CUDA 12.9 compatibility, at least 32 GiB VRAM, 99% reported reliability, 100 GB disk
by default, and one direct port for SSH or two for SSH plus HTTPS. Vast calls its
certified tier Secure Cloud (Datacenter).
The returned offer must confirm hosting_type=1 and verification=verified;
missing tier data, insufficient memory, and excessive hourly price are rejected.
There is no fallback to community hosts or smaller GPUs. min_gpu_ram_gb can
raise the floor. offer_id retains all constraints.
The default USD 1/hour ceiling includes requested disk; it does not cap transfer
charges, continuing storage, or total duration. Marketplace changes do not replace
an existing contract, but each normal plan rechecks availability; an empty eligible
market can block planning. Mode, credentials, image, template, startup, or disk
changes replace the instance. Export wanted images before replacement/destruction.
Model downloads
model_downloads is a list of {url, filename, kind} objects. The URL must be
public HTTPS without embedded credentials; filenames end in .safetensors and
cannot traverse directories. kind selects a directory supplied by the runtime wrapper. The base validates
public URLs, filenames, uniqueness and the presence of a destination for each
kind; it contains no application-specific paths.
Startup writes a local JSON/YAML-compatible manifest and passes it to Vast’s
native provisioner.
The native application launcher waits while /.provisioning exists. Provisioning
runs on the rented machine and downloads to its billable local storage; there
is no model cache preserved after destruction. An empty list downloads no
configured models. SCP/SFTP remains available for manual file transfer.
This interface currently supports public files; do not put gated-model tokens
in URLs or source. Gated downloads need a separately configured Vault-backed
HF_TOKEN/CIVITAI_TOKEN injection. Review model licenses and required space.
Connect and certificates
Configure account SSH public keys before renting. Creation only acknowledges a
contract. After boot, refresh through the caller’s owning workflow. The
ssh_forward_command remains null until SSH details are observed; run it locally
and open local_url (default http://127.0.0.1:7860). Both forwarding endpoints
bind loopback, using the caller’s SSH agent/normal identity configuration.
In exposed mode, https_url remains null until refresh reports both public IP
and the actual mapped 7860/tcp host port. It does not establish application
readiness.
Certificates
The proxy uses /etc/instance.crt and /etc/instance.key. Follow
Vast’s certificate guidance
and verify issuer/fingerprint through a trusted channel before entering the login.
Do not disable TLS validation or blindly bypass warnings. No DNS or publicly
trusted domain certificate is configured by this module.
Privacy
Applications run on the rented machine; output files and prompt/image metadata
may persist locally. Extensions and provisioning code may access them and make
network requests. This module adds no prompt-sharing service. Runtime-specific
controls are described by each wrapper; none establish confidentiality from the
host administrator or a no-training commitment for the complete stack.
Vast’s privacy policy covers account/website processing.
Certified datacenter status does not prevent the host administrator accessing the
workload. See the infrastructure project’s privacy boundary
for host trust and retention limits. Stopping retains billable storage; export
wanted files before destruction. This project cannot verify physical erasure or
exclude host-made copies.
Validation
bazel test //projects/tf_modules/vastai_instance_imagegen:all
bazel test //projects/vastai_terraform_provider/test/acceptance:acceptance_test
The base and both wrappers run through pinned Terraform/provider against a loopback API
fixture: both modes, unsafe templates/credentials, memory/tier rejection, sensitive
output, replacement, and mapped URLs. imagegen-lifecycle.json and
imagegen-https.json are repeatable undeclared test outputs. No GPU is rented.
Actual image boot, TLS/authentication, management-service bindings, model loading,
and image generation remain unverified without a scoped live acceptance run.
The common offer filters are declared once in offer_defaults.json; callers add
their hardware, storage, port and price bounds. The ephemeral evaluator reuses
those filters and the same startup.sh.tftpl through pure template compilation.
Terraform still owns this module’s regular rental lifecycle; it does not own
evaluation resources.
10 - Vast.ai team module
Team and project API-key composition with caller-owned authentication
This module declares one Vast.ai team and a map of project API keys through the
in-tree provider. It declares no compute or Vault resources. The caller selects
the provider and owns state and secret storage. Generated key outputs are
sensitive and belong directly in secret resources.
A new team receives zero credits. Its project keys use the management key
generated during the same apply. Existing module resource addresses and outputs
remain unchanged; upgrading a managed team requires no state migration.
For an existing owned team, import its numeric account ID into the module’s
vastai_team.team resource before applying keys. Import reads identity without
creating a team or recovering an old secret. Imported teams have no management
key, so project keys use the caller’s configured provider and the imported team
ID. This binding requires permissions = "" for default full access. There is
no separate existing-team input or ownership mode.
provider "vastai" {
alias = "issuer" # VAST_API_KEY is injected from Vault.
}
module "alwaldend" {
source = "../../../projects/tf_modules/vastai_team"
providers = { vastai = vastai.issuer }
name = "alwaldend"
api_keys = {
rentals = { name = "infra_vastai_alwaldend", permissions = "" }
}
}
Use the owning root’s packaged import command with address
module.alwaldend.vastai_team.team and the verified account ID. If another
Terraform address or state already owns that team, migrate that ownership
instead of importing a duplicate. A plan for an imported team must show no team
creation or replacement. Imported team destruction is refused; cleanup can
revoke the declared project keys without deleting the existing team.
The provider verifies the generated key’s team selection before returning its
sensitive value. Rejected selection fails apply and leaves a tracked key for
explicit cleanup. Instantiate this module with for_each for multiple teams.
Vault identity and destination paths belong to the caller; the module grants no
Vault permissions.
Terraform CLI fixtures verify managed bootstrap, imported-team key creation,
rejected activation and scoped input, unchanged plans and addresses, and key
cleanup while preserving imported teams. They require no live account. Live
alwaldend activation remains blocked by the recorded HTTP 400 response.
11 - Vault approle
Create a vault approle
By default the member group grants AppRole bootstrap permissions. The role’s
own KV namespace policy stays on the role token. Set
allow_member_secret_access = true for a personal role whose human members
should also access that namespace directly, including through Vault’s UI.
This reuses the existing namespace policy and group; other roles retain the
default bootstrap-only member permissions.
Opted-in roles also receive list-only permissions on exact metadata ancestors
so the UI can navigate from the mount root. Those listings reveal folder names;
they grant no secret-value access outside the role’s own namespace.
12 - Vault approle
Create a vault approle
13 - Vault OIDC provider
Vault OIDC provider
14 - Vault pki server
Create a pki config for a server
allowed_domains defines permitted certificate names. allow_subdomains
defaults to true for existing consumers; set it to false to permit only
the explicitly listed names. EAB access is granted through
eab_new_member_group_ids for the role-scoped ACME directory.
15 - Vault ssh server role
Create an ssh role for a server
16 - Vault transit key
Vault transit key
Links
17 - Yc folder
Folder for Yandex Cloud