Skip to content

Commit 8dbf720

Browse files
authored
Merge pull request #330 from env0/fix/hello-world-etag-plan-time-file
[APO-88] Fix: hello-world change tracking without plan-time generated file
2 parents c4e2e00 + 00bef45 commit 8dbf720

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

aws/hello-world/env0.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ deploy:
44
steps:
55
terraformInit:
66
before:
7-
- echo Replacing !!!USER!!! with $USER in index.html
8-
- sed 's/!!!USER!!!/'"$USER"'/g' index.template.html > index.html
7+
- echo "Running env0 custom deploy flow for the hello-world template"

aws/hello-world/main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@ provider "aws" {
66
terraform {
77
required_version = ">= 0.13"
88
}
9+
10+
variable "user" {
11+
type = string
12+
default = "env0"
13+
}
14+
15+
locals {
16+
index_html = replace(file("${path.module}/index.template.html"), "!!!USER!!!", var.user)
17+
}

aws/hello-world/s3.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ resource "aws_s3_bucket_policy" "website_bucket_policy" {
7777
resource "aws_s3_object" "object" {
7878
bucket = aws_s3_bucket.website_bucket.bucket
7979
key = "index.html"
80-
source = "index.html"
80+
content = local.index_html
8181
content_type = "text/html"
82-
etag = filemd5("index.html")
82+
etag = md5(local.index_html)
8383
}

0 commit comments

Comments
 (0)