-
Notifications
You must be signed in to change notification settings - Fork 48
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
tailscale: add import logic for remaining resources #445
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
examples/resources/tailscale_logstream_configuration/import.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Logstream configuration can be imported using the logstream configuration id, e.g., | ||
terraform import tailscale_logstream_configuration.sample_logstream_configuration 123456789 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Posture integration can be imported using the posture integration id, e.g., | ||
terraform import tailscale_posture_integration.sample_posture_integration 123456789 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting.
What were the issues with just using plain device id? I didn't experience any problems with importing the subnet just by passthrough.
This logic seems a bit unnecessary but maybe I'm not understanding something in this context.
The UUID creation is also present in the other device resources as well, so I'm not following why it has to be UUID for this particular resource but not the other device resources.
I mean I get why it has to be UUID when creating the resource, but when importing it can straight be the device_id, nothing assumes this has to be UUID tbqh.
Anyway, still works, was just curious to see this changed for only device_subnet, and not for device_key, device_tags, device_authorization.
Maybe it needs to change for those as well?
@mpminardi
EDIT: I think the other resources I broke backward compatibility with read, you probably need to change device_key, device_tags, device_authorization in a similar manner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @reegnz!
The rest of the
device*
resources are usingdevice_id
as theid
in state upon resource creation (and were before the import changes), so in those cases the passthrough can be used and works as expected (device_key, device_tags, and device_authorization for reference).For this resource the change here would end up breaking existing users of the resource as the Id of existing
device_subnet
resources are a UUID in state, meaning that we would try and fail to fetch the device using the UUID instead of the device Id for non-imported resources.This is why we need to do the more complex import logic in this case: so that we can properly read both when doing the import and when doing a read operation for an existing resource. Doing a fresh import would not have surfaced this issue as the read would be using the passthrough Id (e.g., the
device_id
) and work properly for that scenario.This resource should also use the
device_id
as its id, but since we have released versions where it uses a UUID instead we need to keep this in UUID format to stay within what we can release without doing a major version revision as per the HashiCorp versioning best practices.Apologies as well for not catching this on the original review! I had forgotten that this resource was using a UUID for its Id and completely missed that this would cause issues originally.