Hello, I’m currently using Terraform Cloud for remote state. I have one workspace outputting a sensitive variable and another trying to use it.
For some reason, when using tfe_outputs
I receive this error: Null value found in list
. If I switch to using terraform_remote_state
I do not receive the error and it works correctly. I would prefer to use tfe_outputs
as it is the recommended way to share outputs across Terraform Cloud workspaces.
Here’s an example snippet configuration of what I’m doing:
data "tfe_outputs" "my_var_tfe" {
organization = "MyOrg"
workspace = "${var.env}-my-workspace"
}
data "terraform_remote_state" "my_var_remote" {
backend = "remote"
config = {
organization = "MyOrg"
workspaces = {
name = "${var.env}-my-workspace"
}
}
}
resource "aws_lambda_function" "lambda_proxy" {
function_name = "${var.env}-${var.lambda_proxy_function_name}-${random_id.lambda_proxy_name.id}"
s3_bucket = aws_s3_bucket.lambda_proxy.id
s3_key = aws_s3_object.lambda_proxy.key
runtime = "nodejs16.x"
handler = "lambda-proxy.handler"
source_code_hash = data.archive_file.lambda_proxy.output_base64sha256
role = aws_iam_role.lambda_exec.arn
# throws Error: Null value found in list
layers = [data.tfe_outputs.my_var_tfe.values.lambda_layer_arn]
# Works perfectly.
# layers = [data.terraform_remote_state.my_var_remote.outputs.lambda_layer_arn]
}
Any help would be much appreciated. Thanks!