@@ -1808,4 +1808,56 @@ describe('#compileStateMachines', () => {
18081808 orderValue : '{% $states.input.order.total %}' ,
18091809 } ) ;
18101810 } ) ;
1811+
1812+ it ( 'should compile with a specified KMS key' , ( ) => {
1813+ serverless . service . stepFunctions = {
1814+ stateMachines : {
1815+ myStateMachine1 : {
1816+ id : 'Test' ,
1817+ name : 'Test' ,
1818+ definition : { } ,
1819+ encryptionConfig : {
1820+ KmsKeyId : 'arn:kms:...' ,
1821+ } ,
1822+ } ,
1823+ } ,
1824+ } ;
1825+
1826+ serverlessStepFunctions . compileStateMachines ( ) ;
1827+
1828+ const encryptionConfiguration = serverlessStepFunctions . serverless . service
1829+ . provider . compiledCloudFormationTemplate . Resources
1830+ . Test . Properties . EncryptionConfiguration ;
1831+
1832+ expect ( encryptionConfiguration . KmsKeyId [ 'Fn::Sub' ] ) . to . equal ( 'arn:kms:...' ) ;
1833+ expect ( encryptionConfiguration . KmsDataKeyReusePeriodSeconds ) . to . equal ( 900 ) ;
1834+ expect ( encryptionConfiguration . Type ) . to . equal ( 'AWS_OWNED_KEY' ) ;
1835+ } ) ;
1836+
1837+ it ( 'should compile with a specified KMS key, type and reuse period' , ( ) => {
1838+ serverless . service . stepFunctions = {
1839+ stateMachines : {
1840+ myStateMachine1 : {
1841+ id : 'Test' ,
1842+ name : 'Test' ,
1843+ definition : { } ,
1844+ encryptionConfig : {
1845+ KmsKeyId : 'arn:kms:...' ,
1846+ KmsDataKeyReusePeriodSeconds : 10 ,
1847+ Type : 'MANAGED' ,
1848+ } ,
1849+ } ,
1850+ } ,
1851+ } ;
1852+
1853+ serverlessStepFunctions . compileStateMachines ( ) ;
1854+
1855+ const encryptionConfiguration = serverlessStepFunctions . serverless . service
1856+ . provider . compiledCloudFormationTemplate . Resources
1857+ . Test . Properties . EncryptionConfiguration ;
1858+
1859+ expect ( encryptionConfiguration . KmsKeyId [ 'Fn::Sub' ] ) . to . equal ( 'arn:kms:...' ) ;
1860+ expect ( encryptionConfiguration . KmsDataKeyReusePeriodSeconds ) . to . equal ( 10 ) ;
1861+ expect ( encryptionConfiguration . Type ) . to . equal ( 'MANAGED' ) ;
1862+ } ) ;
18111863} ) ;
0 commit comments