Skip to content

Conversation

mpminardi
Copy link
Member

Add a tailscale_contacts resource to allow for managing tailscale contacts settings via Terraform.

Updates https://github.com/tailscale/corp/issues/21631

@mpminardi mpminardi self-assigned this Jul 26, 2024
@mpminardi mpminardi force-pushed the mpminardi/contacts-resource branch from 3eee341 to ca92fe6 Compare July 26, 2024 01:51
@mpminardi mpminardi marked this pull request as ready for review July 26, 2024 02:04
@mpminardi mpminardi force-pushed the mpminardi/contacts-resource branch 2 times, most recently from 9672b7c to a0ed2e9 Compare July 30, 2024 22:43
Copy link
Collaborator

@oxtoacart oxtoacart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of suggestions about maybe making it a little more DRY, otherwise LGTM. Nice job on the documentation piece!

return diagnosticsError(err, "Failed to fetch contacts")
}

accountMap := []map[string]interface{}{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These feel somewhat repetitive, could maybe be pulled into a function like buildContact() or something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have added a buildContactMap function to clean this up a bit.

client := m.(*tailscale.Client)

if d.HasChange("account") {
account := d.Get("account").(*schema.Set).List()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These sections feel a little repetitive, maybe they could be pulled into a helper function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made an updateContact helper to encapsulate some of the repetitive bits here.

@mpminardi mpminardi force-pushed the mpminardi/initial-acceptance-test branch 2 times, most recently from 9ff27ef to 0b27a26 Compare August 1, 2024 21:37
Base automatically changed from mpminardi/initial-acceptance-test to main August 1, 2024 21:40
Add a `tailscale_contacts` resource to allow for managing tailscale
contacts settings via Terraform.

Updates tailscale/corp#21631

Signed-off-by: Mario Minardi <mario@tailscale.com>
@mpminardi mpminardi force-pushed the mpminardi/contacts-resource branch from a0ed2e9 to eccd7ef Compare August 1, 2024 22:01
@mpminardi mpminardi merged commit 6bc9542 into main Aug 1, 2024
3 checks passed
@mpminardi mpminardi deleted the mpminardi/contacts-resource branch August 1, 2024 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants