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

Use tfadd.StateForTargets to avoid running terraform show for multiple times #349

Merged
merged 2 commits into from
Feb 1, 2023

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented Feb 1, 2023

Previously, when converting the state to its config, we uses tfadd.State() the same time as the amount of target resources, each time with only one resource being converted. Though we were parallelising this process, while a terraform show (called inside tfadd.State()) execution is expensive.

This PR now uses a new function tfadd.StateForTargets() to ensure we only call terraform show once.

This improves the performance a lot in poor runtime env. E.g. previously, it takes ~60sec to convert a state file to config, which contains 30 resources in a 2core+4G mem azure container app. Now it finishes within 3 seconds.

@magodo magodo added the enhancement New feature or request label Feb 1, 2023
@magodo magodo merged commit e9c582c into Azure:main Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant