vendor: github.com/terraform-providers/terraform-provider-aws/...@v0.1.4

This commit is contained in:
Radek Simko 2017-08-10 15:15:10 +02:00
parent 24d5b13cac
commit 1c0ee7360e
No known key found for this signature in database
GPG Key ID: 6823F3DCCE01BB19
5 changed files with 35 additions and 96 deletions

View File

@ -61,16 +61,6 @@ func dataSourceAwsVpc() *schema.Resource {
Computed: true, Computed: true,
}, },
"enable_dns_hostnames": {
Type: schema.TypeBool,
Computed: true,
},
"enable_dns_support": {
Type: schema.TypeBool,
Computed: true,
},
"tags": tagsSchemaComputed(), "tags": tagsSchemaComputed(),
}, },
} }
@ -142,17 +132,5 @@ func dataSourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error {
d.Set("ipv6_cidr_block", vpc.Ipv6CidrBlockAssociationSet[0].Ipv6CidrBlock) d.Set("ipv6_cidr_block", vpc.Ipv6CidrBlockAssociationSet[0].Ipv6CidrBlock)
} }
attResp, err := awsVpcDescribeVpcAttribute("enableDnsSupport", *vpc.VpcId, conn)
if err != nil {
return err
}
d.Set("enable_dns_support", attResp.EnableDnsSupport.Value)
attResp, err = awsVpcDescribeVpcAttribute("enableDnsHostnames", *vpc.VpcId, conn)
if err != nil {
return err
}
d.Set("enable_dns_hostnames", attResp.EnableDnsHostnames.Value)
return nil return nil
} }

View File

