Skip to content

feat(cloudformation): provision AWS::StepFunctions::StateMachine#1152

Open
walker-luke wants to merge 1 commit into
floci-io:mainfrom
walker-luke:feat/cfn-stepfunctions-statemachine
Open

feat(cloudformation): provision AWS::StepFunctions::StateMachine#1152
walker-luke wants to merge 1 commit into
floci-io:mainfrom
walker-luke:feat/cfn-stepfunctions-statemachine

Conversation

@walker-luke
Copy link
Copy Markdown

@walker-luke walker-luke commented Jun 3, 2026

Summary

CloudFormationResourceProvisioner has handlers for ~30 resource types but no case for AWS::StepFunctions::StateMachine. Templates containing one currently fall through to the default branch in provision(...), which stubs a placeholder physical id, sets Arn to arn:aws:stub:::<logical-id>, and reports CREATE_COMPLETE without ever calling StepFunctionsService.

The state machine therefore does not exist in the SFN store after a stack create. Downstream resources that depend on it (e.g. AWS::Pipes::Pipe with a Step Functions target) deploy successfully but fail at runtime with State machine does not exist (AwsException) the first time the pipe tries to invoke its target.

Change

Add a provisioner that delegates to the existing StepFunctionsService.createStateMachine:

  • Resolves StateMachineName (auto-generates from logical id when absent, matching the Pipe/Lambda pattern).
  • Resolves DefinitionString and applies DefinitionSubstitutions - the same ${Var} replacement CloudFormation performs server-side before handing the definition to Step Functions.
  • Resolves RoleArn, StateMachineType, and Tags (via the existing parseCfnTags helper).
  • Sets PhysicalId to the canonical ARN (matching real AWS Ref semantics) and exposes Arn + Name attributes for Fn::GetAtt.

Wires deletion through StepFunctionsService.deleteStateMachine.

Test plan

Adds CloudFormationIntegrationTest#createStack_stepFunctionsStateMachineResolvesDefinitionSubstitutionsAndIsDeletable, which:

  • Creates a stack containing an IAM role plus an AWS::StepFunctions::StateMachine with a DefinitionSubstitutions map referencing `{Marker}`.
  • Asserts DescribeStateMachine returns the canonical ARN, the resolved role, and a definition where ${Marker} has been replaced (and no placeholder remains).
  • Asserts the stack's Outputs expose the canonical ARN via Ref and the name via Fn::GetAtt.
  • Deletes the stack and asserts DescribeStateMachine then returns StateMachineDoesNotExist.

Verified locally:

  • ./mvnw test -Dtest=CloudFormationIntegrationTest - 77/77 pass
  • ./mvnw test -Dtest='StepFunctions*Test' - 68/68 pass

Notes

  • No changes to StepFunctionsService, the SFN wire protocol, or any other resource handler.
  • LoggingConfiguration and TracingConfiguration properties are accepted on the input but not persisted, matching how other Floci provisioners treat operationally‑irrelevant emulator properties today.

CloudFormationResourceProvisioner previously had no case for
AWS::StepFunctions::StateMachine, so stacks containing one fell through
to the default branch that stubs a placeholder ARN and reports
CREATE_COMPLETE without invoking StepFunctionsService. Downstream
EventBridge Pipes that target the state machine then fail at runtime
with "State machine does not exist".

Add a provisioner that:

- Resolves StateMachineName (auto-generating from logical id when absent)
- Resolves DefinitionString and applies DefinitionSubstitutions
  (the same ${Var} replacement CloudFormation performs server-side)
- Resolves RoleArn, StateMachineType, and Tags
- Delegates to the existing StepFunctionsService.createStateMachine
- Sets PhysicalId to the canonical ARN (matching AWS Ref semantics)
  and exposes the Arn and Name attributes for Fn::GetAtt

Also wire deletion through StepFunctionsService.deleteStateMachine.

Adds an integration test that creates a stack with substitutions,
asserts the resolved definition is stored, asserts CFN outputs return
the canonical ARN and name, and asserts deletion removes the resource.
@hectorvent hectorvent added cloudformation AWS CloudFormation feature labels Jun 4, 2026
Copy link
Copy Markdown
Collaborator

@hectorvent hectorvent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @walker-luke,

Thanks for the PR. It is a solid fix.
Please take a look at the conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants