在不删除资源组中现有Azure函数的情况下创建新Azure函数应用程序
我有一个资源组,它已经有一些功能应用程序。我现在想使用Terraform在同一资源组中部署更多功能应用程序。问题是,当我运行Terraform plan时,它告诉我以前的资源将被删除,新资源将被创建。我想让以前的资源保持原样。我复制了下面的代码。地形规划的结果是创建了5个资源,删除了5个资源在不删除资源组中现有Azure函数的情况下创建新Azure函数应用程序,azure,terraform,azure-function-app,Azure,Terraform,Azure Function App,我有一个资源组,它已经有一些功能应用程序。我现在想使用Terraform在同一资源组中部署更多功能应用程序。问题是,当我运行Terraform plan时,它告诉我以前的资源将被删除,新资源将被创建。我想让以前的资源保持原样。我复制了下面的代码。地形规划的结果是创建了5个资源,删除了5个资源 variable "resource_group_name" { type = string } variable "location" { type = string } variable "
variable "resource_group_name" {
type = string
}
variable "location" {
type = string
}
variable "resource_name" {
type = string
}
resource "random_string" "random" {
length = 9
special = false
number = true
upper = false
}
variable "storage_account_tier" {
type = string
default = "Standard"
}
variable "storage_account_type" {
type = string
default = "LRS"
}
variable "service_plan_name" {
type = string
}
variable "service_plan_tier" {
type = string
default = "Standard"
}
variable "service_plan_size" {
type = string
default = "S1"
}
resource "azurerm_resource_group" "example" {
name = var.resource_group_name
location = var.location
}
resource "azurerm_storage_account" "example" {
name = replace(join(",",["storageaccount",random_string.random.result]),",","")
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = var.storage_account_tier
account_replication_type = var.storage_account_type
}
resource "azurerm_app_service_plan" "example" {
name = var.service_plan_name
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku {
tier = var.service_plan_tier
size = var.service_plan_size
}
}
resource "azurerm_function_app" "example" {
name = var.resource_name
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
app_service_plan_id = azurerm_app_service_plan.example.id
storage_connection_string = azurerm_storage_account.example.primary_connection_string
}
我曾在Terraform上工作,用于在AWS上创建基础设施,并使用AWS资源解决了这个问题。如果您可以粘贴您的
terraform plan
输出作为回复,我可能能够回答这个问题。我曾在terraform上工作,用于在AWS上创建基础设施,并使用AWS资源解决了这个问题。如果您可以粘贴您的terraform平面图
输出作为回复,我可能能够回答这个问题。平面图是什么样子的?你能编辑你的问题,包括一个复制问题的答案吗?计划中说创建了5个资源,删除了5个资源。很遗憾,我无法附加图像。请将文本复制并粘贴到您的问题中。不要把它当作一个形象。这个计划是什么样子的?你能编辑你的问题,包括一个复制问题的答案吗?计划中说创建了5个资源,删除了5个资源。很遗憾,我无法附加图像。请将文本复制并粘贴到您的问题中。不要把它当作一个形象。