@ -58,13 +58,6 @@ func resourceAwsEMRCluster() *schema.Resource {
Type: schema.TypeString, Type: schema.TypeString,
ForceNew: true, ForceNew: true,
Optional: true, Optional: true,
DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
// EMR uses a proprietary filesystem called EMRFS
// and both s3n & s3 protocols are mapped to that FS
// so they're equvivalent in this context (confirmed by AWS support)
old = strings.Replace(old, "s3n://", "s3://", -1)
return old == new
},
}, },
"master_public_dns": { "master_public_dns": {
Type: schema.TypeString, Type: schema.TypeString,

View File

@ -104,10 +104,9 @@ func resourceAwsInstance() *schema.Resource {
}, },
"user_data": { "user_data": {
Type: schema.TypeString, Type: schema.TypeString,
Optional: true, Optional: true,
ForceNew: true, ForceNew: true,
ConflictsWith: []string{"user_data_base64"},
StateFunc: func(v interface{}) string { StateFunc: func(v interface{}) string {
switch v.(type) { switch v.(type) {
case string: case string:
@ -118,22 +117,6 @@ func resourceAwsInstance() *schema.Resource {
}, },
}, },
"user_data_base64": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ConflictsWith: []string{"user_data"},
ValidateFunc: func(v interface{}, name string) (warns []string, errs []error) {
s := v.(string)
if !isBase64Encoded([]byte(s)) {
errs = append(errs, fmt.Errorf(
"%s: must be base64-encoded", name,
))
}
return
},
},
"security_groups": { "security_groups": {
Type: schema.TypeSet, Type: schema.TypeSet,
Optional: true, Optional: true,
@ -736,16 +719,7 @@ func resourceAwsInstanceRead(d *schema.ResourceData, meta interface{}) error {
return err return err
} }
if attr.UserData != nil && attr.UserData.Value != nil { if attr.UserData != nil && attr.UserData.Value != nil {
// Since user_data and user_data_base64 conflict with each other, d.Set("user_data", userDataHashSum(*attr.UserData.Value))
// we'll only set one or the other here to avoid a perma-diff.
// Since user_data_base64 was added later, we'll prefer to set
// user_data.
_, b64 := d.GetOk("user_data_base64")
if b64 {
d.Set("user_data_base64", attr.UserData.Value)
} else {
d.Set("user_data", userDataHashSum(*attr.UserData.Value))
}
} }
} }
@ -1235,9 +1209,10 @@ func fetchRootDeviceName(ami string, conn *ec2.EC2) (*string, error) {
func buildNetworkInterfaceOpts(d *schema.ResourceData, groups []*string, nInterfaces interface{}) []*ec2.InstanceNetworkInterfaceSpecification { func buildNetworkInterfaceOpts(d *schema.ResourceData, groups []*string, nInterfaces interface{}) []*ec2.InstanceNetworkInterfaceSpecification {
networkInterfaces := []*ec2.InstanceNetworkInterfaceSpecification{} networkInterfaces := []*ec2.InstanceNetworkInterfaceSpecification{}
// Get necessary items // Get necessary items
associatePublicIPAddress := d.Get("associate_public_ip_address").(bool)
subnet, hasSubnet := d.GetOk("subnet_id") subnet, hasSubnet := d.GetOk("subnet_id")
if hasSubnet { if hasSubnet && associatePublicIPAddress {
// If we have a non-default VPC / Subnet specified, we can flag // If we have a non-default VPC / Subnet specified, we can flag
// AssociatePublicIpAddress to get a Public IP assigned. By default these are not provided. // AssociatePublicIpAddress to get a Public IP assigned. By default these are not provided.
// You cannot specify both SubnetId and the NetworkInterface.0.* parameters though, otherwise // You cannot specify both SubnetId and the NetworkInterface.0.* parameters though, otherwise
@ -1246,13 +1221,10 @@ func buildNetworkInterfaceOpts(d *schema.ResourceData, groups []*string, nInterf
// to avoid: Network interfaces and an instance-level security groups may not be specified on // to avoid: Network interfaces and an instance-level security groups may not be specified on
// the same request // the same request
ni := &ec2.InstanceNetworkInterfaceSpecification{ ni := &ec2.InstanceNetworkInterfaceSpecification{
DeviceIndex: aws.Int64(int64(0)), AssociatePublicIpAddress: aws.Bool(associatePublicIPAddress),
SubnetId: aws.String(subnet.(string)), DeviceIndex: aws.Int64(int64(0)),
Groups: groups, SubnetId: aws.String(subnet.(string)),
} Groups: groups,
if v, ok := d.GetOkExists("associate_public_ip_address"); ok {
ni.AssociatePublicIpAddress = aws.Bool(v.(bool))
} }
if v, ok := d.GetOk("private_ip"); ok { if v, ok := d.GetOk("private_ip"); ok {
@ -1546,14 +1518,9 @@ func buildAwsInstanceOpts(
Name: aws.String(d.Get("iam_instance_profile").(string)), Name: aws.String(d.Get("iam_instance_profile").(string)),
} }
userData := d.Get("user_data").(string) user_data := d.Get("user_data").(string)
userDataBase64 := d.Get("user_data_base64").(string)
if userData != "" { opts.UserData64 = aws.String(base64Encode([]byte(user_data)))
opts.UserData64 = aws.String(base64Encode([]byte(userData)))
} else if userDataBase64 != "" {
opts.UserData64 = aws.String(userDataBase64)
}
// check for non-default Subnet, and cast it to a String // check for non-default Subnet, and cast it to a String
subnet, hasSubnet := d.GetOk("subnet_id") subnet, hasSubnet := d.GetOk("subnet_id")
@ -1575,6 +1542,8 @@ func buildAwsInstanceOpts(
opts.Placement.Tenancy = aws.String(v) opts.Placement.Tenancy = aws.String(v)
} }
associatePublicIPAddress := d.Get("associate_public_ip_address").(bool)
var groups []*string var groups []*string
if v := d.Get("security_groups"); v != nil { if v := d.Get("security_groups"); v != nil {
// Security group names. // Security group names.
@ -1593,7 +1562,7 @@ func buildAwsInstanceOpts(
networkInterfaces, interfacesOk := d.GetOk("network_interface") networkInterfaces, interfacesOk := d.GetOk("network_interface")
// If setting subnet and public address, OR manual network interfaces, populate those now. // If setting subnet and public address, OR manual network interfaces, populate those now.
if hasSubnet || interfacesOk { if hasSubnet && associatePublicIPAddress || interfacesOk {
// Otherwise we're attaching (a) network interface(s) // Otherwise we're attaching (a) network interface(s)
opts.NetworkInterfaces = buildNetworkInterfaceOpts(d, groups, networkInterfaces) opts.NetworkInterfaces = buildNetworkInterfaceOpts(d, groups, networkInterfaces)
} else { } else {

View File

@ -194,17 +194,27 @@ func resourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error {
} }
} }
resp, err := awsVpcDescribeVpcAttribute("enableDnsSupport", vpcid, conn) // Attributes
attribute := "enableDnsSupport"
describeAttrOpts := &ec2.DescribeVpcAttributeInput{
Attribute: aws.String(attribute),
VpcId: aws.String(vpcid),
}
resp, err := conn.DescribeVpcAttribute(describeAttrOpts)
if err != nil { if err != nil {
return err return err
} }
d.Set("enable_dns_support", resp.EnableDnsSupport.Value) d.Set("enable_dns_support", *resp.EnableDnsSupport.Value)
attribute = "enableDnsHostnames"
resp, err = awsVpcDescribeVpcAttribute("enableDnsHostnames", vpcid, conn) describeAttrOpts = &ec2.DescribeVpcAttributeInput{
Attribute: &attribute,
VpcId: &vpcid,
}
resp, err = conn.DescribeVpcAttribute(describeAttrOpts)
if err != nil { if err != nil {
return err return err
} }
d.Set("enable_dns_hostnames", resp.EnableDnsHostnames.Value) d.Set("enable_dns_hostnames", *resp.EnableDnsHostnames.Value)
describeClassiclinkOpts := &ec2.DescribeVpcClassicLinkInput{ describeClassiclinkOpts := &ec2.DescribeVpcClassicLinkInput{
VpcIds: []*string{&vpcid}, VpcIds: []*string{&vpcid},
@ -637,16 +647,3 @@ func resourceAwsVpcInstanceImport(
d.Set("assign_generated_ipv6_cidr_block", false) d.Set("assign_generated_ipv6_cidr_block", false)
return []*schema.ResourceData{d}, nil return []*schema.ResourceData{d}, nil
} }
func awsVpcDescribeVpcAttribute(attribute string, vpcId string, conn *ec2.EC2) (*ec2.DescribeVpcAttributeOutput, error) {
describeAttrOpts := &ec2.DescribeVpcAttributeInput{
Attribute: aws.String(attribute),
VpcId: aws.String(vpcId),
}
resp, err := conn.DescribeVpcAttribute(describeAttrOpts)
if err != nil {
return nil, err
}
return resp, nil
}

8
vendor/vendor.json vendored
View File

@ -1820,10 +1820,12 @@
"revisionTime": "2016-09-27T10:08:44Z" "revisionTime": "2016-09-27T10:08:44Z"
}, },
{ {
"checksumSHA1": "xG4fC10IB94QTZqilXGPYsuXY4Y=", "checksumSHA1": "UxgAKjDS6mher0PL9dw61QnPQ7w=",
"path": "github.com/terraform-providers/terraform-provider-aws/aws", "path": "github.com/terraform-providers/terraform-provider-aws/aws",
"revision": "09d5c403db49e319daefa1eeaf9265f89c16f633", "revision": "4bf6f8f8134705ab3aea5451a186e85c4fb10547",
"revisionTime": "2017-08-10T09:00:58Z" "revisionTime": "2017-08-08T15:30:11Z",
"version": "v0.1.4",
"versionExact": "v0.1.4"
}, },
{ {
"checksumSHA1": "R+2QkZ1uCKhGJN7Nak++jdKx59I=", "checksumSHA1": "R+2QkZ1uCKhGJN7Nak++jdKx59I=",