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: add retry step to terragrunt apply #444

Closed
wants to merge 5 commits into from

Conversation

samuelarogbonlo
Copy link
Contributor

Summary of changes
Changes introduced in this pull request:

  • add retry step to terragrunt apply

Reference issue to close (if applicable)

Partof #424

Other information and links

@samuelarogbonlo samuelarogbonlo requested a review from a team as a code owner May 10, 2024 13:35
@samuelarogbonlo samuelarogbonlo requested review from LesnyRumcajs and aatifsyed and removed request for a team May 10, 2024 13:35
Copy link

github-actions bot commented May 10, 2024

Forest: forest-calibnet Infrastructure Plan: success

Show Plan
local_sensitive_file.bootstrap_script: Refreshing state... [id=c58ad2bc337a858d708a500567d5f6adc10c68c4]
data.digitalocean_project.forest_project: Reading...
data.digitalocean_ssh_keys.keys: Reading...
data.digitalocean_ssh_keys.keys: Read complete after 0s [id=ssh_keys/8656000852680004208]
digitalocean_droplet.forest: Refreshing state... [id=417938626]
digitalocean_firewall.forest_firewall: Refreshing state... [id=78cd36bd-6771-4e0c-94d0-8ab39481a0bb]
data.digitalocean_project.forest_project: Read complete after 1s [id=da5e6601-7fd9-4d02-951e-390f7feb3411]
digitalocean_project_resources.connect_forest_project: Refreshing state... [id=da5e6601-7fd9-4d02-951e-390f7feb3411]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # local_sensitive_file.bootstrap_script will be created
  + resource "local_sensitive_file" "bootstrap_script" {
      + content              = (sensitive value)
      + content_base64sha256 = (known after apply)
      + content_base64sha512 = (known after apply)
      + content_md5          = (known after apply)
      + content_sha1         = (known after apply)
      + content_sha256       = (known after apply)
      + content_sha512       = (known after apply)
      + directory_permission = "0700"
      + file_permission      = "0700"
      + filename             = "bootstrap.bash"
      + id                   = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: /home/runner/work/forest-iac/forest-iac/tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "/home/runner/work/forest-iac/forest-iac/tfplan"

Copy link

github-actions bot commented May 10, 2024

Forest: forest-mainnet Infrastructure Plan: success

Show Plan
data.digitalocean_project.forest_project: Reading...
data.digitalocean_ssh_keys.keys: Reading...
local_sensitive_file.bootstrap_script: Refreshing state... [id=294e7ef9578337cda4789472e42c604a7a03d7d5]
data.digitalocean_ssh_keys.keys: Read complete after 0s [id=ssh_keys/8656000852680004208]
digitalocean_droplet.forest: Refreshing state... [id=417938820]
digitalocean_firewall.forest_firewall: Refreshing state... [id=d711124f-d654-4399-8d12-d62e6f452398]
data.digitalocean_project.forest_project: Read complete after 1s [id=da5e6601-7fd9-4d02-951e-390f7feb3411]
digitalocean_project_resources.connect_forest_project: Refreshing state... [id=da5e6601-7fd9-4d02-951e-390f7feb3411]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # local_sensitive_file.bootstrap_script will be created
  + resource "local_sensitive_file" "bootstrap_script" {
      + content              = (sensitive value)
      + content_base64sha256 = (known after apply)
      + content_base64sha512 = (known after apply)
      + content_md5          = (known after apply)
      + content_sha1         = (known after apply)
      + content_sha256       = (known after apply)
      + content_sha512       = (known after apply)
      + directory_permission = "0700"
      + file_permission      = "0700"
      + filename             = "bootstrap.bash"
      + id                   = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: /home/runner/work/forest-iac/forest-iac/tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "/home/runner/work/forest-iac/forest-iac/tfplan"

Copy link

github-actions bot commented May 10, 2024

Forest: forest-butterflynet Infrastructure Plan: success

Show Plan
local_sensitive_file.bootstrap_script: Refreshing state... [id=d2a6cdedab4cda47e44a4a2c9e8148ac8728df78]
data.digitalocean_project.forest_project: Reading...
data.digitalocean_ssh_keys.keys: Reading...
data.digitalocean_ssh_keys.keys: Read complete after 0s [id=ssh_keys/8656000852680004208]
digitalocean_droplet.forest: Refreshing state... [id=417978594]
digitalocean_firewall.forest_firewall: Refreshing state... [id=72f20b31-da0d-4200-bdbe-8c69d6448f80]
data.digitalocean_project.forest_project: Read complete after 2s [id=da5e6601-7fd9-4d02-951e-390f7feb3411]
digitalocean_project_resources.connect_forest_project: Refreshing state... [id=da5e6601-7fd9-4d02-951e-390f7feb3411]

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  + create

Terraform will perform the following actions:

  # local_sensitive_file.bootstrap_script will be created
  + resource "local_sensitive_file" "bootstrap_script" {
      + content              = (sensitive value)
      + content_base64sha256 = (known after apply)
      + content_base64sha512 = (known after apply)
      + content_md5          = (known after apply)
      + content_sha1         = (known after apply)
      + content_sha256       = (known after apply)
      + content_sha512       = (known after apply)
      + directory_permission = "0700"
      + file_permission      = "0700"
      + filename             = "bootstrap.bash"
      + id                   = (known after apply)
    }

Plan: 1 to add, 0 to change, 0 to destroy.

─────────────────────────────────────────────────────────────────────────────

Saved the plan to: /home/runner/work/forest-iac/forest-iac/tfplan

To perform exactly these actions, run the following command to apply:
    terraform apply "/home/runner/work/forest-iac/forest-iac/tfplan"

Signed-off-by: samuelarogbonlo <[email protected]>
@@ -155,7 +161,22 @@ runs:
else
echo "Changes detected. Redeploying everything..."
terragrunt destroy -auto-approve --terragrunt-non-interactive
Copy link
Member

Choose a reason for hiding this comment

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

I believe this is the issue that should be addressed. We should use lifecycle.create_before_destroy and not force-destroy the resource - it should get destroyed after the new one is created successfully, leaving it untouched in case of errors. What do you think? We can do it in a separate issue/PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah makes sense. i will implement in this PR

@ruseinov ruseinov self-requested a review May 13, 2024 12:28
@LesnyRumcajs
Copy link
Member

@samuelarogbonlo The lifecycle.create_before_destroy won't work if we do terragrunt destroy -auto-approve --terragrunt-non-interactive, no?

@samuelarogbonlo
Copy link
Contributor Author

@samuelarogbonlo The lifecycle.create_before_destroy won't work if we do terragrunt destroy -auto-approve --terragrunt-non-interactive, no?

@LesnyRumcajs, lifecycle.create_before_destroy is useless in this current set-up will remove.

@samuelarogbonlo samuelarogbonlo marked this pull request as draft July 15, 2024 09:54
@LesnyRumcajs
Copy link
Member

Given we only have sync check now, it doesn't seem required.

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.

4 participants