Skip to content

Commit

Permalink
Merge pull request #6 from ItamarMalka/ItamarMalka-add-hello-world
Browse files Browse the repository at this point in the history
Create main.tf
  • Loading branch information
ItamarMalka authored May 8, 2022
2 parents ab0dd36 + 6fd3f43 commit e2de3ec
Show file tree
Hide file tree
Showing 4 changed files with 115 additions and 0 deletions.
54 changes: 54 additions & 0 deletions 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>
10 changes: 10 additions & 0 deletions hello-world/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@


provider "aws" {
version = "~> 2.0"
region = "us-east-1"
}

terraform {
required_version = ">= 0.12"
}
3 changes: 3 additions & 0 deletions hello-world/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "url" {
value = aws_s3_bucket.website_bucket.website_endpoint
}
48 changes: 48 additions & 0 deletions hello-world/s3.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
provider "random" {}

resource "random_string" "random" {
length = 16
special = false
min_lower = 16
}

resource "aws_s3_bucket" "website_bucket" {
bucket = "hello-env0-${random_string.random.result}"
acl = "public-read"

force_destroy = true

website {
index_document = "index.html"
error_document = "index.html"
}
}

resource "aws_s3_bucket_policy" "website_bucket_policy" {
bucket = aws_s3_bucket.website_bucket.id

policy = <<POLICY
{
"Version": "2012-10-17",
"Id": "Public-Access",
"Statement": [
{
"Sid": "Allow-Public-Access-To-Bucket",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": [
"arn:aws:s3:::${aws_s3_bucket.website_bucket.bucket}/*"
]
}
]
}
POLICY
}

resource "aws_s3_bucket_object" "object" {
bucket = aws_s3_bucket.website_bucket.bucket
key = "index.html"
source = "index.html"
content_type = "text/html"
}

0 comments on commit e2de3ec

Please sign in to comment.