@restatedev/restate-cdk 1.1.0-rc.2 → 1.1.1-pre.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/pr-checks.yaml +1 -3
- package/.github/workflows/publish.yml +41 -5
- package/.github/workflows/test.yml +5 -9
- package/LICENSE +1 -1
- package/README.md +13 -9
- package/dist/deployments-common.js +3 -3
- package/dist/fargate-restate-deployment.js +26 -14
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -3
- package/dist/register-service-handler/index.d.ts +0 -2
- package/dist/register-service-handler/index.js +24 -13
- package/dist/restate-cloud-environment.d.ts +14 -4
- package/dist/restate-cloud-environment.js +33 -19
- package/dist/restate-environment.d.ts +0 -2
- package/dist/restate-environment.js +3 -3
- package/dist/service-deployer.d.ts +2 -1
- package/dist/service-deployer.js +34 -18
- package/dist/single-node-restate-deployment.d.ts +6 -0
- package/dist/single-node-restate-deployment.js +29 -12
- package/jest.config.base.js +6 -0
- package/jest.config.e2e.js +8 -0
- package/jest.config.js +6 -5
- package/package.json +9 -7
- package/test/__snapshots__/restate-constructs.test.ts.snap +441 -20
- package/test/e2e/README.md +11 -0
- package/test/handlers/build.mts +19 -0
- package/test/handlers/handler.js +2 -2
|
@@ -130,8 +130,10 @@ exports[`Restate constructs [Experimental] Create a self-hosted Restate environm
|
|
|
130
130
|
Properties:
|
|
131
131
|
ContainerDefinitions:
|
|
132
132
|
- Environment:
|
|
133
|
-
- Name:
|
|
134
|
-
Value:
|
|
133
|
+
- Name: RESTATE_LOG_FORMAT
|
|
134
|
+
Value: json
|
|
135
|
+
- Name: RESTATE_NODE_NAME
|
|
136
|
+
Value: fargate
|
|
135
137
|
Essential: true
|
|
136
138
|
Image: Any<Object>
|
|
137
139
|
LogConfiguration:
|
|
@@ -142,7 +144,7 @@ exports[`Restate constructs [Experimental] Create a self-hosted Restate environm
|
|
|
142
144
|
awslogs-stream-prefix: restate
|
|
143
145
|
awslogs-region: region
|
|
144
146
|
MountPoints:
|
|
145
|
-
- ContainerPath: /
|
|
147
|
+
- ContainerPath: /restate-data
|
|
146
148
|
ReadOnly: false
|
|
147
149
|
SourceVolume: restateStore
|
|
148
150
|
Name: restate-runtime
|
|
@@ -424,10 +426,10 @@ exports[`Restate constructs [Experimental] Create a self-hosted Restate environm
|
|
|
424
426
|
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
|
|
425
427
|
Properties:
|
|
426
428
|
HealthCheckIntervalSeconds: 5
|
|
427
|
-
HealthCheckPath: /
|
|
429
|
+
HealthCheckPath: /restate/health
|
|
428
430
|
HealthCheckTimeoutSeconds: 2
|
|
429
431
|
HealthyThresholdCount: 3
|
|
430
|
-
Port:
|
|
432
|
+
Port: 8080
|
|
431
433
|
Protocol: HTTP
|
|
432
434
|
TargetGroupAttributes:
|
|
433
435
|
- Key: deregistration_delay.timeout_seconds
|
|
@@ -458,7 +460,7 @@ exports[`Restate constructs [Experimental] Create a self-hosted Restate environm
|
|
|
458
460
|
HealthCheckPath: /health
|
|
459
461
|
HealthCheckTimeoutSeconds: 2
|
|
460
462
|
HealthyThresholdCount: 3
|
|
461
|
-
Port:
|
|
463
|
+
Port: 9070
|
|
462
464
|
Protocol: HTTP
|
|
463
465
|
TargetGroupAttributes:
|
|
464
466
|
- Key: deregistration_delay.timeout_seconds
|
|
@@ -777,9 +779,9 @@ exports[`Restate constructs Create a self-hosted Restate environment deployed on
|
|
|
777
779
|
docker run --name restate --restart on-failure --detach
|
|
778
780
|
--volume /etc/restate:/etc/restate --volume
|
|
779
781
|
/var/restate:/restate-data --network=host -e
|
|
780
|
-
RESTATE_OBSERVABILITY__LOG__FORMAT=Json -e
|
|
781
|
-
RUST_LOG=info
|
|
782
|
-
RESTATE_OBSERVABILITY__TRACING__ENDPOINT=http://localhost:4317
|
|
782
|
+
RESTATE_OBSERVABILITY__LOG__FORMAT="Json" -e
|
|
783
|
+
RUST_LOG="info" -e
|
|
784
|
+
RESTATE_OBSERVABILITY__TRACING__ENDPOINT="http://localhost:4317"
|
|
783
785
|
--log-driver=awslogs --log-opt awslogs-group=
|
|
784
786
|
- Ref: RestateLogsFD86ECAE
|
|
785
787
|
- ' docker.io/restatedev/restate:latest --config-file /etc/restate/config.toml'
|
|
@@ -1116,9 +1118,11 @@ exports[`Restate constructs Create a self-hosted Restate environment deployed on
|
|
|
1116
1118
|
docker run --name restate --restart on-failure --detach
|
|
1117
1119
|
--volume /etc/restate:/etc/restate --volume
|
|
1118
1120
|
/var/restate:/restate-data --network=host -e
|
|
1119
|
-
RESTATE_OBSERVABILITY__LOG__FORMAT=Json -e
|
|
1120
|
-
RUST_LOG=info
|
|
1121
|
-
RESTATE_OBSERVABILITY__TRACING__ENDPOINT=http://localhost:4317
|
|
1121
|
+
RESTATE_OBSERVABILITY__LOG__FORMAT="Json" -e
|
|
1122
|
+
RUST_LOG="info" -e
|
|
1123
|
+
RESTATE_OBSERVABILITY__TRACING__ENDPOINT="http://localhost:4317"
|
|
1124
|
+
-e
|
|
1125
|
+
RESTATE_INGRESS__ADVERTISED_INGRESS_ENDPOINT="http://restate-ingress"
|
|
1122
1126
|
--log-driver=awslogs --log-opt awslogs-group=
|
|
1123
1127
|
- Ref: RestateLogsFD86ECAE
|
|
1124
1128
|
- ' docker.io/restatedev/restate:custom-version --config-file /etc/restate/config.toml'
|
|
@@ -1264,7 +1268,6 @@ exports[`Restate constructs Deploy a Lambda service handler to Restate Cloud env
|
|
|
1264
1268
|
'Fn::GetAtt':
|
|
1265
1269
|
- RestateInvokerRole42565598
|
|
1266
1270
|
- Arn
|
|
1267
|
-
removalPolicy: retain
|
|
1268
1271
|
private: 'false'
|
|
1269
1272
|
insecure: 'false'
|
|
1270
1273
|
DependsOn:
|
|
@@ -1322,7 +1325,7 @@ exports[`Restate constructs Deploy a Lambda service handler to Restate Cloud env
|
|
|
1322
1325
|
'Fn::GetAtt':
|
|
1323
1326
|
- ServiceDeployerEventHandlerServiceRoleF133584F
|
|
1324
1327
|
- Arn
|
|
1325
|
-
Runtime:
|
|
1328
|
+
Runtime: nodejs22.x
|
|
1326
1329
|
Timeout: 180
|
|
1327
1330
|
DependsOn:
|
|
1328
1331
|
- ServiceDeployerEventHandlerServiceRoleDefaultPolicyFE2DC3C9
|
|
@@ -1371,6 +1374,12 @@ exports[`Restate constructs Deploy a Lambda service handler to Restate Cloud env
|
|
|
1371
1374
|
- ServiceDeployerEventHandler89EAD25F
|
|
1372
1375
|
- Arn
|
|
1373
1376
|
- ':*'
|
|
1377
|
+
- Action: 'lambda:GetFunction'
|
|
1378
|
+
Effect: Allow
|
|
1379
|
+
Resource:
|
|
1380
|
+
'Fn::GetAtt':
|
|
1381
|
+
- ServiceDeployerEventHandler89EAD25F
|
|
1382
|
+
- Arn
|
|
1374
1383
|
Version: '2012-10-17'
|
|
1375
1384
|
PolicyName: >-
|
|
1376
1385
|
ServiceDeployerCustomResourceProviderframeworkonEventServiceRoleDefaultPolicy740A65C9
|
|
@@ -1522,7 +1531,6 @@ exports[`Restate constructs Deploy a Lambda service handler to existing Restate
|
|
|
1522
1531
|
'Fn::GetAtt':
|
|
1523
1532
|
- InvokerRole4DB2757E
|
|
1524
1533
|
- Arn
|
|
1525
|
-
removalPolicy: retain
|
|
1526
1534
|
private: 'false'
|
|
1527
1535
|
insecure: 'false'
|
|
1528
1536
|
DependsOn:
|
|
@@ -1576,7 +1584,7 @@ exports[`Restate constructs Deploy a Lambda service handler to existing Restate
|
|
|
1576
1584
|
'Fn::GetAtt':
|
|
1577
1585
|
- ServiceDeployerEventHandlerServiceRoleF133584F
|
|
1578
1586
|
- Arn
|
|
1579
|
-
Runtime:
|
|
1587
|
+
Runtime: nodejs22.x
|
|
1580
1588
|
Timeout: 180
|
|
1581
1589
|
DependsOn:
|
|
1582
1590
|
- ServiceDeployerEventHandlerServiceRoleDefaultPolicyFE2DC3C9
|
|
@@ -1625,6 +1633,12 @@ exports[`Restate constructs Deploy a Lambda service handler to existing Restate
|
|
|
1625
1633
|
- ServiceDeployerEventHandler89EAD25F
|
|
1626
1634
|
- Arn
|
|
1627
1635
|
- ':*'
|
|
1636
|
+
- Action: 'lambda:GetFunction'
|
|
1637
|
+
Effect: Allow
|
|
1638
|
+
Resource:
|
|
1639
|
+
'Fn::GetAtt':
|
|
1640
|
+
- ServiceDeployerEventHandler89EAD25F
|
|
1641
|
+
- Arn
|
|
1628
1642
|
Version: '2012-10-17'
|
|
1629
1643
|
PolicyName: >-
|
|
1630
1644
|
ServiceDeployerCustomResourceProviderframeworkonEventServiceRoleDefaultPolicy740A65C9
|
|
@@ -1714,9 +1728,9 @@ Mappings:
|
|
|
1714
1728
|
ca-west-1:
|
|
1715
1729
|
value: nodejs20.x
|
|
1716
1730
|
cn-north-1:
|
|
1717
|
-
value:
|
|
1731
|
+
value: nodejs20.x
|
|
1718
1732
|
cn-northwest-1:
|
|
1719
|
-
value:
|
|
1733
|
+
value: nodejs20.x
|
|
1720
1734
|
eu-central-1:
|
|
1721
1735
|
value: nodejs20.x
|
|
1722
1736
|
eu-central-2:
|
|
@@ -1750,9 +1764,9 @@ Mappings:
|
|
|
1750
1764
|
us-east-2:
|
|
1751
1765
|
value: nodejs20.x
|
|
1752
1766
|
us-gov-east-1:
|
|
1753
|
-
value:
|
|
1767
|
+
value: nodejs20.x
|
|
1754
1768
|
us-gov-west-1:
|
|
1755
|
-
value:
|
|
1769
|
+
value: nodejs20.x
|
|
1756
1770
|
us-iso-east-1:
|
|
1757
1771
|
value: nodejs18.x
|
|
1758
1772
|
us-iso-west-1:
|
|
@@ -1765,3 +1779,410 @@ Mappings:
|
|
|
1765
1779
|
value: nodejs20.x
|
|
1766
1780
|
"
|
|
1767
1781
|
`;
|
|
1782
|
+
|
|
1783
|
+
exports[`Restate constructs Restate Cloud Environment construct 1`] = `
|
|
1784
|
+
"Resources:
|
|
1785
|
+
e1InvokerRoleEEC53B29:
|
|
1786
|
+
Type: 'AWS::IAM::Role'
|
|
1787
|
+
Properties:
|
|
1788
|
+
AssumeRolePolicyDocument:
|
|
1789
|
+
Statement:
|
|
1790
|
+
- Action: 'sts:AssumeRole'
|
|
1791
|
+
Condition:
|
|
1792
|
+
StringEquals:
|
|
1793
|
+
'sts:ExternalId': env_e1
|
|
1794
|
+
'aws:PrincipalArn': 'arn:aws:iam::654654156625:role/RestateCloud'
|
|
1795
|
+
Effect: Allow
|
|
1796
|
+
Principal:
|
|
1797
|
+
AWS:
|
|
1798
|
+
'Fn::Join':
|
|
1799
|
+
- ''
|
|
1800
|
+
- - 'arn:'
|
|
1801
|
+
- Ref: 'AWS::Partition'
|
|
1802
|
+
- ':iam::654654156625:root'
|
|
1803
|
+
- Action: 'sts:TagSession'
|
|
1804
|
+
Effect: Allow
|
|
1805
|
+
Principal:
|
|
1806
|
+
AWS:
|
|
1807
|
+
'Fn::Join':
|
|
1808
|
+
- ''
|
|
1809
|
+
- - 'arn:'
|
|
1810
|
+
- Ref: 'AWS::Partition'
|
|
1811
|
+
- ':iam::654654156625:root'
|
|
1812
|
+
Version: '2012-10-17'
|
|
1813
|
+
e2InvokerRoleFFCF8E05:
|
|
1814
|
+
Type: 'AWS::IAM::Role'
|
|
1815
|
+
Properties:
|
|
1816
|
+
AssumeRolePolicyDocument:
|
|
1817
|
+
Statement:
|
|
1818
|
+
- Action: 'sts:AssumeRole'
|
|
1819
|
+
Condition:
|
|
1820
|
+
StringEquals:
|
|
1821
|
+
'sts:ExternalId': env_e2
|
|
1822
|
+
'aws:PrincipalArn': 'arn:aws:iam::654654156625:role/RestateCloud'
|
|
1823
|
+
Effect: Allow
|
|
1824
|
+
Principal:
|
|
1825
|
+
AWS:
|
|
1826
|
+
'Fn::Join':
|
|
1827
|
+
- ''
|
|
1828
|
+
- - 'arn:'
|
|
1829
|
+
- Ref: 'AWS::Partition'
|
|
1830
|
+
- ':iam::654654156625:root'
|
|
1831
|
+
- Action: 'sts:TagSession'
|
|
1832
|
+
Effect: Allow
|
|
1833
|
+
Principal:
|
|
1834
|
+
AWS:
|
|
1835
|
+
'Fn::Join':
|
|
1836
|
+
- ''
|
|
1837
|
+
- - 'arn:'
|
|
1838
|
+
- Ref: 'AWS::Partition'
|
|
1839
|
+
- ':iam::654654156625:root'
|
|
1840
|
+
Version: '2012-10-17'
|
|
1841
|
+
"
|
|
1842
|
+
`;
|
|
1843
|
+
|
|
1844
|
+
exports[`Restate constructs Restate Cloud Environment construct with role reference 1`] = `
|
|
1845
|
+
"Resources:
|
|
1846
|
+
RestateServiceHandlerServiceRole07B26D05:
|
|
1847
|
+
Type: 'AWS::IAM::Role'
|
|
1848
|
+
Properties:
|
|
1849
|
+
AssumeRolePolicyDocument:
|
|
1850
|
+
Statement:
|
|
1851
|
+
- Action: 'sts:AssumeRole'
|
|
1852
|
+
Effect: Allow
|
|
1853
|
+
Principal:
|
|
1854
|
+
Service: lambda.amazonaws.com
|
|
1855
|
+
Version: '2012-10-17'
|
|
1856
|
+
ManagedPolicyArns:
|
|
1857
|
+
- 'Fn::Join':
|
|
1858
|
+
- ''
|
|
1859
|
+
- - 'arn:'
|
|
1860
|
+
- Ref: 'AWS::Partition'
|
|
1861
|
+
- ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
|
|
1862
|
+
RestateServiceHandler71409CD7:
|
|
1863
|
+
Type: 'AWS::Lambda::Function'
|
|
1864
|
+
Properties:
|
|
1865
|
+
Code: Any<Object>
|
|
1866
|
+
Handler: index.handler
|
|
1867
|
+
Role:
|
|
1868
|
+
'Fn::GetAtt':
|
|
1869
|
+
- RestateServiceHandlerServiceRole07B26D05
|
|
1870
|
+
- Arn
|
|
1871
|
+
Runtime: nodejs18.x
|
|
1872
|
+
DependsOn:
|
|
1873
|
+
- RestateServiceHandlerServiceRole07B26D05
|
|
1874
|
+
RestateServiceHandlerCurrentVersion40030E671fc2ba09c2d7b4ea8c6a3f8fee895a65:
|
|
1875
|
+
Type: 'AWS::Lambda::Version'
|
|
1876
|
+
Properties:
|
|
1877
|
+
FunctionName:
|
|
1878
|
+
Ref: RestateServiceHandler71409CD7
|
|
1879
|
+
RestateServiceHandlerCurrentVersionRestateDeploymentE8F102EB:
|
|
1880
|
+
Type: 'Custom::RestateServiceDeployment'
|
|
1881
|
+
Properties:
|
|
1882
|
+
ServiceToken:
|
|
1883
|
+
'Fn::GetAtt':
|
|
1884
|
+
- ServiceDeployerCustomResourceProviderframeworkonEvent528FE6C2
|
|
1885
|
+
- Arn
|
|
1886
|
+
adminUrl: 'https://e1.env.eu.restate.cloud:9070'
|
|
1887
|
+
authTokenSecretArn:
|
|
1888
|
+
'Fn::Join':
|
|
1889
|
+
- ''
|
|
1890
|
+
- - 'arn:'
|
|
1891
|
+
- Ref: 'AWS::Partition'
|
|
1892
|
+
- ':secretsmanager:region:account-id:secret:secret_name'
|
|
1893
|
+
serviceLambdaArn:
|
|
1894
|
+
Ref: >-
|
|
1895
|
+
RestateServiceHandlerCurrentVersion40030E671fc2ba09c2d7b4ea8c6a3f8fee895a65
|
|
1896
|
+
invokeRoleArn: 'arn:aws:iam::654654156625:role/Invoker'
|
|
1897
|
+
private: 'false'
|
|
1898
|
+
insecure: 'false'
|
|
1899
|
+
DependsOn:
|
|
1900
|
+
- ServiceDeployerInvocationPolicyD09B639D
|
|
1901
|
+
UpdateReplacePolicy: Delete
|
|
1902
|
+
DeletionPolicy: Delete
|
|
1903
|
+
ServiceDeployerEventHandlerServiceRoleF133584F:
|
|
1904
|
+
Type: 'AWS::IAM::Role'
|
|
1905
|
+
Properties:
|
|
1906
|
+
AssumeRolePolicyDocument:
|
|
1907
|
+
Statement:
|
|
1908
|
+
- Action: 'sts:AssumeRole'
|
|
1909
|
+
Effect: Allow
|
|
1910
|
+
Principal:
|
|
1911
|
+
Service: lambda.amazonaws.com
|
|
1912
|
+
Version: '2012-10-17'
|
|
1913
|
+
ManagedPolicyArns:
|
|
1914
|
+
- 'Fn::Join':
|
|
1915
|
+
- ''
|
|
1916
|
+
- - 'arn:'
|
|
1917
|
+
- Ref: 'AWS::Partition'
|
|
1918
|
+
- ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
|
|
1919
|
+
ServiceDeployerEventHandlerServiceRoleDefaultPolicyFE2DC3C9:
|
|
1920
|
+
Type: 'AWS::IAM::Policy'
|
|
1921
|
+
Properties:
|
|
1922
|
+
PolicyDocument:
|
|
1923
|
+
Statement:
|
|
1924
|
+
- Action:
|
|
1925
|
+
- 'secretsmanager:GetSecretValue'
|
|
1926
|
+
- 'secretsmanager:DescribeSecret'
|
|
1927
|
+
Effect: Allow
|
|
1928
|
+
Resource:
|
|
1929
|
+
'Fn::Join':
|
|
1930
|
+
- ''
|
|
1931
|
+
- - 'arn:'
|
|
1932
|
+
- Ref: 'AWS::Partition'
|
|
1933
|
+
- ':secretsmanager:region:account-id:secret:secret_name-??????'
|
|
1934
|
+
Version: '2012-10-17'
|
|
1935
|
+
PolicyName: ServiceDeployerEventHandlerServiceRoleDefaultPolicyFE2DC3C9
|
|
1936
|
+
Roles:
|
|
1937
|
+
- Ref: ServiceDeployerEventHandlerServiceRoleF133584F
|
|
1938
|
+
ServiceDeployerEventHandler89EAD25F:
|
|
1939
|
+
Type: 'AWS::Lambda::Function'
|
|
1940
|
+
Properties:
|
|
1941
|
+
Architectures:
|
|
1942
|
+
- arm64
|
|
1943
|
+
Code: Any<Object>
|
|
1944
|
+
Description: Restate custom registration handler
|
|
1945
|
+
Environment:
|
|
1946
|
+
Variables:
|
|
1947
|
+
NODE_OPTIONS: '--enable-source-maps'
|
|
1948
|
+
Handler: index.handler
|
|
1949
|
+
MemorySize: 128
|
|
1950
|
+
Role:
|
|
1951
|
+
'Fn::GetAtt':
|
|
1952
|
+
- ServiceDeployerEventHandlerServiceRoleF133584F
|
|
1953
|
+
- Arn
|
|
1954
|
+
Runtime: nodejs22.x
|
|
1955
|
+
Timeout: 180
|
|
1956
|
+
DependsOn:
|
|
1957
|
+
- ServiceDeployerEventHandlerServiceRoleDefaultPolicyFE2DC3C9
|
|
1958
|
+
- ServiceDeployerEventHandlerServiceRoleF133584F
|
|
1959
|
+
ServiceDeployerDeploymentLogs5B8BE5D2:
|
|
1960
|
+
Type: 'AWS::Logs::LogGroup'
|
|
1961
|
+
Properties:
|
|
1962
|
+
LogGroupName:
|
|
1963
|
+
'Fn::Join':
|
|
1964
|
+
- ''
|
|
1965
|
+
- - /aws/lambda/
|
|
1966
|
+
- Ref: ServiceDeployerEventHandler89EAD25F
|
|
1967
|
+
RetentionInDays: 30
|
|
1968
|
+
UpdateReplacePolicy: Retain
|
|
1969
|
+
DeletionPolicy: RetainExceptOnCreate
|
|
1970
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C:
|
|
1971
|
+
Type: 'AWS::IAM::Role'
|
|
1972
|
+
Properties:
|
|
1973
|
+
AssumeRolePolicyDocument:
|
|
1974
|
+
Statement:
|
|
1975
|
+
- Action: 'sts:AssumeRole'
|
|
1976
|
+
Effect: Allow
|
|
1977
|
+
Principal:
|
|
1978
|
+
Service: lambda.amazonaws.com
|
|
1979
|
+
Version: '2012-10-17'
|
|
1980
|
+
ManagedPolicyArns:
|
|
1981
|
+
- 'Fn::Join':
|
|
1982
|
+
- ''
|
|
1983
|
+
- - 'arn:'
|
|
1984
|
+
- Ref: 'AWS::Partition'
|
|
1985
|
+
- ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
|
|
1986
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRoleDefaultPolicy740A65C9:
|
|
1987
|
+
Type: 'AWS::IAM::Policy'
|
|
1988
|
+
Properties:
|
|
1989
|
+
PolicyDocument:
|
|
1990
|
+
Statement:
|
|
1991
|
+
- Action: 'lambda:InvokeFunction'
|
|
1992
|
+
Effect: Allow
|
|
1993
|
+
Resource:
|
|
1994
|
+
- 'Fn::GetAtt':
|
|
1995
|
+
- ServiceDeployerEventHandler89EAD25F
|
|
1996
|
+
- Arn
|
|
1997
|
+
- 'Fn::Join':
|
|
1998
|
+
- ''
|
|
1999
|
+
- - 'Fn::GetAtt':
|
|
2000
|
+
- ServiceDeployerEventHandler89EAD25F
|
|
2001
|
+
- Arn
|
|
2002
|
+
- ':*'
|
|
2003
|
+
- Action: 'lambda:GetFunction'
|
|
2004
|
+
Effect: Allow
|
|
2005
|
+
Resource:
|
|
2006
|
+
'Fn::GetAtt':
|
|
2007
|
+
- ServiceDeployerEventHandler89EAD25F
|
|
2008
|
+
- Arn
|
|
2009
|
+
Version: '2012-10-17'
|
|
2010
|
+
PolicyName: >-
|
|
2011
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRoleDefaultPolicy740A65C9
|
|
2012
|
+
Roles:
|
|
2013
|
+
- Ref: >-
|
|
2014
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C
|
|
2015
|
+
ServiceDeployerCustomResourceProviderframeworkonEvent528FE6C2:
|
|
2016
|
+
Type: 'AWS::Lambda::Function'
|
|
2017
|
+
Properties:
|
|
2018
|
+
Code: Any<Object>
|
|
2019
|
+
Description: >-
|
|
2020
|
+
AWS CDK resource provider framework - onEvent
|
|
2021
|
+
(RestateCloudStack/ServiceDeployer/CustomResourceProvider)
|
|
2022
|
+
Environment:
|
|
2023
|
+
Variables:
|
|
2024
|
+
USER_ON_EVENT_FUNCTION_ARN:
|
|
2025
|
+
'Fn::GetAtt':
|
|
2026
|
+
- ServiceDeployerEventHandler89EAD25F
|
|
2027
|
+
- Arn
|
|
2028
|
+
Handler: framework.onEvent
|
|
2029
|
+
Role:
|
|
2030
|
+
'Fn::GetAtt':
|
|
2031
|
+
- >-
|
|
2032
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C
|
|
2033
|
+
- Arn
|
|
2034
|
+
Runtime: nodejs18.x
|
|
2035
|
+
Timeout: 900
|
|
2036
|
+
DependsOn:
|
|
2037
|
+
- >-
|
|
2038
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRoleDefaultPolicy740A65C9
|
|
2039
|
+
- ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C
|
|
2040
|
+
ServiceDeployerInvocationPolicyD09B639D:
|
|
2041
|
+
Type: 'AWS::IAM::Policy'
|
|
2042
|
+
Properties:
|
|
2043
|
+
PolicyDocument:
|
|
2044
|
+
Statement:
|
|
2045
|
+
- Action: 'lambda:InvokeFunction'
|
|
2046
|
+
Effect: Allow
|
|
2047
|
+
Resource:
|
|
2048
|
+
- 'Fn::GetAtt':
|
|
2049
|
+
- RestateServiceHandler71409CD7
|
|
2050
|
+
- Arn
|
|
2051
|
+
- 'Fn::Join':
|
|
2052
|
+
- ''
|
|
2053
|
+
- - 'Fn::GetAtt':
|
|
2054
|
+
- RestateServiceHandler71409CD7
|
|
2055
|
+
- Arn
|
|
2056
|
+
- ':*'
|
|
2057
|
+
Version: '2012-10-17'
|
|
2058
|
+
PolicyName: ServiceDeployerInvocationPolicyD09B639D
|
|
2059
|
+
Roles:
|
|
2060
|
+
- Invoker
|
|
2061
|
+
"
|
|
2062
|
+
`;
|
|
2063
|
+
|
|
2064
|
+
exports[`Restate constructs Service Deployer overrides 1`] = `
|
|
2065
|
+
"Resources:
|
|
2066
|
+
ServiceDeployerEventHandlerServiceRoleF133584F:
|
|
2067
|
+
Type: 'AWS::IAM::Role'
|
|
2068
|
+
Properties:
|
|
2069
|
+
AssumeRolePolicyDocument:
|
|
2070
|
+
Statement:
|
|
2071
|
+
- Action: 'sts:AssumeRole'
|
|
2072
|
+
Effect: Allow
|
|
2073
|
+
Principal:
|
|
2074
|
+
Service: lambda.amazonaws.com
|
|
2075
|
+
Version: '2012-10-17'
|
|
2076
|
+
ManagedPolicyArns:
|
|
2077
|
+
- 'Fn::Join':
|
|
2078
|
+
- ''
|
|
2079
|
+
- - 'arn:'
|
|
2080
|
+
- Ref: 'AWS::Partition'
|
|
2081
|
+
- ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
|
|
2082
|
+
ServiceDeployerEventHandler89EAD25F:
|
|
2083
|
+
Type: 'AWS::Lambda::Function'
|
|
2084
|
+
Properties:
|
|
2085
|
+
Architectures:
|
|
2086
|
+
- arm64
|
|
2087
|
+
Code:
|
|
2088
|
+
S3Bucket: cdk-hnb659fds-assets-account-id-region
|
|
2089
|
+
S3Key: 9b2f401811d992475d0f265d5bf5fdfd2f1fbbe762760b5674e60f80274bc089.zip
|
|
2090
|
+
Description: Restate custom registration handler
|
|
2091
|
+
Environment:
|
|
2092
|
+
Variables:
|
|
2093
|
+
NODE_OPTIONS: '--enable-source-maps'
|
|
2094
|
+
Handler: index.handler
|
|
2095
|
+
MemorySize: 128
|
|
2096
|
+
Role:
|
|
2097
|
+
'Fn::GetAtt':
|
|
2098
|
+
- ServiceDeployerEventHandlerServiceRoleF133584F
|
|
2099
|
+
- Arn
|
|
2100
|
+
Runtime: nodejs22.x
|
|
2101
|
+
Timeout: 180
|
|
2102
|
+
DependsOn:
|
|
2103
|
+
- ServiceDeployerEventHandlerServiceRoleF133584F
|
|
2104
|
+
ServiceDeployerDeploymentLogs5B8BE5D2:
|
|
2105
|
+
Type: 'AWS::Logs::LogGroup'
|
|
2106
|
+
Properties:
|
|
2107
|
+
LogGroupName:
|
|
2108
|
+
'Fn::Join':
|
|
2109
|
+
- ''
|
|
2110
|
+
- - /aws/lambda/
|
|
2111
|
+
- Ref: ServiceDeployerEventHandler89EAD25F
|
|
2112
|
+
RetentionInDays: 30
|
|
2113
|
+
UpdateReplacePolicy: Retain
|
|
2114
|
+
DeletionPolicy: RetainExceptOnCreate
|
|
2115
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C:
|
|
2116
|
+
Type: 'AWS::IAM::Role'
|
|
2117
|
+
Properties:
|
|
2118
|
+
AssumeRolePolicyDocument:
|
|
2119
|
+
Statement:
|
|
2120
|
+
- Action: 'sts:AssumeRole'
|
|
2121
|
+
Effect: Allow
|
|
2122
|
+
Principal:
|
|
2123
|
+
Service: lambda.amazonaws.com
|
|
2124
|
+
Version: '2012-10-17'
|
|
2125
|
+
ManagedPolicyArns:
|
|
2126
|
+
- 'Fn::Join':
|
|
2127
|
+
- ''
|
|
2128
|
+
- - 'arn:'
|
|
2129
|
+
- Ref: 'AWS::Partition'
|
|
2130
|
+
- ':iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
|
|
2131
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRoleDefaultPolicy740A65C9:
|
|
2132
|
+
Type: 'AWS::IAM::Policy'
|
|
2133
|
+
Properties:
|
|
2134
|
+
PolicyDocument:
|
|
2135
|
+
Statement:
|
|
2136
|
+
- Action: 'lambda:InvokeFunction'
|
|
2137
|
+
Effect: Allow
|
|
2138
|
+
Resource:
|
|
2139
|
+
- 'Fn::GetAtt':
|
|
2140
|
+
- ServiceDeployerEventHandler89EAD25F
|
|
2141
|
+
- Arn
|
|
2142
|
+
- 'Fn::Join':
|
|
2143
|
+
- ''
|
|
2144
|
+
- - 'Fn::GetAtt':
|
|
2145
|
+
- ServiceDeployerEventHandler89EAD25F
|
|
2146
|
+
- Arn
|
|
2147
|
+
- ':*'
|
|
2148
|
+
- Action: 'lambda:GetFunction'
|
|
2149
|
+
Effect: Allow
|
|
2150
|
+
Resource:
|
|
2151
|
+
'Fn::GetAtt':
|
|
2152
|
+
- ServiceDeployerEventHandler89EAD25F
|
|
2153
|
+
- Arn
|
|
2154
|
+
Version: '2012-10-17'
|
|
2155
|
+
PolicyName: >-
|
|
2156
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRoleDefaultPolicy740A65C9
|
|
2157
|
+
Roles:
|
|
2158
|
+
- Ref: >-
|
|
2159
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C
|
|
2160
|
+
ServiceDeployerCustomResourceProviderframeworkonEvent528FE6C2:
|
|
2161
|
+
Type: 'AWS::Lambda::Function'
|
|
2162
|
+
Properties:
|
|
2163
|
+
Code:
|
|
2164
|
+
S3Bucket: cdk-hnb659fds-assets-account-id-region
|
|
2165
|
+
S3Key: bdc104ed9cab1b5b6421713c8155f0b753380595356f710400609664d3635eca.zip
|
|
2166
|
+
Description: >-
|
|
2167
|
+
AWS CDK resource provider framework - onEvent
|
|
2168
|
+
(RestateCloudStack/ServiceDeployer/CustomResourceProvider)
|
|
2169
|
+
Environment:
|
|
2170
|
+
Variables:
|
|
2171
|
+
USER_ON_EVENT_FUNCTION_ARN:
|
|
2172
|
+
'Fn::GetAtt':
|
|
2173
|
+
- ServiceDeployerEventHandler89EAD25F
|
|
2174
|
+
- Arn
|
|
2175
|
+
Handler: framework.onEvent
|
|
2176
|
+
Role:
|
|
2177
|
+
'Fn::GetAtt':
|
|
2178
|
+
- >-
|
|
2179
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C
|
|
2180
|
+
- Arn
|
|
2181
|
+
Runtime: nodejs18.x
|
|
2182
|
+
Timeout: 900
|
|
2183
|
+
DependsOn:
|
|
2184
|
+
- >-
|
|
2185
|
+
ServiceDeployerCustomResourceProviderframeworkonEventServiceRoleDefaultPolicy740A65C9
|
|
2186
|
+
- ServiceDeployerCustomResourceProviderframeworkonEventServiceRole865AFB0C
|
|
2187
|
+
"
|
|
2188
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
## Restate CDK e2e tests
|
|
2
|
+
|
|
3
|
+
The CDK stacks in this directory serve a dual purpose of providing usage examples, and validation targets during development.
|
|
4
|
+
|
|
5
|
+
Some of these are wrapped in e2e tests you can run with:
|
|
6
|
+
|
|
7
|
+
```shell
|
|
8
|
+
npm run test:e2e
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
To run the automated e2e tests, you'll generally need valid AWS or Restate Cloud credentials. To speed things up you can set `RETAIN_STACK=true`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2023-2025 - Restate Software, Inc., Restate GmbH
|
|
3
|
+
*
|
|
4
|
+
* This file is part of the Restate CDK Construct Library,
|
|
5
|
+
* which is released under the MIT license.
|
|
6
|
+
*
|
|
7
|
+
* You can find a copy of the license in file LICENSE in the root
|
|
8
|
+
* directory of this repository or package, or at
|
|
9
|
+
* https://github.com/restatedev/sdk-typescript/blob/main/LICENSE
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { $, cd } from "zx";
|
|
13
|
+
import * as path from "path";
|
|
14
|
+
import { fileURLToPath } from "url";
|
|
15
|
+
|
|
16
|
+
$.verbose = true;
|
|
17
|
+
|
|
18
|
+
cd(path.dirname(fileURLToPath(import.meta.url)));
|
|
19
|
+
await $`npx esbuild --bundle --platform=node handler.js --outfile=dist/bundle.js`;
|
package/test/handlers/handler.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2023-2025 - Restate Software, Inc., Restate GmbH
|
|
3
3
|
*
|
|
4
|
-
* This file is part of the Restate
|
|
4
|
+
* This file is part of the Restate CDK Construct Library,
|
|
5
5
|
* which is released under the MIT license.
|
|
6
6
|
*
|
|
7
7
|
* You can find a copy of the license in file LICENSE in the root
|