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

Fix locking issue + validation improvement + bumps #11

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

lechuk47
Copy link
Contributor

  • Bump cdktf version
  • Remove unused requirements.txt file
  • Do not lock resources on plan runs
  • Run validate_plan with Destroy action

@@ -44,7 +44,7 @@ $TERRAFORM_CMD init

if [[ $ACTION == "Apply" ]]; then
if [[ $DRY_RUN == "True" ]]; then
cdktf plan --skip-synth --output "$ER_OUTDIR"
$TERRAFORM_CMD plan -out=plan --lock=false
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plan can write to state, we should use -refresh=false during plan to ensure no concurrent write, no sure if --lock=false still needed when no write, maybe need to add a terraform refresh part to detect drift separately.

Copy link
Contributor Author

@lechuk47 lechuk47 Jan 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure a plan can write the state? Is that documented anywhere?

In my understanding, refresh-false won't get the current configuration from AWS, hence the plan shown to users won't be reliable.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it used to write, because plan includes refresh by default, it seems 0.14+ version changed that to in memory, check https://discuss.hashicorp.com/t/why-does-a-plan-lock-the-state-file/3520 and https://developer.hashicorp.com/terraform/tutorials/state/refresh. Need to confirm with the version we are running by creating a drift then run terraform plan, see if remote state updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants