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

aws_network_interface_sg_attachment: Remove unnecessary comments #1010

Merged
merged 1 commit into from
Jun 29, 2017
Merged
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
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