-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create aws ccapi resources by using the SDK (#217)
This PR updates our mapping to create resources using the SDK directly instead of creating a `pulumi.CustomResource`. By using a `pulumi.CustomResource` we were missing out on all the resource specific things from the generated SDK. (`replaceOnChanges`, required property validation, etc). closes #216
- Loading branch information
Showing
12 changed files
with
150 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
name: pulumi-aws-replaceOnChanges | ||
runtime: nodejs | ||
description: replaceOnChanges integration test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import * as aws from '@pulumi/aws'; | ||
import * as pulumicdk from '@pulumi/cdk'; | ||
import * as ec2 from 'aws-cdk-lib/aws-ec2'; | ||
|
||
class ReplaceOnChangesStack extends pulumicdk.Stack { | ||
constructor(app: pulumicdk.App, id: string, options?: pulumicdk.StackOptions) { | ||
super(app, id, options); | ||
const vpc = aws.ec2.getVpcOutput({ | ||
default: true, | ||
}).id; | ||
const azs = aws.getAvailabilityZonesOutput({}).names; | ||
new ec2.SecurityGroup(this, 'sg', { | ||
description: 'Some Description', | ||
vpc: ec2.Vpc.fromVpcAttributes(this, 'vpc', { | ||
vpcId: pulumicdk.asString(vpc), | ||
availabilityZones: pulumicdk.asList(azs), | ||
}), | ||
}); | ||
} | ||
} | ||
|
||
new pulumicdk.App('app', (scope: pulumicdk.App) => { | ||
new ReplaceOnChangesStack(scope, 'teststack'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"name": "pulumi-aws-cdk", | ||
"devDependencies": { | ||
"@types/node": "^10.0.0" | ||
}, | ||
"dependencies": { | ||
"@pulumi/aws": "^6.0.0", | ||
"@pulumi/aws-native": "^1.5.0", | ||
"@pulumi/cdk": "^0.5.0", | ||
"@pulumi/pulumi": "^3.0.0", | ||
"aws-cdk-lib": "2.149.0", | ||
"constructs": "10.3.0", | ||
"esbuild": "^0.24.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import * as aws from '@pulumi/aws'; | ||
import * as pulumicdk from '@pulumi/cdk'; | ||
import * as ec2 from 'aws-cdk-lib/aws-ec2'; | ||
|
||
class ReplaceOnChangesStack extends pulumicdk.Stack { | ||
constructor(app: pulumicdk.App, id: string, options?: pulumicdk.StackOptions) { | ||
super(app, id, options); | ||
const vpc = aws.ec2.getVpcOutput({ | ||
default: true, | ||
}).id; | ||
const azs = aws.getAvailabilityZonesOutput({}).names; | ||
new ec2.SecurityGroup(this, 'sg', { | ||
// description is a createOnlyProperty which means this would fail | ||
// if `replaceOnChanges` was not working | ||
description: 'Some New Description', | ||
vpc: ec2.Vpc.fromVpcAttributes(this, 'vpc', { | ||
vpcId: pulumicdk.asString(vpc), | ||
availabilityZones: pulumicdk.asList(azs), | ||
}), | ||
}); | ||
} | ||
} | ||
|
||
new pulumicdk.App('app', (scope: pulumicdk.App) => { | ||
new ReplaceOnChangesStack(scope, 'teststack'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"strict": true, | ||
"outDir": "bin", | ||
"target": "es2019", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"experimentalDecorators": true, | ||
"pretty": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitReturns": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"include": [ | ||
"./*.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters