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

Generate independet objects for terraform-state resources #1102

Merged
merged 5 commits into from
Feb 23, 2022

Conversation

viniciusdc
Copy link
Contributor

Fixes | Closes | Resolves #1082

This PR should fix the above-linked issue by creating specific groups, containers, and storage resources for terraform-state files.

Changes introduced in this PR:

  • Update resource group name, for terraform state stage
  • Update backend configuration following the same changes
  • Add a new variable to deploy for the custom resource group name (in theory)

Types of changes

What types of changes does your PR introduce?

Put an x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a feature)
  • Breaking change (fix or feature that would cause existing features to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Other (please describe):

Testing

Requires testing

  • Yes
  • No

In case you checked yes, did you write tests?

  • Yes
  • No

Copy link
Member

@costrouc costrouc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@viniciusdc this looks good to me. Can you verify that you can redeploy (without doing destroy in between) and delete the stages directory. I want to check that the terraform import is working as expected.

@viniciusdc
Copy link
Contributor Author

Hi @costrouc, testing results:

  • Just simple redeploying worked fine, even updating the qhub-config lead to no issue
  • Deleting the stages/ dir and redeplogin lead to the folowing error:
[terraform]: │ Error: A resource with the ID "/subscriptions/********/resourceGroups/qhubstages-dev-state" already exists - to be 
[terraform]: | managed via Terraform this resource needs to be imported into the State. Please see the resource documentation
[terraform]: | for "azurerm_resource_group" for more information.
[terraform]: │ 
[terraform]: │   with module.terraform-state.azurerm_resource_group.terraform-state-resource-group,
[terraform]: │   on modules/terraform-state/main.tf line 1, in resource "azurerm_resource_group" "terraform-state-resource-group":
[terraform]: │    1: resource "azurerm_resource_group" "terraform-state-resource-group" {
[terraform]: │ 
[terraform]: ╵

@viniciusdc
Copy link
Contributor Author

Ok, so I forgot to add the correct resource names for the state blocks, so the generated import-config didn't match what was previously submitted.

@viniciusdc viniciusdc requested a review from costrouc February 22, 2022 23:55
Copy link
Member

@costrouc costrouc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome thanks for this quick worker @viniciusdc 😄

@costrouc costrouc merged commit 1a94f8e into main Feb 23, 2022
@costrouc costrouc deleted the fix-1082-azure branch February 23, 2022 01:03
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

Successfully merging this pull request may close these issues.

[bug] Qhub Azure deploy fails when remote state is activated
2 participants