Repository navigation
feat: shared cluster in previews-shared scopes secrets per env - #27
Merged
Merged
Conversation
SHARED_ENVS=true (set from the cluster's shared output) names every tenant role env.tenant and binds it to an entity carrying env and tenant metadata. Tenant policies then scope KV to envs/<env>/customers/<tenant> and the broker policies to the app's own env, which the cluster function writes on the app entity. Provisioning and apps-auth gain narrow identity grants with policies refused. Unshared clusters render the 0.1.x policies byte for byte (pinned by goldens). vault-utils: tenants create/destroy take --env (required when shared, refused otherwise), tenants list shows the env, new envs list/destroy, and env prints SHARED_ENVS from the workspace output.
aws-ec2-vault-cluster 0.2.0: output shared (env_name == previews-shared), SHARED_ENVS in user-data, vault-admin ~> 0.3.0. aws-vault-access 0.3.0: passes the app env to the function and injects VAULT_ENV when the cluster is shared; empty otherwise.
Cluster: where each tenant's secrets live, how tenant tokens are scoped, and what apps and humans can do in both modes. Access: the two-step login, token lifetimes, and gotchas. .gitignore now keeps module READMEs.
shared = data.ns_env.this.type == "PreviewsSharedEnv".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets one cluster serve every Nullstone preview env while keeping their secrets apart. Nothing changes for a cluster that is not shared.
Shared mode
The cluster decides:
aws-ec2-vault-clustersetsshared = data.ns_env.this.type == "PreviewsSharedEnv", exposes it as outputshared, and writesSHARED_ENVSinto user-data. Everything else reads that one value. When true:<env>.<tenant>on the same two AppRole mounts, each bound to an identity entity carryingenvandtenantmetadata. Provisioning creates the entity and its alias on the role'srole_id.kv/<family>/envs/{{entity.env}}/customers/{{entity.tenant}}/*with the wholeenvs/prefix denied otherwise.auth/approle-<kind>/role/{{entity.env}}.*with every parameter denied: an app mints logins only for its own env and cannot change a role. The env comes from the entity the cluster function writes on the app role (feat: bind app roles to an env-scoped entity on shared clusters vault-admin#6).policiesanddisabledrefused; groups, OIDC, MFA, and merge stay denied.Unshared clusters render the 0.1.x policies byte for byte. Goldens under
testdata/policies/unsharedpin that;testdata/policies/shareddocuments the shared output.Modules
aws-ec2-vault-cluster0.2.0: outputshared,SHARED_ENVSin user-data, pinsvault-admin ~> 0.3.0.tofu initon this module fails until vault-admin v0.3.0 is published; the tests here ran against 0.2.2 with the pin swapped locally.aws-vault-access0.3.0: reads the cluster'ssharedoutput (try(..., false), so 0.1.x clusters read as unshared), passesenvto the function only when shared, injectsVAULT_ENV(always present, empty when unshared)..gitignorenow keepsaws/*/README.md.CLI
tenants create|destroytake--env, required when shared and refused otherwise.tenants listshows the env and flags a role that does not fit the cluster mode.envs listandenvs destroy <env> --yes [--purge-secrets].vault-utils envprintsSHARED_ENVS=truefor a shared cluster.Tests
SharedEnvs=false.tofu testin both modules covers shared, unshared, and a cluster with nosharedoutput.denied_parametersbehaviors before the design was committed.Release order
aws-ec2-vault-cluster0.2.0 with--include='templates/*'andaws-vault-access0.3.0.