Skip to content
Snippets Groups Projects
Commit 1e1b82b9 authored by Lorenzo Ceccon's avatar Lorenzo Ceccon
Browse files

Added tf conf holi-social env

parent e0914a09
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ locals {
# geo api environments zone
resource "google_dns_managed_zone" "geo_api_environments_zone" {
project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
name = "geo-api-environments-zone"
name = "geo-api-holi-social-environments-zone"
dns_name = local.geo_api_environments_zone_dns_name
}
......
## these dns changes are done in the infra shared project (https://gitlab.com/holisticfoundation/holi-infra)
## because the zone apis.project-holi.org is managed in that project.
locals {
# effectively, this is geo.apis.project-holi.org
project_holi_geo_api_environments_zone_dns_name = "geo.${data.terraform_remote_state.holi_infra_state.outputs.dns_project_holi_apis_zone_domain}."
}
# geo api environments zone
resource "google_dns_managed_zone" "project_holi_geo_api_environments_zone" {
project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
name = "geo-api-environments-zone"
dns_name = local.project_holi_geo_api_environments_zone_dns_name
}
resource "google_dns_record_set" "project_holi_geo_api_environments_zone_entry" {
project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
name = local.project_holi_geo_api_environments_zone_dns_name
type = "NS"
ttl = 300
managed_zone = data.terraform_remote_state.holi_infra_state.outputs.dns_project_holi_apis_zone_name
rrdatas = google_dns_managed_zone.project_holi_geo_api_environments_zone.name_servers
}
output "dns_project_holi_geo_api_domain" {
value = trim(google_dns_managed_zone.project_holi_geo_api_environments_zone.dns_name, ".")
}
output "dns_project_holi_geo_api_domain_name" {
value = google_dns_managed_zone.project_holi_geo_api_environments_zone.name
}
......@@ -101,6 +101,21 @@ resource "google_cloud_run_service" "geo_api" {
}
resource "google_cloud_run_domain_mapping" "geo_api" {
project = google_cloud_run_service.geo_api.project
# location needs to be the same as the service's
location = google_cloud_run_service.geo_api.location
name = local.project_holi_dns_name
metadata {
namespace = google_cloud_run_service.geo_api.project
}
spec {
route_name = google_cloud_run_service.geo_api.name
}
}
resource "google_cloud_run_domain_mapping" "holi_social_geo_api" {
project = google_cloud_run_service.geo_api.project
# location needs to be the same as the service's
location = google_cloud_run_service.geo_api.location
......
## these dns changes are done in the infra shared project (https://gitlab.com/holisticfoundation/holi-infra)
## because the zone web.project-holi.org is managed in that project.
resource "google_dns_record_set" "geo_api_domain_record_set" {
resource "google_dns_record_set" "holi_social_geo_api_domain_record_set" {
project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
managed_zone = data.terraform_remote_state.holi_geo_api_common_state.outputs.dns_geo_api_domain_name
name = "${google_cloud_run_domain_mapping.holi_social_geo_api.name}."
type = google_cloud_run_domain_mapping.holi_social_geo_api.status[0].resource_records[0].type
ttl = 300
rrdatas = [google_cloud_run_domain_mapping.holi_social_geo_api.status[0].resource_records[0].rrdata]
}
resource "google_dns_record_set" "geo_api_domain_record_set" {
project = data.terraform_remote_state.holi_infra_state.outputs.shared_project_id
managed_zone = data.terraform_remote_state.holi_geo_api_common_state.outputs.dns_project_holi_geo_api_domain_name
name = "${google_cloud_run_domain_mapping.geo_api.name}."
type = google_cloud_run_domain_mapping.geo_api.status[0].resource_records[0].type
ttl = 300
......
......@@ -5,4 +5,5 @@ locals {
# the dns name can be at most 64 chars in total
dns_name = "${trimsuffix(substr(local.environment, 0, 34), ".-")}.${data.terraform_remote_state.holi_geo_api_common_state.outputs.dns_geo_api_domain}"
project_holi_dns_name = "${trimsuffix(substr(local.environment, 0, 34), ".-")}.${data.terraform_remote_state.holi_geo_api_common_state.outputs.dns_project_holi_geo_api_domain}"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment