Closed pilchkinstein-perspectum closed 2 years ago
@tongueroo I've spent about 24hrs trying to isolate and describe the steps to reproduce this issue. It is not intermittent on our codebase but I'm afraid I cant share all of that with you. I think I've demonstrated part of the problem (an error due to incorrect versions being selected) but I cant demonstrate the fatal that we see at our place.
After upgrading to Terraspace 1.1.7 we dont see this issue
Checklist
My Environment
Expected Behaviour
Terraspace should allow different stacks to use different provider versions
Current Behavior
Terraspace downloads the latest version of a provider and then fails during the plan/up/down stage with an error such as
The error we observe appears to be related to a 3-tier dependency and sourcing remote terraform modules. While trying to replicate the issue for this report I could only demonstrate that the providers downloaded during the Downloading tfstate files for dependencies defined in tfvars... stage were not the ones declared within the stack itself. This did not cause the version constraint error above. I cannot rule out that it is our Terraform module which tips an error which Terraspace proceeds through into the fatal I've listed above
Step-by-step reproduction instructions
terraspace new stack A
terraspace new stack B
terraspace new stack C
TS_ENV=base terraspace seed B
TS_ENV=base terraspace seed C
A/main.tf
B/main.tf
B/tfvars/base.tfvars
C/main.tf
C/tfvars/base.tfvars
terraspace up A
terraspace up B
terraspace clean cache
terraspace plan B
At this point part of the problem is observed The log for B.log shows an init step due to the presence of the child dependency C. Below is the start of the log from our stack which annoyingly I cannot fully reproduce. It's possible to see the 4 lines where the latest version of plugins are installed:-
This shows that something is causing Terraspace to go and download the latest providers for aws, azuread etc - not the ones specified in the providers in either A or B
Code Sample
Solution Suggestion
I propose that terraspace run terraform init within each stack directory (and obey stack specific required_provider constraints) before moving on to the "Downloading tfstate files for dependencies defined in tfvars..." step