Skip to content

Commit d7199d8

Browse files
Merge pull request #14 from hashicorp/rln-update-cdktf-0_13
Update CDKTF and other deps to latest version
2 parents f282ba1 + 8207647 commit d7199d8

File tree

3 files changed

+4978
-1285
lines changed

3 files changed

+4978
-1285
lines changed

cdktf/main.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ class LambdaStack extends TerraformStack {
3131
constructor(scope: Construct, name: string, config: LambdaFunctionConfig) {
3232
super(scope, name);
3333

34-
new aws.AwsProvider(this, "aws", {
34+
new aws.provider.AwsProvider(this, "aws", {
3535
region: "us-west-2",
3636
});
3737

38-
new random.RandomProvider(this, "random");
38+
new random.provider.RandomProvider(this, "random");
3939

4040
// Create random value
41-
const pet = new random.Pet(this, "random-name", {
41+
const pet = new random.pet.Pet(this, "random-name", {
4242
length: 2,
4343
});
4444

@@ -49,31 +49,31 @@ class LambdaStack extends TerraformStack {
4949
});
5050

5151
// Create unique S3 bucket that hosts Lambda executable
52-
const bucket = new aws.s3.S3Bucket(this, "bucket", {
52+
const bucket = new aws.s3Bucket.S3Bucket(this, "bucket", {
5353
bucketPrefix: `learn-cdktf-${name}`,
5454
});
5555

5656
// Upload Lambda zip file to newly created S3 bucket
57-
const lambdaArchive = new aws.s3.S3Object(this, "lambda-archive", {
57+
const lambdaArchive = new aws.s3Object.S3Object(this, "lambda-archive", {
5858
bucket: bucket.bucket,
5959
key: `${config.version}/${asset.fileName}`,
6060
source: asset.path, // returns a posix path
6161
});
6262

6363
// Create Lambda role
64-
const role = new aws.iam.IamRole(this, "lambda-exec", {
64+
const role = new aws.iamRole.IamRole(this, "lambda-exec", {
6565
name: `learn-cdktf-${name}-${pet.id}`,
6666
assumeRolePolicy: JSON.stringify(lambdaRolePolicy)
6767
});
6868

6969
// Add execution role for lambda to write to CloudWatch logs
70-
new aws.iam.IamRolePolicyAttachment(this, "lambda-managed-policy", {
70+
new aws.iamRolePolicyAttachment.IamRolePolicyAttachment(this, "lambda-managed-policy", {
7171
policyArn: 'arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole',
7272
role: role.name
7373
});
7474

7575
// Create Lambda function
76-
const lambdaFunc = new aws.lambdafunction.LambdaFunction(this, "learn-cdktf-lambda", {
76+
const lambdaFunc = new aws.lambdaFunction.LambdaFunction(this, "learn-cdktf-lambda", {
7777
functionName: `learn-cdktf-${name}-${pet.id}`,
7878
s3Bucket: bucket.bucket,
7979
s3Key: lambdaArchive.key,
@@ -83,13 +83,13 @@ class LambdaStack extends TerraformStack {
8383
});
8484

8585
// Create and configure API gateway
86-
const api = new aws.apigatewayv2.Apigatewayv2Api(this, "api-gw", {
86+
const api = new aws.apigatewayv2Api.Apigatewayv2Api(this, "api-gw", {
8787
name: name,
8888
protocolType: "HTTP",
8989
target: lambdaFunc.arn
9090
});
9191

92-
new aws.lambdafunction.LambdaPermission(this, "apigw-lambda", {
92+
new aws.lambdaPermission.LambdaPermission(this, "apigw-lambda", {
9393
functionName: lambdaFunc.functionName,
9494
action: "lambda:InvokeFunction",
9595
principal: "apigateway.amazonaws.com",

0 commit comments

Comments
 (0)