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

Replace data source lookup for "azurerm_resource_group" with variables to avoid resources recreation issue when re-applying the module #102

Closed
wants to merge 6 commits into from

Conversation

nitinnbisht
Copy link

@nitinnbisht nitinnbisht commented May 31, 2021

FIxes #105
Changes proposed in the pull request:
When testing in terraform v13,14,15 - The current module results in recreation of cluster in consecutive apply due to the unwanted diff generated by data source lookup of location from the resource group. The fix in the PR proposes using variable for location in-place of a data source lookup to resolve this issue.

The data source lookup responsible:

 data "azurerm_resource_group" "main" {  
  name = var.resource_group_name
  }

Terraform plan using the module results in certain resources to force replacement, PFB

# module.aks.azurerm_kubernetes_cluster.main must be replaced
-/+ resource "azurerm_kubernetes_cluster" "main" {
      - api_server_authorized_ip_ranges = [] -> null
      - enable_pod_security_policy      = false -> null
---
      ~ location                        = "westeurope" -> (known after apply) # forces replacement
---
    }

  # module.aks.azurerm_log_analytics_solution.main[0] must be replaced
-/+ resource "azurerm_log_analytics_solution" "main" {
---
      ~ location              = "westeurope" -> (known after apply) # forces replacement
---
        }
    }

  # module.aks.azurerm_log_analytics_workspace.main[0] must be replaced
-/+ resource "azurerm_log_analytics_workspace" "main" {
 ---
      ~ location                   = "westeurope" -> (known after apply) # forces replacement
 ---
    }

@ghost
Copy link

ghost commented May 31, 2021

CLA assistant check
All CLA requirements met.

@nitinnbisht nitinnbisht changed the title cluster and other resources recreation issue when re-applying the module Cluster and other resources recreation issue when re-applying the module May 31, 2021
@nitinnbisht nitinnbisht changed the title Cluster and other resources recreation issue when re-applying the module Replace data source lookup for "azurerm_resource_group" with variables to avoid resources recreation issue when re-applying the module May 31, 2021
@fplantinga-guida
Copy link

+1. We experience resource recreation as well when using data source lookups

@nitinnbisht
Copy link
Author

Any updates for this?

@github-actions
Copy link
Contributor

MAIN BRANCH PUSH DETECTED DUE TO #241, THIS PR WILL BE UPDATED.

@github-actions
Copy link
Contributor

MAIN BRANCH PUSH DETECTED DUE TO #, THIS PR WILL BE UPDATED.

1 similar comment
@github-actions
Copy link
Contributor

MAIN BRANCH PUSH DETECTED DUE TO #, THIS PR WILL BE UPDATED.

@github-actions
Copy link
Contributor

MAIN BRANCH PUSH DETECTED DUE TO #, THIS PR NEED TO BE UPDATED TO TRIGGER CI.

@lonegunmanb
Copy link
Member

I'm closing this pr since we've implemented this feature in #172. Thanks folks.

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.

Cannot override cluster location
4 participants