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

CDKTF: Support -refresh=false on plan/diff and apply #3539

Open
1 task done
Danielku15 opened this issue Mar 7, 2024 · 2 comments
Open
1 task done

CDKTF: Support -refresh=false on plan/diff and apply #3539

Danielku15 opened this issue Mar 7, 2024 · 2 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request priority/awaiting-more-evidence Lowest priority. Unlikely to be worked on unless/until it gets a lot more upvotes.

Comments

@Danielku15
Copy link

Danielku15 commented Mar 7, 2024

Description

The cdktf-cli and components have no support for the -refresh=false option of terraform but we want to use it.

Background is that some providers like the one for GitHub are very slow and spend minutes over minutes in refreshing the state. We want to introduce a workflow where we regularly update our state to have it up-to-date (also via cdktf-cli apply) but do not do any refresh on incremental changes done as part of PRs and PR merges.

We are aware of any risks this implies.

As an alternative we could also allow users to specify any plain parameters which should be forwarded to terraform. A typical pattern I've seen for this (dotnet, npm) would be a syntax where any arguments after a -- are forwarded directly to the underlying executable:

npx cdktf-cli@latest apply Stack --auto-approve -- -refresh=false

References

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@Danielku15 Danielku15 added enhancement New feature or request new Un-triaged issue labels Mar 7, 2024
@ansgarm
Copy link
Member

ansgarm commented Mar 18, 2024

Hi @Danielku15 👋

You should be able to use TF_CLI_ARGS_plan="-refresh=false" which is a feature of Terraform (docs).

@ansgarm ansgarm added documentation Improvements or additions to documentation needs-priority Issue has not yet been prioritized; this will prompt team review priority/awaiting-more-evidence Lowest priority. Unlikely to be worked on unless/until it gets a lot more upvotes. and removed new Un-triaged issue needs-priority Issue has not yet been prioritized; this will prompt team review labels Mar 18, 2024
@Danielku15
Copy link
Author

Thanks for this hint. This certainly helps as a workaround. I assume as other arguments like --refresh-only are also available within CDKTF directly, it is intended to allow specifying the same arguments as TF itself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request priority/awaiting-more-evidence Lowest priority. Unlikely to be worked on unless/until it gets a lot more upvotes.
Projects
None yet
Development

No branches or pull requests

2 participants