Merge #9390: arn attribute for AWS Lambda alias

This commit is contained in:
Martin Atkins 2016-10-16 09:58:30 -07:00
commit f86198c155
4 changed files with 15 additions and 0 deletions

View File

@ -6,6 +6,10 @@ BUG FIXES:
* core: List and map indexes are implicitly converted to the correct type if possible [GH-9372]
* provider/google: Fixed a bug causing a crash when migrating `google_compute_target_pool` resources from 0.6.x releases [GH-9370]
IMPROVEMENTS:
* provider/aws: Expose ARN for aws_lambda_alias [GH-9390]
## 0.7.6 (October 14, 2016)
BACKWARDS INCOMPATIBILITIES / NOTES:

View File

@ -33,6 +33,10 @@ func resourceAwsLambdaAlias() *schema.Resource {
Type: schema.TypeString,
Required: true,
},
"arn": &schema.Schema{
Type: schema.TypeString,
Computed: true,
},
},
}
}
@ -84,6 +88,7 @@ func resourceAwsLambdaAliasRead(d *schema.ResourceData, meta interface{}) error
d.Set("description", aliasConfiguration.Description)
d.Set("function_version", aliasConfiguration.FunctionVersion)
d.Set("name", aliasConfiguration.Name)
d.Set("arn", aliasConfiguration.AliasArn)
return nil
}

View File

@ -2,6 +2,7 @@ package aws
import (
"fmt"
"regexp"
"testing"
"github.com/aws/aws-sdk-go/aws"
@ -23,6 +24,7 @@ func TestAccAWSLambdaAlias_basic(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testAccCheckAwsLambdaAliasExists("aws_lambda_alias.lambda_alias_test", &conf),
testAccCheckAwsLambdaAttributes(&conf),
resource.TestMatchResourceAttr("aws_lambda_alias.lambda_alias_test", "arn", regexp.MustCompile(`^arn:aws:lambda:[a-z]+-[a-z]+-[0-9]+:\d{12}:function:example_lambda_name_create:testalias$`)),
),
},
},

View File

@ -31,5 +31,9 @@ resource "aws_lambda_alias" "test_alias" {
* `function_name` - (Required) The function ARN of the Lambda function for which you want to create an alias.
* `function_version` - (Required) Lambda function version for which you are creating the alias. Pattern: `(\$LATEST|[0-9]+)`.
## Attributes Reference
* `arn` - The Amazon Resource Name (ARN) identifying your Lambda function alias.
[1]: http://docs.aws.amazon.com/lambda/latest/dg/welcome.html
[2]: http://docs.aws.amazon.com/lambda/latest/dg/API_CreateAlias.html