I want to update a Lambda function Environment Variable after it is created in the same script.
I want to preserve the ARN, I would just like to update an environmental variable after it is created. In my situation, I had to setup the API Gateway configuration to get the URL, and I add that URL as an Environmental Variable. So, I need the lambda to setup the deployment, and I need the URL to go back into the integrated Lambda function.
Lambda->API Gateway-> (API Gateway URL)->Lambda Tada !
resource "aws_lambda_function" "lambda" {
filename = "${data.archive_file.zip.output_path}"
source_code_hash = "${data.archive_file.zip.output_base64sha256}"
function_name = "terraformLambdaWebsite"
role = "${aws_iam_role.role.arn}"
handler = "index.handler"
runtime = "nodejs10.x"
tags = {
Environment = "KeepQL"
}
}
Then, after everything is setup, I want to change the Environment variable.
aws_lambda_function.lambda.tags.Environment = "KeepQL2"
I had hoped that Terraform was Smart enough to realize that it had already created that Lambda function, and since the Hash had not changed, it would just determine what was different and update that variable.
Much Thanks