Skip to content

Commit ada0b63

Browse files
committed
add deprecation output
1 parent 0d0161b commit ada0b63

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed

examples/default/outputs.tf

+5
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@ output "webhook_secret" {
1313
value = random_id.random.hex
1414
}
1515

16+
output "deprecated_variables_warning" {
17+
value = join("", [
18+
module.runners.deprecated_variables_warning,
19+
])
20+
}

examples/multi-runner/outputs.tf

+6
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,9 @@ output "webhook_secret" {
66
sensitive = true
77
value = random_id.random.hex
88
}
9+
10+
output "deprecated_variables_warning" {
11+
value = join("", [
12+
module.runners.deprecated_variables_warning,
13+
])
14+
}

examples/test/main.tf

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# data "aws_ami" "runner" {
2+
# most_recent = "true"
3+
4+
# dynamic "filter" {
5+
# for_each = local.ami_filter
6+
# content {
7+
# name = filter.key
8+
# values = filter.value
9+
# }
10+
# }
11+
12+
# owners = var.ami_owners
13+
# }
14+
15+
# lookup ami default owner Amazon, default ami Amazon linux
16+
17+
variable "ami_owners" {
18+
type = list(string)
19+
default = ["amazon"]
20+
}
21+
22+
variable "ami_filter" {
23+
type = map(list(string))
24+
default = { name = ["al2023-ami-2023.*-kernel-6.*-x86_64"] }
25+
}
26+
27+
data "aws_ami" "runner" {
28+
most_recent = "true"
29+
30+
dynamic "filter" {
31+
for_each = var.ami_filter
32+
content {
33+
name = filter.key
34+
values = filter.value
35+
}
36+
}
37+
38+
owners = var.ami_owners
39+
}
40+
41+
output "ami_id" {
42+
value = data.aws_ami.runner
43+
}

modules/multi-runner/outputs.tf

+11
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,14 @@ output "instance_termination_handler" {
6767
lambda_role = module.instance_termination_watcher[0].spot_termination_handler.lambda_role
6868
} : null
6969
}
70+
71+
output "deprecated_variables_warning" {
72+
description = "Warning for deprecated variables usage"
73+
value = join("", [
74+
for key, runner_config in var.multi_runner_config : (
75+
try(runner_config.ami_id_ssm_parameter_name, null) != null ?
76+
"DEPRECATION WARNING: The variable 'ami_id_ssm_parameter_name' in runner '${key}' is deprecated and will be removed in a future version. Please use 'ami_id_ssm_parameter_arn' instead.\n" :
77+
""
78+
)
79+
])
80+
}

outputs.tf

+7
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,10 @@ output "instance_termination_handler" {
7575
lambda_role = module.instance_termination_watcher[0].spot_termination_handler.lambda_role
7676
} : null
7777
}
78+
79+
output "deprecated_variables_warning" {
80+
description = "Warning for deprecated variables usage"
81+
value = join("", [
82+
var.ami_id_ssm_parameter_name != null ? "DEPRECATION WARNING: The variable 'ami_id_ssm_parameter_name' is deprecated and will be removed in a future version. Please use 'ami_id_ssm_parameter_arn' instead.\n" : "",
83+
])
84+
}

0 commit comments

Comments
 (0)