-
Notifications
You must be signed in to change notification settings - Fork 28
feat: Track and display import changes #64
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
base: main
Are you sure you want to change the base?
Conversation
🤖 StalebotThis pull request hasn't seen updates in the last 60 days. If it is not relevant anymore, please consider closing the pull request. Otherwise, it will be closed automatically in 30 days. |
borchero
left a comment
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.
Sorry for the late review!
Overall question: are imported resources using resource_drift? 🤔 could you share an example/add a test?
| function queryChanges(changes: StructuredPlanChange[], changeKind: string): string[] { | ||
| return changes | ||
| .filter((r) => r.change.actions.toString() === [changeKind].toString()) | ||
| .map((r) => r.address) | ||
| } |
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.
Let's generalize this and use changeKind: string[] s.t. we can also use this for recreated changes
| const createdResources = queryChanges( | ||
| structuredPlan.resource_changes || [], | ||
| 'create' | ||
| ).concat(queryChanges( | ||
| structuredPlan.resource_drift || [], | ||
| 'create', | ||
| )) |
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.
Can we create a new function which takes care of the concatenation s.t. we don't have to do this multiple times?
|
Hello @borchero ! Any plans on wrapping up this change so that the action also supports showing resource imports from import blocks? |
|
@mj3c I might only get to this in a couple weeks. Feel free to continue this PR yourself though and I'll be able to review :) |
Motivation
Closes #32
Changes
The tfplan structure contains not only a
resource_changesfield, but also aresource_driftfield.resource_drifthas the same internal type asresource_changes, so they now share a named type.