Skip to content

Commit

Permalink
Fix terraform error on temporal machine lookup (#3569)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoacierno authored Sep 17, 2023
1 parent 7a2c36a commit 4cd846a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
14 changes: 8 additions & 6 deletions infrastructure/applications/applications.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
locals {
is_prod = terraform.workspace == "production"
deploy_pretix = local.is_prod
enable_proxy = local.is_prod ? false : false
is_prod = terraform.workspace == "production"
deploy_pretix = local.is_prod
deploy_temporal = false
enable_proxy = local.is_prod ? false : false
}

# Applications
Expand All @@ -14,13 +15,14 @@ module "pretix" {

module "temporal" {
source = "./temporal"
count = 0
count = local.deploy_temporal ? 1 : 0
enable_proxy = local.enable_proxy
}

module "pycon_backend" {
source = "./pycon_backend"
enable_proxy = local.enable_proxy
source = "./pycon_backend"
enable_proxy = local.enable_proxy
deploy_temporal = local.deploy_temporal

providers = {
aws = aws
Expand Down
4 changes: 3 additions & 1 deletion infrastructure/applications/pycon_backend/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ data "aws_elasticache_cluster" "redis" {
}

data "aws_instance" "temporal_machine" {
count = var.deploy_temporal ? 1 : 0

filter {
name = "tag:Name"
values = ["production-temporal-instance"]
Expand Down Expand Up @@ -104,7 +106,7 @@ module "lambda" {
PLAIN_API = "https://core-api.uk.plain.com/graphql/v1"
PLAIN_API_TOKEN = module.secrets.value.plain_api_token
CACHE_URL = local.is_prod ? "redis://${data.aws_elasticache_cluster.redis.cache_nodes.0.address}/8" : "locmemcache://snowflake"
TEMPORAL_ADDRESS = "${data.aws_instance.temporal_machine.private_ip}:7233"
TEMPORAL_ADDRESS = var.deploy_temporal ? "${data.aws_instance.temporal_machine[0].private_ip}:7233" : ""
}
}

Expand Down
1 change: 1 addition & 0 deletions infrastructure/applications/pycon_backend/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ locals {
}

variable "enable_proxy" {}
variable "deploy_temporal" {}

1 comment on commit 4cd846a

@vercel
Copy link

@vercel vercel bot commented on 4cd846a Sep 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

pycon – ./frontend/

pycon-python-italia.vercel.app
pycon-git-main-python-italia.vercel.app
pycon.it
2023.pycon.it
www.pycon.it

Please sign in to comment.