From 0cd6fbf325551a4e57d54960b748e32f5fe09bc4 Mon Sep 17 00:00:00 2001 From: gcrespi Date: Fri, 17 Apr 2020 11:48:10 -0300 Subject: [PATCH] Fixes aws_lambda_alias import to set function_name attribute correctly instead of function's ARN --- aws/resource_aws_lambda_alias.go | 4 ++-- aws/resource_aws_lambda_alias_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aws/resource_aws_lambda_alias.go b/aws/resource_aws_lambda_alias.go index 40ce9ebd5ef..80413d6c84d 100644 --- a/aws/resource_aws_lambda_alias.go +++ b/aws/resource_aws_lambda_alias.go @@ -204,12 +204,12 @@ func resourceAwsLambdaAliasImport(d *schema.ResourceData, meta interface{}) ([]* conn := meta.(*AWSClient).lambdaconn - getFunctionOutput, err := conn.GetFunction(&lambda.GetFunctionInput{FunctionName: &functionName}) + _, err := conn.GetFunction(&lambda.GetFunctionInput{FunctionName: &functionName}) if err != nil { return nil, err } - d.Set("function_name", getFunctionOutput.Configuration.FunctionArn) + d.Set("function_name", functionName) d.Set("name", alias) return []*schema.ResourceData{d}, nil } diff --git a/aws/resource_aws_lambda_alias_test.go b/aws/resource_aws_lambda_alias_test.go index 92a1bfc4592..302d4bacdb3 100644 --- a/aws/resource_aws_lambda_alias_test.go +++ b/aws/resource_aws_lambda_alias_test.go @@ -282,7 +282,7 @@ resource "aws_lambda_function" "lambda_function_test_create" { resource "aws_lambda_alias" "lambda_alias_test" { name = "%s" description = "a sample description" - function_name = "${aws_lambda_function.lambda_function_test_create.arn}" + function_name = "${aws_lambda_function.lambda_function_test_create.function_name}" function_version = "1" } `, roleName, policyName, attachmentName, funcName, aliasName) @@ -350,7 +350,7 @@ resource "aws_lambda_function" "lambda_function_test_create" { resource "aws_lambda_alias" "lambda_alias_test" { name = "%s" description = "a sample description" - function_name = "${aws_lambda_function.lambda_function_test_create.arn}" + function_name = "${aws_lambda_function.lambda_function_test_create.function_name}" function_version = "1" routing_config {