Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service/ec2: Remove deprecated (helper/schema.ResourceData).Partial() and (helper/schema.ResourceData).SetPartial() #12465

Merged
merged 1 commit into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions aws/resource_aws_ami.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,6 @@ func resourceAwsAmiRead(d *schema.ResourceData, meta interface{}) error {
func resourceAwsAmiUpdate(d *schema.ResourceData, meta interface{}) error {
client := meta.(*AWSClient).ec2conn

d.Partial(true)

if d.HasChange("tags") {
o, n := d.GetChange("tags")

Expand All @@ -431,11 +429,8 @@ func resourceAwsAmiUpdate(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return err
}
d.SetPartial("description")
}

d.Partial(false)

return resourceAwsAmiRead(d, meta)
}

Expand Down
3 changes: 0 additions & 3 deletions aws/resource_aws_ami_copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,7 @@ func resourceAwsAmiCopyCreate(d *schema.ResourceData, meta interface{}) error {

id := *res.ImageId
d.SetId(id)
d.Partial(true) // make sure we record the id even if the rest of this gets interrupted
d.Set("manage_ebs_snapshots", true)
d.SetPartial("manage_ebs_snapshots")
d.Partial(false)

if v := d.Get("tags").(map[string]interface{}); len(v) > 0 {
if err := keyvaluetags.Ec2UpdateTags(client, id, nil, v); err != nil {
Expand Down
3 changes: 0 additions & 3 deletions aws/resource_aws_ami_from_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,7 @@ func resourceAwsAmiFromInstanceCreate(d *schema.ResourceData, meta interface{})

id := *res.ImageId
d.SetId(id)
d.Partial(true) // make sure we record the id even if the rest of this gets interrupted
d.Set("manage_ebs_snapshots", true)
d.SetPartial("manage_ebs_snapshots")
d.Partial(false)

if v := d.Get("tags").(map[string]interface{}); len(v) > 0 {
if err := keyvaluetags.Ec2UpdateTags(client, id, nil, v); err != nil {
Expand Down
2 changes: 0 additions & 2 deletions aws/resource_aws_default_network_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ func resourceAwsDefaultNetworkAclCreate(d *schema.ResourceData, meta interface{}

func resourceAwsDefaultNetworkAclUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
d.Partial(true)

if d.HasChange("ingress") {
err := updateNetworkAclEntries(d, "ingress", conn)
Expand Down Expand Up @@ -241,7 +240,6 @@ func resourceAwsDefaultNetworkAclUpdate(d *schema.ResourceData, meta interface{}
}
}

d.Partial(false)
// Re-use the exiting Network ACL Resources READ method
return resourceAwsNetworkAclRead(d, meta)
}
Expand Down
3 changes: 0 additions & 3 deletions aws/resource_aws_ec2_client_vpn_endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ func resourceAwsEc2ClientVpnEndpointDelete(d *schema.ResourceData, meta interfac
func resourceAwsEc2ClientVpnEndpointUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn

d.Partial(true)

req := &ec2.ModifyClientVpnEndpointInput{
ClientVpnEndpointId: aws.String(d.Id()),
}
Expand Down Expand Up @@ -334,7 +332,6 @@ func resourceAwsEc2ClientVpnEndpointUpdate(d *schema.ResourceData, meta interfac
}
}

d.Partial(false)
return resourceAwsEc2ClientVpnEndpointRead(d, meta)
}

Expand Down
8 changes: 0 additions & 8 deletions aws/resource_aws_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -915,16 +915,12 @@ func resourceAwsInstanceRead(d *schema.ResourceData, meta interface{}) error {
func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn

d.Partial(true)

if d.HasChange("tags") && !d.IsNewResource() {
o, n := d.GetChange("tags")

if err := keyvaluetags.Ec2UpdateTags(conn, d.Id(), o, n); err != nil {
return fmt.Errorf("error updating tags: %s", err)
}

d.SetPartial("tags")
}

if d.HasChange("volume_tags") && !d.IsNewResource() {
Expand All @@ -940,8 +936,6 @@ func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error {
return fmt.Errorf("error updating volume_tags (%s): %s", volumeId, err)
}
}

d.SetPartial("volume_tags")
}

if d.HasChange("iam_instance_profile") && !d.IsNewResource() {
Expand Down Expand Up @@ -1214,8 +1208,6 @@ func resourceAwsInstanceUpdate(d *schema.ResourceData, meta interface{}) error {
// TODO(mitchellh): wait for the attributes we modified to
// persist the change...

d.Partial(false)

return resourceAwsInstanceRead(d, meta)
}

Expand Down
2 changes: 0 additions & 2 deletions aws/resource_aws_network_acl.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ func resourceAwsNetworkAclRead(d *schema.ResourceData, meta interface{}) error {

func resourceAwsNetworkAclUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
d.Partial(true)

if d.HasChange("ingress") {
err := updateNetworkAclEntries(d, "ingress", conn)
Expand Down Expand Up @@ -335,7 +334,6 @@ func resourceAwsNetworkAclUpdate(d *schema.ResourceData, meta interface{}) error
}
}

d.Partial(false)
return resourceAwsNetworkAclRead(d, meta)
}

Expand Down
15 changes: 0 additions & 15 deletions aws/resource_aws_network_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ func resourceAwsNetworkInterfaceDetach(oa *schema.Set, meta interface{}, eniId s

func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn
d.Partial(true)

if d.HasChange("attachment") {
oa, na := d.GetChange("attachment")
Expand All @@ -285,8 +284,6 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{})
return fmt.Errorf("Error attaching ENI: %s", attach_err)
}
}

d.SetPartial("attachment")
}

if d.HasChange("private_ips") {
Expand Down Expand Up @@ -326,8 +323,6 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{})
return fmt.Errorf("Failure to assign Private IPs: %s", err)
}
}

d.SetPartial("private_ips")
}

