Pulumi/CDK Interop Library

Overview

Pulumi CDK Adapter (preview)

The Pulumi CDK Adapter is a library that enables Pulumi programs to use AWS CDK constructs.

The adapter allows writing AWS CDK code as part of an AWS CDK Stack inside a Pulumi program, and having the resulting AWS resources be deployed and managed via Pulumi. Outputs of resources defined in a Pulumi program can be passed into AWS CDK Constructs, and outputs from AWS CDK stacks can be used as inputs to other Pulumi resources.

Note: Currently, the Pulumi CDK Adapter preview is available only for TypeScript/JavaScript users.

For example, to construct an AWS AppRunner Service resource from within a Pulumi program, and export the resulting service's URL as as Pulumi Stack Output you write the following:

import * as pulumi from '@pulumi/pulumi';
import * as pulumicdk from '@pulumi/cdk';
import { Service, Source } from '@aws-cdk/aws-apprunner-alpha';

class AppRunnerStack extends pulumicdk.Stack {
    url: pulumi.Output<string>;

    constructor(id: string, options?: pulumicdk.StackOptions) {
        super(id, options);

        const service = new Service(this, 'service', {
            source: Source.fromEcrPublic({
                imageConfiguration: { port: 8000 },
                imageIdentifier: 'public.ecr.aws/aws-containers/hello-app-runner:latest',
            }),
        });

        this.url = this.asOutput(service.serviceUrl);

        this.synth();
    }
}

const stack = new AppRunnerStack('teststack');
export const url = stack.url;

And then deploy with pulumi update:

> pulumi up

Updating (dev)

View Live: https://app.pulumi.com/lukehoban/pulumi-cdk-apprunner/dev/updates/1

     Type                                   Name                       Status      
 +   pulumi:pulumi:Stack                    pulumi-cdk-apprunner-dev   created     
 +   └─ cdk:index:StackComponent            teststack                  created     
 +      └─ cdk:construct:Service            teststack/adapter/service  created     
 +         └─ aws-native:apprunner:Service  service6D174F83            created     
 
Outputs:
    url: "2ez3iazupm.us-west-2.awsapprunner.com"

Resources:
    + 4 created

And curl the endpoint:

> curl https://$(pulumi stack output url)           

   ______                             __        __      __  _                  __
  / ____/___  ____  ____ __________ _/ /___  __/ /___ _/ /_(_)___  ____  _____/ /
 / /   / __ \/ __ \/ __ `/ ___/ __ `/ __/ / / / / __ `/ __/ / __ \/ __ \/ ___/ / 
/ /___/ /_/ / / / / /_/ / /  / /_/ / /_/ /_/ / / /_/ / /_/ / /_/ / / / (__  )_/  
\____/\____/_/ /_/\__, /_/   \__,_/\__/\__,_/_/\__,_/\__/_/\____/_/ /_/____(_)   
                 /____/                                                          


        Congratulations, your service has successfully deployed on AWS App Runner.



Open it in your browser at https://2ez3iazupm.us-west-2.awsapprunner.com/

Try the workshop at https://apprunnerworkshop.com
Read the docs at https://docs.aws.amazon.com/apprunner

Getting Started

Coming soon!

API

Stack

A Construct that represents an AWS CDK stack deployed with Pulumi. In order to deploy a CDK stack with Pulumi, it must derive from this class. The synth method must be called after all CDK resources have been defined in order to deploy the stack (usually, this is done as the last line of the subclass's constructor).

constructor

Create and register an AWS CDK stack deployed with Pulumi.

constructor(name: string, options?: StackOptions)

Parameters:

  • name: The unique name of the resource.
  • options: A bag of options that control this resource's behavior.

urn

The URN of the underlying Pulumi component.

outputs

The collection of outputs from the AWS CDK Stack represented as Pulumi Outputs. Each CfnOutput defined in the AWS CDK Stack will populate a value in the outputs.

outputs: { [outputId: string]: pulumi.Output<any> }

synth

Finalize the stack and deploy its resources.

protected synth()

asOutput

Convert a CDK value to a Pulumi output.

Parameters:

  • v: A CDK value.
asOutput<T>(v: T): pulumi.Output<T>

StackOptions

Options specific to the Stack component.

interface StackOptions

remapCloudControlResource

This optional method can be implemented to define a mapping to override and/or provide an implementation for a CloudFormation resource type that is not (yet) implemented in the AWS Cloud Control API (and thus not yet available in the Pulumi AWS Native provider). Pulumi code can override this method to provide a custom mapping of CloudFormation elements and their properties into Pulumi CustomResources, commonly by using the AWS Classic provider to implement the missing resource.

remapCloudControlResource(element: CfnElement, logicalId: string, typeName: string, props: any, options: pulumi.ResourceOptions): { [key: string]: pulumi.CustomResource } | undefined

Parameters:

  • element: The full CloudFormation element object being mapped.
  • logicalId: The logical ID of the resource being mapped.
  • typeName: The CloudFormation type name of the resource being mapped.
  • props: The bag of input properties to the CloudFormation resource being mapped.
  • options: The set of Pulumi ResourceOptions to apply to the resource being mapped.

Returns an object containing one or more logical IDs mapped to Pulumi resources that must be created to implement the mapped CloudFormation resource, or else undefined if no mapping is implemented.

create

Create and register an AWS CDK stack deployed with Pulumi.

create(name: string, ctor: typeof Stack, opts?: pulumi.CustomResourceOptions): StackComponent

Parameters:

  • name: The unique name of the resource.
  • stack: The CDK Stack subclass to create.
  • parent: The Pulumi CDKStackComponent parent resource.
  • opts: A bag of options that control this resource's behavior.

asString

Convert a Pulumi Output to a CDK string value.

function asString<T>(o: pulumi.Output<T>): string

Parameters:

  • o: A Pulumi Output value which represents a string.

Returns A CDK token representing a string value.

asNumber

Convert a Pulumi Output to a CDK number value.

function asNumber<T>(o: pulumi.Output<T>): number

Parameters:

  • o: A Pulumi Output value which represents a number.

Returns A CDK token representing a number value.

asList

Convert a Pulumi Output to a list of CDK values.

function asList<T>(o: pulumi.Output<T>): string[]

Parameters:

  • o: A Pulumi Output value which represents a list.

Returns a CDK token representing a list of values.

Building locally

Install dependencies, build library, and link for local usage.

$ yarn install
$ yarn build
$ pushd lib && yarn link && popd

Run unit test:

$ yarn test

  Basic tests
    ✔ Checking single resource registration (124ms)
    ✔ Supports Output<T> (58ms)

  Graph tests
    ✔ Test sort for single resource
    ✔ Test sort for ASG example (56ms)
    ✔ Test sort for appsvc example
    ✔ Test sort for apprunner example


  6 passing (278ms)

Run Pulumi examples:

$ yarn test-examples
Comments
  • Support static file assets.

    Support static file assets.

    Static file assets--that is, file assets that are not generated by running a command--are translated to S3 bucket object resources. As part of these changes, a new node is created in the resource tree that corresponds to the CDK stack itself in order to simplify the dependency graph. This node depends on any assets required by the stack (rather than plumbing the assets through to each of the stack's children).

    opened by pgavlin 4
  • Add ability to use Lookup options

    Add ability to use Lookup options

    If we take the example of creating an ECS cluster using a construct:

    const cluster = new ecs.Cluster(this, `${name}-cluster`, {
      vpc
    });
    

    the vpc part takes a type ec2.IVpc which isn't easily castable from Pulumi lookup types. When trying something like this:

    const vpc = aws.ec2.getVpc({default: true}) 
        const cluster = new ecs.Cluster(this, `${name}-cluster`, {
          vpc: vpc
        });
    

    We have issues.

    It might be nice to be able to use CDK's lookup types: https://docs.aws.amazon.com/cdk/api/v1/docs/@aws-cdk_aws-ec2.VpcLookupOptions.html

    Or alternatively, allow easy casting from Pulumi's lookup types

    kind/enhancement resolution/fixed 
    opened by jaxxstorm 3
  • Support L1 constructs

    Support L1 constructs

    Sometimes you need to fall back to L1 constructs, for example if a resource doesn't exist in aws-native or aws classic.

    Currently, it appears as if L1 constructs aren't support if they don't exist in aws-native:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as pulumicdk from '@pulumi/cdk';
    import * as redshift from 'aws-cdk-lib/aws-redshiftserverless';
    
    class RedshiftStack extends pulumicdk.Stack {
    
        constructor(id: string, options?: pulumicdk.StackOptions) {
            super(id, options);
    
            const namespace = new aws.redshiftserverless.Namespace("namespace", {
                namespaceName: "lbriggs",
            })
    
            const workgroup = new redshift.CfnWorkgroup(this, 'workgroup', {
                workgroupName: "workgroup",
                namespaceName: "lbriggs",
            })
    
            this.synth();
    
    
        }
    }
    
    const stack = new RedshiftStack('teststack');
    

    Error:

    Diagnostics:
      aws-native:redshiftserverless:Workgroup (workgroup):
        error: Resource type aws-native:redshiftserverless:Workgroup not found
    

    I suspect this is going to be pretty hard (if not impossible) but I'm filing here for posterity

    kind/enhancement resolution/duplicate 
    opened by jaxxstorm 2
  • Draft: adjust public API

    Draft: adjust public API

    The proposed public API requires that users subclass pulumicdk.Stack (which is itself a subclass of cdk.Stack) and call this.synth() at the end of the subclass's constructor. synth is provided by pulumicdk.Stack and does the work of creating a Pulumi component resource, synthesizing the CDK resources, etc.

    opened by pgavlin 2
  • Register component resources for L2+ constructs.

    Register component resources for L2+ constructs.

    These changes add support for registering a component resource per L2+ construct in the construct tree and properly parenting its children. As part of these changes, the naming scheme for the resources created by the adapter has changed to incorporate the StackComponent's name and each construct's path (rather than its logical ID). This will allow multiple instances of a construct to be created within the same Pulumi program without conflicting URNs.

    Contributes to #6.

    opened by pgavlin 2
  • Lift intrinsic functions over `Output` values.

    Lift intrinsic functions over `Output` values.

    This tracks some follow-up work to #3. Currently, Fn::Join et. al. will not translate as expected if there are operands that are Output values, as they will attempt to operate directly on the Output values instead of using all/apply. The translator needs updating to lift operations over those values.

    kind/enhancement resolution/fixed 
    opened by pgavlin 2
  • Unable to provision VPC

    Unable to provision VPC

    What happened?

    I am not able to provision an AWS VPC using aws-cdk

    Steps to reproduce

    index.ts

    import * as pulumi from '@pulumi/pulumi'
    import * as ec2 from 'aws-cdk-lib/aws-ec2'
    import { Config } from '@pulumi/pulumi'
    import { Vpc } from './vpc'
    
    const awsConfig = new Config('aws')
    const region = awsConfig.require('region')
    
    const nomadConfig = new Config('nomad')
    const cidr = nomadConfig.require('cidr')
    
    const config = new Config()
    const account = config.require('aws_account_id')
    
    const subnets = [
      {
        name: 'public',
        type: ec2.SubnetType.PUBLIC,
        cmask: nomadConfig.requireNumber('public_subnet_cmask'),
      },
      {
        name: 'servers',
        type: ec2.SubnetType.PRIVATE_WITH_EGRESS,
        cmask: nomadConfig.requireNumber('servers_subnet_cmask'),
      },
      {
        name: 'agents',
        type: ec2.SubnetType.PRIVATE_WITH_EGRESS,
        cmask: nomadConfig.requireNumber('agents_subnet_cmask'),
      },
    ]
    
    const getSubnets = (clusterName: string) => {
      const snets: ec2.SubnetConfiguration[] = []
    
      subnets.forEach((subnet) => {
        const { name, type, cmask } = subnet
    
        snets.push({
          name: `${clusterName}-nomad-${name}`,
          subnetType: type,
          cidrMask: cmask,
        })
      })
    
      return snets
    }
    
    export function createVpc(clusterName: string) {
      const name = `${clusterName}-vpc`
    
      new Vpc(
        name,
        {
          name,
          cidr,
          subnets: getSubnets(clusterName),
        },
        { props: { env: { account, region } } },
      )
    }
    
    const stack = pulumi.getStack()
    const name = `sd-${stack}`
    
    createVpc(name)
    

    vpc.ts

    import * as pulumi from '@pulumi/pulumi'
    import * as pulumicdk from '@pulumi/cdk'
    import * as ec2 from 'aws-cdk-lib/aws-ec2'
    import { FckNatInstanceProvider } from 'cdk-fck-nat'
    
    export interface VpcInputs {
      readonly name: string
      readonly cidr: string
      readonly subnets: ec2.SubnetConfiguration[]
    }
    
    export interface Subnet {
      readonly availabilityZone: string
      readonly subnetId: string
      readonly ipv4CidrBlock: string
      readonly routeTableId: string
    }
    
    function getSubnets(subnets: ec2.ISubnet[]): Subnet[] {
      return subnets.map((subnet) => {
        const {
          subnetId,
          availabilityZone,
          ipv4CidrBlock,
          routeTable: { routeTableId },
        } = subnet
    
        return { subnetId, availabilityZone, ipv4CidrBlock, routeTableId }
      })
    }
    
    export class Vpc extends pulumicdk.Stack {
      readonly id: pulumi.Output<string>
      readonly arn: pulumi.Output<string>
      readonly cidrBlock: pulumi.Output<string>
      readonly defaultNetworkAcl: pulumi.Output<string>
      readonly cidrBlockAssociations: pulumi.Output<string[]>
      readonly defaultSecurityGroup: pulumi.Output<string>
      readonly ipv6CidrBlocks: pulumi.Output<string[]>
      readonly publicSubnets: pulumi.Output<Subnet[]>
      readonly privateSubnets: pulumi.Output<Subnet[]>
      readonly isolatedSubnets: pulumi.Output<Subnet[]>
      readonly vpcAvailabilityZones: pulumi.Output<string[]>
      readonly internetGatewayId?: pulumi.Output<string | undefined>
      readonly dnsHostnamesEnabled: pulumi.Output<boolean>
      readonly dnsSupportEnabled: pulumi.Output<boolean>
    
      constructor(id: string, inputs: VpcInputs, options?: pulumicdk.StackOptions) {
        super(id, { ...options })
    
        const { name, cidr, subnets } = inputs
    
        const vpc = new ec2.Vpc(this, name, {
          vpcName: name,
          subnetConfiguration: subnets,
          ipAddresses: ec2.IpAddresses.cidr(cidr),
          natGatewayProvider: new FckNatInstanceProvider({
            instanceType: ec2.InstanceType.of(ec2.InstanceClass.T4G, ec2.InstanceSize.NANO),
          }),
        })
    
        this.id = this.asOutput(vpc.vpcId)
        this.arn = this.asOutput(vpc.vpcArn)
        this.cidrBlock = this.asOutput(vpc.vpcCidrBlock)
        this.defaultNetworkAcl = this.asOutput(vpc.vpcDefaultNetworkAcl)
        this.cidrBlockAssociations = this.asOutput(vpc.vpcCidrBlockAssociations)
        this.defaultSecurityGroup = this.asOutput(vpc.vpcDefaultSecurityGroup)
        this.ipv6CidrBlocks = this.asOutput(vpc.vpcIpv6CidrBlocks)
        this.publicSubnets = this.asOutput(getSubnets(vpc.publicSubnets))
        this.privateSubnets = this.asOutput(getSubnets(vpc.privateSubnets))
        this.isolatedSubnets = this.asOutput(getSubnets(vpc.isolatedSubnets))
        this.vpcAvailabilityZones = this.asOutput(vpc.availabilityZones)
        this.internetGatewayId = this.asOutput(vpc.internetGatewayId)
        this.dnsHostnamesEnabled = this.asOutput(vpc.dnsHostnamesEnabled)
        this.dnsSupportEnabled = this.asOutput(vpc.dnsSupportEnabled)
    
        this.synth()
      }
    }
    

    Pulumi.dev.yaml

    config:
      aws-native:region: us-west-2
      aws:region: us-west-2
      infrastructure:aws_account_id: "your_aws_account_id"
      nomad:agents_subnet_cmask: "20"
      nomad:cidr: 10.10.0.0/16
      nomad:public_subnet_cmask: "24"
      nomad:servers_subnet_cmask: "22"
    

    Expected Behavior

    The AWS VPC should get provisioned.

    Actual Behavior

    Provisioning of AWS VPC fails with the following output.

        Type                                                       Name
         pulumi:pulumi:Stack                                        infrastructure-dev
     +   ├─ cdk:index:Stack                                         sd-dev-nomad
     +   │  └─ cdk:construct:Vpc                                    sd-dev-nomad/sd-dev-nomad
     +   │     └─ cdk:construct:Vpc                                 sd-dev-nomad/sd-dev-nomad/sd-dev-nomad
     +   │        ├─ cdk:construct:PublicSubnet                     sd-dev-nomad/sd-dev-nomad/sd-dev-nomad/sd-dev-pub-nm
     +   │        │  ├─ aws:ec2:Eip                                 sddevnomadsddevpubnmdSubnet2EIPFEE9E5AB
     +   │        │  ├─ aws-native:ec2:RouteTable                   sddevnomadsddevpubnmdSubnet2RouteTableF01D2CB9
     +   │        │  ├─ aws-native:ec2:Subnet                       sddevnomadsddevpubnmdSubnet2Subnet6432C5B0
     +   │        │  ├─ aws-native:ec2:SubnetRouteTableAssociation  sddevnomadsddevpubnmdSubnet2RouteTableAssociationFC0FBFF9
     +   │        │  ├─ aws:ec2:Route                               sddevnomadsddevpubnmdSubnet2DefaultRoute415B30F8
     +   │        │  └─ aws:ec2:NatGateway                          sddevnomadsddevpubnmdSubnet2NATGateway2A202C5B
     +   │        ├─ cdk:construct:PrivateSubnet                    sd-dev-nomad/sd-dev-nomad/sd-dev-nomad/sd-dev-ser-nm
     +   │        │  ├─ aws-native:ec2:Subnet                       sddevnomadsddevsernmdSubnet1SubnetCC517582
     +   │        │  ├─ aws-native:ec2:RouteTable                   sddevnomadsddevsernmdSubnet1RouteTableAD2F9E46
     +   │        │  ├─ aws-native:ec2:SubnetRouteTableAssociation  sddevnomadsddevsernmdSubnet1RouteTableAssociation4E958184
     +   │        │  └─ aws:ec2:Route                               sddevnomadsddevsernmdSubnet1DefaultRoute8877D9AF
     +   │        ├─ cdk:construct:PrivateSubnet                    sd-dev-nomad/sd-dev-nomad/sd-dev-nomad/sd-dev-age-nm
     +   │        │  ├─ aws-native:ec2:RouteTable                   sddevnomadsddevagenmdSubnet3RouteTableE55F6F0E
     +   │        │  ├─ aws-native:ec2:Subnet                       sddevnomadsddevagenmdSubnet3SubnetA16CBD09
     +   │        │  ├─ aws-native:ec2:SubnetRouteTableAssociation  sddevnomadsddevagenmdSubnet3RouteTableAssociation53319F5C
     +   │        │  └─ aws:ec2:Route                               sddevnomadsddevagenmdSubnet3DefaultRoute06FAC36E
     +   │        ├─ cdk:construct:PrivateSubnet                    sd-dev-nomad/sd-dev-nomad/sd-dev-nomad/sd-dev-ser-nm
     +   │        │  ├─ aws-native:ec2:Subnet                       sddevnomadsddevsernmdSubnet3Subnet176B51D4
     +   │        │  ├─ aws-native:ec2:RouteTable                   sddevnomadsddevsernmdSubnet3RouteTableA5490635
     +   │        │  ├─ aws-native:ec2:SubnetRouteTableAssociation  sddevnomadsddevsernmdSubnet3RouteTableAssociation0A4FD0A9
     +   │        │  └─ aws:ec2:Route                               sddevnomadsddevsernmdSubnet3DefaultRouteACCB7DAF
     +   │        ├─ cdk:construct:PublicSubnet                     sd-dev-nomad/sd-dev-nomad/sd-dev-nomad/sd-dev-pub-nm
     +   │        │  ├─ aws:ec2:Eip                                 sddevnomadsddevpubnmdSubnet1EIP8D049AD3
     +   │        │  ├─ aws-native:ec2:RouteTable                   sddevnomadsddevpubnmdSubnet1RouteTable173B3FEB
     +   │        │  ├─ aws-native:ec2:Subnet                       sddevnomadsddevpubnmdSubnet1SubnetB013F315
     +   │        │  ├─ aws-native:ec2:SubnetRouteTableAssociation  sddevnomadsddevpubnmdSubnet1RouteTableAssociation8F19258C
     +   │        │  ├─ aws:ec2:Route                               sddevnomadsddevpubnmdSubnet1DefaultRouteF4632F25
     +   │        │  └─ aws:ec2:NatGateway                          sddevnomadsddevpubnmdSubnet1NATGatewayC856B197
     +   │        ├─ cdk:construct:PublicSubnet                     sd-dev-nomad/sd-dev-nomad/sd-dev-nomad/sd-dev-pub-nm
     +   │        │  ├─ aws:ec2:Eip                                 sddevnomadsddevpubnmdSubnet3EIPBDCB562B
     +   │        │  ├─ aws-native:ec2:Subnet                       sddevnomadsddevpubnmdSubnet3SubnetE96F6114
     +   │        │  ├─ aws-native:ec2:RouteTable                   sddevnomadsddevpubnmdSubnet3RouteTable6C87849F
     +   │        │  ├─ aws-native:ec2:SubnetRouteTableAssociation  sddevnomadsddevpubnmdSubnet3RouteTableAssociation06FA27FA
     +   │        │  ├─ aws:ec2:Route                               sddevnomadsddevpubnmdSubnet3DefaultRoute9944437D
     +   │        │  └─ aws:ec2:NatGateway                          sddevnomadsddevpubnmdSubnet3NATGateway5A4D9C62
     +   │        ├─ cdk:construct:PrivateSubnet                    sd-dev-nomad/sd-dev-nomad/sd-dev-nomad/sd-dev-ser-nm
     +   │        │  ├─ aws-native:ec2:Subnet                       sddevnomadsddevsernmdSubnet2Subnet7BFF9A93
     +   │        │  ├─ aws-native:ec2:RouteTable                   sddevnomadsddevsernmdSubnet2RouteTable753378E5
     +   │        │  ├─ aws-native:ec2:SubnetRouteTableAssociation  sddevnomadsddevsernmdSubnet2RouteTableAssociationAEFBA795
     +   │        │  └─ aws:ec2:Route                               sddevnomadsddevsernmdSubnet2DefaultRoute7E09DF3C
     +   │        ├─ cdk:construct:PrivateSubnet                    sd-dev-nomad/sd-dev-nomad/sd-dev-nomad/sd-dev-age-nm
     +   │        │  ├─ aws-native:ec2:Subnet                       sddevnomadsddevagenmdSubnet1Subnet89B94FE1
     +   │        │  ├─ aws-native:ec2:RouteTable                   sddevnomadsddevagenmdSubnet1RouteTable661A46E4
     +   │        │  ├─ aws-native:ec2:SubnetRouteTableAssociation  sddevnomadsddevagenmdSubnet1RouteTableAssociation062ED5D6
     +   │        │  └─ aws:ec2:Route                               sddevnomadsddevagenmdSubnet1DefaultRouteABE14730
     +   │        ├─ cdk:construct:PrivateSubnet                    sd-dev-nomad/sd-dev-nomad/sd-dev-nomad/sd-dev-age-nm
     +   │        │  ├─ aws-native:ec2:Subnet                       sddevnomadsddevagenmdSubnet2Subnet66799117
     +   │        │  ├─ aws-native:ec2:RouteTable                   sddevnomadsddevagenmdSubnet2RouteTable77541FBB
     +   │        │  ├─ aws-native:ec2:SubnetRouteTableAssociation  sddevnomadsddevagenmdSubnet2RouteTableAssociationD498699B
     +   │        │  └─ aws:ec2:Route                               sddevnomadsddevagenmdSubnet2DefaultRoute5CF6585D
     +   │        ├─ aws-native:ec2:VPC                             sddevnomad9168BF25
     +   │        ├─ aws-native:ec2:InternetGateway                 sddevnomadIGWB9CF05EE
     +   │        └─ aws:ec2:InternetGatewayAttachment              sddevnomadVPCGW8D7DFD6F
     +   └─ aws:ec2:Tag                                             sd-dev-nomad-vpc
    
    
    Diagnostics:
      pulumi:pulumi:Stack (infrastructure-dev):
        error: Error: invocation of aws-native:index:getSsmParameterString returned an error: operation error SSM: GetParameter, https response error StatusCode: 400, RequestID: fb0e830a-6a62-4911-a556-44b0fb42b683, ParameterNotFound:
            at Object.callback (/Users/munjalapatel/workspace/sd/dops-infrastructure/node_modules/@pulumi/runtime/invoke.ts:159:33)
            at Object.onReceiveStatus (/Users/munjalapatel/workspace/sd/dops-infrastructure/node_modules/@grpc/grpc-js/src/client.ts:338:26)
            at Object.onReceiveStatus (/Users/munjalapatel/workspace/sd/dops-infrastructure/node_modules/@grpc/grpc-js/src/client-interceptors.ts:426:34)
            at Object.onReceiveStatus (/Users/munjalapatel/workspace/sd/dops-infrastructure/node_modules/@grpc/grpc-js/src/client-interceptors.ts:389:48)
            at /Users/munjalapatel/workspace/sd/dops-infrastructure/node_modules/@grpc/grpc-js/src/call-stream.ts:276:24
            at processTicksAndRejections (node:internal/process/task_queues:78:11)
    

    Output of pulumi about

    CLI
    Version      3.46.1
    Go Version   go1.19.3
    Go Compiler  gc
    
    Plugins
    NAME        VERSION
    aws         5.19.0
    aws         5.10.0
    aws-native  0.18.0
    docker      3.5.0
    eks         0.42.7
    kubernetes  3.22.1
    kubernetes  3.20.2
    nodejs      unknown
    tls         4.6.1
    
    Host
    OS       darwin
    Version  13.0
    Arch     x86_64
    
    This project is written in nodejs: executable='/Users/munjalapatel/.nvm/versions/node/v16.13.2/bin/node' version='v16.13.2'
    
    Backend
    Name           pulumi.com
    URL            https://app.pulumi.com/sd-dev
    User           sd-dev
    Organizations  sd-dev
    
    Dependencies:
    NAME                              VERSION
    @pulumi/pulumi                    3.46.0
    @typescript-eslint/eslint-plugin  5.42.0
    eslint-plugin-prettier            4.2.1
    @pulumi/aws                       5.19.0
    @pulumi/cdk                       0.4.0
    @pulumi/eks                       0.42.7
    @types/node                       18.11.9
    cdk-fck-nat                       1.0.44
    cz-conventional-changelog         3.3.0
    @commitlint/config-conventional   17.2.0
    @kubernetes/client-node           0.17.1
    @pulumi/tls                       4.6.1
    @types/fs-extra                   9.0.13
    commitizen                        4.2.5
    eslint-config-prettier            8.5.0
    eslint                            8.26.0
    husky                             8.0.1
    @pulumi/awsx                      0.40.1
    @pulumi/kubernetes                3.22.1
    prettier                          2.7.1
    validate-commit-email             1.0.1
    @typescript-eslint/parser         5.42.0
    lint-staged                       13.0.3
    @commitlint/cli                   17.2.0
    @pulumi/kubernetesx               0.1.6
    
    Pulumi locates its logs in /var/folders/zv/ypxkdwcx46d9vrf40tckqq880000gn/T/ by default
    warning: Failed to get information about the current stack: No current stack
    

    Additional context

    No response

    Contributing

    Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

    kind/bug needs-triage 
    opened by munjalpatel 1
  • Support passing pulumi Outputs as input parameters to constructs

    Support passing pulumi Outputs as input parameters to constructs

    A very simple example which should work, but doesn't:

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    import * as pulumicdk from '@pulumi/cdk';
    import * as redshift from 'aws-cdk-lib/aws-redshiftserverless';
    
    class RedshiftStack extends pulumicdk.Stack {
    
        constructor(id: string, options?: pulumicdk.StackOptions) {
            super(id, options);
    
            const namespace = new aws.redshiftserverless.Namespace("namespace", {
                namespaceName: "lbriggs",
            })
    
            const workgroup = new redshift.CfnWorkgroup(this, 'workgroup', {
                workgroupName: "workgroup",
                namespaceName: namespace.namespaceName // namespaceName doesn't support inputs
            })
    
    
        }
    }
    
    const stack = new RedshiftStack('teststack');
    
    kind/enhancement resolution/by-design 
    opened by jaxxstorm 1
  • Add default remappings to support VPC resources

    Add default remappings to support VPC resources

    Hello!

    • Vote on this issue by adding a 👍 reaction
    • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

    Issue details

    Affected area/feature

    kind/enhancement resolution/fixed 
    opened by viveklak 1
  • Use nicer names for S3 assets where possible.

    Use nicer names for S3 assets where possible.

    Prior to asset conversion, crawl each stack's node tree in search of S3 assets and build a map from asset paths to S3 asset objects. When converting a file asset, derive its name from the path of its corresponding S3 asset object, if any.

    opened by pgavlin 1
  • Add the S3 object example.

    Add the S3 object example.

    This involved adding a couple of features: support for evaluating Fn::Sub and support for builtin AWS resource mappings. The existing native resource mappings were also split out into their own file.

    opened by pgavlin 1
  • LoadBalancer

    LoadBalancer "name" cannot be longer than 32 characters

    Question from Community Slack:

    I have a question about names and length of names. When set up an sample infrastructure with Pulumi CDK I got this error message when running pulumi preview:

    Diagnostics:
      aws:lb:LoadBalancer (loadbalancedserviceLB1BE8EDCE):
        error: aws:lb/loadBalancer:LoadBalancer resource 'loadbalancedserviceLB1BE8EDCE' has a problem: "name" cannot be longer than 32 characters: "loadbalancedserviceLB1BE8EDCE-403d9b7". Examine values at 'LoadBalancer.Name'.
    

    The corresponding code looks like this:

    const lbservice = new ApplicationLoadBalancedFargateService(this, 'loadbalanced-service', {
      cluster,
      taskDefinition: taskdef,
      desiredCount: 2,
      serviceName: 'my-service',
      circuitBreaker: { rollback: true },
      publicLoadBalancer: true,
      listenerPort: webserverPort,
    });
    

    The name part is not an issue with regular AWS CDK, and Pulumi generates a different (shorter) name than AWS CDK, but still too short compared to name lengths allowed by CloudFormation, it seems. The question is really what to think and consider in terms of name issues here, what would be preferred approaches besides keeping construct id values short - and how many levels will this work out with?

    I suspect that the issue is that we should be passing name through explicitly in the mapping linked below if provided (which it will always be I believe?) so that Pulumi doesn't apply it's own autonaming here. If you open an issue on this - we can look into whether that is indeed the right resolution. https://github.com/pulumi/pulumi-cdk/blob/342f7d5bbbc0d272c7e1616ae108b04c478add5d/src/aws-resource-mappings.ts#L210

    opened by lukehoban 1
  • Is there a way to pass a pulumi provider to a cdk resource?

    Is there a way to pass a pulumi provider to a cdk resource?

    This was asked in community slack.

    I believe there is not currently. All resources are parented to the StackComponent, but that resource is constructed automatically without the end user being able to provide and parameters, including resource options.

    The Stack resource that users create does accept an options parameter which is derived from ComponentResourceOptions (and thus supports passing parent and provider), but we don't ultimately pass that through into the Pulumi StackComponent resource. I expect we can and should forward this on to allow the normal inheritance of resource options down into component and it's CDK-based children.

    opened by lukehoban 0
  • Support BucketDeployment

    Support BucketDeployment

    Hello!

    • Vote on this issue by adding a 👍 reaction
    • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

    Issue details

    I'm trying use CDK v2 to deploy files to a bucket via "aws-cdk-lib/aws-s3-deployment" and using BucketDeployment, but the resource type is Custom::CDKBucketDeployment and there is no direct mapping to it for Cloud Control API (https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.html). Even with manual mapping, it doesn't really seem to work.Looking for a fix or workaround | Peter WhiteAug 10, 2022, 05:02 PDTm trying use CDK v2 to deploy files to a bucket via "aws-cdk-lib/aws-s3-deployment" and using BucketDeployment, but the resource type is Custom::CDKBucketDeployment and there is no direct mapping to it for Cloud Control API (https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.html). Even with manual mapping, it doesn't really seem to work .Looking for a fix or workaround -- | -- We are trying use CDK v2 to deploy files to a bucket via "aws-cdk-lib/aws-s3-deployment" and using BucketDeployment, but the resource type is Custom::CDKBucketDeployment and there is no direct mapping to it for Cloud Control API (https://docs.aws.amazon.com/cloudcontrolapi/latest/userguide/supported-resources.html). Even with manual mapping, it doesn't really seem to work.Looking for a fix or workaround

    This is for an article commissioned by Pulumi. I have attached a link to a repository containing the code for the project from our author.

    Affected area/feature

    pulumi-cdk-static.zip

    kind/enhancement 
    opened by PeterWhiteCL 2
  • Document bootstrap requirements in README

    Document bootstrap requirements in README

    To use AWS CDK on Pulumi, you must currently have the CDK bootstrap installed in the target AWS account+region. We should document this as part of requirements in the README.

    kind/bug 
    opened by lukehoban 1
  • Support all Pulumi Languages

    Support all Pulumi Languages

    Hello!

    • Vote on this issue by adding a 👍 reaction
    • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

    Issue details

    Currently pulumi-cdk only directly supports Typescript:

    Note: Currently, the Pulumi CDK Adapter preview is available only for TypeScript/JavaScript users. (via README)

    It would be nice if all Pulumi languages were supported.

    This is presumptively made difficult by CDK being based on jsii, which means all of the CDK implementation languages have a ts/js dependency.

    Affected area/feature

    pulumi-cdk

    kind/enhancement 
    opened by fitzoh 2
  • Concurrent runs of the test suite fail

    Concurrent runs of the test suite fail

    Some resources seem to have fixed names which can collide if concurrent runs occur, e.g.:

    aws:lb:TargetGroup (LBListenerTargetGroupF04FCF6D):
          error: 1 error occurred:
          	* error creating LB Target Group: DuplicateTargetGroupName: A target group with the same name 'LBListenerTargetGroupF04FCF6D' exists, but with different settings
          	status code: 400, request id: 7e4ad2d9-bb3b-4f45-aa1f-507f8355a098
    

    For the time being concurrency has been dropped to 1 here: https://github.com/pulumi/pulumi-cdk/pull/37/commits/ad5922e9530276506d6e90216a6917a3e19441fd.

    We should revisit if autonaming can be safely honored on resources corresponding to the L1 CDK constructs to make this moot.

    kind/engineering 
    opened by viveklak 1
Releases(v0.4.0)
  • v0.4.0(Aug 12, 2022)

    What's Changed

    • Support specifying stack properties by @lukehoban in https://github.com/pulumi/pulumi-cdk/pull/56

    Full Changelog: https://github.com/pulumi/pulumi-cdk/compare/v0.3.0...v0.4.0

    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(May 27, 2022)

    What's Changed

    • Re-enable examples in release in https://github.com/pulumi/pulumi-cdk/pull/45
    • Fix tiny typos in README in https://github.com/pulumi/pulumi-cdk/pull/46
    • Fix command-dispatch and add conditional to only run on pr comments in https://github.com/pulumi/pulumi-cdk/pull/51
    • Bump aws and aws-native provider dependencies in https://github.com/pulumi/pulumi-cdk/pull/52

    Full Changelog: https://github.com/pulumi/pulumi-cdk/compare/v0.2.0...v0.3.0

    Source code(tar.gz)
    Source code(zip)
  • v0.2.0(May 4, 2022)

  • v0.1.1(May 4, 2022)

  • v0.1.0(May 4, 2022)

  • v0.0.1(May 4, 2022)

Owner
Pulumi
Pulumi
This project provides a CDK construct creating AWS organizations.

AWS Organizations This project provides a CDK construct creating AWS organizations. Currently, there is no @aws-cdk/aws-organizations available. See t

Pepperize 107 Dec 29, 2022
Sample AWS microservices app with service discovery defined using the CDK. Uses Docker + Fargate & ELB.

AWS Microservices Demo with CDK and Fargate About Simple AWS microservice-based app. Consists of two Spring Boot based services: Name Service GET /nam

Nick Klaene 7 Nov 23, 2022
Example Serverless DynamoDB integration tests using Jest, TypeScript and the AWS CDK

serverless dynamodb integration tests ?? Example Serverless DynamoDB integration tests using Jest, TypeScript and the AWS CDK Introduction How to inte

Lee Gilmore 8 Nov 4, 2022
awsrun 189 Jan 3, 2023
Easy-to-use CDK constructs for monitoring your AWS infrastructure

CDK Monitoring Constructs Easy-to-use CDK constructs for monitoring your AWS infrastructure. Easily add commonly-used alarms using predefined properti

CDK Labs at AWS 214 Jan 6, 2023
AWS CDK compiled for web (and Node!)

cdk-web ?? DEMO ?? AWS CDK compiled for web (and Node!) cdk-web and aws-cdk-web are functionally identical packages on npm. read about the differences

Sepehr Laal 44 Dec 5, 2022
A sample CICD Deployment Pipeline for your Alexa Skills, using AWS CDK, CodeBuild and CodePipeline

Alexa Skils - CI/CD CDK Pipeline This repository will help you setting up a CI/CD pipeline for your Alexa Skills. This pipeline is powered by AWS Clou

null 5 Nov 23, 2022
The operator CLI for CDK apps.

cdk-app The operator CLI for CDK apps. Experimental. cdk-app lets you associate commands with CDK constructs so that you can quickly invoke functions,

CDK Labs at AWS 42 Dec 8, 2022
CDK constructs for self-hosted GitHub Actions runners

GitHub Self-Hosted Runners CDK Constructs Use this CDK construct to create ephemeral self-hosted GitHub runners on-demand inside your AWS account. Eas

CloudSnorkel 134 Dec 20, 2022
Learn Web 2.0 and Web 3.0 Development using Next.js, Typescript, AWS CDK, AWS Serverless, Ethereum and AWS Aurora Serverless

Learn Web 2.0 Cloud and Web 3.0 Development in Baby Steps In this course repo we will learn Web 2.0 cloud development using the latest state of the ar

Panacloud Multi-Cloud Internet-Scale Modern Global Apps 89 Jan 3, 2023
Sample code for resizing Images with Lambda@Edge using the Custom Origin. You can deploy using AWS CDK.

Resizing Images with Lambda@Edge using the Custom Origin You can resize the images and convert the image format by query parameters. This Lambda@Edge

AWS Samples 16 Dec 11, 2022
A sample code that implements a simple Web app using AWS CDK v2

A sample code that implements a simple Web app using AWS CDK v2. This code will be introduced in a live coding session at AWS Summit Online Japan 2022 Developer Zone in 2022/5/25.

AWS Samples 29 Dec 5, 2022
1on1 call demo using Chime SDK meetings, Next.js, AppSync, and CDK!

Chime SDK Meetings 1on1 call demo with Next.js / AppSync / CDK This is a sample project to demonstrate Chime SDK meetings for one-on-one call with Nex

AWS Samples 4 Dec 15, 2022
CDK construct to periodically take snapshots of RDS databases, sanitize them, and share with selected accounts.

CDK Construct for RDS Sanitized Snapshots Periodically take snapshots of RDS databases, sanitize them, and share with selected accounts. Use this to a

CloudSnorkel 6 Dec 7, 2022
Functionless-based mini-framework for DynamoDB migrations in AWS CDK.

dynamodb-migrations This repo is heavily in progress! Readme describes desired contract and functionality. Please do not try using it yet!. I'm not ev

Rafal Wilinski 23 Dec 20, 2022
This application provides the CDK project and a frontend that allows you to build a serverless chat application based on API Gateway's WebSocket-based API feature.

Serverless chat application using ApiGateway Websockets This project lets you provision a ready-to-use fully serverless real-time chat application usi

AWS Samples 60 Jan 3, 2023
AWS CDK stack for taking website screenshots (powered by Puppeteer)

CDK Screenshot (powered by Puppeteer) Made possible by the excellent Puppeteer. Install export AWS_PROFILE=myprofile export AWS_DEFAULT_REGION=us-east

Alexei Boronine 6 Oct 23, 2022
An AWS Cloud Native application using CDK that defines a Serverless Event Driven application for interacting with Twitter and utilising Machine Learning / AI as a Service.

AWS Serverless Event Driven Twitter Bot An AWS Cloud Native application using CDK (Written in TypeScript) that defines a Serverless Event Driven appli

null 4 Dec 18, 2022
An Amazon Kendra REST API CDK example with an API Gateway, including authentication with AWS Cognito and AWS X-Ray Tracing

Amazon Kendra Web Service CDK Sample Amazon Kendra has a robust JSON API for use with the AWS SDK (software development kit), but does not expose endp

AWS Samples 8 Nov 28, 2022