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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_mssql_server systemassigned identity not idempotent #26534

Open
1 task done
IEP-Brewin opened this issue Jul 3, 2024 · 3 comments
Open
1 task done

azurerm_mssql_server systemassigned identity not idempotent #26534

IEP-Brewin opened this issue Jul 3, 2024 · 3 comments
Labels
service/mssql Microsoft SQL Server v/3.x

Comments

@IEP-Brewin
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.9.1

AzureRM Provider Version

3.110.0

Affected Resource(s)/Data Source(s)

azurerm_mssql_server

Terraform Configuration Files

terraform {
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "3.110.0"
    }
  }
}

provider "azurerm" {
  features{}
}

resource "azurerm_resource_group" "example" {
  name     = "database-rg"
  location = "West Europe"
}

resource "azurerm_mssql_server" "example" {
  name                         = "mssqlserverxyz123"
  resource_group_name          = azurerm_resource_group.example.name
  location                     = azurerm_resource_group.example.location
  version                      = "12.0"
  administrator_login          = "adminuser"
  administrator_login_password = "thisIsKat11"
  minimum_tls_version          = "1.2"

  identity {
    type         = "SystemAssigned"
  }

  tags = {
    environment = "production"
  }
}

output "identity" {
  value = azurerm_mssql_server.example.identity
}

Debug Output/Panic Output

Terraform Apply
Terraform Plan


~identity {
  + identity_ids = []
}

Expected Behaviour

The Terraform plan (after apply) should not show anything new.

Actual Behaviour

The Terraform planTerraform plan shows...

~identity {

identity_ids = []
}

(after apply) should not show anything new.

Steps to Reproduce

Terraform Apply
Terraform plan

Important Factoids

Identity = SystemAssigned

References

Looks similar to issue: https://github.com/hashicorp/terraform-provider-azurerm/issues/19216

@github-actions github-actions bot added service/mssql Microsoft SQL Server v/3.x labels Jul 3, 2024
@xuzhang3
Copy link
Contributor

xuzhang3 commented Jul 4, 2024

@IEP-Brewin This is not a AzureRM issue, this is the Terraform feature. You can use toset instead of the default tolist to bypass this issue

output "identity" {
  value = toset(azurerm_mssql_server.example.identity)
}

@IEP-Brewin
Copy link
Author

I think I might have confused the situation by adding the output to the example code. Please disregard it. Then run a plan and apply to see the behaviour.

@xuzhang3
Copy link
Contributor

xuzhang3 commented Jul 5, 2024

Cannot reproduce this error. Nothing happens. The diff only occurs when output enabled.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/mssql Microsoft SQL Server v/3.x
Projects
None yet
Development

No branches or pull requests

2 participants