So, I am trying out TF v1.5 to import an existing lambda. I created the import block, ran plan and apply and it got imported to my state file. I re-ran the plan on the same files without changing anything, expecting that there will be no changes. But, the source_code_hash
is showing changes. I assumed this would not change as there are no changes done since the last successful import. So, why is it showing a change in the plan?
resource "aws_lambda_function" "lambda_function" {
filename = "../../lambda/vpc-default-reporting.zip"
function_name = "vpc_default_reporting"
role = aws_iam_role.lambda_exe_role.arn
handler = "lambda_function.lambda_handler"
timeout = "300"
memory_size = "2048"
source_code_hash = filebase64sha256("../../lambda/vpc-default-reporting.zip")
runtime = "python3.7"
environment {
variables = {
region = var.target_region
}
}
}
Plan output:
"Terraform will perform the following actions:",
"",
" # aws_lambda_function.lambda_function will be updated in-place",
" ~ resource \"aws_lambda_function\" \"lambda_function\" {",
" id = \"vpc_default_reporting\"",
" ~ last_modified = \"2023-06-23T06:10:30.691+0000\" -> (known after apply)",
" ~ source_code_hash = \"Gq5Zz1uRRW9V5R0fbpaVsOvh0PzGQ1QC230MjdjRcSM=\" -> \"5BPzTMjO/ziAJpn1VXFnV8oQybR/VP4pg9LKVziUPLE=\"",
" tags = {}",
" # (20 unchanged attributes hidden)",
"",
" # (3 unchanged blocks hidden)",
" }",
"",
"Plan: 0 to add, 1 to change, 0 to destroy.",