Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions infrastructure/Azure/.terraform.lock.hcl

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

18 changes: 14 additions & 4 deletions infrastructure/Azure/locals.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# --- Local Values for Naming Convention ---
locals {
workgroup_name_lower = lower(var.workgroup_name)
workgroup_name_alnum = replace(local.workgroup_name_lower, "-", "")

# Resource Group: {workgroup name}-rhino-{environment}-rg-{seq#}
resource_group_name = "${var.workgroup_name}-rhino-${var.environment}-rg-${var.sequence_number}"

Expand All @@ -12,10 +15,17 @@ locals {
# Virtual Machine: {workgroup name}-rhino-{environment}-{seq#}
vm_name = "${var.workgroup_name}-rhino-${var.environment}-${var.sequence_number}"

# Storage Accounts: {workgroup name}rhino{type}{seq#} (lowercase, no hyphens for Azure storage account naming)
storage_account_output_logs_name = "${replace(var.workgroup_name, "-", "")}rhinooutput${var.sequence_number}"
storage_account_source_data_name = "${replace(var.workgroup_name, "-", "")}rhinoinput${var.sequence_number}"
storage_account_logs_name = "${replace(var.workgroup_name, "-", "")}rhinolog${var.sequence_number}"
# Azure storage account names are limited to 24 lowercase alphanumeric characters.
storage_account_prefix_max_length = 24 - length(var.sequence_number) - 3
storage_account_prefix = substr(local.workgroup_name_alnum, 0, local.storage_account_prefix_max_length)
storage_account_output_logs_name = "${local.storage_account_prefix}out${var.sequence_number}"
storage_account_source_data_name = "${local.storage_account_prefix}in${var.sequence_number}"
storage_account_logs_name = "${local.storage_account_prefix}log${var.sequence_number}"

# Azure Key Vault names are limited to 24 characters and allow dashes.
key_vault_prefix_max_length = 24 - length(var.environment) - 7
key_vault_prefix = trimsuffix(substr(local.workgroup_name_lower, 0, local.key_vault_prefix_max_length), "-")
key_vault_name = "${local.key_vault_prefix}-rh-${var.environment}-kv"

# Standard tags for cost aggregation
common_tags = {
Expand Down
6 changes: 4 additions & 2 deletions infrastructure/Azure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ resource "tls_private_key" "rhino" {

# Create Key Vault
resource "azurerm_key_vault" "main" {
name = "${var.workgroup_name}-rhino-${var.environment}-kv"
name = local.key_vault_name
location = azurerm_resource_group.main.location
resource_group_name = azurerm_resource_group.main.name
tenant_id = var.tenant_id
Expand Down Expand Up @@ -384,8 +384,10 @@ resource "azurerm_linux_virtual_machine" "main" {
}

custom_data = base64encode(format(
"#!/bin/bash\ncurl -fsS --proto '=https' https://activate.rhinohealth.com | sudo RHINO_AGENT_ID='%s' PACKAGE_REGISTRY_USER='%s' PACKAGE_REGISTRY_PASSWORD='%s' SKIP_HW_CHECK=True bash -",
"#!/bin/bash\ncurl -fsS --proto '=https' https://activate.rhinohealth.com | sudo RHINO_AGENT_ID='%s' ROLE_ID='%s' SECRET_ID='%s' PACKAGE_REGISTRY_USER='%s' PACKAGE_REGISTRY_PASSWORD='%s' SKIP_HW_CHECK=True bash -",
var.rhino_agent_id,
var.rhino_role_id,
var.rhino_secret_id,
var.rhino_package_registry_user,
var.rhino_package_registry_password
))
Expand Down
12 changes: 12 additions & 0 deletions infrastructure/Azure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ variable "rhino_agent_id" {
sensitive = true
}

variable "rhino_role_id" {
description = "The role ID for the Rhino Health installation."
type = string
sensitive = true
}

variable "rhino_secret_id" {
description = "The secret ID for the Rhino Health installation."
type = string
sensitive = true
}

variable "rhino_package_registry_user" {
description = "The user for the Rhino Health package registry."
type = string
Expand Down