feat: Track and display import changes#64
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.
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.
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.
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.