provider/aws: Read VPC ID for Lambda function back from API

This commit is contained in:
Radek Simko 2016-04-13 14:47:51 +01:00
parent 3f188d5d1b
commit f6a21e7899
1 changed files with 9 additions and 1 deletions

View File

@ -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)