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

resource creation in wrong subscription #20

Open
flexwie opened this issue Dec 1, 2022 · 0 comments
Open

resource creation in wrong subscription #20

flexwie opened this issue Dec 1, 2022 · 0 comments

Comments

@flexwie
Copy link

flexwie commented Dec 1, 2022

I am trying to solve the same problem that is answered in this post with Terraspace.

My .env file has both ARM_SUBSCRIPTION_ID set for the subscription that is supposed to hold the resources and ARM_BACKEND_SUBSCRIPTION_ID for the subscription where we are storing our terraform state.

My backend config looks like this:

terraform {
  backend "azurerm" {
    resource_group_name  = "<Name>"
    storage_account_name = "<%= expansion('<NAME>:ENV') %>"
    container_name       = "terraform-state"
    key                  = "<%= expansion(':PROJECT/:LOCATION/:APP/:ROLE/:ENV/:BUILD_DIR/terraform.tfstate') %>"
    subscription_id      = "<%= expansion(':ARM_BACKEND_SUBSCRIPTION_ID') %>"
  }
}

Yet the builder tries to find and create the resource group and storage account in the subscription set in ARM_SUBSCRIPTION_ID. I don't know Ruby but from scanning the code in here it seems that the subscription parameter from the backend block is not read anywhere.

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

No branches or pull requests

1 participant