-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_function_app doesn't handle 'identity' property as modify/destroy-create when principal ID outputted #5663
Comments
hey @brandonh-msft Thanks for opening this issue. Taking a look into this I believe this has been fixed via #5676 which will ship as a part of v1.44 of the Azure Provider - as such I'm going to tag this with that Milestone so that @hashibot will comment when that's released - however since I believe this issue's been resolved by #5676 I'm going to close this issue for the moment. Thanks! |
This has been released in version 1.44.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 1.44.0"
}
# ... other configuration ... |
Nope, still exists. Please reopen @tombuildsstuff Updated HCL#Set the terraform required version
terraform {
required_version = ">= 0.12.6"
}
# Configure the Azure Provider
provider "azurerm" {
# It is recommended to pin to a given version of the Provider
version = "=1.44"
}
variable "prefix" {
type = string
}
variable "sampleName" {
type = string
default = "terraform-functions-msi-bug"
}
variable "location" {
type = string
default = "West US 2"
}
resource "azurerm_resource_group" "rg" {
name = "${var.prefix}-rg"
location = var.location
tags = {
sample = var.sampleName
}
}
resource "azurerm_storage_account" "fxnstor" {
name = "${var.prefix}fxnssa"
resource_group_name = azurerm_resource_group.rg.name
location = var.location
account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"
tags = {
sample = var.sampleName
}
}
resource "azurerm_app_service_plan" "fxnapp" {
name = "${var.prefix}-fxn-asp"
location = var.location
resource_group_name = azurerm_resource_group.rg.name
kind = "functionapp"
sku {
tier = "Dynamic"
size = "Y1"
}
tags = {
sample = var.sampleName
}
}
resource "azurerm_function_app" "fxn" {
name = "${var.prefix}-fxn"
location = var.location
resource_group_name = azurerm_resource_group.rg.name
app_service_plan_id = azurerm_app_service_plan.fxnapp.id
storage_connection_string = azurerm_storage_account.fxnstor.primary_connection_string
version = "~2"
tags = {
sample = var.sampleName
}
# identity {
# type = "SystemAssigned"
# }
lifecycle {
ignore_changes = [
app_settings
]
}
}
# output "functionPrincipal" {
# value = azurerm_function_app.identity[0].principal_id
# }
tf init and tf apply :
Then update the HCL to use the `identity` pieces ...#Set the terraform required version
terraform {
required_version = ">= 0.12.6"
}
# Configure the Azure Provider
provider "azurerm" {
# It is recommended to pin to a given version of the Provider
version = "=1.44"
}
variable "prefix" {
type = string
}
variable "sampleName" {
type = string
default = "terraform-functions-msi-bug"
}
variable "location" {
type = string
default = "West US 2"
}
resource "azurerm_resource_group" "rg" {
name = "${var.prefix}-rg"
location = var.location
tags = {
sample = var.sampleName
}
}
resource "azurerm_storage_account" "fxnstor" {
name = "${var.prefix}fxnssa"
resource_group_name = azurerm_resource_group.rg.name
location = var.location
account_tier = "Standard"
account_replication_type = "LRS"
account_kind = "StorageV2"
tags = {
sample = var.sampleName
}
}
resource "azurerm_app_service_plan" "fxnapp" {
name = "${var.prefix}-fxn-asp"
location = var.location
resource_group_name = azurerm_resource_group.rg.name
kind = "functionapp"
sku {
tier = "Dynamic"
size = "Y1"
}
tags = {
sample = var.sampleName
}
}
resource "azurerm_function_app" "fxn" {
name = "${var.prefix}-fxn"
location = var.location
resource_group_name = azurerm_resource_group.rg.name
app_service_plan_id = azurerm_app_service_plan.fxnapp.id
storage_connection_string = azurerm_storage_account.fxnstor.primary_connection_string
version = "~2"
tags = {
sample = var.sampleName
}
identity {
type = "SystemAssigned"
}
lifecycle {
ignore_changes = [
app_settings
]
}
}
output "functionPrincipal" {
value = azurerm_function_app.identity[0].principal_id
} And now re-run
|
ping @tombuildsstuff |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Community Note
Terraform (and AzureRM Provider) Version
Terraform v0.12.20
Affected Resource(s)
Utilize this git repo for reproduction
azurerm_function_app
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
The expected behavior is a SystemAssigned Identity should be given to the Function app, then output as part of
tf apply
.This could happen either by a "modify" or a "destroy, create" path - doesn't matter (modify preferable, though).
Actual Behavior
Steps to Reproduce
terraform apply
on the HCL above. You should getidentity
andoutput
blocksterraform apply
againThe text was updated successfully, but these errors were encountered: