0.0.16 • Published 2 years ago

sourceloop-cdktf v0.0.16

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

sourceloop-cdktf

This package contains cdktf constructs for easily creating AWS infrastructure.

Installation

npm install sourceloop-cdktf

Available Constructs

  • apiGatewayCustomDomainName
  • createAcmCertificate
  • createLambdaRole
  • lambda
  • lambdaWithApiGateway
  • lambdaWithCloudWatchEvent
  • lambdaWithSns
  • lambdaWithSqs

Refer API.md file for API reference.

Example

import * as aws from "@cdktf/provider-aws";
import * as random from "@cdktf/provider-random";
import { App, TerraformStack } from "cdktf";
import { Construct } from "constructs";
import * as dotenv from "dotenv";
import { resolve } from "path";
import { ILambda, Lambda } from "sourceloop-cdktf";

dotenv.config();
export class LambdaStack extends TerraformStack {
  constructor(
    scope: Construct,
    id: string,
    config: Omit<ILambda, "name">
  ) {
    super(scope, id);

    new aws.provider.AwsProvider(this, "aws", {
      region: process.env.AWS_REGION,
      accessKey: process.env.AWS_ACCESS_KEY_ID,
      secretKey: process.env.AWS_SECRET_ACCESS_KEY,
      profile: process.env.AWS_PROFILE,
      assumeRole: [
        {
          roleArn: process.env.AWS_ROLE_ARN,
        },
      ],
    });
    new random.provider.RandomProvider(this, "random");

    const pet = new random.pet.Pet(this, "random-name", {
      length: 2,
    });

    new Lambda(this, "lambda", {
      ...config,
      name: pet.id,
    });
  }
}

const app = new App();
new LambdaStack(app, "example", {
  codePath: resolve(__dirname, "../dist"),
  layerPath: resolve(__dirname, "../layers"),
  handler: "cron.handler",
  runtime: "nodejs16.x",
  namespace: process.env.NAMESPACE || "arc",
  environment: process.env.ENV || "dev",
});
app.synth();
0.0.16

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago