Skip to content

Commit

Permalink
updates based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
corymhall committed Dec 16, 2024
1 parent 618434d commit 01a8b9b
Showing 1 changed file with 4 additions and 43 deletions.
47 changes: 4 additions & 43 deletions content/docs/iac/clouds/aws/guides/cdk.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ menu:
---

The pulumi-cdk library provides access to the many high-level libraries ('constructs') built by service
teams at AWS and by the AWS CDK community.
teams at AWS and by [the AWS CDK community](https://constructs.dev/).

The adapter allows writing [AWS CDK](https://docs.aws.amazon.com/cdk/v2/guide/home.html) code 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.
Pulumi program, and having the resulting AWS resources be deployed and managed via Pulumi. Pulumi and CDK resources can
seamlessly interact with each other. 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.

## Getting Started

Expand Down Expand Up @@ -335,46 +336,6 @@ const app = new pulumicdk.App('app', (scope: pulumicdk.App) => {
});
```

One thing to note is that when you pass different custom providers to a Stack,
by default the Stack becomes an [environment agnostic stack](https://docs.aws.amazon.com/cdk/v2/guide/configure-env.html#configure-env-examples).
If you want to have the environment specified at the CDK Stack level, then you
also need to provide the environment to the Stack Props, as follows:

```ts
import * as aws from '@pulumi/aws';
import * as ccapi from '@pulumi/aws-native';
import * as pulumicdk from '@pulumi/cdk';

const app = new pulumicdk.App('app', (scope: pulumicdk.App) => {
// inherits the provider from the app and has the CDK env auto populated
// based on the default provider
const defaultProviderStack = new pulumicdk.Stack('default-provider-stack');
const bucket = new s3.Bucket(defaultProviderStack, 'Bucket');

// use a different provider for this stack
const east2Stack = new pulumicdk.Stack('east2-stack', {
props: {
env: {
region: 'us-east-2',
account: '12345678912',
},
},
providers: [
new aws.Provider('east2-provider', { region: 'us-east-2' }),
new ccapi.Provider('east2-ccapi-provider', {
region: 'us-east-2',
autoNaming: {
autoTrim: true,
randomSuffixMinLength: 7,
},
}),
],
});
const bucket2 = new s3.Bucket(east2Stack, 'Bucket');
});

```

## CDK Lookups

CDK [lookups](https://docs.aws.amazon.com/cdk/v2/guide/context.html#context_methods) are currently disabled by default.
Expand Down

0 comments on commit 01a8b9b

Please sign in to comment.