-
-
Notifications
You must be signed in to change notification settings - Fork 50
Description
Checklist
- 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/
- 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
I've created new storage account for the backend in another subscription, manually moved terraform state, but now terraspace can't access the storage account in another subscription.
Software | Version |
---|---|
Operating System | WSL ubuntu 22.04 x64 |
Terraform | 1.4.0 |
Terraspace | 2.2.15 |
Ruby | 3.3.0 |
Expected Behaviour
Terraspace works with resources in one subscription, specified in ARM_SUBSCRIPTION_ID
variable, and successfully stores the terraform state in the storage account of another subscription without errors.
Current Behavior
Terraspace doesn't care about subscription_id
in backend config,
TS tries to find resource group in the wrong subscription and of cause can't find.
Then TS creates new resource group in the wrong subscription.
Then TS tries to create storage account(which already exists in another subscription).
Then TS tries to create container in the storage account and fails with 404 Not Found error:
logs
Creating Storage Blob Container terraform-state...
Exception Armrest::Error: #Net::HTTPNotFound:0x00007fde4cdfa8e0
/usr/local/bundle/gems/armrest-0.1.3/lib/armrest/api/base.rb:43:in request' /usr/local/bundle/gems/armrest-0.1.3/lib/armrest/api/base.rb:18:in
block (2 levels) in class:Base'
/usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/terraform/runner.rb:51:in block in terraform' /usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/hooks/builder.rb:25:in
run_hooks'
/usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/hooks/concern.rb:6:in run_hooks' /usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/terraform/runner.rb:50:in
terraform'
/usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/terraform/runner.rb:15:in block in run' /usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/terraform/runner.rb:97:in
time_took'
/usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/terraform/runner.rb:14:in run' /usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/cli/init.rb:23:in
block in init'
/usr/local/lib/ruby/3.3.0/timeout.rb:186:in block in timeout' /usr/local/lib/ruby/3.3.0/timeout.rb:41:in
handle_timeout'
/usr/local/lib/ruby/3.3.0/timeout.rb:195:in timeout' /usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/cli/init.rb:22:in
init'
/usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/cli/init.rb:12:in run' /usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/cli/commander.rb:10:in
run'
/usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/cli/plan.rb:43:in plan_only' /usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/cli/plan.rb:17:in
perform'
/usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/cli/plan.rb:11:in run' /usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/cli.rb:165:in
plan'
/usr/local/bundle/gems/thor-1.3.0/lib/thor/command.rb:28:in run' /usr/local/bundle/gems/thor-1.3.0/lib/thor/invocation.rb:127:in
invoke_command'
/usr/local/bundle/gems/thor-1.3.0/lib/thor.rb:527:in dispatch' /usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/command.rb:76:in
dispatch'
/usr/local/bundle/gems/thor-1.3.0/lib/thor/base.rb:584:in start' /usr/local/bundle/gems/terraspace-2.2.15/lib/terraspace/cli/concern.rb:65:in
start'
/usr/local/bundle/gems/terraspace-2.2.15/exe/terraspace:7:in <top (required)>' /usr/local/bundle/bin/terraspace:25:in
load'
/usr/local/bundle/bin/terraspace:25:in `
Step-by-step reproduction instructions
terraspace plan
Code Sample
# config/terraform/backend.tf
terraform {
backend "azurerm" {
subscription_id = "my-another-subscription-id"
...
}
}
Solution Suggestion
Configure azurerm backend plugin to be able to access storage account in another subscription