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

Exporter: track removed objects during the Emit phase #3554

Merged
merged 2 commits into from
May 8, 2024

Conversation

alexott
Copy link
Contributor

@alexott alexott commented May 8, 2024

Changes

In the current implementation when TF resource data has .id set to an empty string this means the following:

  • object doesn't exist on the backend - a common situation for jobs and DLT pipelines when dependencies are deleted.
  • Grants or Permissions are empty, so we don't need to generate a code for that.

Right now, all such objects are tracked and reported individually via the Ignore function, but not all objects have it. Also, for big exports, unnecessary objects pollute the internal state without any useful effect.

The current PR checks if .id is empty during the Emit phase, adds them to the list of ignored objects (except permissions & grants), and doesn't propagate them to the internal state.

Tests

  • make test run locally
  • relevant change in docs/ folder
  • covered with integration tests in internal/acceptance
  • relevant acceptance tests are passing
  • using Go SDK

In the current implementation when TF resource data has `.id` set to empty string this
means the following:

* object doesn't exist on backend - common situation for jobs and DLT pipelines when
  dependencies are deleted.
* Grants or Permissions are empty, so we don't need to generate a code for that.

Right now, all such objects are tracked and reported individually via `Ignore` function,
but not all objects have it.  Also, for big exports, not necessary objects are polluting
the internal state without any useful effect.

The current PR checks if `.id` is empty during the `Emit` phase, adds them to the list of
ignored objects (except permissions & grants), and don't propagate them to the internal
state.
@alexott alexott requested review from a team as code owners May 8, 2024 07:07
@alexott alexott requested review from mgyucht and removed request for a team May 8, 2024 07:07
@codecov-commenter
Copy link

codecov-commenter commented May 8, 2024

Codecov Report

Attention: Patch coverage is 90.00000% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 82.66%. Comparing base (a30518e) to head (089a48d).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3554   +/-   ##
=======================================
  Coverage   82.66%   82.66%           
=======================================
  Files         184      184           
  Lines       18857    18856    -1     
=======================================
  Hits        15588    15588           
- Misses       2351     2352    +1     
+ Partials      918      916    -2     
Files Coverage Δ
exporter/importables.go 79.18% <100.00%> (+<0.01%) ⬆️
exporter/util.go 76.13% <100.00%> (ø)
exporter/model.go 88.20% <80.00%> (+0.20%) ⬆️

@alexott alexott added the exporter TF configuration generator label May 8, 2024
@alexott alexott requested a review from hectorcast-db May 8, 2024 11:26
@alexott alexott added this pull request to the merge queue May 8, 2024
Merged via the queue into main with commit c71f798 May 8, 2024
5 checks passed
@alexott alexott deleted the exporter-track-ignored-objects-at-emit branch May 8, 2024 11:35
tanmay-db added a commit that referenced this pull request May 13, 2024
### New Features and Improvements
* fix ([#3542](#3542)).
* Update data_aws_crossaccount_policy to format resource string with account and region ([#3544](#3544)).
* Robust retries for workspace get-status ([#3550](#3550)).
* Fix error message typo in mounts.go ([#3552](#3552)).
* State the options for run_if ([#3548](#3548)).
* Exporter: don't emit all UC objects when handling dependencies ([#3556](#3556)).
* Added state upgrader to remove `max_clusters_per_user` and ebs volume attributes set to zero ([#3551](#3551)).
* Exporter: track removed objects during the `Emit` phase ([#3554](#3554)).
* Jobs GoSDK schema migration ([#3532](#3532)).
* Exporter: optimize generation of `databricks_group_member` resource ([#3559](#3559)).

### Documentation Changes

### Exporter

### Internal Changes
@tanmay-db tanmay-db mentioned this pull request May 13, 2024
github-merge-queue bot pushed a commit that referenced this pull request May 14, 2024
* Release v1.43.0

### New Features and Improvements
* fix ([#3542](#3542)).
* Update data_aws_crossaccount_policy to format resource string with account and region ([#3544](#3544)).
* Robust retries for workspace get-status ([#3550](#3550)).
* Fix error message typo in mounts.go ([#3552](#3552)).
* State the options for run_if ([#3548](#3548)).
* Exporter: don't emit all UC objects when handling dependencies ([#3556](#3556)).
* Added state upgrader to remove `max_clusters_per_user` and ebs volume attributes set to zero ([#3551](#3551)).
* Exporter: track removed objects during the `Emit` phase ([#3554](#3554)).
* Jobs GoSDK schema migration ([#3532](#3532)).
* Exporter: optimize generation of `databricks_group_member` resource ([#3559](#3559)).

### Documentation Changes

### Exporter

### Internal Changes

* -

* -

* -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter TF configuration generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants