[x] Upgrade Terraspace: Are you using the latest version of Terraspace? This allows Terraspace to fix issues fast. There's an Upgrading Guide: https://terraspace.cloud/docs/misc/upgrading/
[x] Reproducibility: Are you reporting a bug others will be able to reproduce and not asking a question. If you're unsure or want to ask a question, do so on https://community.boltops.com
[ ] Code sample: Have you put together a code sample to reproduce the issue and make it available? Code samples help speed up fixes dramatically. If it's an easily reproducible issue, then code samples are not needed. If you're unsure, please include a code sample.
My Environment
Software
Version
Operating System
Mac OS 12.6
Terraform
v 1.3.0
Terraspace
v 2.2.2
Ruby
v 3.0.0
Expected Behaviour
terraspace plan app1 -detailed-exitcode should return a detailed-exitcode value of '2' if the plan is successful with a diff to apply.
(This only happens with terraspace > 1.1.7)
Current Behavior
The detailed exit code returned by terraspace is '1'. However when I run terraform plan -detailed-exitcode in the .terraspace-cache folder, I can confirm that terraform returns an exit code of '2' as expected.
Step-by-step reproduction instructions
terraspace plan locks -detailed-exitcode
Terraspace Plan Output and Debug Logs
Terraform will perform the following actions:
azurerm_management_lock.rg_infnet_lock will be destroyed
(because azurerm_management_lock.rg_infnet_lock is not in configuration)
- resource "azurerm_management_lock" "rg_infnet_lock" {
- id = "HIDDEN" -> null
- lock_level = "CanNotDelete" -> null
- name = "rg-us-psoi-pa-inf-net-del-lock" -> null
- notes = "Notes for the lock on the rg rg-us-psoi-pa-inf-net" -> null
- scope = "HIDDEN" -> null
}
Plan: 0 to add, 0 to change, 1 to destroy.
D, [2022-09-22T10:22:45.240901 #65241] DEBUG -- : Backend change detected. Removing .terraspace-cache for complete reinitialization
I, [2022-09-22T10:22:45.259374 #65241] INFO -- : Building .terraspace-cache/canadacentral/dev/stacks/locks
D, [2022-09-22T10:22:45.275059 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/backend.tf
D, [2022-09-22T10:22:45.284073 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/provider.tf
D, [2022-09-22T10:22:45.294366 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/00-main.tf
D, [2022-09-22T10:22:45.303008 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/01-aks-clusters-lock.tf
D, [2022-09-22T10:22:45.312175 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/02-resource-groups-lock.tf
D, [2022-09-22T10:22:45.320726 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/03-storage-accounts-locks.tf
D, [2022-09-22T10:22:45.328964 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/README.md
D, [2022-09-22T10:22:45.337935 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/config.auto.tfvars
D, [2022-09-22T10:22:45.347094 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/variables.tf
D, [2022-09-22T10:22:45.348082 #65241] DEBUG -- : Layers for locks:
D, [2022-09-22T10:22:45.348381 #65241] DEBUG -- : Built in .terraspace-cache/canadacentral/dev/stacks/locks
I, [2022-09-22T10:22:46.954640 #65241] INFO -- : Current directory: .terraspace-cache/canadacentral/dev/stacks/locks
D, [2022-09-22T10:22:47.949776 #65241] DEBUG -- : Resource Group rg-us-psoi-pa-inf-cicd already exists
D, [2022-09-22T10:22:48.741369 #65241] DEBUG -- : Storage Account pccstguspainftf already exists
D, [2022-09-22T10:22:49.193802 #65241] DEBUG -- : Storage Blob Container psoi-inrastructure-terraform-state already exists
I, [2022-09-22T10:22:49.195339 #65241] INFO -- : => terraform init -get -input=false >> /tmp/terraspace/log/init/locks.log
I, [2022-09-22T10:23:02.842429 #65241] INFO -- : => terraform plan -detailed-exitcode -input=false
Code Sample
terraspace plan app1 -detailed-exitcode (ensure there is a diff to apply)
echo $? (validate exitcode is 1 where it should be 2)
Checklist
My Environment
Expected Behaviour
terraspace plan app1 -detailed-exitcode should return a detailed-exitcode value of '2' if the plan is successful with a diff to apply. (This only happens with terraspace > 1.1.7)
Current Behavior
The detailed exit code returned by terraspace is '1'. However when I run terraform plan -detailed-exitcode in the .terraspace-cache folder, I can confirm that terraform returns an exit code of '2' as expected.
Step-by-step reproduction instructions
Terraspace Plan Output and Debug Logs
Terraform will perform the following actions: azurerm_management_lock.rg_infnet_lock will be destroyed (because azurerm_management_lock.rg_infnet_lock is not in configuration) - resource "azurerm_management_lock" "rg_infnet_lock" { - id = "HIDDEN" -> null - lock_level = "CanNotDelete" -> null - name = "rg-us-psoi-pa-inf-net-del-lock" -> null - notes = "Notes for the lock on the rg rg-us-psoi-pa-inf-net" -> null - scope = "HIDDEN" -> null } Plan: 0 to add, 0 to change, 1 to destroy. D, [2022-09-22T10:22:45.240901 #65241] DEBUG -- : Backend change detected. Removing .terraspace-cache for complete reinitialization I, [2022-09-22T10:22:45.259374 #65241] INFO -- : Building .terraspace-cache/canadacentral/dev/stacks/locks D, [2022-09-22T10:22:45.275059 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/backend.tf D, [2022-09-22T10:22:45.284073 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/provider.tf D, [2022-09-22T10:22:45.294366 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/00-main.tf D, [2022-09-22T10:22:45.303008 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/01-aks-clusters-lock.tf D, [2022-09-22T10:22:45.312175 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/02-resource-groups-lock.tf D, [2022-09-22T10:22:45.320726 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/03-storage-accounts-locks.tf D, [2022-09-22T10:22:45.328964 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/README.md D, [2022-09-22T10:22:45.337935 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/config.auto.tfvars D, [2022-09-22T10:22:45.347094 #65241] DEBUG -- : Created .terraspace-cache/canadacentral/dev/stacks/locks/variables.tf D, [2022-09-22T10:22:45.348082 #65241] DEBUG -- : Layers for locks: D, [2022-09-22T10:22:45.348381 #65241] DEBUG -- : Built in .terraspace-cache/canadacentral/dev/stacks/locks I, [2022-09-22T10:22:46.954640 #65241] INFO -- : Current directory: .terraspace-cache/canadacentral/dev/stacks/locks D, [2022-09-22T10:22:47.949776 #65241] DEBUG -- : Resource Group rg-us-psoi-pa-inf-cicd already exists D, [2022-09-22T10:22:48.741369 #65241] DEBUG -- : Storage Account pccstguspainftf already exists D, [2022-09-22T10:22:49.193802 #65241] DEBUG -- : Storage Blob Container psoi-inrastructure-terraform-state already exists I, [2022-09-22T10:22:49.195339 #65241] INFO -- : => terraform init -get -input=false >> /tmp/terraspace/log/init/locks.log I, [2022-09-22T10:23:02.842429 #65241] INFO -- : => terraform plan -detailed-exitcode -input=falseCode Sample
terraspace plan app1 -detailed-exitcode (ensure there is a diff to apply)
echo $? (validate exitcode is 1 where it should be 2)