-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Deprecation Warning For Input/Output Variables #18381
Description
As open sources modules become more popular and teams in organizations create Terraform modules that depend on the remote state of another team's module, there is a need to communicate the evolution of a module.
This request is proposing the addition of an optional deprication_warning parameter to the output and input variable configuration. The depreciation notification would display when a module references the deprecated output via remote state.
Terraform Configuration Files Example
For this example we will first view the outputs.tf file from v1.0.0 of an example module.
output "route53_zone_id" {
value = "${aws_route53_zone.route53_zone.zone_id}"
}Below is the outputs.tf file from v1.1.0 of our example module. The output variable route53_zone_id has been updated to primary_zone_id.
output "route53_zone_id" {
value = "${aws_route53_zone.primary_zone.zone_id}"
deprication_warning = "The route53_zone_id output variable has been deprecated. Please use primary_zone_id"
}
output "primary_zone_id" {
value = "${aws_route53_zone.primary_zone.zone_id}"
}Expected Behavior
When the apply is run in the root module that references the output, a depreciation warning would be displayed
Warning: The route53_zone_id output variable has been deprecated. Please use primary_zone_idAnother option would be to use deprication_replacement instead of deprication_warning. This would allow Terraform to have more control over the message.
output "route53_zone_id" {
value = "${aws_route53_zone.primary_zone.zone_id}"
deprication_replacement = "primary_zone_id"
}Output of terraform apply
Warning: module.our_example: "route53_zone_id": [DEPRECATED] Use primary_zone_id instead