Merge pull request #10492 from Ninir/lambda_env_removal
provider/aws: Fixed Lambda environment removal
This commit is contained in:
commit
f8f4634858
|
@ -495,6 +495,11 @@ func resourceAwsLambdaFunctionUpdate(d *schema.ResourceData, meta interface{}) e
|
|||
}
|
||||
configUpdate = true
|
||||
}
|
||||
} else {
|
||||
configReq.Environment = &lambda.Environment{
|
||||
Variables: aws.StringMap(map[string]string{}),
|
||||
}
|
||||
configUpdate = true
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,6 +77,16 @@ func TestAccAWSLambdaFunction_envVariables(t *testing.T) {
|
|||
resource.TestCheckResourceAttr("aws_lambda_function.lambda_function_test", "environment.0.variables.foo1", "bar1"),
|
||||
),
|
||||
},
|
||||
{
|
||||
Config: testAccAWSLambdaConfigEnvVariablesModifiedWithoutEnvironment(rName),
|
||||
Check: resource.ComposeTestCheckFunc(
|
||||
testAccCheckAwsLambdaFunctionExists("aws_lambda_function.lambda_function_test", rName, &conf),
|
||||
testAccCheckAwsLambdaFunctionName(&conf, rName),
|
||||
testAccCheckAwsLambdaFunctionArnHasSuffix(&conf, ":"+rName),
|
||||
resource.TestCheckResourceAttr("aws_lambda_function.lambda_function_test", "environment.0.variables.foo", ""),
|
||||
resource.TestCheckResourceAttr("aws_lambda_function.lambda_function_test", "environment.0.variables.foo1", ""),
|
||||
),
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
@ -648,6 +658,17 @@ resource "aws_lambda_function" "lambda_function_test" {
|
|||
`, rName)
|
||||
}
|
||||
|
||||
func testAccAWSLambdaConfigEnvVariablesModifiedWithoutEnvironment(rName string) string {
|
||||
return fmt.Sprintf(baseAccAWSLambdaConfig+`
|
||||
resource "aws_lambda_function" "lambda_function_test" {
|
||||
filename = "test-fixtures/lambdatest.zip"
|
||||
function_name = "%s"
|
||||
role = "${aws_iam_role.iam_for_lambda.arn}"
|
||||
handler = "exports.example"
|
||||
}
|
||||
`, rName)
|
||||
}
|
||||
|
||||
func testAccAWSLambdaConfigEncryptedEnvVariables(rName string) string {
|
||||
return fmt.Sprintf(baseAccAWSLambdaConfig+`
|
||||
resource "aws_kms_key" "foo" {
|
||||
|
|
Loading…
Reference in New Issue