-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: aws_lb_listener import returns invalid configuration, with both default_action.target_group_arn and default_action.forward.target_group.arn #37211
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
Note: Import works successfully and does not show drift once the resource has been added to the state |
@robbycuenot I am not able to reproduce this error with v5.50.0. Let me know if my process below misses something key to reproducing this. Otherwise, if we can't figure a way to reproduce it, we'll need to close this issue. Step 1 - Create resourcesresource "aws_lb_listener" "test" {
load_balancer_arn = aws_lb.test.arn
protocol = "HTTP"
port = "80"
default_action {
order = 1
type = "forward"
forward {
target_group {
arn = aws_lb_target_group.test.arn
weight = 1
}
stickiness {
enabled = false
duration = 3600
}
}
}
}
resource "aws_lb" "test" {
name = "tf-acc-test-007"
internal = true
security_groups = [aws_security_group.test.id]
subnets = aws_subnet.test[*].id
idle_timeout = 30
enable_deletion_protection = false
tags = {
Name = "tf-acc-test-007"
}
}
resource "aws_lb_target_group" "test" {
name = "tf-acc-test-007"
port = 8080
protocol = "HTTP"
vpc_id = aws_vpc.test.id
health_check {
path = "/health"
interval = 60
port = 8081
protocol = "HTTP"
timeout = 3
healthy_threshold = 3
unhealthy_threshold = 3
matcher = "200-299"
}
tags = {
Name = "tf-acc-test-007"
}
}
resource "aws_security_group" "test" {
name = "tf-acc-test-007"
description = "Used for ALB Testing"
vpc_id = aws_vpc.test.id
ingress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
egress {
from_port = 0
to_port = 0
protocol = "-1"
cidr_blocks = ["0.0.0.0/0"]
}
tags = {
Name = "tf-acc-test-007"
}
}
resource "aws_vpc" "test" {
cidr_block = "10.0.0.0/16"
tags = {
Name = "tf-acc-test-007"
}
}
resource "aws_subnet" "test" {
count = 2
vpc_id = aws_vpc.test.id
availability_zone = data.aws_availability_zones.available.names[count.index]
cidr_block = cidrsubnet(aws_vpc.test.cidr_block, 8, count.index)
tags = {
Name = "tf-acc-test-007"
}
}
data "aws_availability_zones" "available" {
exclude_zone_ids = ["usw2-az4", "usgw1-az2"]
state = "available"
filter {
name = "opt-in-status"
values = ["opt-in-not-required"]
}
} % terraform apply
... Step 2 - Use CLI to set
|
Terraform Core Version
1.7.5
AWS Provider Version
5.46.0
Affected Resource(s)
aws_lb_listener
Expected Behavior
When importing a aws_lb_listener resource with aws_lb_listener.example.default_action[0].forward.target_group.arn specified, the value aws_lb_listener.example.default_action[0].target_group_arn should not be included in the returned config, as only one of the two values may be specified.
Actual Behavior
Both values are returned in the plan, showing a change in the configuration when there should not be one.
Example Output:
Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
Attempt to import an existing aws_lb_listener resource with aws_lb_listener.example.default_action[0].forward.target_group.arn specified
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
A similar bugfix was pushed in 5.36.0, per this closed issue: #35621
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: