Skip to content

Commit

Permalink
Add imports for Cloudflare resources
Browse files Browse the repository at this point in the history
  • Loading branch information
klejejs committed Nov 14, 2024
1 parent 291c9f4 commit accf116
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 12 deletions.
37 changes: 25 additions & 12 deletions stun_server/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ data "cloudflare_zone" "dns_zone" {
name = var.domain_name
}

import {
to = module.cloudflare_load_balancer.cloudflare_load_balancer.load_balancer
id = "${data.cloudflare_zone.dns_zone.id}/3e9afe7fac269375a9e371c7c41cf3da"
}

import {
to = module.cloudflare_load_balancer.cloudflare_load_balancer_monitor.monitor
id = "${var.CLOUDFLARE_ACCOUNT_ID}/9f1f73919056954a660d29a5511dd57b"
}

module "cloudflare_load_balancer" {
source = "../.modules/cloudflare/load_balancer"

Expand All @@ -33,26 +43,29 @@ module "cloudflare_load_balancer" {
module "us_east_1" {
source = "./region"

region = "us-east-1"
cloudflare_account_id = var.CLOUDFLARE_ACCOUNT_ID
cloudflare_load_balancer_monitor_id = module.cloudflare_load_balancer.load_balancer_monitor_id
image_tag = var.image_tag
region = "us-east-1"
cloudflare_account_id = var.CLOUDFLARE_ACCOUNT_ID
cloudflare_load_balancer_monitor_id = module.cloudflare_load_balancer.load_balancer_monitor_id
cloudflare_load_balancer_pool_import_id = "${var.CLOUDFLARE_ACCOUNT_ID}/abd4bc10bc961fb472442b3784545be3"
image_tag = var.image_tag
}

module "eu_central_1" {
source = "./region"

region = "eu-central-1"
cloudflare_account_id = var.CLOUDFLARE_ACCOUNT_ID
cloudflare_load_balancer_monitor_id = module.cloudflare_load_balancer.load_balancer_monitor_id
image_tag = var.image_tag
region = "eu-central-1"
cloudflare_account_id = var.CLOUDFLARE_ACCOUNT_ID
cloudflare_load_balancer_monitor_id = module.cloudflare_load_balancer.load_balancer_monitor_id
cloudflare_load_balancer_pool_import_id = "${var.CLOUDFLARE_ACCOUNT_ID}/b99c549ecfe01f068bdfdda8d08677be"
image_tag = var.image_tag
}

module "ap_southeast_1" {
source = "./region"

region = "ap-southeast-1"
cloudflare_account_id = var.CLOUDFLARE_ACCOUNT_ID
cloudflare_load_balancer_monitor_id = module.cloudflare_load_balancer.load_balancer_monitor_id
image_tag = var.image_tag
region = "ap-southeast-1"
cloudflare_account_id = var.CLOUDFLARE_ACCOUNT_ID
cloudflare_load_balancer_monitor_id = module.cloudflare_load_balancer.load_balancer_monitor_id
cloudflare_load_balancer_pool_import_id = "${var.CLOUDFLARE_ACCOUNT_ID}/b62889bd0bc43b9a4167ae7da754a1ea"
image_tag = var.image_tag
}
5 changes: 5 additions & 0 deletions stun_server/region/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ data "tfe_outputs" "infrastructure" {

data "aws_region" "current" {}

import {
to = module.cloudflare_load_balancer_pool.cloudflare_load_balancer_pool.pool
id = var.cloudflare_load_balancer_pool_import_id
}

module "cloudflare_load_balancer_pool" {
source = "../../.modules/cloudflare/load_balancer_pool"

Expand Down
5 changes: 5 additions & 0 deletions stun_server/region/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ variable "cloudflare_load_balancer_monitor_id" {
type = string
}

variable "cloudflare_load_balancer_pool_import_id" {
description = "Cloudflare Load Balancer Pool Import Id"
type = string
}

variable "image_tag" {
description = "Version of the Stun server to deploy"
type = string
Expand Down

0 comments on commit accf116

Please sign in to comment.