// ModifyNetworkInterfaceAttribute needs to be called after creating an ENI
Expand All @@ -342,8 +337,6 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{})
if err != nil {
return fmt.Errorf("Failure updating ENI: %s", err)
}

d.SetPartial("source_dest_check")
}

if d.HasChange("private_ips_count") && !d.IsNewResource() {
Expand Down Expand Up @@ -384,8 +377,6 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{})
return fmt.Errorf("Failure to unassign Private IPs: %s", err)
}
}

d.SetPartial("private_ips_count")
}
}

Expand All @@ -399,8 +390,6 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{})
if err != nil {
return fmt.Errorf("Failure updating ENI: %s", err)
}

d.SetPartial("security_groups")
}

if d.HasChange("description") {
Expand All @@ -413,8 +402,6 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{})
if err != nil {
return fmt.Errorf("Failure updating ENI: %s", err)
}

d.SetPartial("description")
}

if d.HasChange("tags") {
Expand All @@ -425,8 +412,6 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{})
}
}

d.Partial(false)

return resourceAwsNetworkInterfaceRead(d, meta)
}

Expand Down
2 changes: 0 additions & 2 deletions aws/resource_aws_spot_fleet_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -1197,8 +1197,6 @@ func resourceAwsSpotFleetRequestUpdate(d *schema.ResourceData, meta interface{})
// http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifySpotFleetRequest.html
conn := meta.(*AWSClient).ec2conn

d.Partial(true)

req := &ec2.ModifySpotFleetRequestInput{
SpotFleetRequestId: aws.String(d.Id()),
}
Expand Down
20 changes: 0 additions & 20 deletions aws/resource_aws_subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ func resourceAwsSubnetCreate(d *schema.ResourceData, meta interface{}) error {
if err != nil {
return fmt.Errorf("error adding tags: %s", err)
}

d.SetPartial("tags")
}

// You cannot modify multiple subnet attributes in the same request.
Expand All @@ -182,8 +180,6 @@ func resourceAwsSubnetCreate(d *schema.ResourceData, meta interface{}) error {
if _, err := conn.ModifySubnetAttribute(input); err != nil {
return fmt.Errorf("error enabling EC2 Subnet (%s) assign IPv6 address on creation: %s", d.Id(), err)
}

d.SetPartial("assign_ipv6_address_on_creation")
}

if d.Get("map_public_ip_on_launch").(bool) {
Expand All @@ -197,12 +193,8 @@ func resourceAwsSubnetCreate(d *schema.ResourceData, meta interface{}) error {
if _, err := conn.ModifySubnetAttribute(input); err != nil {
return fmt.Errorf("error enabling EC2 Subnet (%s) map public IP on launch: %s", d.Id(), err)
}

d.SetPartial("map_public_ip_on_launch")
}

d.Partial(false)

return resourceAwsSubnetRead(d, meta)
}

Expand Down Expand Up @@ -262,16 +254,12 @@ func resourceAwsSubnetRead(d *schema.ResourceData, meta interface{}) error {
func resourceAwsSubnetUpdate(d *schema.ResourceData, meta interface{}) error {
conn := meta.(*AWSClient).ec2conn

d.Partial(true)

if d.HasChange("tags") {
o, n := d.GetChange("tags")

if err := keyvaluetags.Ec2UpdateTags(conn, d.Id(), o, n); err != nil {
return fmt.Errorf("error updating EC2 Subnet (%s) tags: %s", d.Id(), err)
}

d.SetPartial("tags")
}

if d.HasChange("map_public_ip_on_launch") {
Expand All @@ -288,8 +276,6 @@ func resourceAwsSubnetUpdate(d *schema.ResourceData, meta interface{}) error {

if err != nil {
return err
} else {
d.SetPartial("map_public_ip_on_launch")
}
}

Expand Down Expand Up @@ -357,8 +343,6 @@ func resourceAwsSubnetUpdate(d *schema.ResourceData, meta interface{}) error {
"Error waiting for IPv6 CIDR (%s) to become associated: %s",
d.Id(), err)
}

d.SetPartial("ipv6_cidr_block")
}

if d.HasChange("assign_ipv6_address_on_creation") {
Expand All @@ -375,13 +359,9 @@ func resourceAwsSubnetUpdate(d *schema.ResourceData, meta interface{}) error {

if err != nil {
return err
} else {
d.SetPartial("assign_ipv6_address_on_creation")
}
}

d.Partial(false)

return resourceAwsSubnetRead(d, meta)
}

Expand Down
Loading