-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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]: Error: The terraform-provider-aws_v4.67.0_x5 plugin crashed! #32165
Comments
Community NoteVoting for Prioritization
Volunteering to Work on This Issue
|
Could be linked to #31722 If you are limiting memory on your Terraform runner increase it and see if the error still occurs. |
Hey @jsparrow7777 👋 Thank you for taking the time to raise this! Based on some testing I've done, this appears to be due to passing a literal First, looking at the example that you provided, I constructed the following sample configuration: variable "ENV_VAR2" {
description = "optional Environment var"
type = string
default = null
}
variable "ENV_VAR1" {
description = "a Environment var that has a value"
type = string
default = "avalue"
}
output "example" {
value = [
{
name = "ENV_VAR1"
value = var.ENV_VAR1
},
var.ENV_VAR2 != null ? {
name = "ENV_VAR2"
value = var.ENV_VAR2
} : null
]
} When running a $ terraform plan
Changes to Outputs:
+ example = [
+ {
+ name = "ENV_VAR1"
+ value = "avalue"
},
+ null,
] To get around this, I introduced a locals {
env_vars = [
{
name = "ENV_VAR1"
value = var.ENV_VAR1
},
var.ENV_VAR2 != null ? {
name = "ENV_VAR2"
value = var.ENV_VAR2
} : null
]
}
output "example" {
value = [for var in local.env_vars : var if var != null]
} With this change, the $ terraform plan
Changes to Outputs:
+ example = [
+ {
+ name = "ENV_VAR1"
+ value = "avalue"
},
] When passing a value to the $ terraform plan -var ENV_VAR2="anothervalue"
Changes to Outputs:
+ example = [
+ {
+ name = "ENV_VAR1"
+ value = "avalue"
},
+ {
+ name = "ENV_VAR2"
+ value = "anothervalue"
},
] This will get around passing a literal variable "ENV_VAR2" {
description = "optional Environment var"
type = map(string)
default = null
}
variable "ENV_VAR1" {
description = "not optional Environment var"
type = map(string)
default = {
name = "ENV_VAR1"
value = "thisisavalue"
}
}
locals {
env_vars = [var.ENV_VAR1, var.ENV_VAR2]
}
output "locals" {
value = [for var in local.env_vars : var if var != null]
} |
Terraform Core Version
1.4.0
AWS Provider Version
5.1.0
Affected Resource(s)
Expected Behavior
It should add an environment variable if it's value is not null, else ignore it :
Actual Behavior
Stack trace from the terraform-provider-aws_v4.67.0_x5 plugin:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xa4dd396]
Error: The terraform-provider-aws_v4.67.0_x5 plugin crashed!
This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
run
terraform plan
/terraform apply
Debug Output
No response
Panic Output
No response
Important Factoids
This error only comes when I keep the variable value as null.
I want this environment variable to be added only if my variable is not null.
References
#31443
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: