Skip to content

Commit

Permalink
expand default params
Browse files Browse the repository at this point in the history
  • Loading branch information
morga471 committed Feb 12, 2026
1 parent 9fdacec commit bc47380
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 2 deletions.
20 changes: 18 additions & 2 deletions common/defaults.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
locals {
vpc_id = data.aws_vpc.vpc.id
subnet_ids = data.aws_subnets.subnets.ids
# Portfolio ID is required - must be provided via var.portfolio_id
portfolio_id = var.portfolio_id

Expand All @@ -16,9 +18,22 @@ locals {
# Use provided path_id or default to latest
provisioning_artifact_id = var.path_id != null ? var.path_id : local.latest_artifact_id

# Merge default parameters with user-provided parameters
default_parameters = {}
# Build default parameters from module variables
default_parameters = {
ProjectName = var.project_name
VpcId = local.vpc_id
AZName = data.aws_subnet.subnets[sort(data.aws_subnets.subnets.ids)[0]].availability_zone
InstanceType = var.instance_type
OSName = var.os_name
Creator = var.creator
ContactEmail = var.contact_email
IncPocEmail = var.inc_poc_email
RequiresBackup = var.requires_backup
PowerSchedule = var.power_schedule
FISMAID = var.fisma_id
}

# Merge defaults with user-provided parameters (user params override defaults)
parameters = merge(
local.default_parameters,
var.parameters
Expand All @@ -30,5 +45,6 @@ locals {
key = key
value = tostring(value)
}
if value != "" # Only include non-empty values
]
}
15 changes: 15 additions & 0 deletions common/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,18 @@ output "provisioning_artifact_id" {
description = "The ID of the provisioning artifact used"
value = local.provisioning_artifact_id
}

output "vpc_id" {
description = "The VPC ID where the instance will be provisioned"
value = data.aws_vpc.vpc.id
}

output "subnet_ids" {
description = "The subnet IDs where the instance can be provisioned"
value = data.aws_subnets.subnets.ids
}

output "availability_zone" {
description = "The availability zone of the first selected subnet"
value = data.aws_subnet.subnets[sort(data.aws_subnets.subnets.ids)[0]].availability_zone
}
54 changes: 54 additions & 0 deletions common/variables.parameters.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,57 @@ variable "parameters" {
type = map(string)
default = {}
}

variable "project_name" {
description = "Project name (ProjectName parameter)"
type = string
default = ""
}

variable "creator" {
description = "Creator's JBID (Creator parameter)"
type = string
default = ""
}

variable "contact_email" {
description = "Provisioning user's email (ContactEmail parameter)"
type = string
default = ""
}

variable "inc_poc_email" {
description = "Incident POC email (IncPocEmail parameter)"
type = string
default = ""
}

variable "instance_type" {
description = "EC2 instance type"
type = string
default = "t3.small"
}

variable "os_name" {
description = "Operating system version"
type = string
default = "RHEL9"
}

variable "requires_backup" {
description = "Backup requirement"
type = string
default = "no"
}

variable "power_schedule" {
description = "Power schedule"
type = string
default = ""
}

variable "fisma_id" {
description = "FISMA ID"
type = string
default = ""
}

0 comments on commit bc47380

Please sign in to comment.