From f6a21e789954a4d9e770ba9b5378b117f3d0721a Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Wed, 13 Apr 2016 14:47:51 +0100 Subject: [PATCH] provider/aws: Read VPC ID for Lambda function back from API --- builtin/providers/aws/resource_aws_lambda_function.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/builtin/providers/aws/resource_aws_lambda_function.go b/builtin/providers/aws/resource_aws_lambda_function.go index 1c6e706b1..f54bc1a2e 100644 --- a/builtin/providers/aws/resource_aws_lambda_function.go +++ b/builtin/providers/aws/resource_aws_lambda_function.go @@ -98,6 +98,10 @@ func resourceAwsLambdaFunction() *schema.Resource { Elem: &schema.Schema{Type: schema.TypeString}, Set: schema.HashString, }, + "vpc_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, }, }, }, @@ -249,7 +253,11 @@ func resourceAwsLambdaFunctionRead(d *schema.ResourceData, meta interface{}) err d.Set("runtime", function.Runtime) d.Set("timeout", function.Timeout) if config := flattenLambdaVpcConfigResponse(function.VpcConfig); len(config) > 0 { - d.Set("vpc_config", config) + log.Printf("[INFO] Setting Lambda %s VPC config %#v from API", d.Id(), config) + err := d.Set("vpc_config", config) + if err != nil { + return fmt.Errorf("Failed setting vpc_config: %s", err) + } } d.Set("source_code_hash", function.CodeSha256)