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

[bug] Qhub Azure deploy fails when remote state is activated #1082

Closed
viniciusdc opened this issue Feb 19, 2022 · 0 comments · Fixed by #1102
Closed

[bug] Qhub Azure deploy fails when remote state is activated #1082

viniciusdc opened this issue Feb 19, 2022 · 0 comments · Fixed by #1102
Assignees
Labels
area: terraform 💾 provider: Azure status: in progress 🏗 This task is currently being worked on type: bug 🐛 Something isn't working

Comments

@viniciusdc
Copy link
Contributor

Describe the bug

According to some recent intagration tests logs, it seems that qhub is trying to create two resource groups with the same name, resulting in the error below:

[terraform]: azurerm_resource_group.resource_group: Creating...
[terraform]: ╷
[terraform]: │ Error: A resource with the ID "/subscriptions/***/resourceGroups/<rg-name>" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_resource_group" for more information.
[terraform]: │ 
[terraform]: │   with azurerm_resource_group.resource_group,
[terraform]: │   on main.tf line 1, in resource "azurerm_resource_group" "resource_group":
[terraform]: │    1: resource "azurerm_resource_group" "resource_group" {
[terraform]: │ 
[terraform]: ╵

the error seems to be caused by the presence of another resource group created during 01-terraform-state stage:

INFO:qhub.provider.terraform:terraform apply directory=stages/01-terraform-state/azure targets=[]
INFO:qhub.provider.terraform: terraform at /tmp/terraform/1.0.5/terraform
[terraform]: 
[terraform]: Terraform used the selected providers to generate the following execution
[terraform]: plan. Resource actions are indicated with the following symbols:
[terraform]:   + create
[terraform]: 
[terraform]: Terraform will perform the following actions:
[terraform]: 
[terraform]:   # module.terraform-state.azurerm_resource_group.terraform-resource-group will be created
[terraform]:   + resource "azurerm_resource_group" "terraform-resource-group" {
[terraform]:       + id       = (known after apply)
[terraform]:       + location = "eastus"
[terraform]:       + name     = "<rg-name>"
[terraform]:     }
...
[terraform]: module.terraform-state.azurerm_resource_group.terraform-resource-group: Creating...
[terraform]: module.terraform-state.azurerm_resource_group.terraform-resource-group: Creation complete after 1s [id=/subscriptions/***/resourceGroups/<rg-name>]

The possible solution here would be

  • removing the resource group creation (and any possible duplicate resource) from the 01 stage -- this might not be feasible depending on the reason it was in there
  • Using the new python dynamic system to overwrite the 02 stage to import the necessary resources to state using data

Expected behaviour

  • A successeful deployment of an Azure qhub cluster

How to reproduce

  • deploy qhub from main and initialize an Azure deployment with terraform-state=remote
@trallard trallard moved this to Needs Triage 🔍 in QHub Project Mangement 🚀 Feb 21, 2022
@viniciusdc viniciusdc self-assigned this Feb 22, 2022
@viniciusdc viniciusdc added the status: in progress 🏗 This task is currently being worked on label Feb 22, 2022
Repository owner moved this from Needs Triage 🔍 to Done 💪🏾 in QHub Project Mangement 🚀 Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: terraform 💾 provider: Azure status: in progress 🏗 This task is currently being worked on type: bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant