Added encryptionconfiguration support for WS::Serverless::StateMachine
Summary
Passthrough EncryptionConfiguration from AWS::Serverless::StateMachine to AWS::StepFunctions::StateMachine, enabling customer-managed KMS encryption for Step Functions state machines defined in SAM templates.
Issue
Fixes #3925
Description of changes
- Added
EncryptionConfigurationas a pass-through property onAWS::Serverless::StateMachine(sam_resources.py). - Updated
StateMachineGeneratorto setEncryptionConfigurationon the generatedAWS::StepFunctions::StateMachineresource (generators.py,stepfunctions/resources.py). - Updated SAM schema and documentation:
samtranslator/internal/schema_source/aws_serverless_statemachine.pysamtranslator/internal/schema_source/sam-docs.json- Regenerated
schema_source/sam.schema.jsonandsamtranslator/schema/schema.json
- Added translator test case
state_machine_with_encryption_configuration(input + expected output foraws,aws-cn, andaws-us-gov).
Example SAM usage:
MyStateMachine:
Type: AWS::Serverless::StateMachine
Properties:
Definition:
StartAt: Hello
States:
Hello:
Type: Pass
End: true
EncryptionConfiguration:
Type: CUSTOMER_MANAGED_KMS_KEY
KmsKeyId: !GetAtt MyKmsKey.Arn
KmsDataKeyReusePeriodSeconds: 300
Policies:
- ...
Transforms to AWS::StepFunctions::StateMachine with the same EncryptionConfiguration block, aligned with CloudFormation EncryptionConfiguration.
Description of how you validated changes
-
Ran translator tests for the new fixture across partitions:
pytest tests/translator/test_translator.py -k state_machine_with_encryption_configuration -o addopts=(3 passed:
aws,aws-cn,aws-us-gov) -
Ran existing state machine generator unit tests:
pytest tests/model/stepfunctions/test_state_machine_generator.py -o addopts=(15 passed)
-
Regenerated schemas and confirmed they match committed files:
python3 -m samtranslator.internal.schema_source.schema \ --sam-schema .tmp/sam.schema.json \ --cfn-schema schema_source/cloudformation.schema.json \ --unified-schema .tmp/schema.json diff schema_source/sam.schema.json .tmp/sam.schema.json diff samtranslator/schema/schema.json .tmp/schema.json
Checklist
- [x] Review the generative AI contribution guidelines
- [x] Adheres to the development guidelines
- [x] Add/update transform tests
- [x] Using correct values
- [ ] Using wrong values (not added; property is optional pass-through with no SAM-specific validation)
- [ ] Add/update integration tests (not added; change is translator/schema-only)
Examples?
N/A — no new sam init example template in this PR.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Hi, I have pushed another commit to address the failing tests!