Skip to content

Commit

Permalink
update service -> cloud (pulumi#1412)
Browse files Browse the repository at this point in the history
Double-check all instances to ensure correct usage. Fix some incorrect links. Correct some formatting.

Signed-off-by: susanev <[email protected]>
Signed-off-by: Scott Lowe <[email protected]>
Co-authored-by: Scott Lowe <[email protected]>
  • Loading branch information
susanev and scottslowe committed Apr 12, 2023
1 parent 242c9bd commit 47ac5ec
Show file tree
Hide file tree
Showing 52 changed files with 117 additions and 107 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Example | Description |
[Fargate](aws-ts-hello-fargate) | Build, deploy, and run a Dockerized app using ECS, ECR, and Fargate.
[Lambda Thumbnailer](aws-ts-lambda-thumbnailer) | Create a video thumbnail extractor using serverless functions.
[Miniflux](aws-ts-pulumi-miniflux) | Stand up an RSS Service using Fargate and RDS.
[Pulumi Webhooks](aws-ts-pulumi-webhooks) | Create a Pulumi `cloud.HttpEndpoint` that receives webhook events delivered by the Pulumi Service, then echos the event to Slack.
[Pulumi Webhooks](aws-ts-pulumi-webhooks) | Create a Pulumi `cloud.HttpEndpoint` that receives webhook events delivered by Pulumi Cloud, then echos the event to Slack.
[RDS and Airflow](aws-ts-airflow) | Deploy a RDS Postgres instance and containerized Airflow.
[Resources](aws-ts-resources) | Create various resources, including `cloudwatch.Dashboard`, `cloudwatch.EventRule`, `cloudwatch.LogGroup`, and `sqs.Queue`.
[Ruby on Rails](aws-ts-ruby-on-rails) | Create a single EC2 virtual machine instance with a local MySQL database.
Expand Down
2 changes: 1 addition & 1 deletion aws-cs-secrets-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ A simple program that creates an AWS secret and a version under AWS Secrets Mana

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-go-appsync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ After cloning this repo, from this working directory, run these commands:

1. Run `pulumi destroy` to tear down all resources.

2. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
2. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-go-resources/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ After cloning this repo, from this working directory, run these commands:

1. Run `pulumi destroy` to tear down all resources.

2. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
2. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-go-secrets-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ A simple program that creates an AWS secret and a version under AWS Secrets Mana

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
4 changes: 2 additions & 2 deletions aws-go-slackbot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Slack users can subscribe/unsubscribe from notifications easily. To receive not
1. We set up an ApiGateway API to receive push notifications from Slack whenever important events happen.
2. Slack has strict requirements on how quickly the push endpoint must respond with `200` notifications before they consider the message as "not received", triggering back-off and resending of those same messages. For this reason, our example does not process Slack `event` messages as they come in. Instead, they are immediately added to an [AWS SNS Topic](https://aws.amazon.com/sns/) to be processed at a later point in time. This allows the ApiGateway call to return quickly, satisfying Slack's requirements.
3. Two [AWS Lambdas](https://aws.amazon.com/lambda/) are created naturally using simple Python functions. One function is used to create the Lambda that is called when Slack pushes a notification. The other is used to specify the Lamdba that will process the messages added to the Topic. These functions can easily access the other Pulumi resources created, avoiding the need to figure out ways to pass Resource ARNs/IDs/etc. to the Lambdas to ensure they can talk to the right resources. If these resources are swapped out in the future (for example, using RDS instead of DynamoDB, or SQS instead of SNS), Pulumi will make sure that the Lambdas were updated properly.
4. [Pulumi Secrets](https://www.pulumi.com/docs/intro/concepts/config/) provides a simple way to pass important credentials (like your Slack tokens) without having to directly embed them in your application code.
4. [Pulumi Secrets](https://www.pulumi.com/docs/intro/concepts/secrets/) provides a simple way to pass important credentials (like your Slack tokens) without having to directly embed them in your application code.

First, we'll set up the Pulumi App. Then, we'll go create and configure a Slack App and Bot to interact with our Pulumi App.

Expand Down Expand Up @@ -147,4 +147,4 @@ And you're set! From now on when someone from your team mentions you, you'll ge

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-js-containers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ Use the [`pulumi logs`](https://www.pulumi.com/docs/reference/cli/pulumi_logs/)

## Clean Up

To clean up resources, run [`pulumi destroy`](https://www.pulumi.com/docs/reference/cli/pulumi_destroy/) to avoid incurring any costs. Select `yes` on the confirmation prompt so Pulumi will remove all of the resources that you've created. To delete the stack itself, run [`pulumi stack rm`](https://www.pulumi.com/docs/reference/cli/pulumi_stack_rm/). Note that this command deletes all deployment history from the Pulumi Console, unless you've explicitly [chosen a different backend](https://www.pulumi.com/docs/intro/concepts/state/) for storing your infrastructure state.
To clean up resources, run [`pulumi destroy`](https://www.pulumi.com/docs/reference/cli/pulumi_destroy/) to avoid incurring any costs. Select `yes` on the confirmation prompt so Pulumi will remove all of the resources that you've created. To delete the stack itself, run [`pulumi stack rm`](https://www.pulumi.com/docs/reference/cli/pulumi_stack_rm/). Note that this command deletes all deployment history from the Pulumi console, unless you've explicitly [chosen a different backend](https://www.pulumi.com/docs/intro/concepts/state/) for storing your infrastructure state.
2 changes: 1 addition & 1 deletion aws-py-apigateway-lambda-serverless/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Output should include `"Cheers from AWS Lambda!!"`.

1. Run `pulumi destroy` to tear down all resources.

2. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
2. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.

## Summary

Expand Down
2 changes: 1 addition & 1 deletion aws-py-apigatewayv2-http-api-quickcreate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ or anything else you'd like!

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-py-appsync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ This example shows how to setup a basic GraphQL endpoint in AWS AppSync. The end

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-py-ec2-provisioners/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $ cat rsa.pub | pulumi config set publicKey --
$ cat rsa | pulumi config set privateKey --secret --
```

Notice that we've used `--secret` for `privateKey`. This ensures their are stored in encrypted form in the Pulumi secrets system.
Notice that we've used `--secret` for `privateKey`. This ensures the private key is stored as an encrypted [Pulumi secret](https://www.pulumi.com/docs/intro/concepts/secrets/).

Also set your desired AWS region:

Expand Down
2 changes: 1 addition & 1 deletion aws-py-secrets-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ A simple program that creates an AWS secret and a version under AWS Secrets Mana

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-py-serverless-raw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ AWS Lambda).

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
4 changes: 2 additions & 2 deletions aws-py-slackbot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Slack users can subscribe/unsubscribe from notifications easily. To receive not
1. We set up an ApiGateway API to receive push notifications from Slack whenever important events happen.
2. Slack has strict requirements on how quickly the push endpoint must respond with `200` notifications before they consider the message as "not received", triggering back-off and resending of those same messages. For this reason, our example does not process Slack `event` messages as they come in. Instead, they are immediately added to an [AWS SNS Topic](https://aws.amazon.com/sns/) to be processed at a later point in time. This allows the ApiGateway call to return quickly, satisfying Slack's requirements.
3. Two [AWS Lambdas](https://aws.amazon.com/lambda/) are created naturally using simple Python functions. One function is used to create the Lambda that is called when Slack pushes a notification. The other is used to specify the Lamdba that will process the messages added to the Topic. These functions can easily access the other Pulumi resources created, avoiding the need to figure out ways to pass Resource ARNs/IDs/etc. to the Lambdas to ensure they can talk to the right resources. If these resources are swapped out in the future (for example, using RDS instead of DynamoDB, or SQS instead of SNS), Pulumi will make sure that the Lambdas were updated properly.
4. [Pulumi Secrets](https://www.pulumi.com/docs/intro/concepts/config/) provides a simple way to pass important credentials (like your Slack tokens) without having to directly embed them in your application code.
4. [Pulumi Secrets](https://www.pulumi.com/docs/intro/concepts/secrets/) provides a simple way to pass important credentials (like your Slack tokens) without having to directly embed them in your application code.

First, we'll set up the Pulumi App. Then, we'll go create and configure a Slack App and Bot to interact with our Pulumi App.

Expand Down Expand Up @@ -141,4 +141,4 @@ And you're set! From now on when someone from your team mentions you, you'll ge

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
4 changes: 2 additions & 2 deletions aws-py-static-website/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ This is caused by CloudFront confirming the ETag of the resource before applying
ETag is essentially a "version", and AWS is rejecting any requests that are trying to update
any version but the "latest".

This error will occur when the state of the ETag gets out of sync between the Pulumi Service
and AWS. (Which can happen when inspecting the CloudFront distribution in the AWS console.)
This error will occur when the state of the ETag gets out of sync between Pulumi Cloud
and AWS. (This can happen when inspecting the CloudFront distribution in the AWS console.)

You can fix this by running `pulumi refresh` to pickup the newer ETag values.

Expand Down
2 changes: 1 addition & 1 deletion aws-ts-apigateway-auth0/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ $ curl $(pulumi stack output url)hello -H "Authorization: Bearer <VALID_TOKEN>"

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-ts-apigateway-lambda-serverless/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ This sample uses the following AWS products:

1. Run `pulumi destroy` to tear down all resources.

2. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
2. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.

## Summary

Expand Down
2 changes: 1 addition & 1 deletion aws-ts-apigateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ with `***`.

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-ts-apigatewayv2-http-api-quickcreate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ with `***`.

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-ts-apigatewayv2-http-api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,4 @@ with `***`.

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-ts-appsync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,4 @@ This example shows how to set up a basic GraphQL endpoint in AWS AppSync. The en

1. Run `pulumi destroy` to tear down all resources.

1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi Console.
1. To delete the stack itself, run `pulumi stack rm`. Note that this command deletes all deployment history from the Pulumi console.
2 changes: 1 addition & 1 deletion aws-ts-ec2-provisioners/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $ cat rsa.pub | pulumi config set publicKey --
$ cat rsa | pulumi config set privateKey --secret --
```

Notice that we've used `--secret` for `privateKey`. This ensures their are stored in encrypted form in the Pulumi secrets system.
Notice that we've used `--secret` for `privateKey`. This ensures the private key is stored as an encrypted [Pulumi secret](https://www.pulumi.com/docs/intro/concepts/secrets/).

Also set your desired AWS region:

Expand Down
19 changes: 13 additions & 6 deletions aws-ts-netlify-cms-and-oauth/cms-oauth/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
# About the Project

This OAuth Server Project is connected with CMS project which deploy on AWS S3 rather than on Netlify. In this way, it requires us to create a OAuth Client Server for Netlify CMS. Netlify use the Netlify Identity Service which provides OAuth provider server. Based on [Netlify's instruction](https://www.netlifycms.org/docs/external-oauth-clients/) of customize this step we need to provide our own OAuth client.

In this example, we are using [Netlify CMS's Github backends](https://www.netlifycms.org/docs/github-backend/) for CMS, but the OAuth Provider code enabled more types of backends Bitbucket and Gitlab. If you are using these [backends](https://www.netlifycms.org/docs/backends-overview/), simply update the callback url you are register Github OAuth Applicationc (See step 1 in the Getting Started section) to be https://{{the domain of your OAuth App}}/bitbucket/callback or https://{{the domain of your OAuth App}}/gitlab/callback

## References

The provider's content code is referencing to the [External OAuth Client example from Netlify CMS](https://www.netlifycms.org/docs/external-oauth-clients/).
Here are some reference:
- @igk1972 [OAuth provider](https://github.com/igk1972/netlify-cms-oauth-provider-go) Thanks to Igor Kuznetsov for writing go code for OAuth Provider and it's frontend in file main.go. We updated the code in these ways:
Expand All @@ -15,28 +17,34 @@ Here are some reference:
- pulumi's [static website example](https://github.com/pulumi/examples/tree/master/aws-ts-static-website) for configuring certificate and obtain a subdomain for the provider server

## File Structure

- ./infrastructure
- Pulumi code with setting up AWS Fargate and the configuring certificate and domain
- ./main.go the code for the provider itself and it's front end
- It is fetching the access token sent from Github API using Github's goth library.
- .github/workflow contain code for the workflow

## Infrastructure
The OAuth Client Server was deployed on AWS using Pulumi. The Pulumi code use AWS Certificate Manager to create certificate and validate it. It is using AWS ECS Fargate to read docker image and establish a Fargate Service. Then it is also creating Alias Record on Route53 for the OAuth Server.

The OAuth Client Server was deployed on AWS using Pulumi. The Pulumi code uses AWS Certificate Manager to create certificate and validate it. It is using AWS ECS Fargate to read docker image and establish a Fargate Service. Then it is also creating Alias Record on Route53 for the OAuth Server.

### Assume Role (Optional)

It is recommended that you use an IAM role with more permissions in the _target_ AWS using a token for an IAM user in the _source_ account. To do this, you could refer to the [aws-ts-assume-role example](https://github.com/pulumi/examples/tree/master/aws-ts-assume-role) for more information. The example is available in multiple languages in our [examples repostiory](https://github.com/pulumi/examples).

# Getting Start (Replace content in {{}} with correct informations)
# Getting Started (Replace content in {{}} with correct informations)

These steps are now automated using the Github Workflow. If you push to the master or merge a pull request, the OAuth Client Server would be automatically deployed. Open a new branch and push to the branch would only do a pulumi preview where the logs could be check on Github Actions.

### Step 1. Register OAuth Application in Github and Obtain Key and Secret

- Now it is using the OAuth Application in Pulumi's Github organization account
- Steps are provided using this link https://docs.netlify.com/visitor-access/oauth-provider-tokens/#setup-and-settings
- For the Home Page Url should be link to cms's website
- For the Authorization callback URL enter https://{{the domain of your OAuth App}}/github/callback

### Step 2. Fill in the pulumi configuration
### Step 2. Fill in the Pulumi configuration

1. Make sure you are on the root directory of this repo.

2. Get into the infrastructure folder and initialize a new stack
Expand Down Expand Up @@ -74,11 +82,13 @@ $ pulumi config get netlify-cms-oauth-provider-infrastructure:githubSecret
```

### Step 3. Running Infrastructure

```bash
$ pulumi up
```

### Step 4. Config CMS

You also need to add `base_url` to the backend section of your netlify-cms's config file.

Go to the cms repo which stores resource for CMS and on file public/config.yml add the base_url line with the oauth provider url
Expand All @@ -96,6 +106,3 @@ Then build use
$ yarn build
```
and go to the infrastructure folder and do pulumi up to update changes



2 changes: 1 addition & 1 deletion aws-ts-netlify-cms-and-oauth/cms/infrastructure/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function createAliasRecord(
const aRecord = createAliasRecord(config.targetDomain, cdn);

// Export properties from this stack. This prints them at the end of `pulumi up` and
// makes them easier to access from the pulumi.com.
// makes them easier to access from pulumi.com.
export const contentBucketUri = pulumi.interpolate `s3:https://${contentBucket.bucket}`;
export const contentBucketWebsiteEndpoint = contentBucket.websiteEndpoint;
export const cloudFrontDomain = cdn.domainName;
Expand Down
Loading

0 comments on commit 47ac5ec

Please sign in to comment.