-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Move Resources Between Stacks Tutorial (#12637)
* initializing content * added example code placeholders * updated content * added example code * added random package * clean up code and content * added remaining code examples in content * added meta image * updated estimated time * removed unused img and updated link
- Loading branch information
1 parent
ce61351
commit 6ae0bd7
Showing
19 changed files
with
684 additions
and
0 deletions.
There are no files selected for viewing
397 changes: 397 additions & 0 deletions
397
content/tutorials/move-resources-between-stacks/index.md
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions
28
static/programs/aws-s3bucket-s3objects-random-csharp/Program.cs
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,28 @@ | ||
using Pulumi; | ||
using Pulumi.Aws.S3; | ||
using Pulumi.Random; | ||
using System.Collections.Generic; | ||
|
||
return await Deployment.RunAsync(() => | ||
{ | ||
var petName = new RandomPet("my-pet-name"); | ||
|
||
var bucket = new Bucket("b"); | ||
|
||
var index = new BucketObject("index.html", new BucketObjectArgs | ||
{ | ||
Bucket = bucket.BucketName, | ||
Content = "Thanks for using Pulumi!" | ||
}, new CustomResourceOptions { Parent = bucket }); | ||
|
||
var randomSite = new BucketObject("random.html", new BucketObjectArgs | ||
{ | ||
Bucket = bucket.BucketName, | ||
Content = petName.Id | ||
}, new CustomResourceOptions { Parent = bucket }); | ||
|
||
return new Dictionary<string, object?> | ||
{ | ||
["PetName"] = petName.Id | ||
}; | ||
}); |
7 changes: 7 additions & 0 deletions
7
static/programs/aws-s3bucket-s3objects-random-csharp/Pulumi.yaml
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,7 @@ | ||
name: aws-s3bucket-s3objects-random-csharp | ||
runtime: dotnet | ||
description: An example that deploys an S3 bucket, S3 bucket objects, and a Pulumi random resource. | ||
config: | ||
pulumi:tags: | ||
value: | ||
pulumi:template: aws-csharp |
15 changes: 15 additions & 0 deletions
15
...programs/aws-s3bucket-s3objects-random-csharp/aws-s3bucket-s3objects-random-csharp.csproj
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 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Pulumi" Version="3.*" /> | ||
<PackageReference Include="Pulumi.Aws" Version="6.*" /> | ||
<PackageReference Include="Pulumi.Random" Version="4.16.3" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,7 @@ | ||
name: aws-s3bucket-s3objects-random-go | ||
runtime: go | ||
description: An example that deploys an S3 bucket, S3 bucket objects, and a Pulumi random resource. | ||
config: | ||
pulumi:tags: | ||
value: | ||
pulumi:template: aws-go |
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 @@ | ||
module aws-s3bucket-s3objects-random-go | ||
|
||
go 1.21 | ||
|
||
toolchain go1.21.0 | ||
|
||
require ( | ||
github.com/pulumi/pulumi-aws/sdk/v6 v6.37.1 | ||
github.com/pulumi/pulumi-random/sdk/v4 v4.16.3 | ||
github.com/pulumi/pulumi/sdk/v3 v3.121.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,41 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3" | ||
"github.com/pulumi/pulumi-random/sdk/v4/go/random" | ||
"github.com/pulumi/pulumi/sdk/v3/go/pulumi" | ||
) | ||
|
||
func main() { | ||
pulumi.Run(func(ctx *pulumi.Context) error { | ||
|
||
petName, err := random.NewRandomPet(ctx, "my-pet-name", nil) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
bucket, err := s3.NewBucket(ctx, "b", nil) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
_, err = s3.NewBucketObject(ctx, "index.html", &s3.BucketObjectArgs{ | ||
Bucket: bucket.ID(), | ||
Content: pulumi.String("Thanks for using Pulumi!"), | ||
}, pulumi.Parent(bucket)) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
_, err = s3.NewBucketObject(ctx, "random.html", &s3.BucketObjectArgs{ | ||
Bucket: bucket.ID(), | ||
Content: petName.ID(), | ||
}, pulumi.Parent(bucket)) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
ctx.Export("PetName", petName.ID()) | ||
return nil | ||
}) | ||
} |
11 changes: 11 additions & 0 deletions
11
static/programs/aws-s3bucket-s3objects-random-javascript/Pulumi.yaml
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-s3bucket-s3objects-random-javascript | ||
runtime: | ||
name: nodejs | ||
options: | ||
packagemanager: npm | ||
typescript: false | ||
description: An example that deploys an S3 bucket, S3 bucket objects, and a Pulumi random resource. | ||
config: | ||
pulumi:tags: | ||
value: | ||
pulumi:template: aws-javascript |
27 changes: 27 additions & 0 deletions
27
static/programs/aws-s3bucket-s3objects-random-javascript/index.js
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,27 @@ | ||
const pulumi = require("@pulumi/pulumi"); | ||
const random = require("@pulumi/random"); | ||
const aws = require("@pulumi/aws"); | ||
|
||
const petName = new random.RandomPet("my-pet-name"); | ||
|
||
const bucket = new aws.s3.Bucket("b"); | ||
|
||
const index = new aws.s3.BucketObject( | ||
"index.html", | ||
{ | ||
bucket: bucket.bucket, | ||
content: "Thanks for using Pulumi!", | ||
}, | ||
{ parent: bucket }, | ||
); | ||
|
||
const randomSite = new aws.s3.BucketObject( | ||
"random.html", | ||
{ | ||
bucket: bucket.bucket, | ||
content: petName.id, | ||
}, | ||
{ parent: bucket }, | ||
); | ||
|
||
exports.PetName = petName.id; |
10 changes: 10 additions & 0 deletions
10
static/programs/aws-s3bucket-s3objects-random-javascript/package.json
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,10 @@ | ||
{ | ||
"name": "aws-s3bucket-s3objects-random-javascript", | ||
"main": "index.js", | ||
"dependencies": { | ||
"@pulumi/aws": "^6.0.0", | ||
"@pulumi/awsx": "^2.0.2", | ||
"@pulumi/pulumi": "^3.0.0", | ||
"@pulumi/random": "^4.16.3" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
static/programs/aws-s3bucket-s3objects-random-python/Pulumi.yaml
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-s3bucket-s3objects-random-python | ||
runtime: | ||
name: python | ||
options: | ||
toolchain: pip | ||
virtualenv: venv | ||
description: An example that deploys an S3 bucket, S3 bucket objects, and a Pulumi random resource. | ||
config: | ||
pulumi:tags: | ||
value: | ||
pulumi:template: aws-python |
21 changes: 21 additions & 0 deletions
21
static/programs/aws-s3bucket-s3objects-random-python/__main__.py
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,21 @@ | ||
import pulumi | ||
import pulumi_random as random | ||
import pulumi_aws as aws | ||
|
||
pet_name = random.RandomPet('my-pet-name') | ||
|
||
bucket = aws.s3.Bucket("b") | ||
|
||
index = aws.s3.BucketObject("index.html", | ||
bucket=bucket.bucket, | ||
content="Thanks for using Pulumi!", | ||
opts=pulumi.ResourceOptions(parent=bucket) | ||
) | ||
|
||
random_site = aws.s3.BucketObject("random.html", | ||
bucket=bucket.bucket, | ||
content=pet_name.id, | ||
opts=pulumi.ResourceOptions(parent=bucket) | ||
) | ||
|
||
pulumi.export('PetName', pet_name.id) |
3 changes: 3 additions & 0 deletions
3
static/programs/aws-s3bucket-s3objects-random-python/requirements.txt
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 @@ | ||
pulumi>=3.0.0,<4.0.0 | ||
pulumi-aws>=6.0.2,<7.0.0 | ||
pulumi-random |
10 changes: 10 additions & 0 deletions
10
static/programs/aws-s3bucket-s3objects-random-typescript/Pulumi.yaml
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,10 @@ | ||
name: aws-s3bucket-s3objects-random-typescript | ||
runtime: | ||
name: nodejs | ||
options: | ||
packagemanager: npm | ||
description: An example that deploys an S3 bucket, S3 bucket objects, and a Pulumi random resource. | ||
config: | ||
pulumi:tags: | ||
value: | ||
pulumi:template: aws-typescript |
27 changes: 27 additions & 0 deletions
27
static/programs/aws-s3bucket-s3objects-random-typescript/index.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import * as pulumi from "@pulumi/pulumi"; | ||
import * as random from "@pulumi/random"; | ||
import * as aws from "@pulumi/aws"; | ||
|
||
const petName = new random.RandomPet("my-pet-name"); | ||
|
||
const bucket = new aws.s3.Bucket("b"); | ||
|
||
const index = new aws.s3.BucketObject( | ||
"index.html", | ||
{ | ||
bucket: bucket.bucket, | ||
content: "Thanks for using Pulumi!", | ||
}, | ||
{ parent: bucket }, | ||
); | ||
|
||
const randomSite = new aws.s3.BucketObject( | ||
"random.html", | ||
{ | ||
bucket: bucket.bucket, | ||
content: petName.id, | ||
}, | ||
{ parent: bucket }, | ||
); | ||
|
||
export const PetName = petName.id; |
14 changes: 14 additions & 0 deletions
14
static/programs/aws-s3bucket-s3objects-random-typescript/package.json
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,14 @@ | ||
{ | ||
"name": "aws-s3bucket-s3objects-random-typescript", | ||
"main": "index.ts", | ||
"devDependencies": { | ||
"@types/node": "^18", | ||
"typescript": "^5.0.0" | ||
}, | ||
"dependencies": { | ||
"@pulumi/aws": "^6.0.0", | ||
"@pulumi/awsx": "^2.0.2", | ||
"@pulumi/pulumi": "^3.113.0", | ||
"@pulumi/random": "^4.16.3" | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
static/programs/aws-s3bucket-s3objects-random-typescript/tsconfig.json
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": "es2020", | ||
"module": "commonjs", | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"experimentalDecorators": true, | ||
"pretty": true, | ||
"noFallthroughCasesInSwitch": true, | ||
"noImplicitReturns": true, | ||
"forceConsistentCasingInFileNames": true | ||
}, | ||
"files": [ | ||
"index.ts" | ||
] | ||
} |
26 changes: 26 additions & 0 deletions
26
static/programs/aws-s3bucket-s3objects-random-yaml/Pulumi.yaml
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 @@ | ||
name: aws-s3bucket-s3objects-random-yaml | ||
runtime: yaml | ||
description: An example that deploys an S3 bucket, S3 bucket objects, and a Pulumi random resource. | ||
|
||
resources: | ||
pet-name: | ||
type: random:RandomPet | ||
my-bucket: | ||
type: aws:s3:Bucket | ||
index: | ||
type: aws:s3:BucketObject | ||
properties: | ||
bucket: ${my-bucket.bucket} | ||
content: "Thanks for using Pulumi!" | ||
options: | ||
parent: ${my-bucket} | ||
random-site: | ||
type: aws:s3:BucketObject | ||
properties: | ||
bucket: ${my-bucket.bucket} | ||
content: ${pet-name.id} | ||
options: | ||
parent: ${my-bucket} | ||
|
||
outputs: | ||
PetName: ${pet-name.id} |