A Crash and error message of panic: value is not known when creating nested blocks containing lists of unknown sizes.
0.12.2
resource "aws_lb_listener_rule" "host_and_path_conditions" {
listener_arn = "arn:aws:elasticloadbalancing:eu-west-1:0123456678910:listener/app/loadbalancer/0123456789abcdef/abcdef0123456789"
action {
type = "forward"
target_group_arn = "arn:aws:elasticloadbalancing:eu-west-1:0123456678910:targetgroup/targetgroup-name/0123456789abcdef"
}
condition {
host_header {
values = ["mydomain.example.com"]
}
}
condition {
path_pattern {
values = [
"/mypath.jsp",
"/mypathalias",
]
}
}
}
It should have created a load balancer listener rule with 2 conditions
Terraform panic and crash
plan output for resource:
# module.staging.aws_lb_listener_rule.host_and_path_conditions will be created
+ resource "aws_lb_listener_rule" "host_and_path_conditions" {
+ arn = (known after apply)
+ id = (known after apply)
+ listener_arn = "arn:aws:elasticloadbalancing:eu-west-1:0123456678910:listener/app/loadbalancer/0123456789abcdef/abcdef0123456789"
+ priority = (known after apply)
+ action {
+ order = (known after apply)
+ target_group_arn = "arn:aws:elasticloadbalancing:eu-west-1:0123456678910:targetgroup/targetgroup-name/0123456789abcdef"
+ type = "forward"
}
+ condition {
+ field = (known after apply)
+ values = (known after apply)
+ host_header {
+ values = (known after apply)
}
+ path_pattern {
+ values = [
+ "/mypathalias",
+ "/mypath.jsp",
]
}
}
+ condition {
+ field = (known after apply)
+ values = (known after apply)
+ host_header {
+ values = [
+ "mydomain.example.com",
]
}
+ path_pattern {
+ values = (known after apply)
}
}
}
I'm not sure the relevance of each condition block containing both host_header & path_pattern
Hi @completenovice
This bug is fixed in terraform v0.12.24. The fix commit is probably here. (https://github.com/hashicorp/terraform/commit/7a183a0e90619bc04032ffaf646018e117cfd05a)
I've checked if this bug is fixed in terraform v0.12.24.
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.14.6
BuildVersion: 18G87
$ terraform -version
Terraform v0.12.24
+ provider.aws v2.57.0
tf file
$ cat main.tf
...
resource "aws_lb_listener_rule" "host_and_path_conditions" {
listener_arn = aws_lb_listener.front_end.arn
action {
type = "forward"
target_group_arn = aws_lb_target_group.test.arn
}
condition {
host_header {
values = ["mydomain.example.com"]
}
}
condition {
path_pattern {
values = [
"/mypath.jsp",
"/mypathalias",
]
}
}
}
plan result
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# aws_lb_listener_rule.host_and_path_conditions will be created
+ resource "aws_lb_listener_rule" "host_and_path_conditions" {
+ arn = (known after apply)
+ id = (known after apply)
+ listener_arn = "arn:aws:elasticloadbalancing:ap-northeast-1:221684517171:listener/app/test-lb-tf/481890571e3cef47/d78001390289aebb"
+ priority = (known after apply)
+ action {
+ order = (known after apply)
+ target_group_arn = "arn:aws:elasticloadbalancing:ap-northeast-1:221684517171:targetgroup/tf-example-lb-tg/bd3df14d3de44e3e"
+ type = "forward"
}
+ condition {
+ field = (known after apply)
+ values = (known after apply)
+ host_header {
+ values = (known after apply)
}
+ path_pattern {
+ values = [
+ "/mypath.jsp",
+ "/mypathalias",
]
}
}
+ condition {
+ field = (known after apply)
+ values = (known after apply)
+ host_header {
+ values = [
+ "mydomain.example.com",
]
}
+ path_pattern {
+ values = (known after apply)
}
}
}
Plan: 1 to add, 0 to change, 0 to destroy.
------------------------------------------------------------------------
apply result
$ terraform apply -auto-approve
aws_lb.test: Refreshing state... [id=arn:aws:elasticloadbalancing:ap-northeast-1:221684517171:loadbalancer/app/test-lb-tf/481890571e3cef47]
aws_lb_target_group.test: Refreshing state... [id=arn:aws:elasticloadbalancing:ap-northeast-1:221684517171:targetgroup/tf-example-lb-tg/bd3df14d3de44e3e]
aws_lb_listener.front_end: Refreshing state... [id=arn:aws:elasticloadbalancing:ap-northeast-1:221684517171:listener/app/test-lb-tf/481890571e3cef47/d78001390289aebb]
aws_lb_listener_rule.host_and_path_conditions: Creating...
aws_lb_listener_rule.host_and_path_conditions: Creation complete after 1s [id=arn:aws:elasticloadbalancing:ap-northeast-1:221684517171:listener-rule/app/test-lb-tf/481890571e3cef47/d78001390289aebb/347414889bd9cba7]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Thanks, @completenovice and @htamakos! I'm going to close this issue because it looks like @completenovice confirmed with a 👍 that it's fixed in 0.12.24. Please feel free to re-open or leave a comment if this is wrong.
Nope bang on. Cheers guys! 👍
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Hi @completenovice
This bug is fixed in
terraform v0.12.24. The fix commit is probably here. (https://github.com/hashicorp/terraform/commit/7a183a0e90619bc04032ffaf646018e117cfd05a)I've checked if this bug is fixed in
terraform v0.12.24.Test Environment
Test Result
tf file
plan result
apply result