extractAslFromTerraform
function extractAslFromTerraform(params): ExtractAslResult;Defined in: src/terraform/extract.ts:305
Recovers a renderable ASL definition from a Terraform configuration.
Finds the aws_sfn_state_machine resource (disambiguated with resourceId when there is more
than one) in HCL (.tf) or JSON (.tf.json) syntax and reads its definition: a heredoc, a
quoted string of JSON, or jsonencode({...}) of literals. Values only Terraform can compute
(resource attributes, variables, function calls) become ${...} placeholder strings; calls and
operators also add a warning. templatefile(), file(), references such as local.x, %{ }
template directives and module blocks cannot be evaluated and throw with a message saying
what to do instead.
Parameters
Section titled “Parameters”params
Section titled “params”Terraform source, optional format, optional resource name.
Returns
Section titled “Returns”The extracted ASL definition, the resource name used, and any warnings.
Throws
Section titled “Throws”If no state machine is found, the choice is ambiguous, the definition is in an unsupported form, or the HCL has a syntax error.
Example
Section titled “Example”const { aslDefinition } = extractAslFromTerraform({ config: mainTfSource });