Skip to content

Commit c7a00b3

Browse files
committed
Add optional values to variables.tf
1 parent 4d2c587 commit c7a00b3

File tree

2 files changed

+18
-51
lines changed

2 files changed

+18
-51
lines changed

stackguardian_private_runner/aws/variables.tf

Lines changed: 10 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ variable "ami_id" {
1414
Recommended: Use StackGuardian Template with Packer to build custom AMI.
1515
EOT
1616
type = string
17-
default = ""
1817
}
1918

2019
/*-------------------+
@@ -23,6 +22,7 @@ variable "ami_id" {
2322
variable "aws_region" {
2423
description = "The target AWS Region to setup Private Runner"
2524
type = string
25+
default = "eu-central-1"
2626
}
2727

2828
/*---------------------------+
@@ -47,10 +47,6 @@ variable "stackguardian" {
4747
api_key = string
4848
org_name = string
4949
})
50-
default = {
51-
api_key = ""
52-
org_name = ""
53-
}
5450
}
5551

5652
# variable "sg_api_uri" {
@@ -62,13 +58,11 @@ variable "override_names" {
6258
description = "Configuration for overriding default resource names"
6359
type = object({
6460
global_prefix = string
65-
runner_group_name = string
66-
connector_name = string
61+
runner_group_name = optional(string, "")
62+
connector_name = optional(string, "")
6763
})
6864
default = {
69-
global_prefix = "SG_RUNNER"
70-
runner_group_name = ""
71-
connector_name = ""
65+
global_prefix = "SG_RUNNER"
7266
}
7367
}
7468

@@ -79,16 +73,10 @@ variable "network" {
7973
description = "Network configuration for the Private Runner instance"
8074
type = object({
8175
vpc_id = string
82-
private_subnet_id = string
76+
private_subnet_id = optional(string, "")
8377
public_subnet_id = string
8478
associate_public_ip = bool
8579
})
86-
default = {
87-
vpc_id = ""
88-
private_subnet_id = ""
89-
public_subnet_id = ""
90-
associate_public_ip = false
91-
}
9280
}
9381

9482
/*-----------------------+
@@ -101,11 +89,6 @@ variable "volume" {
10189
size = number
10290
delete_on_termination = bool
10391
})
104-
default = {
105-
type = "gp3"
106-
size = 100
107-
delete_on_termination = false
108-
}
10992
}
11093

11194
/*------------------------------+
@@ -114,22 +97,16 @@ variable "volume" {
11497
variable "firewall" {
11598
description = "Firewall and SSH configuration for the Private Runner instance"
11699
type = object({
117-
ssh_key_name = string
118-
ssh_public_key = string
119-
allow_ssh_cidr_blocks = list(string)
120-
additional_ingress_rules = list(object({
100+
ssh_key_name = optional(string, "")
101+
ssh_public_key = optional(string, "")
102+
allow_ssh_cidr_blocks = optional(list(string), [])
103+
additional_ingress_rules = optional(list(object({
121104
port = number
122105
protocol = string
123106
cidr_blocks = list(string)
124107
description = string
125-
}))
108+
})), [])
126109
})
127-
default = {
128-
ssh_key_name = ""
129-
ssh_public_key = ""
130-
allow_ssh_cidr_blocks = []
131-
additional_ingress_rules = []
132-
}
133110
}
134111

135112
/*-----------------------------------+

stackguardian_private_runner/packer/variables.tf

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
variable "aws_region" {
55
description = "The target AWS Region to build the Private Runner AMI"
66
type = string
7+
default = "eu-central-1"
78
}
89

910
variable "instance_type" {
@@ -30,10 +31,6 @@ variable "network" {
3031
vpc_id = string
3132
public_subnet_id = string
3233
})
33-
default = {
34-
vpc_id = ""
35-
public_subnet_id = ""
36-
}
3734
}
3835

3936
/*---------------------------+
@@ -43,17 +40,14 @@ variable "os" {
4340
description = "Operating system configuration for the AMI"
4441
type = object({
4542
family = string
46-
version = string
43+
version = optional(string, "")
4744
update_os_before_install = bool
48-
ssh_username = string
49-
user_script = string
45+
ssh_username = optional(string, "")
46+
user_script = optional(string, "")
5047
})
5148
default = {
5249
family = "amazon"
53-
version = ""
5450
update_os_before_install = true
55-
ssh_username = ""
56-
user_script = ""
5751
}
5852

5953
validation {
@@ -81,8 +75,8 @@ variable "packer_config" {
8175
variable "terraform" {
8276
description = "Terraform installation configuration"
8377
type = object({
84-
primary_version = string
85-
additional_versions = list(string)
78+
primary_version = optional(string, "")
79+
additional_versions = optional(list(string), [])
8680
})
8781
default = {
8882
primary_version = ""
@@ -96,11 +90,7 @@ variable "terraform" {
9690
variable "opentofu" {
9791
description = "OpenTofu installation configuration"
9892
type = object({
99-
primary_version = string
100-
additional_versions = list(string)
93+
primary_version = optional(string, "")
94+
additional_versions = optional(list(string), [])
10195
})
102-
default = {
103-
primary_version = ""
104-
additional_versions = []
105-
}
10696
}

0 commit comments

Comments
 (0)