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

fix: handle column and derived column imports with slashes in the name #437

Merged
merged 3 commits into from
Feb 17, 2024

Conversation

jharley
Copy link
Collaborator

@jharley jharley commented Feb 16, 2024

Some columns and derived columns have slashes in the name. Prior to this change, trying to import either with slashes in the name would result in a message like:

$ terraform import 'honeycombio_column.test' 'test/my/column/name'
honeycombio_column.test: Importing from ID "test/my/column/name"...
honeycombio_column.test: Import prepared!
  Prepared honeycombio_column for import
honeycombio_column.test: Refreshing state... [id=test/my/column/name]
╷
│ Error: Cannot import non-existent remote object
│
│ While attempting to import an existing object to "honeycombio_column.test", the provider detected that no object exists with the given id. Only pre-existing objects can be imported; check that the id is correct
│ and that it is associated with the provider's configured region or endpoint, or use "terraform apply" to create a new remote object for this resource.

Most (all?) other resources are imported by ID, but this subtle change in splitting does the trick here.

@jharley jharley added the bug label Feb 16, 2024
@jharley jharley requested a review from a team as a code owner February 16, 2024 22:47
@@ -61,6 +61,9 @@ func TestClient_InvalidConfig(t *testing.T) {
func TestClient_IsClassic(t *testing.T) {
t.Parallel()

// load environment values from a .env, if available
_ = godotenv.Load("../.env")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

unrelated, but snuck this in as the test was broken locally

@jharley jharley changed the title fix: handling importing columns and derived columns with slashes in the name fix: handle column and derived column imports with slashes in the name Feb 16, 2024
honeycombio/resource_column.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Feb 17, 2024

Codecov Report

Attention: 8 lines in your changes are missing coverage. Please review.

Comparison is base (d92499c) 83.19% compared to head (1365236) 83.20%.

Files Patch % Lines
honeycombio/resource_slo.go 0.00% 3 Missing ⚠️
honeycombio/resource_column.go 33.33% 1 Missing and 1 partial ⚠️
honeycombio/resource_derived_column.go 33.33% 1 Missing and 1 partial ⚠️
internal/provider/trigger_resource.go 50.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #437   +/-   ##
=======================================
  Coverage   83.19%   83.20%           
=======================================
  Files          62       62           
  Lines        4178     4168   -10     
=======================================
- Hits         3476     3468    -8     
+ Misses        549      547    -2     
  Partials      153      153           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jharley jharley merged commit 455f3fa into main Feb 17, 2024
2 checks passed
@jharley jharley deleted the jharley.fix-import-by-name branch February 17, 2024 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants