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

Wraping var.log_analytics_solution_id with an object so we can create an azurerm_log_analytics_solution outside this module and pass id as a variable. #263

Closed
1 task done
lonegunmanb opened this issue Sep 30, 2022 · 0 comments · Fixed by #265
Milestone

Comments

@lonegunmanb
Copy link
Member

Is there an existing issue for this?

  • I have searched the existing issues

Description

Now we're using count = var.log_analytics_workspace_enabled && var.log_analytics_solution_id == null ? 1 : 0 to determine whether we should create an azurerm_log_analytics_solution or not, that requires the var.log_analytics_solution_id is a known value during terraform plan. If we'd like to create a custom solution and pass it's id via this variable, it'll raise an error. It'll be nice if we can wrap this var.log_analytics_solution_id with an object, just like what we've done with var.log_analytics_workspace.

New or Affected Resource(s)/Data Source(s)

azurerm_log_analytics_solution, var.log_analytics_solution_id

Potential Terraform Configuration

variable "log_analytics_solution" {
  type = object({
    id = string
  })
  description = "(Optional) Existing azurerm_log_analytics_solution ID. Providing ID disables creation of azurerm_log_analytics_solution."
  default     = null
  nullable    = true
  validation {
    condition = var.log_analytics_solution == null ? true : (var.log_analytics_solution.id != null)
    error_message = "`var.log_analytics_solution.id` is required when `var.log_analytics_solution` is not `null`."
  }
}

References

Due to Terraform's binary operator is not short-circuit I'm using:

condition = var.log_analytics_solution == null ? true : (var.log_analytics_solution.id != null)

instead of:

condition = var.log_analytics_solution == null || var.log_analytics_solution.id != null
@lonegunmanb lonegunmanb changed the title Support for wraping var.log_analytics_solution_id with an object so we can create an azurerm_log_analytics_solution outside this module and pass id as a variable. Wraping var.log_analytics_solution_id with an object so we can create an azurerm_log_analytics_solution outside this module and pass id as a variable. Sep 30, 2022
lonegunmanb added a commit to lonegunmanb/terraform-azurerm-aks that referenced this issue Oct 10, 2022
Add symbolic links notice in the readme.
lonegunmanb added a commit to lonegunmanb/terraform-azurerm-aks that referenced this issue Oct 18, 2022
Add symbolic links notice in the readme.
lonegunmanb added a commit that referenced this issue Oct 18, 2022
Add symbolic links notice in the readme.
lonegunmanb added a commit that referenced this issue Oct 18, 2022
Add symbolic links notice in the readme.
lonegunmanb added a commit to lonegunmanb/terraform-azurerm-aks that referenced this issue Oct 18, 2022
Add symbolic links notice in the readme.
lonegunmanb added a commit to lonegunmanb/terraform-azurerm-aks that referenced this issue Nov 1, 2022
Add symbolic links notice in the readme.
lonegunmanb added a commit to lonegunmanb/terraform-azurerm-aks that referenced this issue Nov 10, 2022
Add symbolic links notice in the readme.
@lonegunmanb lonegunmanb added this to the 7.0.0 milestone Mar 8, 2023
lonegunmanb added a commit that referenced this issue Apr 10, 2023
Add symbolic links notice in the readme.
lonegunmanb added a commit to lonegunmanb/terraform-azurerm-aks that referenced this issue Apr 11, 2023
Add symbolic links notice in the readme.
jiaweitao001 added a commit that referenced this issue Apr 12, 2023
[Breaking]  Wrap `log_analytics_solution_id` to an object to fix #263.
skolobov pushed a commit to skolobov/terraform-azurerm-aks that referenced this issue Oct 29, 2023
Add symbolic links notice in the readme.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant