provider/aws Return service CIDR blocks from aws_vpc_endpoint resource. (#10254)
This commit is contained in:
parent
8f9c8ba61f
commit
7330d65678
|
@ -52,6 +52,11 @@ func resourceAwsVpcEndpoint() *schema.Resource {
|
|||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
},
|
||||
"cidr_blocks": &schema.Schema{
|
||||
Type: schema.TypeList,
|
||||
Computed: true,
|
||||
Elem: &schema.Schema{Type: schema.TypeString},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
@ -155,7 +160,9 @@ func resourceAwsVPCEndpointRead(d *schema.ResourceData, meta interface{}) error
|
|||
if err := d.Set("route_table_ids", aws.StringValueSlice(vpce.RouteTableIds)); err != nil {
|
||||
return err
|
||||
}
|
||||
d.Set("prefix_list_id", prefixListsOutput.PrefixLists[0].PrefixListId)
|
||||
pl := prefixListsOutput.PrefixLists[0]
|
||||
d.Set("prefix_list_id", pl.PrefixListId)
|
||||
d.Set("cidr_blocks", aws.StringValueSlice(pl.Cidrs))
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package aws
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
|
@ -189,6 +190,18 @@ func testAccCheckVpcEndpointPrefixListAvailable(n string) resource.TestCheckFunc
|
|||
return fmt.Errorf("Prefix list ID does not appear to be a valid value: '%s'", prefixListID)
|
||||
}
|
||||
|
||||
var (
|
||||
cidrBlockSize int
|
||||
err error
|
||||
)
|
||||
|
||||
if cidrBlockSize, err = strconv.Atoi(rs.Primary.Attributes["cidr_blocks.#"]); err != nil {
|
||||
return err
|
||||
}
|
||||
if cidrBlockSize < 1 {
|
||||
return fmt.Errorf("cidr_blocks seem suspiciously low: %d", cidrBlockSize)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ The following attributes are exported:
|
|||
|
||||
* `id` - The ID of the VPC endpoint.
|
||||
* `prefix_list_id` - The prefix list ID of the exposed service.
|
||||
* `cidr_blocks` - The list of CIDR blocks for the exposed service.
|
||||
|
||||
|
||||
## Import
|
||||
|
|
Loading…
Reference in New Issue