Skip to content

Commit

Permalink
#542 Add Unity tf
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed May 22, 2024
1 parent 844954d commit a839a0a
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 0 deletions.
94 changes: 94 additions & 0 deletions sds/unity/terraform/terraform.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
data "aws_ssm_parameter" "vpc_id" {
name = "/unity/account/network/vpc_id"
}

data "aws_ssm_parameter" "subnet_list" {
name = "/unity/account/network/subnet_list"
}

#data "aws_ssm_parameter" "u-cs-ecs" {
# name = "/unity/account/ecs/execution_role_arn"
#}

locals {
subnet_map = jsondecode(data.aws_ssm_parameter.subnet_list.value)
subnet_ids = nonsensitive(local.subnet_map["private"])
public_subnet_ids = nonsensitive(local.subnet_map["public"])
}


module "base" {
source = "git::ssh://[email protected]/terraform/base?ref=6.0.0"
project = var.project
venue = var.venue
subsystem = var.subsystem
capability = var.capability
custom_url = var.custom_url
groups = var.groups
api = var.api
component = var.component
desired_count = var.desired_count
app_protocol = var.app_protocol
app_listening_port = var.app_listening_port
environment = local.environment_vars
ecr_uri = var.ecr_uri
docker_image_name = var.docker_image_name
docker_image_tag = var.docker_image_tag
max_capacity = var.max_capacity
app_one_ecs = var.app_one_ecs
instance_type = var.instance_type
ebs_block_device_size = var.ebs_block_device_size
root_block_device_size = var.root_block_device_size
ebs_mount_directory = var.ebs_mount_directory
csso_proxy_only = var.csso_proxy_only
application_endpoint_url = var.application_endpoint_url
terraform_app_commit = var.terraform_app_commit
deployment_method = var.deployment_method
secrets = local.secrets
stickiness_enabled = var.stickiness_enabled
docker_volume_path = var.docker_volume_path
efs_config = {
efs_id = var.efs_id
efs_root_directory = var.efs_root_directory
}
}

# Application environment variables
locals {
environment_vars = {
AWS_DEFAULT_REGION = module.base.aws_region
CS3_GET_PARAMETERS = module.base.ps_path
DOMAIN = module.base.cname
SERVER = var.server
AUTH = var.auth
NODE_ENV = var.node_env
CSSO_LEAD_GROUP = var.csso_lead_group
SESSION_USER = var.session_user
INGEST_RATE = var.ingest_rate
SECRET = module.base.auto_generated_password
DB_HOST = var.db_host
DB_PORT = var.db_port
DB_NAME = var.db_name
DB_USER = var.db_user
CSSO_GROUPS = "[${join(", ", formatlist("\"%s\"", var.groups))}]"
SESSION_HOST = module.base.csso_login_url
TACTICAL_HOST = var.tactical_host
PLACES_HOST = var.places_host
SCIENCE_INTENT_HOST = var.science_intent_host
MTTTT_HOST = var.mtttt_host
ENABLE_MMGIS_WEBSOCKETS = var.enable_mmgis_websockets
PORT = var.app_listening_port
VERBOSE_LOGGING = var.verbose_logging
HIDE_CONFIG = var.hide_config
CONFIGCONFIG_PATH = var.configconfig_path
FORCE_CONFIG_PATH = var.force_config_path
LEADS = "[${join(", ", formatlist("\"%s\"", var.leads))}]"
}
}

locals {
secrets = {
DB_PASS = var.db_password
SESSION_PASS = var.session_pass
}
}
32 changes: 32 additions & 0 deletions sds/unity/terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
variable "tags" {
description = "AWS Tags"
type = map(string)
}

variable "deployment_name" {
description = "The deployment name"
type = string
}

variable "mgmt_dns" {
description = "The DNS or IP of the ALB or EC2 instance"
type = string
}

variable "project"{
description = "The unity project its installed into"
type = string
default = "UnknownProject"
}

variable "venue" {
description = "The unity venue its installed into"
type = string
default = "UnknownVenue"
}

variable "installprefix" {
description = "The management console install prefix"
type = string
default = "UnknownPrefix"
}

0 comments on commit a839a0a

Please sign in to comment.