@intentius/terragucci 0.4.7 → 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/estate.schema.json +1 -0
- package/dist/inventory.schema.json +1 -0
- package/dist/notify.schema.json +62 -56
- package/dist/report.schema.json +25 -3
- package/dist/run.schema.json +1 -1
- package/dist/terragucci.mjs +763 -668
- package/dist/terragucci.mjs.map +4 -4
- package/dist/terragucci.schema.json +527 -8
- package/dist/types.d.ts +126 -6
- package/package.json +6 -6
package/dist/types.d.ts
CHANGED
|
@@ -2,7 +2,15 @@ import { type GenerateSettings } from "./generate-config";
|
|
|
2
2
|
export { ROOTS_NOT_ATMOS, ROOTS_NOT_TERRAGRUNT, SYNTH_DRIFT_PR, SYNTH_DRIFT_PR_SHORT, SYNTH_GENERATE, SYNTH_ROLLOUTS } from "./refusals";
|
|
3
3
|
export declare const BINARIES: readonly ["terraform", "tofu", "choudoufu"];
|
|
4
4
|
export declare const FORGES: readonly ["github", "gitlab", "forgejo"];
|
|
5
|
-
export declare const GATES: readonly ["always", "on-
|
|
5
|
+
export declare const GATES: readonly ["always", "on-destructive", "never"];
|
|
6
|
+
/** Older spellings of a gate policy, still accepted from terragucci.yml and --gate: `on-destroy` is `on-destructive`. */
|
|
7
|
+
export declare const GATE_ALIASES: {
|
|
8
|
+
readonly "on-destroy": "on-destructive";
|
|
9
|
+
};
|
|
10
|
+
/** Every gate name terragucci accepts: the policies and their older spellings. */
|
|
11
|
+
export declare const GATE_NAMES: readonly GateName[];
|
|
12
|
+
/** The policy a gate name means, or undefined when it names none. */
|
|
13
|
+
export declare function normalizeGate(v: unknown): Gate | undefined;
|
|
6
14
|
/**
|
|
7
15
|
* What counts as the approval of a waiting wave (`approval:`). `ledger` (the
|
|
8
16
|
* default): any `chant approve` of the wave's set digest on chant/lifecycle,
|
|
@@ -43,6 +51,8 @@ export declare const APPLY_REQUIRES: readonly ["approved", "mergeable", "undiver
|
|
|
43
51
|
export type Binary = (typeof BINARIES)[number];
|
|
44
52
|
export type ForgeName = (typeof FORGES)[number];
|
|
45
53
|
export type Gate = (typeof GATES)[number];
|
|
54
|
+
/** A gate as terragucci.yml or --gate may spell it: a policy, or an older name for one. */
|
|
55
|
+
export type GateName = Gate | keyof typeof GATE_ALIASES;
|
|
46
56
|
export type Approval = (typeof APPROVALS)[number];
|
|
47
57
|
/**
|
|
48
58
|
* `gitlab.token`: how a GitLab project keeps its forge token. `unprotected`
|
|
@@ -120,6 +130,14 @@ export interface ApplySettings {
|
|
|
120
130
|
* here matches. Plain roots only, with `when: merge`.
|
|
121
131
|
*/
|
|
122
132
|
branches?: Record<string, string[]>;
|
|
133
|
+
/**
|
|
134
|
+
* The workspace decision point every wave gate asks instead of waiting for
|
|
135
|
+
* `terragucci approve` (chant's "A gate that asks a decision point"). The
|
|
136
|
+
* point declares `gate.planDigest`, so each plan is its own question, and
|
|
137
|
+
* its deciders and quorum decide. Read at base, like `approval:`, which
|
|
138
|
+
* stays `ledger`.
|
|
139
|
+
*/
|
|
140
|
+
point?: string;
|
|
123
141
|
}
|
|
124
142
|
/**
|
|
125
143
|
* Policy as code, off unless set. `tf-plan` runs the engine over each planned
|
|
@@ -164,8 +182,12 @@ export interface OidcSettings {
|
|
|
164
182
|
* does this.
|
|
165
183
|
*/
|
|
166
184
|
roles?: Record<string, RolePair>;
|
|
167
|
-
/**
|
|
168
|
-
|
|
185
|
+
/**
|
|
186
|
+
* The AWS token's audience. Default `sts.amazonaws.com`. A map gives each
|
|
187
|
+
* stage its own (`plan`, `apply`, `drift`); a stage it leaves out keeps the
|
|
188
|
+
* default.
|
|
189
|
+
*/
|
|
190
|
+
audience?: string | Partial<Record<AudienceStage, string>>;
|
|
169
191
|
/** GCP Workload Identity Federation: the provider's resource name and a service account per stage. */
|
|
170
192
|
gcp?: {
|
|
171
193
|
workload_identity_provider: string;
|
|
@@ -352,8 +374,8 @@ export interface ProjectSettings {
|
|
|
352
374
|
forge?: ForgeName;
|
|
353
375
|
/** Where the project lives, for a forge not on https or the default port. */
|
|
354
376
|
url?: string;
|
|
355
|
-
/** When a wave waits for an approval. */
|
|
356
|
-
gate?:
|
|
377
|
+
/** When a wave waits for an approval. A loaded config holds the policy's current name: on-destroy reads as on-destructive. */
|
|
378
|
+
gate?: GateName;
|
|
357
379
|
/** What counts as a waiting wave's approval; see APPROVALS. Read from the config at base, never the applied commit's own. */
|
|
358
380
|
approval?: Approval;
|
|
359
381
|
/** When a change applies; see ApplySettings. */
|
|
@@ -490,6 +512,8 @@ export interface ProjectSettings {
|
|
|
490
512
|
atmos?: AtmosSettings;
|
|
491
513
|
/** Opt-in policy checks over each plan; see PolicySettings. */
|
|
492
514
|
policy?: PolicySettings;
|
|
515
|
+
/** The module and provider sources a root may use, checked before init; see SourcesSettings. Off when absent. */
|
|
516
|
+
sources?: SourcesSettings;
|
|
493
517
|
/**
|
|
494
518
|
* `atlantis plan` and `atlantis apply` comments read as `/terragucci plan`
|
|
495
519
|
* and `/terragucci apply`. Off by default. The alias changes the words
|
|
@@ -525,6 +549,54 @@ export interface ProjectSettings {
|
|
|
525
549
|
own_jobs?: string | Record<string, Record<string, unknown>>;
|
|
526
550
|
/** Roots each pull request gets a copy of, under a state key of its own, destroyed on close or once its TTL passes; see EphemeralSettings. */
|
|
527
551
|
ephemeral?: EphemeralSettings;
|
|
552
|
+
/**
|
|
553
|
+
* Named environments: each names its roots by glob and sets the keys that
|
|
554
|
+
* vary for them (./environments.ts). A root in no environment takes the
|
|
555
|
+
* top-level values. Read at base, like `gate`. A control repo's `defaults`
|
|
556
|
+
* and project blocks merge them per environment name.
|
|
557
|
+
*/
|
|
558
|
+
environments?: Record<string, EnvironmentSettings>;
|
|
559
|
+
}
|
|
560
|
+
/** An environment's name: lower-case letters, digits, `-` and `_`. */
|
|
561
|
+
export declare const ENVIRONMENT_NAME: RegExp;
|
|
562
|
+
/** The keys an environment takes. */
|
|
563
|
+
export declare const ENVIRONMENT_KEYS: readonly ["roots", "gate", "oidc", "runner", "parallelism", "forge_environment"];
|
|
564
|
+
/** The keys of an environment's `oidc`. */
|
|
565
|
+
export declare const ENVIRONMENT_OIDC_KEYS: readonly ["plan_role", "apply_role", "audience", "gcp", "azure"];
|
|
566
|
+
/**
|
|
567
|
+
* One environment of `environments:`. `roots` are root globs; a root matches
|
|
568
|
+
* at most one environment. Each other key, when set, replaces the top-level
|
|
569
|
+
* key's value for the environment's roots.
|
|
570
|
+
*/
|
|
571
|
+
export interface EnvironmentSettings {
|
|
572
|
+
roots: string[];
|
|
573
|
+
/** The gate of a wave that holds the environment's roots. A wave of roots in several environments takes the strictest of their gates. */
|
|
574
|
+
gate?: GateName;
|
|
575
|
+
/** The environment's identities: its roots plan and apply with them, as `oidc.roles` gives a root glob a pair. */
|
|
576
|
+
oidc?: EnvironmentOidc;
|
|
577
|
+
/** The runner the environment's apply jobs run on: a runner, or `{ apply: <runner> }`. A plan job plans every environment's roots, so it keeps the top-level runner. */
|
|
578
|
+
runner?: RunnerSpec | {
|
|
579
|
+
apply?: RunnerSpec;
|
|
580
|
+
};
|
|
581
|
+
/** How many of the environment's roots of one dependency layer plan at once. */
|
|
582
|
+
parallelism?: number;
|
|
583
|
+
/** The forge environment its apply jobs run in, on GitHub and GitLab. Default: the environment's name. Forgejo has none. */
|
|
584
|
+
forge_environment?: string;
|
|
585
|
+
}
|
|
586
|
+
/** An environment's identities: an AWS role pair, and a GCP service account pair or an Azure client pair under the project's `oidc.gcp` or `oidc.azure`. */
|
|
587
|
+
export interface EnvironmentOidc {
|
|
588
|
+
plan_role?: string;
|
|
589
|
+
apply_role?: string;
|
|
590
|
+
/** The AWS token audience of the environment's apply jobs, over `oidc.audience`. */
|
|
591
|
+
audience?: string;
|
|
592
|
+
gcp?: {
|
|
593
|
+
plan_service_account: string;
|
|
594
|
+
apply_service_account: string;
|
|
595
|
+
};
|
|
596
|
+
azure?: {
|
|
597
|
+
plan_client_id: string;
|
|
598
|
+
apply_client_id: string;
|
|
599
|
+
};
|
|
528
600
|
}
|
|
529
601
|
/**
|
|
530
602
|
* Ephemeral environments: each open pull request gets its own copy of the
|
|
@@ -612,7 +684,7 @@ export declare const BUILT_IN: ResolvedSettings;
|
|
|
612
684
|
* own clone URL and `rollouts` belongs to a single repo, so `defaults`
|
|
613
685
|
* refuses both.
|
|
614
686
|
*/
|
|
615
|
-
export declare const PROJECT_FILE_KEYS: readonly ["policy", "reports", "approval", "gate", "roots", "waves", "parallelism", "synth", "steps", "drift", "cost", "tips", "runtime", "telemetry", "respond", "review", "decide", "audit_region", "modules", "terragrunt", "token_env", "generate", "ephemeral"];
|
|
687
|
+
export declare const PROJECT_FILE_KEYS: readonly ["policy", "sources", "reports", "approval", "gate", "roots", "waves", "parallelism", "synth", "steps", "drift", "cost", "tips", "runtime", "telemetry", "respond", "review", "decide", "audit_region", "modules", "terragrunt", "token_env", "generate", "ephemeral", "environments"];
|
|
616
688
|
export declare class ConfigError extends Error {
|
|
617
689
|
/** Every problem found, when the error is a validation failure. */
|
|
618
690
|
readonly problems?: string[];
|
|
@@ -629,7 +701,13 @@ export declare const RELEASE_VERSION: RegExp;
|
|
|
629
701
|
/** The settings of `notify`, `policy`, `oidc`, `telemetry`, `gitlab`, `cost`, `pass` and `agent`. */
|
|
630
702
|
export declare const NOTIFY_KEYS: string[];
|
|
631
703
|
export declare const POLICY_KEYS: string[];
|
|
704
|
+
export declare const SOURCES_KEYS: string[];
|
|
705
|
+
/** One `sources` entry: a glob with no whitespace, commas, semicolons or quotes. */
|
|
706
|
+
export declare const SOURCE_GLOB = "^[^\\s,;'\"]+$";
|
|
632
707
|
export declare const OIDC_KEYS: string[];
|
|
708
|
+
/** The stages `oidc.audience` takes as a map: the jobs that plan a change, the jobs that apply (confirm among them), and drift. */
|
|
709
|
+
export declare const AUDIENCE_STAGES: readonly ["plan", "apply", "drift"];
|
|
710
|
+
export type AudienceStage = (typeof AUDIENCE_STAGES)[number];
|
|
633
711
|
export declare const TELEMETRY_KEYS: string[];
|
|
634
712
|
export declare const TOKEN_PROTECTION_KEYS: string[];
|
|
635
713
|
export declare const COST_KEYS: string[];
|
|
@@ -666,6 +744,18 @@ export interface ModulesSettings {
|
|
|
666
744
|
/** Write each release as the Terraform module registry protocol, as static files a bucket or a Pages site serves. */
|
|
667
745
|
registry?: RegistrySettings;
|
|
668
746
|
}
|
|
747
|
+
/**
|
|
748
|
+
* `sources`: the module and provider sources a root may use (./sources.ts).
|
|
749
|
+
* A list that is set refuses every source of its kind that no glob in it
|
|
750
|
+
* matches, before `init` downloads anything; a list that is not set checks
|
|
751
|
+
* nothing of its kind. Read at base, as `policy` is.
|
|
752
|
+
*/
|
|
753
|
+
export interface SourcesSettings {
|
|
754
|
+
/** Globs of module sources, as written and without their `?` query, such as `./**` for local paths. */
|
|
755
|
+
modules?: string[];
|
|
756
|
+
/** Globs of provider addresses, such as `hashicorp/*` or `registry.example.com/acme/*`. */
|
|
757
|
+
providers?: string[];
|
|
758
|
+
}
|
|
669
759
|
/** `modules.registry`: the module registry protocol as static files. */
|
|
670
760
|
export interface RegistrySettings {
|
|
671
761
|
/** The bucket the files go to: `s3://<bucket>`, `gs://<bucket>` or `az://<account>/<container>`. */
|
|
@@ -733,6 +823,8 @@ export declare const OWN_JOB_NAME: RegExp;
|
|
|
733
823
|
export declare function ownJobsProblems(v: unknown, where: string): string[];
|
|
734
824
|
export declare const EPHEMERAL_KEYS: string[];
|
|
735
825
|
export declare const APPLY_KEYS: string[];
|
|
826
|
+
/** A decision point's name, as chant's points file declares it. */
|
|
827
|
+
export declare const POINT_NAME: RegExp;
|
|
736
828
|
/** A branch name `apply.branches` may name: what a forge's rule and the job's shell both take as it is. */
|
|
737
829
|
export declare const APPLY_BRANCH: RegExp;
|
|
738
830
|
/** Why `apply.branches` is refused with `apply.when: pull-request`. */
|
|
@@ -758,6 +850,32 @@ export declare const ATMOS_KEYS: string[];
|
|
|
758
850
|
export declare const ATMOS_NOT_TERRAGRUNT = "terragucci runs an Atmos repo or a Terragrunt repo, not both; keep the block of the one this repo is";
|
|
759
851
|
/** The GCP Workload Identity Federation provider's resource name. */
|
|
760
852
|
export declare const WIF_PROVIDER: RegExp;
|
|
853
|
+
/** The apply group of the roots in no environment, or that no glob gives an identity (./groups.ts). */
|
|
854
|
+
export declare const DEFAULT_GROUP = "default";
|
|
855
|
+
/** Names an apply group cannot take: the rest group's, and chant's own job names (decide, share-<i>). */
|
|
856
|
+
export declare const reservedGroupName: (name: string) => boolean;
|
|
857
|
+
/** Why an environment's `runner.plan` is refused: a plan job plans the roots of every environment. */
|
|
858
|
+
export declare const ENVIRONMENT_PLAN_RUNNER = "a plan job plans the roots of every environment, so an environment's runner is its apply jobs' alone; set runner: { apply: <runner> }, and runner.plan at the top level";
|
|
859
|
+
/** A forge environment's name, as GitHub and GitLab both take it. */
|
|
860
|
+
export declare const FORGE_ENVIRONMENT_NAME: RegExp;
|
|
861
|
+
/** Why an environment cannot take a name the apply jobs use for their own. */
|
|
862
|
+
export declare const ENVIRONMENT_RESERVED = "names the apply jobs use for their own (default holds the roots in no environment; decide and share-<n> are a wave's own jobs)";
|
|
863
|
+
/** Why `environments` refuses `apply.when: pull-request`: a comment's one job applies every environment's roots. */
|
|
864
|
+
export declare const ENVIRONMENTS_PR_APPLY = "with environments each environment's roots apply in jobs of their own, with their own identities, and apply.when: pull-request applies every wave in the one job a comment starts; leave apply.when at merge";
|
|
865
|
+
/** Why `environments` refuses `apply.resume` on GitHub and Forgejo: the resume job applies every wave in one job. */
|
|
866
|
+
export declare const ENVIRONMENTS_RESUME = "with environments each environment's roots apply in jobs of their own, and on GitHub and Forgejo the resume job applies every wave in one job; leave apply.resume unset and re-run the waiting wave's job once it is approved";
|
|
867
|
+
/** Why `environments` refuses `ephemeral`: a pull request's copies apply in one job with the apply identities. */
|
|
868
|
+
export declare const ENVIRONMENTS_EPHEMERAL = "with environments each environment's roots apply in jobs of their own, and an ephemeral copy applies in the pull request's one job; leave ephemeral unset";
|
|
869
|
+
/** Why an environment's `forge_environment` is refused on Forgejo. */
|
|
870
|
+
export declare const FORGE_ENVIRONMENT_NOT_FORGEJO = "Forgejo Actions has no deployment environments, so a job cannot run in one; leave forge_environment out of each environment";
|
|
871
|
+
/**
|
|
872
|
+
* What a whole set of environments needs from the settings around it: a
|
|
873
|
+
* root glob in each, and the project's `oidc.gcp` or `oidc.azure` for an
|
|
874
|
+
* environment that names a GCP or Azure pair, since the provider, the tenant
|
|
875
|
+
* and the token come from there. A repo's own file is checked whole in
|
|
876
|
+
* checkSettings; a control repo's project once its defaults are merged in.
|
|
877
|
+
*/
|
|
878
|
+
export declare function environmentNeeds(s: ProjectSettings, where: string): string[];
|
|
761
879
|
/** Check a parsed config and return it typed, or throw with every problem listed. */
|
|
762
880
|
export declare function validateConfig(raw: unknown, where: string): TerragucciConfig;
|
|
763
881
|
export type ConfigMode = "fold" | "run" | "check";
|
|
@@ -781,3 +899,5 @@ export declare function forgeFromHost(host: string): ForgeName | undefined;
|
|
|
781
899
|
export declare function resolveRepo(config: TerragucciConfig): ResolvedSettings;
|
|
782
900
|
/** A control repo's project: built-in defaults, then `defaults`, then the project's own keys. */
|
|
783
901
|
export declare function resolveProject(config: TerragucciConfig, key: string): ResolvedSettings;
|
|
902
|
+
/** `environments` merged per environment name: an environment both name takes `over`'s keys over `base`'s. */
|
|
903
|
+
export declare function mergeEnvironments(base: Record<string, EnvironmentSettings> | undefined, over: Record<string, EnvironmentSettings> | undefined): Record<string, EnvironmentSettings> | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/terragucci",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "The whole Terraform lifecycle, handled: one config file, generated pipelines for GitHub, GitLab and Forgejo.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"build": "node ../../scripts/build-cli.mjs"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@intentius/chant": "0.
|
|
37
|
+
"@intentius/chant": "0.124.24"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
40
|
"@intentius/tsad-reference": "2.x",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@cdktn/hcl2json": "0.24.0",
|
|
53
|
-
"@intentius/chant-lexicon-forgejo": "0.
|
|
54
|
-
"@intentius/chant-lexicon-github": "0.
|
|
55
|
-
"@intentius/chant-lexicon-gitlab": "0.
|
|
56
|
-
"@intentius/chant-lexicon-terraform": "0.
|
|
53
|
+
"@intentius/chant-lexicon-forgejo": "0.124.24",
|
|
54
|
+
"@intentius/chant-lexicon-github": "0.124.24",
|
|
55
|
+
"@intentius/chant-lexicon-gitlab": "0.124.24",
|
|
56
|
+
"@intentius/chant-lexicon-terraform": "0.124.24",
|
|
57
57
|
"@intentius/tsad-reference": "2.1.0",
|
|
58
58
|
"@modelcontextprotocol/sdk": "1.30.1"
|
|
59
59
|
}
|