Skip to content

Commit

Permalink
hello pulumi
Browse files Browse the repository at this point in the history
  • Loading branch information
ItamarMalka committed May 23, 2022
1 parent 89dcf67 commit 23576ed
Show file tree
Hide file tree
Showing 12 changed files with 1,154 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pulumi/aws/hello-world/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/bin/
/node_modules/
2 changes: 2 additions & 0 deletions pulumi/aws/hello-world/Pulumi.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config:
aws:region: us-east-1
3 changes: 3 additions & 0 deletions pulumi/aws/hello-world/Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: hello-world
runtime: nodejs
description: A static website S3 bucket serving an HTML greeting the user with their own custom cat image
11 changes: 11 additions & 0 deletions pulumi/aws/hello-world/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Hello World on AWS
A static website S3 bucket serving an HTML greeting the user with their own custom cat image
![](sample.png)

## Configuration

### Environment Variables
- `USER` - sets the user name to greet on the html generated from `index.template.html`

### Terraform Variables
None
22 changes: 22 additions & 0 deletions pulumi/aws/hello-world/env0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 1

deploy:
steps:
setupVariables:
after:
- npm i
- ls /opt
- ls /
- ls .
- pwd

destroy:
steps:
setupVariables:
after:
- npm i
- ls
- ls /opt
- ls /
- ls .
- pwd
54 changes: 54 additions & 0 deletions pulumi/aws/hello-world/index.template.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<html>

<head>
<title>
Hello from env0!
</title>
<link href="https://fonts.googleapis.com/css?family=Roboto&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Roboto';
padding-top: 50px;
width: 40%;
margin: auto;
background-image: url("https://app.env0.com/static/media/background.06648d2b.svg");
background-size: cover;
}

div {
display: flex;
text-align: center;
}

.main {
flex-direction: column;
}

.power {
align-items: center;
justify-content: center;
margin-top: 20px;
}

img {
border-radius: 50px;
}
</style>
</head>

<body>
<div class="main">
<h1>Welcome to your own environment !!!USER!!!</h1>

<img alt="hello" src="https://cataas.com/cat/says/Hello%20!!!USER!!!" />
<div class="power">
<span>Powered by &nbsp;</span>
<a href="https://www.env0.com">
<img width="100px"
src="https://assets.website-files.com/5ceab5395d0f478e169de7c0/5ceab5395d0f47937d9de7c7_Env0-Color.svg" />
</a>
</div>
</div>
</body>

</html>
17 changes: 17 additions & 0 deletions pulumi/aws/hello-world/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as apigateway from "@pulumi/aws-apigateway";
import * as fs from 'fs';

const indexTemplate = fs.readFileSync('index.template.html', 'utf-8');
const index = indexTemplate.replace(new RegExp('!!!USER!!!', 'g'), process.env.USER!);
fs.writeFileSync('www/index.html', index);

const api = new apigateway.RestAPI("api", {
routes: [
{
path: "/",
localPath: "www"
},
],
});

export const url = api.url;
Loading

0 comments on commit 23576ed

Please sign in to comment.