2024-05-29 19:11:07 +02:00
resource " cloudflare_pages_domain " " immich_app_branch_domain " {
account_id = var . cloudflare_account_id
2024-05-30 11:01:17 +02:00
project_name = local . is_release ? data . terraform_remote_state . cloudflare_account . outputs . immich_app_archive_pages_project_name : data . terraform_remote_state . cloudflare_account . outputs . immich_app_preview_pages_project_name
2024-05-29 19:11:07 +02:00
domain = " ${ var . prefix_name } . ${ local . deploy_domain_prefix } .immich.app "
}
resource " cloudflare_record " " immich_app_branch_subdomain " {
name = " ${ var . prefix_name } . ${ local . deploy_domain_prefix } .immich.app "
proxied = true
ttl = 1
type = " CNAME "
2024-05-30 12:08:27 +02:00
value = " ${ replace ( var . prefix_name , " / \\ /| \\ ./ " , " - " ) } . ${ local . is_release ? data . terraform_remote_state . cloudflare_account . outputs . immich_app_archive_pages_project_subdomain : data . terraform_remote_state . cloudflare_account . outputs . immich_app_preview_pages_project_subdomain } "
2024-05-29 19:11:07 +02:00
zone_id = data . terraform_remote_state . cloudflare_account . outputs . immich_app_zone_id
}
output " immich_app_branch_subdomain " {
value = cloudflare_record . immich_app_branch_subdomain . hostname
}
2024-05-30 11:01:17 +02:00
2024-05-30 15:18:27 +02:00
output " immich_app_branch_pages_hostname " {
value = cloudflare_record . immich_app_branch_subdomain . value
}
2024-05-30 11:01:17 +02:00
output " pages_project_name " {
value = cloudflare_pages_domain . immich_app_branch_domain . project_name
}