forked from pulumi/examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request pulumi#178 from pulumi/multi-cloud-example
Add multi-cloud example targeting AWS and GCP
- Loading branch information
Showing
6 changed files
with
130 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/bin/ | ||
/node_modules/ |
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,11 @@ | ||
name: multicloud-ts-buckets | ||
runtime: nodejs | ||
description: Example showing a single program deploying to both AWS and GCP | ||
template: | ||
description: Example showing a single program deploying to both AWS and GCP | ||
config: | ||
aws:region: | ||
description: The AWS region in which to perform operations | ||
default: us-east-1 | ||
gcp:project: | ||
description: The ID of the GCP project in which deploy resources |
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,69 @@ | ||
[![Deploy](https://get.pulumi.com/new/button.svg)](https://app.pulumi.com/new) | ||
|
||
# Multi-Cloud in AWS and GCP using TypeScript | ||
|
||
This example uses a single Pulumi program to provision resources in both AWS and GCP. It was | ||
prepared by starting with the `aws-typescript` template, and then installing the `@pulumi/gcp` | ||
package from NPM. | ||
|
||
## Getting Started | ||
|
||
Install prerequisites with: | ||
|
||
```shell | ||
$ npm install | ||
``` | ||
|
||
Create a new stack: | ||
|
||
```shell | ||
$ pulumi stack init multicloud-aws-gcp | ||
``` | ||
|
||
Configure the Pulumi program with the AWS region in which to deploy, and the GCP project ID: | ||
|
||
```shell | ||
$ pulumi config set aws:region us-east-1 | ||
$ pulumi config set gcp:project my-project-id | ||
``` | ||
|
||
Run the program with `pulumi up`, with ambient AWS and GCP credentials available. The preview shows | ||
resources will be created in both clouds. Confirm the update, and resources are created in each | ||
cloud. The outputs show the name of the AWS and GCP buckets respectively. | ||
|
||
```shell | ||
$ pulumi up | ||
Previewing update (multicloud-ts-buckets-dev): | ||
|
||
Type Name Plan | ||
+ pulumi:pulumi:Stack multicloud-ts-buckets-multicloud-ts-buckets-dev create | ||
+ ├─ gcp:storage:Bucket my-bucket create | ||
+ └─ aws:s3:Bucket my-bucket create | ||
|
||
Resources: | ||
3 changes | ||
+ 3 to create | ||
|
||
Do you want to perform this update? yes | ||
Updating (multicloud-ts-buckets-dev): | ||
|
||
Type Name Status | ||
+ pulumi:pulumi:Stack multicloud-ts-buckets-multicloud-ts-buckets-dev created | ||
+ ├─ gcp:storage:Bucket my-bucket created | ||
+ └─ aws:s3:Bucket my-bucket created | ||
|
||
Outputs: | ||
bucketNames: [ | ||
[0]: "my-bucket-c819937" | ||
[1]: "my-bucket-f722eb9" | ||
] | ||
|
||
Resources: | ||
3 changes | ||
+ 3 created | ||
|
||
Duration: 21.713128552s | ||
|
||
Permalink: https://app.pulumi.com/jen20/multicloud-ts-buckets-dev | ||
``` | ||
|
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 @@ | ||
import * as aws from "@pulumi/aws"; | ||
import * as gcp from "@pulumi/gcp"; | ||
|
||
// Create an AWS resource (S3 Bucket) | ||
const awsBucket = new aws.s3.Bucket("my-bucket"); | ||
|
||
// Create a GCP resource (Storage Bucket) | ||
const gcpBucket = new gcp.storage.Bucket("my-bucket"); | ||
|
||
// Export the names of the buckets | ||
export const bucketNames = [ | ||
awsBucket.bucket, | ||
gcpBucket.name, | ||
]; | ||
|
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,11 @@ | ||
{ | ||
"name": "aws-typescript", | ||
"devDependencies": { | ||
"@types/node": "latest" | ||
}, | ||
"dependencies": { | ||
"@pulumi/aws": "latest", | ||
"@pulumi/gcp": "latest", | ||
"@pulumi/pulumi": "latest" | ||
} | ||
} |
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,22 @@ | ||
{ | ||
"compilerOptions": { | ||
"outDir": "bin", | ||
"target": "es6", | ||
"lib": [ | ||
"es6" | ||
], | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"experimentalDecorators": true, | ||
"pretty": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitAny": true, | ||
"noImplicitReturns": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"strictNullChecks": true | ||
}, | ||
"files": [ | ||
"index.ts" | ||
] | ||
} |