@mark1russell7/stack-tofu 0.0.0-stage → 0.1.2
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/LICENSE +21 -0
- package/README.md +421 -2
- package/build/add-on.d.ts +18 -0
- package/build/add-on.d.ts.map +1 -0
- package/build/add-on.js +28 -0
- package/build/add-on.js.map +1 -0
- package/build/check-COlnfceW.d.ts +154 -0
- package/build/check-COlnfceW.d.ts.map +1 -0
- package/build/index.d.ts +171 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +297 -0
- package/build/index.js.map +1 -0
- package/build/join-1KKMeraY.js +661 -0
- package/build/join-1KKMeraY.js.map +1 -0
- package/build/layer-C9IpaDIx.js +51 -0
- package/build/layer-C9IpaDIx.js.map +1 -0
- package/build/layer-MFHgwWfO.d.ts +118 -0
- package/build/layer-MFHgwWfO.d.ts.map +1 -0
- package/build/plan-B4mHDZjK.d.ts +68 -0
- package/build/plan-B4mHDZjK.d.ts.map +1 -0
- package/build/schema.d.ts +40 -0
- package/build/schema.d.ts.map +1 -0
- package/build/schema.js +126 -0
- package/build/schema.js.map +1 -0
- package/package.json +77 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join-1KKMeraY.js","names":[],"sources":["../src/values.ts","../src/queries.ts","../src/cost.ts","../src/check.ts","../src/join.ts"],"sourcesContent":["import type { TofuObject, TofuValue } from \"./layer.ts\";\n\n// The forms of a value, and the text of each value in the files.\n// In the JSON syntax of OpenTofu, each text is a template. Thus the generator escapes each text of a record.\n\n/** The form of the type of a resource and of the type of a backend. */\nexport const TYPE_FORM: RegExp = /^[a-z][a-z0-9_]*$/;\n\n/** The form of the local name of a provider, for example `example` or `example-beta`. */\nexport const PROVIDER_FORM: RegExp = /^[a-z][a-z0-9_-]*$/;\n\n/** The form of a name in the files: the name of a resource, of a variable, of an alias and of an argument. */\nexport const NAME_FORM: RegExp = /^[A-Za-z_][A-Za-z0-9_-]*$/;\n\n/** The form of a path of attributes, for example `network[0].address`. */\nexport const PATH_FORM: RegExp = /^[A-Za-z_][A-Za-z0-9_-]*(\\.[A-Za-z_][A-Za-z0-9_-]*|\\[[0-9]+\\])*$/;\n\n/** The form of the address of a provider in a registry: two or three words with `/` between them. */\nexport const SOURCE_FORM: RegExp = /^[a-z0-9][a-z0-9.-]*(\\/[a-z0-9][a-z0-9_-]*){1,2}$/;\n\n/** The form of a list of versions, for example `>= 1.8, < 2.0`. */\nexport const VERSION_FORM: RegExp = /^[0-9A-Za-z .,<>=~!+-]+$/;\n\n/** The parts of a reference: the address of a resource, and a path of attributes of it. */\nexport interface RefParts {\n readonly address: string;\n readonly attribute: string;\n}\n\n/**\n * This function gives the parts of the text of a reference, for example `example_server.web.address`.\n * It gives `undefined` for a text with a different form.\n */\nexport function refParts(ref: string): RefParts | undefined {\n const [type, name, ...rest] = ref.split(\".\");\n if (type === undefined || name === undefined || rest.length === 0) return undefined;\n // An index stays with the word before it, so the name of the resource can not have one.\n const attribute = rest.join(\".\");\n if (!TYPE_FORM.test(type) || !NAME_FORM.test(name) || !PATH_FORM.test(attribute)) return undefined;\n return { address: `${type}.${name}`, attribute };\n}\n\n/** This function tells if a value is a list. */\nexport function isList(value: TofuValue): value is readonly TofuValue[] {\n return Array.isArray(value);\n}\n\n/** This function tells if a value is an object of values. A list and `null` are not objects. */\nexport function isObject(value: TofuValue): value is TofuObject {\n return typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\n/** This function tells if an object has a key that starts with `$`: the object is a form, not a map of arguments. */\nexport function isForm(value: TofuObject): boolean {\n return Object.keys(value).some((key) => key.startsWith(\"$\"));\n}\n\n/** This function gives the one value of a form with the one key `key`, when that value is a text. */\nfunction formText(value: TofuObject, key: string): string | undefined {\n const keys = Object.keys(value);\n const text = value[key];\n return keys.length === 1 && keys[0] === key && typeof text === \"string\" ? text : undefined;\n}\n\n/** This function gives the text of a correct reference form, `{ \"$ref\": \"type.name.attribute\" }`. */\nexport function refOf(value: TofuObject): string | undefined {\n const text = formText(value, \"$ref\");\n return text !== undefined && refParts(text) !== undefined ? text : undefined;\n}\n\n/** This function gives the name of a correct variable form, `{ \"$var\": \"name\" }`. */\nexport function varOf(value: TofuObject): string | undefined {\n const text = formText(value, \"$var\");\n return text !== undefined && NAME_FORM.test(text) ? text : undefined;\n}\n\n/**\n * This function escapes the template sequences of a text. OpenTofu then reads the text as it is in the record.\n * `$${` is the escape of `${`, and `%%{` is the escape of `%{`.\n */\nexport function escapeTemplate(text: string): string {\n // A function gives each replacement: in a replacement text, `$$` is the escape of one `$`.\n return text.replaceAll(\"${\", () => \"$${\").replaceAll(\"%{\", () => \"%%{\");\n}\n\n/**\n * This function gives a value as OpenTofu reads it in a JSON file.\n *\n * - A text and each key of an object are escaped.\n * - A reference form becomes the expression of the attribute, and a variable form the expression of the variable.\n *\n * A form that is not correct stays an object with an escaped key. The gate `checkTofu` refuses such a layer.\n */\nexport function renderValue(value: TofuValue): TofuValue {\n if (typeof value === \"string\") return escapeTemplate(value);\n if (isList(value)) return value.map(renderValue);\n if (!isObject(value)) return value;\n const ref = refOf(value);\n if (ref !== undefined) return `\\${${ref}}`;\n const variable = varOf(value);\n if (variable !== undefined) return `\\${var.${variable}}`;\n return Object.fromEntries(Object.entries(value).map(([key, item]) => [escapeTemplate(key), renderValue(item)]));\n}\n\n/** A place in a value: the keys and the positions from the value to the place. */\nexport type ValuePath = readonly (string | number)[];\n\n/** A form of a value, with its place. `text` is absent when the form is not correct. */\nexport interface FormUse {\n readonly kind: \"ref\" | \"var\" | \"bad\";\n readonly path: ValuePath;\n readonly text?: string | undefined;\n}\n\n/** One number of a value that is not finite, with its place. */\nexport interface NumberUse {\n readonly path: ValuePath;\n readonly value: number;\n}\n\n/** The forms and the numbers that are not finite of a value. */\nexport interface ValueUses {\n readonly forms: readonly FormUse[];\n readonly numbers: readonly NumberUse[];\n}\n\n/** This function gives each form of a value and each number that is not finite, in the sequence of the value. */\nexport function valueUses(value: TofuValue): ValueUses {\n const forms: FormUse[] = [];\n const numbers: NumberUse[] = [];\n const walk = (item: TofuValue, path: ValuePath): void => {\n if (typeof item === \"number\") {\n if (!Number.isFinite(item)) numbers.push({ path, value: item });\n return;\n }\n if (isList(item)) {\n item.forEach((child, index) => {\n walk(child, [...path, index]);\n });\n return;\n }\n if (!isObject(item)) return;\n if (isForm(item)) {\n const ref = refOf(item);\n const variable = varOf(item);\n if (ref !== undefined) forms.push({ kind: \"ref\", path, text: ref });\n else if (variable !== undefined) forms.push({ kind: \"var\", path, text: variable });\n else forms.push({ kind: \"bad\", path });\n return;\n }\n for (const [key, child] of Object.entries(item)) walk(child, [...path, key]);\n };\n walk(value, []);\n return { forms, numbers };\n}\n\n/** This function gives a place in a value as a text, for example `disk.0.size`. The place of the value is `(the value)`. */\nexport function pathText(path: ValuePath): string {\n return path.length === 0 ? \"(the value)\" : path.join(\".\");\n}\n","import { stronglyConnectedComponents } from \"@mark1russell7/collections/graph\";\nimport { partNeeds, partsById, type Part, type Stack } from \"@mark1russell7/system-stack\";\nimport { resourceAddress, type Resource, type TofuLayer } from \"./layer.ts\";\nimport { refParts, valueUses } from \"./values.ts\";\n\n// The queries over the records. The sequence of the resources in the files comes from the needs of the stack,\n// so a person writes each dependence one time: in the stack.\n\n/** This function gives the first resource of each address of a layer, in the sequence of the records. */\nexport function firstResources(layer: TofuLayer): readonly Resource[] {\n const seen = new Set<string>();\n return layer.resources.filter((resource) => {\n const address = resourceAddress(resource);\n if (seen.has(address)) return false;\n seen.add(address);\n return true;\n });\n}\n\n/**\n * This function gives the addresses of the resources of each part, by the `id` of the part.\n * The addresses of a part are sorted. With them, a host joins a plan or a state to the parts of the stack.\n */\nexport function resourcesByPart(layer: TofuLayer): Map<string, string[]> {\n const byPart = new Map<string, string[]>();\n for (const resource of firstResources(layer)) {\n const addresses = byPart.get(resource.part) ?? [];\n addresses.push(resourceAddress(resource));\n byPart.set(resource.part, addresses);\n }\n for (const addresses of byPart.values()) addresses.sort();\n return byPart;\n}\n\n/**\n * This function gives the address of each resource that the arguments of a resource read, sorted.\n * Each address comes one time. An address can name a resource that the layer does not have.\n */\nexport function resourceRefs(resource: Resource): string[] {\n const addresses = new Set<string>();\n for (const form of valueUses(resource.values ?? {}).forms) {\n // The arguments as a whole are not a value, so a form at the empty place reads nothing.\n const parts = form.kind === \"ref\" && form.text !== undefined && form.path.length > 0 ? refParts(form.text) : undefined;\n if (parts !== undefined) addresses.add(parts.address);\n }\n return [...addresses].sort();\n}\n\n/**\n * This function walks the needs of a part, nearest first. It gives the `id` of each part where the walk stops or goes on.\n * The walk does not go past a part for which `stop` gives `true`. It does not come back to the first part.\n */\nfunction walkNeeds(parts: ReadonlyMap<string, Part>, from: string, stop: (id: string) => boolean): string[] {\n const seen = new Set<string>([from]);\n const found: string[] = [];\n let level = partNeeds(parts.get(from) ?? { id: from, kind: \"\" });\n while (level.length > 0) {\n const next: string[] = [];\n for (const id of level) {\n if (seen.has(id)) continue;\n seen.add(id);\n found.push(id);\n const part = parts.get(id);\n if (part !== undefined && !stop(id)) next.push(...partNeeds(part));\n }\n level = next;\n }\n return found;\n}\n\n/**\n * This function gives the `id` of each part that a part needs, directly or through other parts.\n * The part itself is not in the result. A need that names no part of the stack is in the result.\n */\nexport function neededParts(stack: Stack, part: string): Set<string> {\n return new Set(walkNeeds(partsById(stack), part, () => false));\n}\n\n/**\n * This function gives the dependencies of each resource that come from the needs of the stack, by the address of the resource.\n *\n * - A resource depends on the resources of each part that its part needs.\n * - For a needed part with no resource, the walk goes on to the needs of that part. It stops at the nearest parts with resources.\n * - An address that the arguments of the resource read is not in the list: OpenTofu knows that dependence from the arguments.\n *\n * The addresses of a resource are sorted. The generator writes them as `depends_on`.\n */\nexport function dependsOn(layer: TofuLayer, stack: Stack): Map<string, string[]> {\n const parts = partsById(stack);\n const byPart = resourcesByPart(layer);\n const result = new Map<string, string[]>();\n for (const resource of firstResources(layer)) {\n const read = new Set(resourceRefs(resource));\n const addresses = walkNeeds(parts, resource.part, (id) => byPart.has(id)).flatMap((id) => byPart.get(id) ?? []);\n result.set(\n resourceAddress(resource),\n addresses.filter((address) => !read.has(address)).sort(),\n );\n }\n return result;\n}\n\n/**\n * This function gives the cycles of the resources of a layer. In a cycle, each resource waits for a different one, and OpenTofu can make none of them.\n * A resource waits for each resource that its arguments read, and for each one of `dependsOn`.\n * Each cycle is a sorted list of addresses. A resource that reads its own attribute is a cycle of one resource.\n */\nexport function resourceCycles(layer: TofuLayer, stack: Stack): string[][] {\n const depends = dependsOn(layer, stack);\n const waits = new Map<string, string[]>();\n for (const resource of firstResources(layer)) {\n const address = resourceAddress(resource);\n waits.set(address, [...resourceRefs(resource), ...(depends.get(address) ?? [])]);\n }\n const nodes = [...waits.keys()].sort();\n return stronglyConnectedComponents(nodes, (address) => waits.get(address) ?? []).filter((component) => {\n const [only = \"\"] = component;\n return component.length > 1 || (waits.get(only) ?? []).includes(only);\n });\n}\n","import { app, axes, each, evaluate, lit, ref, space, type Expr, type Result, type Space } from \"@mark1russell7/vex\";\nimport { BoolDomain, NumDomain, TextDomain } from \"@mark1russell7/vex-domains\";\nimport { isBuiltin, resourceAddress, resourceProvider, type TofuLayer } from \"./layer.ts\";\nimport { firstResources } from \"./queries.ts\";\n\n// The planned cost of the resources, as Vex programs. A program is data: `explain` of Vex shows each step.\n// The layer becomes a tree: the layer, then each account, then each resource of the account.\n\n/**\n * The limit of the cost of a part for a month. A state of a service of the spend add-on has this form.\n * Thus a host gives the states of a spend layer as the budgets, and the two add-ons do not know each other.\n */\nexport interface Budget {\n /** The `id` of the part: an account, a project or a tenant. */\n readonly part: string;\n /** The hard limit of the cost of the part for a month. A part with no hard limit has none. */\n readonly hardLimit?: number | undefined;\n}\n\n/** The key of the layer node: the root of the cost tree. */\nexport const COST_LAYER_KEY = \"layer\";\n\n/** This function gives the key of the node of an account: the text `account:` and the `id` of its part. */\nexport function accountKey(part: string): string {\n return `account:${part}`;\n}\n\n/** This function gives the key of the node of a resource: the text `resource:` and its address. */\nexport function resourceKey(address: string): string {\n return `resource:${address}`;\n}\n\n/** This function tells if a value is a finite number, 0 or more. */\nexport function isZeroOrMore(value: number): boolean {\n return Number.isFinite(value) && value >= 0;\n}\n\n/** This function gives the first budget of each part, by the `id` of the part. */\nexport function budgetsByPart(budgets: readonly Budget[]): Map<string, Budget> {\n const byPart = new Map<string, Budget>();\n for (const budget of budgets) if (!byPart.has(budget.part)) byPart.set(budget.part, budget);\n return byPart;\n}\n\n/** The planned cost of each resource of an account. A resource with no known cost gives an error value. */\nconst COSTS: Expr = each(axes.children, ref(\"cost\"));\n\n/** The planned cost of an account in a month: the sum of the known costs of its resources. The program evaluates at an account node. */\nexport const PLANNED: Expr = app(\"sum\", COSTS);\n\n/** This test tells if a resource node has a known cost. */\nconst HAS_COST: Expr = app(\"ifError\", app(\"eq\", ref(\"cost\"), ref(\"cost\")), lit(false));\n\n/** The count of the resources of an account with no known cost. The program evaluates at an account node. */\nexport const UNKNOWN_COSTS: Expr = app(\"count\", each(axes.where(axes.children, app(\"not\", HAS_COST)), ref(\"kind\")));\n\n/** This test tells if the planned cost of an account is more than its hard limit. An account with no hard limit gives an error value. */\nexport const PLANNED_OVER: Expr = app(\"gt\", PLANNED, ref(\"limit\"));\n\n/** The room of an account: its hard limit less its planned cost. An account with no hard limit gives an error value. */\nexport const PLANNED_ROOM: Expr = app(\"subtract\", ref(\"limit\"), PLANNED);\n\n/** The planned cost of the layer in a month: the sum of the planned costs of its accounts. The program evaluates at the layer node. */\nexport const PLANNED_TOTAL: Expr = app(\"sum\", each(axes.children, PLANNED));\n\n/**\n * This function gives the cost tree of a layer, as a space of Vex.\n *\n * - The layer is the root, with the key `COST_LAYER_KEY`.\n * - An account is a child of the layer: the part of a provider configuration that has one resource or more. Its field `limit` is its hard limit.\n * - A resource is a child of the account of its provider configuration. Its field `cost` is its planned cost.\n *\n * A cost or a limit that is less than 0 or not finite is not in the tree: it is not known.\n * A resource with no provider configuration is not in the tree, because it counts against no account.\n */\nexport function costSpace(layer: TofuLayer, budgets: readonly Budget[] = []): Space {\n const limits = budgetsByPart(budgets);\n const records: Record<string, Readonly<Record<string, unknown>>> = { [COST_LAYER_KEY]: { kind: \"layer\" } };\n const parents: Record<string, string | null> = { [COST_LAYER_KEY]: null };\n for (const resource of firstResources(layer)) {\n const provider = isBuiltin(resource) ? undefined : resourceProvider(layer, resource);\n if (provider === undefined) continue;\n const account = accountKey(provider.part);\n if (records[account] === undefined) {\n const limit = limits.get(provider.part)?.hardLimit;\n records[account] = { kind: \"account\", part: provider.part, ...(limit !== undefined && isZeroOrMore(limit) ? { limit } : {}) };\n parents[account] = COST_LAYER_KEY;\n }\n const key = resourceKey(resourceAddress(resource));\n records[key] = { kind: \"resource\", ...(resource.cost !== undefined && isZeroOrMore(resource.cost) ? { cost: resource.cost } : {}) };\n parents[key] = account;\n }\n return space.tree(records, parents);\n}\n\n/**\n * This function evaluates a program of this module at a node of a cost tree. It gives the value, or the error value.\n * `tree` is the result of `costSpace`, and `key` is the key of a node.\n */\nexport function evaluateCost(program: Expr, tree: Space, key: string): Result<unknown> {\n return evaluate(program, { space: tree, origin: key, domains: [NumDomain, BoolDomain, TextDomain] });\n}\n\n/** This function gives the number of a result, or `undefined` for an error value. */\nfunction numberOf(result: Result<unknown>): number | undefined {\n return result.ok && typeof result.value === \"number\" ? result.value : undefined;\n}\n\n/** The state of the planned cost of one account of a layer. */\nexport interface AccountState {\n /** The `id` of the part of the account. */\n readonly part: string;\n /** The addresses of the resources that count against the account, sorted. */\n readonly resources: readonly string[];\n /** The planned cost of the account in a month: the sum of the known costs of its resources. */\n readonly planned: number;\n /** The count of the resources with no known cost. With one or more, `planned` is not the whole cost. */\n readonly unknown: number;\n /** The hard limit of the account for a month. An account with no budget, or with a budget with no hard limit, has none. */\n readonly limit?: number | undefined;\n /** `true`: the planned cost is more than the hard limit. An account with no hard limit has no value. */\n readonly over?: boolean | undefined;\n /** The hard limit less the planned cost. An account with no hard limit has no value. */\n readonly room?: number | undefined;\n}\n\n/** This function gives the state of the planned cost of each account of a layer, in the sequence of the first resource of each account. */\nexport function accountStates(layer: TofuLayer, budgets: readonly Budget[] = []): AccountState[] {\n const tree = costSpace(layer, budgets);\n const accounts = new Map<string, string[]>();\n for (const resource of firstResources(layer)) {\n const provider = isBuiltin(resource) ? undefined : resourceProvider(layer, resource);\n if (provider === undefined) continue;\n const addresses = accounts.get(provider.part) ?? [];\n addresses.push(resourceAddress(resource));\n accounts.set(provider.part, addresses);\n }\n return [...accounts].map(([part, addresses]) => {\n const key = accountKey(part);\n const limit = numberOf(evaluateCost(ref(\"limit\"), tree, key));\n const over = evaluateCost(PLANNED_OVER, tree, key);\n const room = numberOf(evaluateCost(PLANNED_ROOM, tree, key));\n return {\n part,\n resources: [...addresses].sort(),\n planned: numberOf(evaluateCost(PLANNED, tree, key)) ?? 0,\n unknown: numberOf(evaluateCost(UNKNOWN_COSTS, tree, key)) ?? 0,\n ...(limit === undefined ? {} : { limit }),\n ...(over.ok && typeof over.value === \"boolean\" ? { over: over.value } : {}),\n ...(room === undefined ? {} : { room }),\n };\n });\n}\n\n/** This function gives the planned cost of a layer in a month: the sum of the planned costs of its accounts. */\nexport function plannedTotal(layer: TofuLayer): number {\n return numberOf(evaluateCost(PLANNED_TOTAL, costSpace(layer), COST_LAYER_KEY)) ?? 0;\n}\n","import { partsById, type Fault, type FaultLevel, type Stack } from \"@mark1russell7/system-stack\";\nimport { accountStates, isZeroOrMore, type Budget } from \"./cost.ts\";\nimport { BUILTIN_PROVIDER, isBuiltin, providerAddress, resourceAddress, resourceName, resourceProvider, typeProvider, type Provider, type TofuLayer, type TofuObject } from \"./layer.ts\";\nimport { firstResources, neededParts, resourceCycles } from \"./queries.ts\";\nimport { isForm, NAME_FORM, PATH_FORM, pathText, PROVIDER_FORM, refParts, SOURCE_FORM, TYPE_FORM, valueUses, VERSION_FORM } from \"./values.ts\";\n\n// The gate of the OpenTofu layer. A gate that passes tells that the files are safe to write:\n// each record has a correct form, no resource waits in a cycle, and the planned cost of each account is known and not more than its hard limit.\n\n/** These are the codes of the faults of an OpenTofu layer. */\nexport const TOFU_CODES: readonly [\n \"version\",\n \"backend\",\n \"variable-form\",\n \"variable-duplicate\",\n \"provider-form\",\n \"provider-duplicate\",\n \"provider-source\",\n \"provider-part\",\n \"provider-value\",\n \"resource-form\",\n \"resource-duplicate\",\n \"resource-part\",\n \"provider-none\",\n \"ignore-form\",\n \"value-name\",\n \"value-meta\",\n \"value-form\",\n \"value-number\",\n \"ref-none\",\n \"var-none\",\n \"cycle\",\n \"cost-amount\",\n \"cost-none\",\n \"cost-builtin\",\n \"budget-duplicate\",\n \"budget-amount\",\n \"budget-none\",\n \"limit-none\",\n \"cost-over\",\n \"provider-need\",\n \"variable-unused\",\n] = [\n \"version\",\n \"backend\",\n \"variable-form\",\n \"variable-duplicate\",\n \"provider-form\",\n \"provider-duplicate\",\n \"provider-source\",\n \"provider-part\",\n \"provider-value\",\n \"resource-form\",\n \"resource-duplicate\",\n \"resource-part\",\n \"provider-none\",\n \"ignore-form\",\n \"value-name\",\n \"value-meta\",\n \"value-form\",\n \"value-number\",\n \"ref-none\",\n \"var-none\",\n \"cycle\",\n \"cost-amount\",\n \"cost-none\",\n \"cost-builtin\",\n \"budget-duplicate\",\n \"budget-amount\",\n \"budget-none\",\n \"limit-none\",\n \"cost-over\",\n \"provider-need\",\n \"variable-unused\",\n];\n\n/** A code of a fault of an OpenTofu layer. */\nexport type TofuCode = (typeof TOFU_CODES)[number];\n\n/**\n * A fault of an OpenTofu layer. Its field `at` is the place of the fault in the files.\n *\n * - For a resource, `at` is its address.\n * - For a provider configuration, `at` is `provider.` and its address.\n * - For a variable, `at` is `var.` and its name.\n * - For the settings, `at` is `terraform`.\n *\n * For a fault of a budget or of an account, `at` is the `id` of the part.\n */\nexport interface TofuFault extends Fault {\n readonly code: TofuCode;\n /** The `id` of the part of the stack of the record with the fault. */\n readonly part?: string | undefined;\n}\n\n/** The options of the gate and of the generator. */\nexport interface TofuOptions {\n /**\n * The limit of the cost of each account for a month. The states of a spend layer have this form.\n * An account with resources and no budget stops the gate: the gate has no read of its limit.\n */\n readonly budgets?: readonly Budget[] | undefined;\n /** The currency of the costs and of the budgets, for the text of a fault. */\n readonly currency?: string | undefined;\n}\n\n/** These arguments of a resource are meta-arguments. The generator writes them from the records, so the arguments of a record cannot have them. */\nexport const RESOURCE_META: readonly string[] = [\"provider\", \"depends_on\", \"lifecycle\", \"count\", \"for_each\", \"provisioner\", \"connection\", \"dynamic\"];\n\n/** These arguments of a provider configuration are meta-arguments. The generator writes them from the records. */\nexport const PROVIDER_META: readonly string[] = [\"alias\", \"version\", \"for_each\"];\n\n/** This function gives a list of names for a message, for example `\"a\", \"b\"`. */\nfunction names(items: readonly string[]): string {\n return items.map((item) => `\"${item}\"`).join(\", \");\n}\n\n/**\n * This function gives each fault of an OpenTofu layer for a stack. A list with no error tells that the gate passes.\n *\n * The settings, the variables and the providers, as errors:\n * - `version`: the versions of OpenTofu do not have the form of a list of versions.\n * - `backend`: the type of the backend does not have the form of a type, or a value of the backend is not literal.\n * - `variable-form`: the name of a variable does not have the form of a name.\n * - `variable-duplicate`: two variables have one name.\n * - `provider-form`: the name, the alias, the source or the versions of a provider configuration do not have their form.\n * - `provider-duplicate`: two provider configurations have one address.\n * - `provider-source`: two configurations of one provider have different sources or versions.\n * - `provider-part`: a provider configuration names no part of the stack.\n * - `provider-value`: a value of a provider configuration reads a resource.\n *\n * The resources, as errors:\n * - `resource-form`: the type, the name or the import id of a resource does not have its form.\n * - `resource-duplicate`: two resources have one address.\n * - `resource-part`: a resource names no part of the stack.\n * - `provider-none`: the layer does not have the provider configuration of a resource.\n * - `ignore-form`: an attribute of `ignore` does not have the form of a path.\n *\n * The values, as errors:\n * - `value-name`: the name of an argument does not have the form of a name.\n * - `value-meta`: an argument is a meta-argument. The generator writes each meta-argument.\n * - `value-form`: an object has a key that starts with `$`, and it is not a correct reference or variable.\n * - `value-number`: a number is not finite. JSON cannot hold it.\n * - `ref-none`: a reference names a resource that the layer does not have.\n * - `var-none`: a value names a variable that the layer does not have.\n *\n * The queries, as errors:\n * - `cycle`: resources wait for each other, so OpenTofu can make none of them.\n *\n * The costs, as errors:\n * - `cost-amount`: the planned cost of a resource is less than 0 or not finite.\n * - `cost-none`: a resource of a provider has no planned cost. A cost that is not known is not 0.\n * - `cost-builtin`: a resource that is a part of OpenTofu has a planned cost above 0. It counts against no account.\n * - `budget-duplicate`: two budgets name one part.\n * - `budget-amount`: the hard limit of a budget is less than 0 or not finite.\n * - `budget-none`: no budget names an account with resources. The gate has no read of its limit, so it does not pass.\n * - `limit-none`: the resources of an account have a planned cost above 0, and the account has no hard limit.\n * - `cost-over`: the planned cost of an account is more than its hard limit.\n *\n * The warnings:\n * - `provider-need`: the part of a resource does not need the part of its provider configuration. The stack does not show that dependence.\n * - `variable-unused`: no value reads a variable.\n *\n * The gate does not examine the stack: `checkStack` of the core does. The function is pure.\n */\nexport function checkTofu(layer: TofuLayer, stack: Stack, options: TofuOptions = {}): TofuFault[] {\n const faults: TofuFault[] = [];\n const add = (level: FaultLevel, code: TofuCode, at: string, message: string, more: { readonly other?: string; readonly part?: string } = {}): void => {\n faults.push({ level, code, at, message, ...more });\n };\n const error = (code: TofuCode, at: string, message: string, more: { readonly other?: string; readonly part?: string } = {}): void => {\n add(\"error\", code, at, message, more);\n };\n const money = (amount: number): string => (options.currency === undefined ? String(amount) : `${String(amount)} ${options.currency}`);\n const parts = partsById(stack);\n const addresses = new Set(firstResources(layer).map(resourceAddress));\n\n const variables = new Set<string>();\n const readVariables = new Set<string>();\n for (const variable of layer.variables ?? []) {\n const at = `var.${variable.name}`;\n if (variables.has(variable.name)) {\n error(\"variable-duplicate\", at, `Two variables have the name \"${variable.name}\".`);\n continue;\n }\n variables.add(variable.name);\n if (!NAME_FORM.test(variable.name)) error(\"variable-form\", at, `The name \"${variable.name}\" of a variable does not have the form of a name.`);\n }\n\n /** This function examines the arguments of one record. `owner` is the record in words, for a message. */\n const checkValues = (values: TofuObject | undefined, at: string, owner: string, kind: \"resource\" | \"provider\" | \"backend\", meta: readonly string[], part?: string): void => {\n if (values === undefined) return;\n const more = part === undefined ? {} : { part };\n if (isForm(values)) {\n error(\"value-form\", at, `The arguments of ${owner} have a key that starts with \"$\". The arguments of a record are not a reference and not a variable.`, more);\n return;\n }\n for (const name of Object.keys(values)) {\n if (meta.includes(name)) error(\"value-meta\", at, `The argument \"${name}\" of ${owner} is a meta-argument. The generator writes it from the records.`, more);\n else if (!NAME_FORM.test(name)) error(\"value-name\", at, `The name \"${name}\" of an argument of ${owner} does not have the form of a name.`, more);\n }\n const uses = valueUses(values);\n for (const number of uses.numbers) error(\"value-number\", at, `The number ${String(number.value)} at \"${pathText(number.path)}\" of ${owner} is not finite.`, more);\n for (const form of uses.forms) {\n const place = pathText(form.path);\n if (form.kind === \"bad\" || form.text === undefined) {\n error(\"value-form\", at, `The object at \"${place}\" of ${owner} has a key that starts with \"$\", and it is not a correct reference or variable.`, more);\n } else if (kind === \"backend\") {\n error(\"backend\", at, `The value at \"${place}\" of ${owner} is not literal. A backend reads no variable and no resource.`, more);\n } else if (form.kind === \"var\") {\n if (variables.has(form.text)) readVariables.add(form.text);\n else error(\"var-none\", at, `The value at \"${place}\" of ${owner} names the variable \"${form.text}\", which the layer does not have.`, { ...more, other: `var.${form.text}` });\n } else if (kind === \"provider\") {\n error(\"provider-value\", at, `The value at \"${place}\" of ${owner} reads the resource attribute \"${form.text}\". A provider configuration reads no resource.`, more);\n } else {\n const address = refParts(form.text)?.address ?? \"\";\n if (!addresses.has(address)) error(\"ref-none\", at, `The value at \"${place}\" of ${owner} reads \"${form.text}\", and the layer has no resource \"${address}\".`, { ...more, other: address });\n }\n }\n };\n\n if (layer.version !== undefined && !VERSION_FORM.test(layer.version)) {\n error(\"version\", \"terraform\", `The versions \"${layer.version}\" of OpenTofu do not have the form of a list of versions, for example \">= 1.8\".`);\n }\n if (layer.backend !== undefined) {\n if (!TYPE_FORM.test(layer.backend.type)) error(\"backend\", \"terraform\", `The type \"${layer.backend.type}\" of the backend does not have the form of a type.`);\n checkValues(layer.backend.values, \"terraform\", \"the backend\", \"backend\", []);\n }\n\n const providers = new Set<string>();\n const firstOfName = new Map<string, Provider>();\n for (const provider of layer.providers ?? []) {\n const address = providerAddress(provider);\n const at = `provider.${address}`;\n const more = { part: provider.part };\n if (providers.has(address)) {\n error(\"provider-duplicate\", at, `Two provider configurations have the address \"${address}\".`, more);\n continue;\n }\n providers.add(address);\n if (!PROVIDER_FORM.test(provider.name)) error(\"provider-form\", at, `The name \"${provider.name}\" of a provider does not have the form of a provider name.`, more);\n else if (provider.name === BUILTIN_PROVIDER) error(\"provider-form\", at, `The provider \"${BUILTIN_PROVIDER}\" is a part of OpenTofu. It has no configuration.`, more);\n if (provider.alias !== undefined && !NAME_FORM.test(provider.alias)) error(\"provider-form\", at, `The alias \"${provider.alias}\" of the provider \"${provider.name}\" does not have the form of a name.`, more);\n if (!SOURCE_FORM.test(provider.source)) error(\"provider-form\", at, `The source \"${provider.source}\" of the provider \"${provider.name}\" does not have the form of a source, for example \"example-org/example\".`, more);\n if (provider.version !== undefined && !VERSION_FORM.test(provider.version)) {\n error(\"provider-form\", at, `The versions \"${provider.version}\" of the provider \"${provider.name}\" do not have the form of a list of versions, for example \"~> 2.0\".`, more);\n }\n const first = firstOfName.get(provider.name);\n if (first === undefined) firstOfName.set(provider.name, provider);\n else if (first.source !== provider.source || first.version !== provider.version) {\n error(\"provider-source\", at, `Two configurations of the provider \"${provider.name}\" have different sources or versions. A provider has one source and one list of versions.`, more);\n }\n if (!parts.has(provider.part)) error(\"provider-part\", at, `The provider configuration \"${address}\" names \"${provider.part}\", which is no part of the stack.`, { ...more, other: provider.part });\n checkValues(provider.values, at, `the provider configuration \"${address}\"`, \"provider\", PROVIDER_META, provider.part);\n }\n\n const seen = new Set<string>();\n for (const resource of layer.resources) {\n const at = resourceAddress(resource);\n const more = { part: resource.part };\n if (seen.has(at)) {\n error(\"resource-duplicate\", at, `Two resources have the address \"${at}\".`, more);\n continue;\n }\n seen.add(at);\n if (!TYPE_FORM.test(resource.type)) error(\"resource-form\", at, `The type \"${resource.type}\" of a resource of \"${resource.part}\" does not have the form of a type.`, more);\n if (!NAME_FORM.test(resourceName(resource))) error(\"resource-form\", at, `The name \"${resourceName(resource)}\" of a resource of \"${resource.part}\" does not have the form of a name.`, more);\n if (resource.import === \"\") error(\"resource-form\", at, `The import id of the resource \"${at}\" is empty.`, more);\n if (!parts.has(resource.part)) error(\"resource-part\", at, `The resource \"${at}\" names \"${resource.part}\", which is no part of the stack.`, { ...more, other: resource.part });\n for (const path of resource.ignore ?? []) {\n if (!PATH_FORM.test(path)) error(\"ignore-form\", at, `The attribute \"${path}\" of the field \"ignore\" of the resource \"${at}\" does not have the form of a path.`, more);\n }\n checkValues(resource.values, at, `the resource \"${at}\"`, \"resource\", RESOURCE_META, resource.part);\n\n const builtin = isBuiltin(resource);\n const provider = builtin ? undefined : resourceProvider(layer, resource);\n if (!builtin && provider === undefined) {\n const wanted = resource.provider ?? typeProvider(resource.type);\n error(\"provider-none\", at, `The resource \"${at}\" uses the provider configuration \"${wanted}\", which the layer does not have.`, more);\n }\n if (resource.cost !== undefined && !isZeroOrMore(resource.cost)) {\n error(\"cost-amount\", at, `The planned cost ${String(resource.cost)} of the resource \"${at}\" is less than 0 or not finite.`, more);\n } else if (builtin) {\n if (resource.cost !== undefined && resource.cost > 0) {\n error(\"cost-builtin\", at, `The resource \"${at}\" is a part of OpenTofu, and its record has a planned cost of ${money(resource.cost)}. It counts against no account.`, more);\n }\n } else if (resource.cost === undefined) {\n error(\"cost-none\", at, `The resource \"${at}\" has no planned cost. A cost that is not known is not 0: give the cost of a month, or 0 for a resource with no price.`, more);\n }\n if (provider !== undefined && provider.part !== resource.part && parts.has(resource.part) && parts.has(provider.part) && !neededParts(stack, resource.part).has(provider.part)) {\n add(\n \"warning\",\n \"provider-need\",\n at,\n `The resource \"${at}\" makes the part \"${resource.part}\" with the provider configuration of \"${provider.part}\", and \"${resource.part}\" does not need \"${provider.part}\" in the stack.`,\n { ...more, other: provider.part },\n );\n }\n }\n\n for (const cycle of resourceCycles(layer, stack)) {\n const [first = \"\", second] = cycle;\n const message = cycle.length === 1 ? `The resource \"${first}\" reads its own attribute, so OpenTofu cannot make it.` : `The resources ${names(cycle)} wait for each other, so OpenTofu can make none of them.`;\n error(\"cycle\", first, message, second === undefined ? {} : { other: second });\n }\n\n const budgets = options.budgets ?? [];\n const budgetParts = new Set<string>();\n const wrongBudgets = new Set<string>();\n for (const budget of budgets) {\n if (budgetParts.has(budget.part)) {\n error(\"budget-duplicate\", budget.part, `Two budgets name the part \"${budget.part}\".`, { part: budget.part });\n continue;\n }\n budgetParts.add(budget.part);\n if (budget.hardLimit !== undefined && !isZeroOrMore(budget.hardLimit)) {\n wrongBudgets.add(budget.part);\n error(\"budget-amount\", budget.part, `The hard limit ${String(budget.hardLimit)} of the budget of \"${budget.part}\" is less than 0 or not finite.`, { part: budget.part });\n }\n }\n for (const state of accountStates(layer, budgets)) {\n const at = state.part;\n const more = { part: at };\n if (!budgetParts.has(at)) {\n error(\"budget-none\", at, `The resources ${names(state.resources)} count against \"${at}\", and no budget names \"${at}\". The gate has no read of its limit.`, more);\n } else if (state.limit === undefined) {\n // A hard limit with a wrong amount has its own fault.\n if (state.planned > 0 && !wrongBudgets.has(at)) error(\"limit-none\", at, `The planned cost of the resources of \"${at}\" is ${money(state.planned)} for a month, and \"${at}\" has no hard limit.`, more);\n } else if (state.over === true) {\n error(\"cost-over\", at, `The planned cost of the resources of \"${at}\" is ${money(state.planned)} for a month. Its hard limit is ${money(state.limit)}.`, more);\n }\n }\n\n for (const name of variables) {\n if (!readVariables.has(name)) add(\"warning\", \"variable-unused\", `var.${name}`, `No value reads the variable \"${name}\".`);\n }\n return faults;\n}\n","import { joinRecords, joinSetting, type LayerParse, type LayerPiece } from \"@mark1russell7/system-stack\";\nimport { providerAddress, resourceAddress, TOFU_SCHEMA, type TofuLayer } from \"./layer.ts\";\n\n// The join of the OpenTofu layers of the fragments of a stack, for example one file of resources for each owner.\n\n/**\n * This function joins the OpenTofu layers of the fragments of a stack into one layer.\n *\n * - The resources, the provider configurations and the variables are in the order of the fragments.\n * - A resource address in two or more fragments is a fault, also when the resources are equal.\n * - The same rule holds for the address of a provider configuration and for the name of a variable.\n * - The layer has one version of OpenTofu. A fragment with a different value is a fault.\n * - The state has one place. Thus a backend in two or more fragments is a fault, also when the backends are equal.\n *\n * A resource of one fragment can use a provider configuration or a variable of a different fragment.\n * The joined layer has the field `providers` or `variables` when a fragment has it. The function is pure, and it\n * changes no layer. The gate `checkTofu` examines the joined layer afterward.\n *\n * @param pieces - The layers, with the name of the fragment of each one, in the order of the fragments.\n * @returns The joined layer, or the faults of the join.\n */\nexport function joinTofu(pieces: readonly LayerPiece<TofuLayer>[]): LayerParse<TofuLayer> {\n const version = joinSetting(pieces, (layer) => layer.version, \"version of OpenTofu\");\n const backends = pieces.filter((piece) => piece.layer.backend !== undefined);\n const providers = joinRecords(pieces, (layer) => layer.providers, providerAddress, \"provider configuration\");\n const variables = joinRecords(\n pieces,\n (layer) => layer.variables,\n (variable) => variable.name,\n \"variable\",\n );\n const resources = joinRecords(pieces, (layer) => layer.resources, resourceAddress, \"resource\");\n const errors = [...version.errors];\n if (backends.length > 1) errors.push(`The fragments ${backends.map((piece) => `\"${piece.from}\"`).join(\", \")} each have a backend. The state has one place.`);\n errors.push(...providers.errors, ...variables.errors, ...resources.errors);\n if (errors.length > 0) return { ok: false, errors };\n const backend = backends[0]?.layer.backend;\n return {\n ok: true,\n layer: {\n schema: TOFU_SCHEMA,\n ...(version.value === undefined ? {} : { version: version.value }),\n ...(backend === undefined ? {} : { backend }),\n ...(pieces.some((piece) => piece.layer.providers !== undefined) ? { providers: providers.items } : {}),\n ...(pieces.some((piece) => piece.layer.variables !== undefined) ? { variables: variables.items } : {}),\n resources: resources.items,\n },\n };\n}\n"],"mappings":";;;;;;;AAMA,MAAa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C,CAAC,KAAK,IAAI,EAAE,+CAA+C;CAC3J,OAAO,KAAK,GAAG,UAAU,QAAQ,GAAG,UAAU,QAAQ,GAAG,UAAU,MAAM;CACzE,IAAI,OAAO,SAAS,GAAG,OAAO;EAAE,IAAI;EAAO;CAAO;CAClD,MAAM,UAAU,SAAS,EAAE,EAAE,MAAM;CACnC,OAAO;EACL,IAAI;EACJ,OAAO;GACL,QAAQ;GACR,GAAI,QAAQ,UAAU,KAAA,IAAY,CAAC,IAAI,EAAE,SAAS,QAAQ,MAAM;GAChE,GAAI,YAAY,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ;GAC3C,GAAI,OAAO,MAAM,UAAU,MAAM,MAAM,cAAc,KAAA,CAAS,IAAI,EAAE,WAAW,UAAU,MAAM,IAAI,CAAC;GACpG,GAAI,OAAO,MAAM,UAAU,MAAM,MAAM,cAAc,KAAA,CAAS,IAAI,EAAE,WAAW,UAAU,MAAM,IAAI,CAAC;GACpG,WAAW,UAAU;EACvB;CACF;AACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/layer.ts
|
|
2
|
+
/** The name of the format of an OpenTofu layer. It is the key of the layer in `Stack.layers`. */
|
|
3
|
+
const TOFU_SCHEMA = "tofu/1";
|
|
4
|
+
/** These are the types of a variable. */
|
|
5
|
+
const VARIABLE_TYPES = [
|
|
6
|
+
"string",
|
|
7
|
+
"number",
|
|
8
|
+
"bool"
|
|
9
|
+
];
|
|
10
|
+
/**
|
|
11
|
+
* The first word of the types of the resources that are a part of OpenTofu, for example `terraform_data`.
|
|
12
|
+
* Such a resource has no provider configuration, no account and no cost.
|
|
13
|
+
*/
|
|
14
|
+
const BUILTIN_PROVIDER = "terraform";
|
|
15
|
+
/**
|
|
16
|
+
* This function gives the name of a resource in the files: its field `name`, or a name from the `id` of its part.
|
|
17
|
+
* In a name from an `id`, `_` replaces each character that a name cannot have, and a name does not start with a digit.
|
|
18
|
+
*/
|
|
19
|
+
function resourceName(resource) {
|
|
20
|
+
if (resource.name !== void 0) return resource.name;
|
|
21
|
+
const name = resource.part.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
22
|
+
return /^[A-Za-z_]/.test(name) ? name : `_${name}`;
|
|
23
|
+
}
|
|
24
|
+
/** This function gives the address of a resource in the files: its type, a point and its name. */
|
|
25
|
+
function resourceAddress(resource) {
|
|
26
|
+
return `${resource.type}.${resourceName(resource)}`;
|
|
27
|
+
}
|
|
28
|
+
/** This function gives the address of a provider configuration: its name, or its name, a point and its alias. */
|
|
29
|
+
function providerAddress(provider) {
|
|
30
|
+
return provider.alias === void 0 ? provider.name : `${provider.name}.${provider.alias}`;
|
|
31
|
+
}
|
|
32
|
+
/** This function gives the first word of a type: the local name of the provider of the type. */
|
|
33
|
+
function typeProvider(type) {
|
|
34
|
+
const end = type.indexOf("_");
|
|
35
|
+
return end === -1 ? type : type.slice(0, end);
|
|
36
|
+
}
|
|
37
|
+
/** This function tells if a resource is a part of OpenTofu, with no provider configuration. */
|
|
38
|
+
function isBuiltin(resource) {
|
|
39
|
+
return resource.provider === void 0 && typeProvider(resource.type) === "terraform";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* This function gives the provider configuration of a resource, or `undefined` when the layer has none for it.
|
|
43
|
+
* For two configurations with one address, it gives the first one.
|
|
44
|
+
*/
|
|
45
|
+
function resourceProvider(layer, resource) {
|
|
46
|
+
const address = resource.provider ?? typeProvider(resource.type);
|
|
47
|
+
return (layer.providers ?? []).find((provider) => providerAddress(provider) === address);
|
|
48
|
+
}
|
|
49
|
+
export { providerAddress as a, resourceProvider as c, isBuiltin as i, typeProvider as l, TOFU_SCHEMA as n, resourceAddress as o, VARIABLE_TYPES as r, resourceName as s, BUILTIN_PROVIDER as t };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=layer-C9IpaDIx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-C9IpaDIx.js","names":[],"sources":["../src/layer.ts"],"sourcesContent":["// The records of the OpenTofu add-on. They are one layer of a stack, with the key `tofu/1` in `Stack.layers`.\n// Each record tells how a part of the stack becomes a resource of OpenTofu.\n// The add-on knows no provider: the type of a resource and its arguments are data.\n\n/** The name of the format of an OpenTofu layer. It is the key of the layer in `Stack.layers`. */\nexport const TOFU_SCHEMA = \"tofu/1\";\n\n/**\n * A value of an argument, as JSON.\n *\n * - A text is literal. The generator escapes each template sequence, so a text of a record is not an expression.\n * - `{ \"$ref\": \"type.name.attribute\" }` is an attribute of a resource of the layer.\n * - `{ \"$var\": \"name\" }` is the value of a variable of the layer.\n *\n * A key that starts with `$` has no other use.\n */\nexport type TofuValue = string | number | boolean | null | readonly TofuValue[] | TofuObject;\n\n/** An object of values. Its keys are the names of arguments, or the keys of a map. */\nexport interface TofuObject {\n readonly [key: string]: TofuValue;\n}\n\n/**\n * A configuration of a provider. It acts for one part of the stack: an account, a project or a tenant.\n * The cost of each resource of the configuration counts against the limit of that part.\n */\nexport interface Provider {\n /** The local name of the provider, for example `example`. It is the first word of the types of its resources. */\n readonly name: string;\n /** The address of the provider in a registry, for example `example-org/example`. */\n readonly source: string;\n /** The versions of the provider that the files accept, for example `~> 2.0`. */\n readonly version?: string | undefined;\n /** The alias of the configuration. One provider can have one configuration with no alias, and others with an alias each. */\n readonly alias?: string | undefined;\n /** The `id` of the part of the stack that pays for the resources of the configuration. */\n readonly part: string;\n /** The arguments of the configuration. */\n readonly values?: TofuObject | undefined;\n}\n\n/** These are the types of a variable. */\nexport const VARIABLE_TYPES: readonly [\"string\", \"number\", \"bool\"] = [\"string\", \"number\", \"bool\"];\n\n/** A type of a variable. */\nexport type VariableType = (typeof VARIABLE_TYPES)[number];\n\n/**\n * A variable of the files. A person or a program gives its value when OpenTofu runs.\n * A secret is a variable, so no record holds its value. A variable has no default for that reason.\n */\nexport interface Variable {\n readonly name: string;\n /** The type of the variable. The default is `string`. */\n readonly type?: VariableType | undefined;\n /** `true`: OpenTofu does not show the value. */\n readonly sensitive?: boolean | undefined;\n readonly description?: string | undefined;\n}\n\n/** The place where OpenTofu keeps its state. Each value is literal: a backend reads no variable and no resource. */\nexport interface Backend {\n /** The type of the backend, for example `local`. */\n readonly type: string;\n readonly values?: TofuObject | undefined;\n}\n\n/** A resource of OpenTofu that makes a part of the stack, or a piece of it. */\nexport interface Resource {\n /** The `id` of the part of the stack that the resource makes. One part can have two resources or more. */\n readonly part: string;\n /** The type of the resource, for example `example_server`. */\n readonly type: string;\n /** The name of the resource in the files. The default comes from the `id` of the part. */\n readonly name?: string | undefined;\n /**\n * The provider configuration of the resource: a name, or a name, a point and an alias.\n * The default is the configuration with no alias whose name is the first word of the type.\n */\n readonly provider?: string | undefined;\n /** The arguments of the resource. A meta-argument is not an argument: the generator writes each one. */\n readonly values?: TofuObject | undefined;\n /**\n * The planned cost of the resource in a month, in the currency of the budgets.\n * It is the standing price of the resource. The cost that grows with the use is not in it.\n */\n readonly cost?: number | undefined;\n /** `true`: the resource holds data or a name that must stay. The files stop a plan that destroys it. */\n readonly keep?: boolean | undefined;\n /** The attributes whose changes outside the files are permitted, for example `labels`. */\n readonly ignore?: readonly string[] | undefined;\n /** The id of an object that exists at the provider. The files import the object as this resource. */\n readonly import?: string | undefined;\n}\n\n/** An OpenTofu layer: the resources of the parts of a stack, with their providers. */\nexport interface TofuLayer {\n readonly schema: typeof TOFU_SCHEMA;\n /** The versions of OpenTofu that the files accept, for example `>= 1.8`. */\n readonly version?: string | undefined;\n readonly backend?: Backend | undefined;\n readonly providers?: readonly Provider[] | undefined;\n readonly variables?: readonly Variable[] | undefined;\n readonly resources: readonly Resource[];\n}\n\n/**\n * The first word of the types of the resources that are a part of OpenTofu, for example `terraform_data`.\n * Such a resource has no provider configuration, no account and no cost.\n */\nexport const BUILTIN_PROVIDER = \"terraform\";\n\n/**\n * This function gives the name of a resource in the files: its field `name`, or a name from the `id` of its part.\n * In a name from an `id`, `_` replaces each character that a name cannot have, and a name does not start with a digit.\n */\nexport function resourceName(resource: Resource): string {\n if (resource.name !== undefined) return resource.name;\n const name = resource.part.replace(/[^A-Za-z0-9_-]/g, \"_\");\n return /^[A-Za-z_]/.test(name) ? name : `_${name}`;\n}\n\n/** This function gives the address of a resource in the files: its type, a point and its name. */\nexport function resourceAddress(resource: Resource): string {\n return `${resource.type}.${resourceName(resource)}`;\n}\n\n/** This function gives the address of a provider configuration: its name, or its name, a point and its alias. */\nexport function providerAddress(provider: Provider): string {\n return provider.alias === undefined ? provider.name : `${provider.name}.${provider.alias}`;\n}\n\n/** This function gives the first word of a type: the local name of the provider of the type. */\nexport function typeProvider(type: string): string {\n const end = type.indexOf(\"_\");\n return end === -1 ? type : type.slice(0, end);\n}\n\n/** This function tells if a resource is a part of OpenTofu, with no provider configuration. */\nexport function isBuiltin(resource: Resource): boolean {\n return resource.provider === undefined && typeProvider(resource.type) === BUILTIN_PROVIDER;\n}\n\n/**\n * This function gives the provider configuration of a resource, or `undefined` when the layer has none for it.\n * For two configurations with one address, it gives the first one.\n */\nexport function resourceProvider(layer: TofuLayer, resource: Resource): Provider | undefined {\n const address = resource.provider ?? typeProvider(resource.type);\n return (layer.providers ?? []).find((provider) => providerAddress(provider) === address);\n}\n"],"mappings":";;AAKA,MAAa,cAAc;;AAsC3B,MAAa,iBAAwD;CAAC;CAAU;CAAU;AAAM;;;;;AAoEhG,MAAa,mBAAmB;;;;;AAMhC,SAAgB,aAAa,UAA4B;CACvD,IAAI,SAAS,SAAS,KAAA,GAAW,OAAO,SAAS;CACjD,MAAM,OAAO,SAAS,KAAK,QAAQ,mBAAmB,GAAG;CACzD,OAAO,aAAa,KAAK,IAAI,IAAI,OAAO,IAAI;AAC9C;;AAGA,SAAgB,gBAAgB,UAA4B;CAC1D,OAAO,GAAG,SAAS,KAAK,GAAG,aAAa,QAAQ;AAClD;;AAGA,SAAgB,gBAAgB,UAA4B;CAC1D,OAAO,SAAS,UAAU,KAAA,IAAY,SAAS,OAAO,GAAG,SAAS,KAAK,GAAG,SAAS;AACrF;;AAGA,SAAgB,aAAa,MAAsB;CACjD,MAAM,MAAM,KAAK,QAAQ,GAAG;CAC5B,OAAO,QAAQ,KAAK,OAAO,KAAK,MAAM,GAAG,GAAG;AAC9C;;AAGA,SAAgB,UAAU,UAA6B;CACrD,OAAO,SAAS,aAAa,KAAA,KAAa,aAAa,SAAS,IAAI,MAAA;AACtE;;;;;AAMA,SAAgB,iBAAiB,OAAkB,UAA0C;CAC3F,MAAM,UAAU,SAAS,YAAY,aAAa,SAAS,IAAI;CAC/D,QAAQ,MAAM,aAAa,CAAC,EAAA,CAAG,MAAM,aAAa,gBAAgB,QAAQ,MAAM,OAAO;AACzF"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/** The name of the format of an OpenTofu layer. It is the key of the layer in `Stack.layers`. */
|
|
2
|
+
declare const TOFU_SCHEMA = "tofu/1";
|
|
3
|
+
/**
|
|
4
|
+
* A value of an argument, as JSON.
|
|
5
|
+
*
|
|
6
|
+
* - A text is literal. The generator escapes each template sequence, so a text of a record is not an expression.
|
|
7
|
+
* - `{ "$ref": "type.name.attribute" }` is an attribute of a resource of the layer.
|
|
8
|
+
* - `{ "$var": "name" }` is the value of a variable of the layer.
|
|
9
|
+
*
|
|
10
|
+
* A key that starts with `$` has no other use.
|
|
11
|
+
*/
|
|
12
|
+
type TofuValue = string | number | boolean | null | readonly TofuValue[] | TofuObject;
|
|
13
|
+
/** An object of values. Its keys are the names of arguments, or the keys of a map. */
|
|
14
|
+
interface TofuObject {
|
|
15
|
+
readonly [key: string]: TofuValue;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A configuration of a provider. It acts for one part of the stack: an account, a project or a tenant.
|
|
19
|
+
* The cost of each resource of the configuration counts against the limit of that part.
|
|
20
|
+
*/
|
|
21
|
+
interface Provider {
|
|
22
|
+
/** The local name of the provider, for example `example`. It is the first word of the types of its resources. */
|
|
23
|
+
readonly name: string;
|
|
24
|
+
/** The address of the provider in a registry, for example `example-org/example`. */
|
|
25
|
+
readonly source: string;
|
|
26
|
+
/** The versions of the provider that the files accept, for example `~> 2.0`. */
|
|
27
|
+
readonly version?: string | undefined;
|
|
28
|
+
/** The alias of the configuration. One provider can have one configuration with no alias, and others with an alias each. */
|
|
29
|
+
readonly alias?: string | undefined;
|
|
30
|
+
/** The `id` of the part of the stack that pays for the resources of the configuration. */
|
|
31
|
+
readonly part: string;
|
|
32
|
+
/** The arguments of the configuration. */
|
|
33
|
+
readonly values?: TofuObject | undefined;
|
|
34
|
+
}
|
|
35
|
+
/** These are the types of a variable. */
|
|
36
|
+
declare const VARIABLE_TYPES: readonly ["string", "number", "bool"];
|
|
37
|
+
/** A type of a variable. */
|
|
38
|
+
type VariableType = (typeof VARIABLE_TYPES)[number];
|
|
39
|
+
/**
|
|
40
|
+
* A variable of the files. A person or a program gives its value when OpenTofu runs.
|
|
41
|
+
* A secret is a variable, so no record holds its value. A variable has no default for that reason.
|
|
42
|
+
*/
|
|
43
|
+
interface Variable {
|
|
44
|
+
readonly name: string;
|
|
45
|
+
/** The type of the variable. The default is `string`. */
|
|
46
|
+
readonly type?: VariableType | undefined;
|
|
47
|
+
/** `true`: OpenTofu does not show the value. */
|
|
48
|
+
readonly sensitive?: boolean | undefined;
|
|
49
|
+
readonly description?: string | undefined;
|
|
50
|
+
}
|
|
51
|
+
/** The place where OpenTofu keeps its state. Each value is literal: a backend reads no variable and no resource. */
|
|
52
|
+
interface Backend {
|
|
53
|
+
/** The type of the backend, for example `local`. */
|
|
54
|
+
readonly type: string;
|
|
55
|
+
readonly values?: TofuObject | undefined;
|
|
56
|
+
}
|
|
57
|
+
/** A resource of OpenTofu that makes a part of the stack, or a piece of it. */
|
|
58
|
+
interface Resource {
|
|
59
|
+
/** The `id` of the part of the stack that the resource makes. One part can have two resources or more. */
|
|
60
|
+
readonly part: string;
|
|
61
|
+
/** The type of the resource, for example `example_server`. */
|
|
62
|
+
readonly type: string;
|
|
63
|
+
/** The name of the resource in the files. The default comes from the `id` of the part. */
|
|
64
|
+
readonly name?: string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* The provider configuration of the resource: a name, or a name, a point and an alias.
|
|
67
|
+
* The default is the configuration with no alias whose name is the first word of the type.
|
|
68
|
+
*/
|
|
69
|
+
readonly provider?: string | undefined;
|
|
70
|
+
/** The arguments of the resource. A meta-argument is not an argument: the generator writes each one. */
|
|
71
|
+
readonly values?: TofuObject | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* The planned cost of the resource in a month, in the currency of the budgets.
|
|
74
|
+
* It is the standing price of the resource. The cost that grows with the use is not in it.
|
|
75
|
+
*/
|
|
76
|
+
readonly cost?: number | undefined;
|
|
77
|
+
/** `true`: the resource holds data or a name that must stay. The files stop a plan that destroys it. */
|
|
78
|
+
readonly keep?: boolean | undefined;
|
|
79
|
+
/** The attributes whose changes outside the files are permitted, for example `labels`. */
|
|
80
|
+
readonly ignore?: readonly string[] | undefined;
|
|
81
|
+
/** The id of an object that exists at the provider. The files import the object as this resource. */
|
|
82
|
+
readonly import?: string | undefined;
|
|
83
|
+
}
|
|
84
|
+
/** An OpenTofu layer: the resources of the parts of a stack, with their providers. */
|
|
85
|
+
interface TofuLayer {
|
|
86
|
+
readonly schema: typeof TOFU_SCHEMA;
|
|
87
|
+
/** The versions of OpenTofu that the files accept, for example `>= 1.8`. */
|
|
88
|
+
readonly version?: string | undefined;
|
|
89
|
+
readonly backend?: Backend | undefined;
|
|
90
|
+
readonly providers?: readonly Provider[] | undefined;
|
|
91
|
+
readonly variables?: readonly Variable[] | undefined;
|
|
92
|
+
readonly resources: readonly Resource[];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The first word of the types of the resources that are a part of OpenTofu, for example `terraform_data`.
|
|
96
|
+
* Such a resource has no provider configuration, no account and no cost.
|
|
97
|
+
*/
|
|
98
|
+
declare const BUILTIN_PROVIDER = "terraform";
|
|
99
|
+
/**
|
|
100
|
+
* This function gives the name of a resource in the files: its field `name`, or a name from the `id` of its part.
|
|
101
|
+
* In a name from an `id`, `_` replaces each character that a name cannot have, and a name does not start with a digit.
|
|
102
|
+
*/
|
|
103
|
+
declare function resourceName(resource: Resource): string;
|
|
104
|
+
/** This function gives the address of a resource in the files: its type, a point and its name. */
|
|
105
|
+
declare function resourceAddress(resource: Resource): string;
|
|
106
|
+
/** This function gives the address of a provider configuration: its name, or its name, a point and its alias. */
|
|
107
|
+
declare function providerAddress(provider: Provider): string;
|
|
108
|
+
/** This function gives the first word of a type: the local name of the provider of the type. */
|
|
109
|
+
declare function typeProvider(type: string): string;
|
|
110
|
+
/** This function tells if a resource is a part of OpenTofu, with no provider configuration. */
|
|
111
|
+
declare function isBuiltin(resource: Resource): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* This function gives the provider configuration of a resource, or `undefined` when the layer has none for it.
|
|
114
|
+
* For two configurations with one address, it gives the first one.
|
|
115
|
+
*/
|
|
116
|
+
declare function resourceProvider(layer: TofuLayer, resource: Resource): Provider | undefined;
|
|
117
|
+
export { typeProvider as _, TOFU_SCHEMA as a, TofuValue as c, VariableType as d, isBuiltin as f, resourceProvider as g, resourceName as h, Resource as i, VARIABLE_TYPES as l, resourceAddress as m, Backend as n, TofuLayer as o, providerAddress as p, Provider as r, TofuObject as s, BUILTIN_PROVIDER as t, Variable as u };
|
|
118
|
+
//# sourceMappingURL=layer-MFHgwWfO.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layer-MFHgwWfO.d.ts","names":[],"sources":["../src/layer.ts"],"mappings":";cAKa;;;;;;;;;;KAWD,wDAAwD,cAAc;;UAGjE;YACS,cAAA;;;;;;UAOT;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;WAEA,SAAS;;;cAIP;;KAGD,uBAAuB;;;;;UAMlB;WACN;;WAEA,OAAO;;WAEP;WACA;;;UAIM;;WAEN;WACA,SAAS;;;UAIH;;WAEN;;WAEA;;WAEA;;;;;WAKA;;WAEA,SAAS;;;;;WAKT;;WAEA;;WAEA;;WAEA;;;UAIM;WACN,eAAe;;WAEf;WACA,UAAU;WACV,qBAAqB;WACrB,qBAAqB;WACrB,oBAAoB;;;;;;cAOlB;;;;;iBAMG,aAAa,UAAU;;iBAOvB,gBAAgB,UAAU;;iBAK1B,gBAAgB,UAAU;;iBAK1B,aAAa;;iBAMb,UAAU,UAAU;;;;;iBAQpB,iBAAiB,OAAO,WAAW,UAAU,WAAW"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { o as TofuLayer } from "./layer-MFHgwWfO.js";
|
|
2
|
+
import { Fault } from "@mark1russell7/system-stack";
|
|
3
|
+
/** A change of one resource in a plan. The names of the fields are the names of the JSON of OpenTofu. */
|
|
4
|
+
interface PlanChange {
|
|
5
|
+
/** The address of the resource, for example `example_server.web`. */
|
|
6
|
+
readonly address: string;
|
|
7
|
+
/** `managed` for a resource, or `data` for a data source. */
|
|
8
|
+
readonly mode?: string | undefined;
|
|
9
|
+
readonly change: {
|
|
10
|
+
/** The actions of the change: `no-op`, `create`, `read`, `update`, `delete` or `forget`. A replacement has `delete` and `create`. */
|
|
11
|
+
readonly actions: readonly string[];
|
|
12
|
+
/** The import of an object that exists at the provider, with its id. A change with no import has none. */
|
|
13
|
+
readonly importing?: {
|
|
14
|
+
readonly id?: string | undefined;
|
|
15
|
+
} | null | undefined;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
/** The JSON of a plan of OpenTofu. This type has only the fields that the gate reads. */
|
|
19
|
+
interface TofuPlan {
|
|
20
|
+
/** The version of the format, for example `1.2`. A reader ignores a field that it does not know. */
|
|
21
|
+
readonly format_version: string;
|
|
22
|
+
/** `true`: the plan has an error, and it is not complete. */
|
|
23
|
+
readonly errored?: boolean | undefined;
|
|
24
|
+
readonly resource_changes?: readonly PlanChange[] | undefined;
|
|
25
|
+
}
|
|
26
|
+
/** These are the codes of the faults of a plan. */
|
|
27
|
+
declare const PLAN_CODES: readonly ["plan-format", "plan-errored", "plan-action", "plan-unknown", "plan-missing", "plan-destroy", "plan-delete", "plan-forget", "plan-import", "plan-change"];
|
|
28
|
+
/** A code of a fault of a plan. */
|
|
29
|
+
type PlanCode = (typeof PLAN_CODES)[number];
|
|
30
|
+
/** A fault of a plan. Its field `at` is the address of the resource, or `plan` for the plan as a whole. */
|
|
31
|
+
interface PlanFault extends Fault {
|
|
32
|
+
readonly code: PlanCode;
|
|
33
|
+
/** The `id` of the part of the stack of the resource. A resource that the layer does not have has none. */
|
|
34
|
+
readonly part?: string | undefined;
|
|
35
|
+
}
|
|
36
|
+
/** The options of the gate of a plan. */
|
|
37
|
+
interface PlanOptions {
|
|
38
|
+
/**
|
|
39
|
+
* `true`: the plan must change nothing. Use it for the capture of resources that exist.
|
|
40
|
+
* After their import, a plan with no change tells that the records and the provider agree.
|
|
41
|
+
*/
|
|
42
|
+
readonly noChange?: boolean | undefined;
|
|
43
|
+
/** The addresses of the resources that the plan can delete. A delete of a different resource stops the gate. */
|
|
44
|
+
readonly removes?: readonly string[] | undefined;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* This function gives each fault of a plan for a layer. An empty list tells that the gate passes.
|
|
48
|
+
*
|
|
49
|
+
* The read of the plan:
|
|
50
|
+
* - `plan-format`: the format of the plan has a different major version. The gate reads nothing more.
|
|
51
|
+
* - `plan-errored`: the plan has an error, so it is not complete.
|
|
52
|
+
* - `plan-action`: a change has an action that the gate does not know, or no action.
|
|
53
|
+
*
|
|
54
|
+
* The plan and the records:
|
|
55
|
+
* - `plan-unknown`: the plan changes a resource that the layer does not have. No record tells its cost.
|
|
56
|
+
* - `plan-missing`: the plan does not have a resource of the layer. The plan is not a plan of these records.
|
|
57
|
+
* - `plan-destroy`: the plan deletes or replaces a resource whose record has `keep`.
|
|
58
|
+
* - `plan-delete`: the plan deletes a resource, and the option `removes` does not name it.
|
|
59
|
+
* - `plan-forget`: the plan removes a resource from the state and does not delete it. The object stays at the provider with no record.
|
|
60
|
+
* - `plan-import`: the import of a resource in the plan and the field `import` of its record do not agree.
|
|
61
|
+
* - `plan-change`: the option `noChange` is set, and the plan changes a resource.
|
|
62
|
+
*
|
|
63
|
+
* A gate that cannot read a plan does not pass. The faults are in the sequence of the changes of the plan, then of the resources of the layer.
|
|
64
|
+
* The function is pure.
|
|
65
|
+
*/
|
|
66
|
+
declare function checkPlan(layer: TofuLayer, plan: TofuPlan, options?: PlanOptions): PlanFault[];
|
|
67
|
+
export { PlanOptions as a, PlanFault as i, PlanChange as n, TofuPlan as o, PlanCode as r, checkPlan as s, PLAN_CODES as t };
|
|
68
|
+
//# sourceMappingURL=plan-B4mHDZjK.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan-B4mHDZjK.d.ts","names":[],"sources":["../src/plan.ts"],"mappings":";;;UAQiB;;WAEN;;WAEA;WACA;;aAEE;;aAEA;eAAuB;;;;;UAKnB;;WAEN;;WAEA;WACA,4BAA4B;;;cAI1B;;KAcD,mBAAmB;;UAGd,kBAAkB;WACxB,MAAM;;WAEN;;;UAIM;;;;;WAKN;;WAEA;;;;;;;;;;;;;;;;;;;;;;iBA6BK,UAAU,OAAO,WAAW,MAAM,UAAU,UAAS,cAAmB"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { o as TofuLayer } from "./layer-MFHgwWfO.js";
|
|
2
|
+
import { o as TofuPlan } from "./plan-B4mHDZjK.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
/**
|
|
5
|
+
* The schema of an OpenTofu layer. It examines the form of the record: the fields, their types and the finite numbers.
|
|
6
|
+
* It refuses a field that the format does not have. `checkTofu` examines the meaning of a layer with a correct form.
|
|
7
|
+
*/
|
|
8
|
+
export declare const tofuSchema: z.ZodType<TofuLayer>;
|
|
9
|
+
/** The result of the read of an OpenTofu layer: the layer, or the faults of its form. */
|
|
10
|
+
export type TofuParse = {
|
|
11
|
+
readonly ok: true;
|
|
12
|
+
readonly layer: TofuLayer;
|
|
13
|
+
} | {
|
|
14
|
+
readonly ok: false;
|
|
15
|
+
readonly errors: readonly string[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* This function reads the JSON of an OpenTofu layer. It gives the layer, or the faults of its form.
|
|
19
|
+
* Each fault names its place in the record, for example `resources.0.type`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseTofu(input: unknown): TofuParse;
|
|
22
|
+
/**
|
|
23
|
+
* The schema of the JSON of a plan of OpenTofu. It examines only the fields that the gate reads.
|
|
24
|
+
* It keeps each other field, because a later version of OpenTofu can add fields. `checkPlan` examines the meaning of the plan.
|
|
25
|
+
*/
|
|
26
|
+
export declare const planSchema: z.ZodType<TofuPlan>;
|
|
27
|
+
/** The result of the read of a plan: the plan, or the faults of its form. */
|
|
28
|
+
export type PlanParse = {
|
|
29
|
+
readonly ok: true;
|
|
30
|
+
readonly plan: TofuPlan;
|
|
31
|
+
} | {
|
|
32
|
+
readonly ok: false;
|
|
33
|
+
readonly errors: readonly string[];
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* This function reads the JSON of a plan of OpenTofu, from the command `tofu show -json`. It gives the plan, or the faults of its form.
|
|
37
|
+
* Each fault names its place in the plan, for example `resource_changes.0.address`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function parsePlan(input: unknown): PlanParse;
|
|
40
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../src/schema.ts"],"mappings":";;;;;;;qBA0Ea,YAAY,EAAE,QAAQ;;YAUvB;WAAuB;WAAmB,OAAO;;WAAyB;WAAoB;;;;;;wBAM1F,UAAU,iBAAiB;;;;;qBAsB9B,YAAY,EAAE,QAAQ;;YAOvB;WAAuB;WAAmB,MAAM;;WAAwB;WAAoB;;;;;;wBAMxF,UAAU,iBAAiB"}
|
package/build/schema.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { n as TOFU_SCHEMA, r as VARIABLE_TYPES } from "./layer-C9IpaDIx.js";
|
|
2
|
+
import { formErrors } from "@mark1russell7/system-stack/schema";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
// src/schema.ts
|
|
5
|
+
const id = z.string().min(1);
|
|
6
|
+
/** This function tells if a value is an object of JSON. A list, a date and an instance of a class are not. */
|
|
7
|
+
function isPlain(input) {
|
|
8
|
+
if (typeof input !== "object" || input === null || Array.isArray(input)) return false;
|
|
9
|
+
const proto = Object.getPrototypeOf(input);
|
|
10
|
+
return proto === Object.prototype || proto === null;
|
|
11
|
+
}
|
|
12
|
+
/** This function gives the place of each piece of a value that is not a value of JSON. */
|
|
13
|
+
function wrongPlaces(input, path = []) {
|
|
14
|
+
if (input === null || typeof input === "string" || typeof input === "boolean") return [];
|
|
15
|
+
if (typeof input === "number") return Number.isFinite(input) ? [] : [[...path]];
|
|
16
|
+
if (Array.isArray(input)) return input.flatMap((item, at) => wrongPlaces(item, [...path, at]));
|
|
17
|
+
if (isPlain(input)) return Object.entries(input).flatMap(([key, item]) => wrongPlaces(item, [...path, key]));
|
|
18
|
+
return [[...path]];
|
|
19
|
+
}
|
|
20
|
+
const values = z.custom().superRefine((input, context) => {
|
|
21
|
+
if (!isPlain(input)) {
|
|
22
|
+
context.addIssue({
|
|
23
|
+
code: "custom",
|
|
24
|
+
message: "The arguments are not an object."
|
|
25
|
+
});
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
for (const path of wrongPlaces(input)) context.addIssue({
|
|
29
|
+
code: "custom",
|
|
30
|
+
path,
|
|
31
|
+
message: "The value is not a value of JSON: a text, a finite number, a boolean, null, a list or an object."
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
const provider = z.strictObject({
|
|
35
|
+
name: id,
|
|
36
|
+
source: id,
|
|
37
|
+
version: id.optional(),
|
|
38
|
+
alias: id.optional(),
|
|
39
|
+
part: id,
|
|
40
|
+
values: values.optional()
|
|
41
|
+
});
|
|
42
|
+
const variable = z.strictObject({
|
|
43
|
+
name: id,
|
|
44
|
+
type: z.enum([...VARIABLE_TYPES]).optional(),
|
|
45
|
+
sensitive: z.boolean().optional(),
|
|
46
|
+
description: z.string().optional()
|
|
47
|
+
});
|
|
48
|
+
const backend = z.strictObject({
|
|
49
|
+
type: id,
|
|
50
|
+
values: values.optional()
|
|
51
|
+
});
|
|
52
|
+
const resource = z.strictObject({
|
|
53
|
+
part: id,
|
|
54
|
+
type: id,
|
|
55
|
+
name: id.optional(),
|
|
56
|
+
provider: id.optional(),
|
|
57
|
+
values: values.optional(),
|
|
58
|
+
cost: z.number().optional(),
|
|
59
|
+
keep: z.boolean().optional(),
|
|
60
|
+
ignore: z.array(id).readonly().optional(),
|
|
61
|
+
import: z.string().optional()
|
|
62
|
+
});
|
|
63
|
+
/**
|
|
64
|
+
* The schema of an OpenTofu layer. It examines the form of the record: the fields, their types and the finite numbers.
|
|
65
|
+
* It refuses a field that the format does not have. `checkTofu` examines the meaning of a layer with a correct form.
|
|
66
|
+
*/
|
|
67
|
+
const tofuSchema = z.strictObject({
|
|
68
|
+
schema: z.literal(TOFU_SCHEMA),
|
|
69
|
+
version: id.optional(),
|
|
70
|
+
backend: backend.optional(),
|
|
71
|
+
providers: z.array(provider).readonly().optional(),
|
|
72
|
+
variables: z.array(variable).readonly().optional(),
|
|
73
|
+
resources: z.array(resource).readonly()
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* This function reads the JSON of an OpenTofu layer. It gives the layer, or the faults of its form.
|
|
77
|
+
* Each fault names its place in the record, for example `resources.0.type`.
|
|
78
|
+
*/
|
|
79
|
+
function parseTofu(input) {
|
|
80
|
+
const read = tofuSchema.safeParse(input);
|
|
81
|
+
if (read.success) return {
|
|
82
|
+
ok: true,
|
|
83
|
+
layer: read.data
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
ok: false,
|
|
87
|
+
errors: formErrors(TOFU_SCHEMA, read.error.issues)
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const change = z.looseObject({
|
|
91
|
+
address: id,
|
|
92
|
+
mode: z.string().optional(),
|
|
93
|
+
change: z.looseObject({
|
|
94
|
+
actions: z.array(z.string()).readonly(),
|
|
95
|
+
importing: z.looseObject({ id: z.string().optional() }).nullable().optional()
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
/** The name of a plan in a fault of its form. */
|
|
99
|
+
const PLAN_NAME = "plan";
|
|
100
|
+
/**
|
|
101
|
+
* The schema of the JSON of a plan of OpenTofu. It examines only the fields that the gate reads.
|
|
102
|
+
* It keeps each other field, because a later version of OpenTofu can add fields. `checkPlan` examines the meaning of the plan.
|
|
103
|
+
*/
|
|
104
|
+
const planSchema = z.looseObject({
|
|
105
|
+
format_version: id,
|
|
106
|
+
errored: z.boolean().optional(),
|
|
107
|
+
resource_changes: z.array(change).readonly().optional()
|
|
108
|
+
});
|
|
109
|
+
/**
|
|
110
|
+
* This function reads the JSON of a plan of OpenTofu, from the command `tofu show -json`. It gives the plan, or the faults of its form.
|
|
111
|
+
* Each fault names its place in the plan, for example `resource_changes.0.address`.
|
|
112
|
+
*/
|
|
113
|
+
function parsePlan(input) {
|
|
114
|
+
const read = planSchema.safeParse(input);
|
|
115
|
+
if (read.success) return {
|
|
116
|
+
ok: true,
|
|
117
|
+
plan: read.data
|
|
118
|
+
};
|
|
119
|
+
return {
|
|
120
|
+
ok: false,
|
|
121
|
+
errors: formErrors(PLAN_NAME, read.error.issues)
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
export { parsePlan, parseTofu, planSchema, tofuSchema };
|
|
125
|
+
|
|
126
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../src/schema.ts"],"sourcesContent":["import { formErrors } from \"@mark1russell7/system-stack/schema\";\nimport { z } from \"zod\";\nimport { TOFU_SCHEMA, VARIABLE_TYPES, type TofuLayer, type TofuObject } from \"./layer.ts\";\nimport type { TofuPlan } from \"./plan.ts\";\n\n// The zod schema of an OpenTofu layer and of a plan, and the read of their JSON. This module is the entry `/schema` of the package.\n// The root entry has no zod, so a page that only generates a document gets no schema library.\n\nconst id = z.string().min(1);\n\n/** This function tells if a value is an object of JSON. A list, a date and an instance of a class are not. */\nfunction isPlain(input: unknown): input is Readonly<Record<string, unknown>> {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) return false;\n const proto: unknown = Object.getPrototypeOf(input);\n return proto === Object.prototype || proto === null;\n}\n\n/** This function gives the place of each piece of a value that is not a value of JSON. */\nfunction wrongPlaces(input: unknown, path: readonly (string | number)[] = []): (string | number)[][] {\n if (input === null || typeof input === \"string\" || typeof input === \"boolean\") return [];\n if (typeof input === \"number\") return Number.isFinite(input) ? [] : [[...path]];\n if (Array.isArray(input)) return input.flatMap((item: unknown, at) => wrongPlaces(item, [...path, at]));\n if (isPlain(input)) return Object.entries(input).flatMap(([key, item]) => wrongPlaces(item, [...path, key]));\n return [[...path]];\n}\n\n// The arguments of a record are JSON of each depth. One walk examines them, so a fault names its exact place.\nconst values = z.custom<TofuObject>().superRefine((input, context) => {\n if (!isPlain(input)) {\n context.addIssue({ code: \"custom\", message: \"The arguments are not an object.\" });\n return;\n }\n for (const path of wrongPlaces(input)) {\n context.addIssue({ code: \"custom\", path, message: \"The value is not a value of JSON: a text, a finite number, a boolean, null, a list or an object.\" });\n }\n});\n\nconst provider = z.strictObject({\n name: id,\n source: id,\n version: id.optional(),\n alias: id.optional(),\n part: id,\n values: values.optional(),\n});\n\nconst variable = z.strictObject({\n name: id,\n type: z.enum([...VARIABLE_TYPES]).optional(),\n sensitive: z.boolean().optional(),\n description: z.string().optional(),\n});\n\nconst backend = z.strictObject({\n type: id,\n values: values.optional(),\n});\n\nconst resource = z.strictObject({\n part: id,\n type: id,\n name: id.optional(),\n provider: id.optional(),\n values: values.optional(),\n cost: z.number().optional(),\n keep: z.boolean().optional(),\n ignore: z.array(id).readonly().optional(),\n import: z.string().optional(),\n});\n\n/**\n * The schema of an OpenTofu layer. It examines the form of the record: the fields, their types and the finite numbers.\n * It refuses a field that the format does not have. `checkTofu` examines the meaning of a layer with a correct form.\n */\nexport const tofuSchema: z.ZodType<TofuLayer> = z.strictObject({\n schema: z.literal(TOFU_SCHEMA),\n version: id.optional(),\n backend: backend.optional(),\n providers: z.array(provider).readonly().optional(),\n variables: z.array(variable).readonly().optional(),\n resources: z.array(resource).readonly(),\n});\n\n/** The result of the read of an OpenTofu layer: the layer, or the faults of its form. */\nexport type TofuParse = { readonly ok: true; readonly layer: TofuLayer } | { readonly ok: false; readonly errors: readonly string[] };\n\n/**\n * This function reads the JSON of an OpenTofu layer. It gives the layer, or the faults of its form.\n * Each fault names its place in the record, for example `resources.0.type`.\n */\nexport function parseTofu(input: unknown): TofuParse {\n const read = tofuSchema.safeParse(input);\n if (read.success) return { ok: true, layer: read.data };\n return { ok: false, errors: formErrors(TOFU_SCHEMA, read.error.issues) };\n}\n\nconst change = z.looseObject({\n address: id,\n mode: z.string().optional(),\n change: z.looseObject({\n actions: z.array(z.string()).readonly(),\n importing: z.looseObject({ id: z.string().optional() }).nullable().optional(),\n }),\n});\n\n/** The name of a plan in a fault of its form. */\nconst PLAN_NAME = \"plan\";\n\n/**\n * The schema of the JSON of a plan of OpenTofu. It examines only the fields that the gate reads.\n * It keeps each other field, because a later version of OpenTofu can add fields. `checkPlan` examines the meaning of the plan.\n */\nexport const planSchema: z.ZodType<TofuPlan> = z.looseObject({\n format_version: id,\n errored: z.boolean().optional(),\n resource_changes: z.array(change).readonly().optional(),\n});\n\n/** The result of the read of a plan: the plan, or the faults of its form. */\nexport type PlanParse = { readonly ok: true; readonly plan: TofuPlan } | { readonly ok: false; readonly errors: readonly string[] };\n\n/**\n * This function reads the JSON of a plan of OpenTofu, from the command `tofu show -json`. It gives the plan, or the faults of its form.\n * Each fault names its place in the plan, for example `resource_changes.0.address`.\n */\nexport function parsePlan(input: unknown): PlanParse {\n const read = planSchema.safeParse(input);\n if (read.success) return { ok: true, plan: read.data };\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