Skip to content

Commit

Permalink
Merge pull request #1010 from vancluever/b-aws-sg-attachment-remove-c…
Browse files Browse the repository at this point in the history
…omments

aws_network_interface_sg_attachment: Remove unnecessary comments
  • Loading branch information
vancluever committed Jun 29, 2017
2 parents c70c32b + c282a2a commit ce3c48b
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions aws/resource_aws_network_interface_sg_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ func resourceAwsNetworkInterfaceSGAttachment() *schema.Resource {
}

func resourceAwsNetworkInterfaceSGAttachmentCreate(d *schema.ResourceData, meta interface{}) error {
// Get a lock to prevent races on other SG attachments/detatchments on this
// interface ID. This lock is released when the function exits, regardless of
// success or failure.
//
// The lock here - in the create function - deliberately covers the
// post-creation read as well, which is normally not covered as Read is
// otherwise only performed on refresh. Locking on it here prevents
// inconsistencies that could be caused by other attachments that will be
// operating on the interface, ensuring that Create gets a full lay of the
// land before moving on.
mk := "network_interface_sg_attachment_" + d.Get("network_interface_id").(string)
awsMutexKV.Lock(mk)
defer awsMutexKV.Unlock(mk)
Expand Down Expand Up @@ -98,17 +88,14 @@ func resourceAwsNetworkInterfaceSGAttachmentRead(d *schema.ResourceData, meta in
if sgExistsInENI(sgID, iface) {
d.SetId(fmt.Sprintf("%s_%s", sgID, interfaceID))
} else {
// The assocation does not exist when it should, taint this resource.
// The association does not exist when it should, taint this resource.
log.Printf("[WARN] Security group %s not associated with network interface ID %s, tainting", sgID, interfaceID)
d.SetId("")
}
return nil
}

func resourceAwsNetworkInterfaceSGAttachmentDelete(d *schema.ResourceData, meta interface{}) error {
// Get a lock to prevent races on other SG attachments/detatchments on this
// interface ID. This lock is released when the function exits, regardless of
// success or failure.
mk := "network_interface_sg_attachment_" + d.Get("network_interface_id").(string)
awsMutexKV.Lock(mk)
defer awsMutexKV.Unlock(mk)
Expand Down

0 comments on commit ce3c48b

Please sign in to comment.