'How to apply tags to Elastic Beanstalk Application Load Balancer?
I need to apply tags to Elastic Beanstalk Internet facing Application Load Balancers. I do not want to apply the tags to the Elastic Beanstalk Environment.
My terraform script can apply settings to the Application Load Balancer using this pattern, this WORKS:
dynamic "setting" {
for_each = var.is_application_load_balancer ? ["include"] : []
content {
name = "AccessLogsS3Enabled"
namespace = "aws:elbv2:loadbalancer"
value = var.access_log_enabled
resource = ""
}
}
dynamic "setting" {
for_each = var.is_application_load_balancer ? ["include"] : []
content {
name = "Protocol"
namespace = "aws:elbv2:listener:443"
value = "HTTPS"
resource = ""
}
}
However, I cannot apply tags using the same pattern. This does NOT work:
dynamic "setting" {
for_each = var.is_application_load_balancer ? ["include"] : []
content {
name = "Tags"
namespace = "aws:elbv2:loadbalancer"
value = module.meta.waf_tags
resource = ""
}
}
The error:
╷
│ Error: Incorrect attribute value type
│
│ on ../../../modules/elastic-beanstalk-env/eb-app.tf line 272, in resource "aws_elastic_beanstalk_environment" "beanstalk_environment":
│ 272: value = module.meta.waf_tags
│ ├────────────────
│ │ module.meta.waf_tags is object with 8 attributes
│
│ Inappropriate value for attribute "value": string required.
module.meta.waf_tags:
output "waf_tags" {
value = {
Owner = "Owner"
Product = "Product"
Service = "Service"
Team = "Team"
Terraform = replace(abspath(path.root),"/.*/*terraform/","terraform")
WAF_Enabled = "True"
WAF_Mode = "Block"
WAF_Policy = "Log4j"
}
}
Do you have any suggestions on how to apply the tags using terraform?
Thank you
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
