IF Commons GitHub

logical/terraform

Written to: 2 requirements: 2 proved, 0 partly, 0 failing, 0 with no test recorded. 0003-estate-iac-importers FR-001, 0003-estate-iac-importers FR-002

OpenTofu and Terraform: the JSON of show -json for a plan or for a state, read as text. Every managed resource becomes an asset of the estate (a cloud resource; a record of the name system a domain; a load balancer listener an endpoint; a certificate a certificate), with the provider, the partition (the government clouds are told from the others by the region), the type, the region and the identifier where the state has one. Only those facts are copied: the values of a resource are never, because a state holds secrets. A link is a reference between resources (a plan's expressions, a state's depends_on).

import { importTerraform } from "./terraform.ts";
importTerraform("opentofu", "plan.json", JSON.stringify({ planned_values: { root_module: { resources: [] } } })).assets; // []

Source: commons/estate-iac/src/logical/terraform.ts

1 of 4 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

logical.partitionOffunctionno test imports it
function partitionOf(provider: string, region: string | undefined): string | undefined

The partition of a cloud from the region or location of a resource: AWS GovCloud regions begin us-gov-, Azure Government locations usgov, usdod or usdodeast.

logical.importTerraformfunctionno test imports it
function importTerraform(tool: "opentofu" | "terraform", source: string, text: string): Imports

The resources of a plan or a state, as show -json writes it, as assets and links. A text that is not JSON, or not that JSON, is a problem and no asset.

partitionOffunctionno test imports it
function partitionOf(provider: string, region: string | undefined): string | undefined

The partition of a cloud from the region or location of a resource: AWS GovCloud regions begin us-gov-, Azure Government locations usgov, usdod or usdodeast.

importTerraformfunction
function importTerraform(tool: "opentofu" | "terraform", source: string, text: string): Imports

The resources of a plan or a state, as show -json writes it, as assets and links. A text that is not JSON, or not that JSON, is a problem and no asset.

Imported by 10 tests of the run (10 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.