Skip to content

Commit

Permalink
feat(agent,frontend): bump versions and use github releases (except f…
Browse files Browse the repository at this point in the history
…or s3 static content)
  • Loading branch information
aleksasiriski committed Oct 21, 2024
1 parent 5e3a55e commit 8d5a44f
Show file tree
Hide file tree
Showing 28 changed files with 150 additions and 726 deletions.
2 changes: 1 addition & 1 deletion live/prod/agent/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ EOF
inputs = {
aws_profile = local.aws_profile
hosted_zone_id = dependency.dns.outputs.hosted_zone_id
release_tag = "v0.28.6"
release_tag = "v0.30.0"

cloudfront_name = "hearchco-api-cloudfront-${local.environment}"
cloudfront_domain_name = local.domain_name_cloudfront
Expand Down
18 changes: 18 additions & 0 deletions live/prod/frontend/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions live/prod/frontend/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ EOF
inputs = {
aws_profile = local.aws_profile
hosted_zone_id = dependency.dns.outputs.hosted_zone_id
release_tag = "v0.16.0"
release_tag = "v0.18.0"

cloudfront_name = "hearchco-ssr-cloudfront-${local.environment}"
cloudfront_domain_name = local.domain_name_cloudfront
Expand All @@ -122,5 +122,5 @@ inputs = {
lambda_keep_warm = true

s3_bucket_name = "hearchco-ssr-s3-static-${local.environment}"
s3_static_assets_path = "./tmp/s3"
s3_static_assets_path = "./tmp/hearchco_s3_assets_aws"
}
9 changes: 9 additions & 0 deletions modules/unarchive-zip/locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
locals {
filename_zipped = endswith(var.filename, ".zip") ? var.filename : "${var.filename}.zip"
filename_unzipped = endswith(var.filename, ".zip") ? substr(var.filename, 0, length(var.filename) - 4) : var.filename
filepath = "${path.module}/.terraform/${local.filename_zipped}"
extract_path = "${path.module}/.terraform/${local.filename_unzipped}"
extract_cmd = "unzip -o ${local_file.write.filename} -d \"${local.extract_path}\""
}
19 changes: 19 additions & 0 deletions modules/unarchive-zip/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
resource "local_file" "write" {
content = var.content.content
content_base64 = var.content.content_base64
filename = local.filepath
}

resource "terraform_data" "unarchive" {
input = local.extract_path
triggers_replace = [
local.extract_cmd,
timestamp() # Force re-run on every apply
]

provisioner "local-exec" {
command = local.extract_cmd
}

depends_on = [local_file.write]
}
3 changes: 3 additions & 0 deletions modules/unarchive-zip/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "output_path" {
value = terraform_data.unarchive.output
}
22 changes: 22 additions & 0 deletions modules/unarchive-zip/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
variable "filename" {
description = "The name of the zip file"
type = string
}

variable "content" {
description = "The content of a zip file"
type = object({
content = optional(string)
content_base64 = optional(string)
})

validation {
condition = var.content.content != null || var.content.content_base64 != null
error_message = "Either content or content_base64 must be provided"
}

validation {
condition = var.content.content == null || var.content.content_base64 == null
error_message = "Only one of content or content_base64 must be provided"
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
terraform {
required_version = ">= 1.5.0"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
local = {
source = "hashicorp/local"
version = "~> 2.0"
}
}
}
4 changes: 2 additions & 2 deletions stacks/agent/lambda.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module "src_downloader" {
source = "../../modules/github-asset-downloader"

release_repository = "agent"
release_repository_owner = "hearchco"
release_repository = var.release_repository
release_repository_owner = var.release_repository_owner
release_tag = var.release_tag
release_asset_name = "hearchco_bootstrap_aws_${var.lambda_architecture == "arm64" ? "arm64" : "amd64"}.zip"
}
Expand Down
12 changes: 12 additions & 0 deletions stacks/agent/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ variable "release_tag" {
type = string
}

variable "release_repository" {
description = "The repository to download the release from"
type = string
default = "agent"
}

variable "release_repository_owner" {
description = "The owner of the repository to download the release from"
type = string
default = "hearchco"
}

###### Cloudfront variables #####
variable "cloudfront_name" {
description = "The name of the CloudFront distribution"
Expand Down
82 changes: 0 additions & 82 deletions stacks/frontend-edge/cloudfront.tf

This file was deleted.

69 changes: 0 additions & 69 deletions stacks/frontend-edge/lambda.tf

This file was deleted.

15 changes: 0 additions & 15 deletions stacks/frontend-edge/locals.tf

This file was deleted.

5 changes: 0 additions & 5 deletions stacks/frontend-edge/provider.edge.tf

This file was deleted.

20 changes: 0 additions & 20 deletions stacks/frontend-edge/s3.tf

This file was deleted.

Loading

0 comments on commit 8d5a44f

Please sign in to comment.