Skip to content

Commit

Permalink
For aws assume role projects, resolve cs indentation, name of stack i…
Browse files Browse the repository at this point in the history
…n cs, and unnecessary plugins
  • Loading branch information
XUANHE ZHOU committed Jul 14, 2020
1 parent 579adfa commit 2562356
Show file tree
Hide file tree
Showing 13 changed files with 22 additions and 18 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Example | Description |

Example | Description |
--------- | --------- |
[AssumeRole](aws-go-assume-role) | Use AssumeRole to create resources.
[Fargate](aws-go-fargate) | Provision a full ECS Fargate cluster running a load-balanced nginx web server.
[Lambda](aws-go-lambda) | Create a lambda that does a simple `ToUpper` on the string input and returns it.
[S3 Folder](aws-go-s3-folder) | Serve a static website on S3.
Expand All @@ -118,6 +119,7 @@ Example | Description |

Example | Description |
--------- | --------- |
[AssumeRole](aws-cs-assume-role) | Use AssumeRole to create resources.
[Fargate](aws-cs-fargate) | Build, deploy, and run a Dockerized app using ECS, ECR, and Fargate.
[Lambda](aws-cs-lambda) | Create a lambda that does a simple `ToUpper` on the string input and returns it.
[S3 Folder](aws-cs-s3-folder) | Serve a static website on S3.
Expand Down
1 change: 1 addition & 0 deletions aws-cs-assume-role/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ $ pulumi stack output --json
"roleArn": "arn:aws:iam::<redacted>:role/allow-s3-management-ad477e6"
}
```

If we just use the above command then the secretAccessKey would not be shown. In order to show the secret value use this

```
Expand Down
5 changes: 2 additions & 3 deletions aws-cs-assume-role/assume-role/AssumeRoleStack.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System;
using Pulumi;
using Aws = Pulumi.Aws;
using Input = Pulumi.Aws.Inputs;
using AwsConfig = Pulumi.Aws.Config;
using System;


class AssumeRoleStack : Stack
Expand All @@ -12,8 +12,7 @@ public AssumeRoleStack()
var awsConfig = new Pulumi.Config("aws");
var config = new Pulumi.Config();
var roleToAssumeARN = config.Require("roleToAssumeARN");
var provider = new Aws.Provider("privileged", new Aws.ProviderArgs
{
var provider = new Aws.Provider("privileged", new Aws.ProviderArgs {
AssumeRole = new Aws.Inputs.ProviderAssumeRoleArgs
{
RoleArn = roleToAssumeARN,
Expand Down
2 changes: 1 addition & 1 deletion aws-cs-assume-role/assume-role/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: cs-assume-role
name: assume-role
runtime: dotnet
description: Demonstrate use of AWS AssumeRole Functionality in C#
10 changes: 5 additions & 5 deletions aws-cs-assume-role/create-role/CreateRoleStack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ public CreateRoleStack()
var config = new Pulumi.Config();
var unprivilegedUsername = config.Require("unprivilegedUsername");

var unprivilegedUser = new Iam.User("unprivilegedUser", new Iam.UserArgs
{
Name = unprivilegedUsername,
});
var unprivilegedUser = new Iam.User("unprivilegedUser", new Iam.UserArgs
{
Name = unprivilegedUsername,
});

var unprivilegedUserCreds = new Iam.AccessKey("unprivileged-user-key", new Iam.AccessKeyArgs
{
Expand All @@ -28,7 +28,7 @@ public CreateRoleStack()
var tempPolicy = unprivilegedUser.Arn.Apply((string arn) => {
AssumeRolePolicyArgs policyArgs = new AssumeRolePolicyArgs(arn);
return JsonSerializer.Serialize<AssumeRolePolicyArgs>(policyArgs);
});
});

var allowS3ManagementRole = new Iam.Role("allow-s3-management", new Iam.RoleArgs
{
Expand Down
4 changes: 3 additions & 1 deletion aws-cs-assume-role/create-role/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Threading.Tasks;
// Copyright 2016-2020, Pulumi Corporation. All rights reserved.

using System.Threading.Tasks;
using Pulumi;

class Program
Expand Down
2 changes: 1 addition & 1 deletion aws-cs-assume-role/create-role/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name: cs-create-role
name: create-role
runtime: dotnet
description: Demonstrate use of AWS AssumeRole Functionality in C#
2 changes: 1 addition & 1 deletion aws-go-assume-role/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ must be set to the region in which you wish to operate:

```bash
$ pulumi stack init assume-role-assume
$ pulumi config set roleToAssumeARN "$(pulumi stack output --stack assume-role-create roleArn)"
$ pulumi config set roleToAssumeARN "$(pulumi stack output --stack {YOUR_STACK_PATH/assume-role-create} roleArn)"
$ pulumi config set aws:region us-east-1
```

Expand Down
Binary file removed aws-go-assume-role/assume-role/assume-role
Binary file not shown.
2 changes: 2 additions & 0 deletions aws-go-assume-role/assume-role/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// Copyright 2016-2020, Pulumi Corporation. All rights reserved.

package main

import (
Expand Down
3 changes: 2 additions & 1 deletion aws-go-assume-role/create-role/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
// Copyright 2016-2020, Pulumi Corporation. All rights reserved.

package main

import (
Expand Down
3 changes: 0 additions & 3 deletions aws-py-assume-role/create-role/venv/pyvenv.cfg

This file was deleted.

4 changes: 2 additions & 2 deletions aws-ts-assume-role/create-role/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016-2019, Pulumi Corporation. All rights reserved.
// Copyright 2016-2020, Pulumi Corporation. All rights reserved.

import * as aws from "@pulumi/aws";
import * as pulumi from "@pulumi/pulumi";
Expand All @@ -15,7 +15,7 @@ const unprivilegedUserCreds = new aws.iam.AccessKey("unprivileged-user-key", {
},
// additional_secret_outputs specify properties that must be encrypted as secrets
// https://www.pulumi.com/docs/intro/concepts/programming-model/#additionalsecretoutputs
{additionalSecretOutputs: ["secret"]});
{ additionalSecretOutputs: ["secret"] });

const allowS3ManagementRole = new aws.iam.Role("allow-s3-management", {
description: "Allow management of S3 buckets",
Expand Down

0 comments on commit 2562356

Please sign in to comment.