我们在 azure 中使用 terraform 提供了一个解决方案,其中一个步骤是提供一个函数应用程序
单独的管道在函数应用程序中安装软件函数
当我重新运行 terraform apply (用于更新某些内容)时,软件功能将从 azure 功能应用程序中删除
使用 terraform 版本 1.22 这是预期的行为吗?
从原来的问题延伸出来。我相信今天从 terraform 1.21 到 1.22 的更改为函数应用程序添加了额外的应用程序设置。这似乎重新部署了整个功能应用程序,而不是仅仅添加应用程序设置,并因此破坏了功能,因为功能消失了。
我不确定这是否是一个错误或预期的行为,但至少这是我们没有预料到的。
因为我不想仅仅因为应用程序设置的更改而再次部署某些内容。有人遇到这个问题吗?你有解决办法吗?或者他们的工作流程是我在 terraform 文档中错过的。
额外信息编辑2:
像这样创建的Azure函数
resource "azurerm_function_app" "xxx"{
name = "xxx-status2signalr-func"
location = "${var.region}"
resource_group_name = "${azurerm_resource_group.xxx.name}"
app_service_plan_id = "${azurerm_app_service_plan.xxx.id}"
storage_connection_string = "${azurerm_storage_account.xxx.primary_connection_string}"
enable_builtin_logging = "false"
app_settings {
"blabladosmomethingEventhub" = "${var.blabla-something-eventhub}"
"blabladosomethingChangedEventhubConsumer" = "${var.blabla-dosomething-eventhub-consumer}"
"blablasomethingEventhubConnectionkeyListen" = "${var.xxxblabladosomethingchangedlisten}"
"AzureSignalRConnectionString" = "${azurerm_signalr_service.xxx.primary_connection_string}"
"WEBSITE_RUN_FROM_PACKAGE" = "1"
}
enabled="true"
version="~2"
Run Code Online (Sandbox Code Playgroud)
}
功能创建得很好我们部署了当前使用Visual Studio右键部署功能的软件部分
一切正常
现在我们对 appsettings 键进行了以下更改
resource "azurerm_function_app" "xxx"{ …Run Code Online (Sandbox Code Playgroud) # Using a single workspace:
terraform {
backend "remote" {
hostname = "app.terraform.io"
organization = "company"
workspaces {
name = "my-app-prod"
}
}
}
Run Code Online (Sandbox Code Playgroud)
对于 Terraform 远程后端,是否有一种方法可以使用变量来指定组织/工作区名称而不是那里的硬编码值?
Terraform 文档似乎 也没有提及任何相关内容。
我在单独的 yaml 文件中有 kubernetes 配置。我想在运行 terraform 时使用该 yaml 文件,可以吗?如果是,那么如何。
我在一个租户中有一个服务主体,需要访问另一租户中的 Azure 容器注册表。但是,我不确定如何为其创建 azurerm_role_assignment。有没有办法将服务主体配置为多租户,以便它可以在两个租户中相应地进行角色分配?
azure azure-active-directory terraform terraform-provider-azure azure-rm
我有一个provider块,我想为其提供assume_role属性,但前提是它没有在我的本地计算机上运行。
islocal我在所有环境文件中定义了一个变量.tfvars,只有本地文件的值为true.
这是provider块:
provider "aws" {
region = var.region1
profile = var.islocal == true ? "default" : null # ONLY USED LOCALLY
assume_role { # NOT TO BE USED LOCALLY
role_arn = var.terraform_execution_role
}
}
Run Code Online (Sandbox Code Playgroud)
问题:
role_arn属性设置为null是否会使该assume_role块无效?(即:与不存在相同)assume_role块确实有影响,即使值为role_arn,null我怎样才能在为 时完全删除var.islocal它true?我考虑过动态块,但我不确定如何构建它。
amazon-web-services conditional-statements terraform terraform-provider-azure
我们在 Azure-Devops 中有多个管道执行 Terraform init-plan-apply。到目前为止,工作正常。\n但是突然间,我们在 Init 阶段遇到了这些错误。
\nInitializing the backend...\n\xe2\x95\xb7\n\xe2\x94\x82 Error: Invalid backend configuration argument\n\xe2\x94\x82 \n\xe2\x94\x82 The backend configuration argument "arm_subscription_id" given on the command line is not expected for the selected backend type.\n\xe2\x95\xb5 Error: Invalid backend configuration argument\n\xe2\x94\x82 \n\xe2\x94\x82 The backend configuration argument "arm_tenant_id" .....\n\xe2\x94\x82 The backend configuration argument "arm_client_id" .....\n\xe2\x94\x82 The backend configuration argument "arm_client_secret" ....\nRun Code Online (Sandbox Code Playgroud)\n在hasicorp网站上我发现了一个关于这个https://www.terraform.io/upgrade-guides/0-15.html的评论。\n但是init命令的生成完全是由DevOps完成的,没有地方我可以将arm_client_id更改为client_id(以及其他)。
\n任何人都见过这种行为并能够解决它。
\n使用 Terraform 创建 Azure Front Door 实例时遇到问题。设置应该是非常基本的,但无法找出问题所在。
这是地形脚本
resource "azurerm_frontdoor" "b2cfrontdoor" {
name = "fd-adpb2c-westeurope-dev"
resource_group_name = azurerm_resource_group.b2c.name
enforce_backend_pools_certificate_name_check = true
routing_rule {
name = "routingrule"
accepted_protocols = ["Http", "Https"]
patterns_to_match = ["/*"]
frontend_endpoints = ["b2c-frontdoor-endpoint-dev"]
forwarding_configuration {
forwarding_protocol = "MatchRequest"
backend_pool_name = "b2-backend-pool-dev"
}
}
backend_pool_load_balancing {
name = "loadbalancingsettings"
}
backend_pool_health_probe {
name = "healthprobesettings"
enabled = false
probe_method = "HEAD"
}
backend_pool {
name = "b2-backend-pool-dev"
backend {
host_header = "xyz.b2clogin.com"
address = "xyz.b2clogin.com"
http_port = 80 …Run Code Online (Sandbox Code Playgroud) 为了解决以下错误(其中 terraform 无法创建 的实例),必须进行哪些特定语法或配置更改azuread_application?
代码:
运行时触发错误的 terraform 代码terraform apply如下:
variable "tenantId" { }
variable "clientId" { }
variable "clientSecret" { }
variable "instanceName" { }
terraform {
required_providers {
azuread = {
source = "hashicorp/azuread"
version = "2.5.0"
}
}
}
provider "azuread" {
tenant_id = var.tenantId
client_id = var.clientId
client_secret = var.clientSecret
}
resource "azuread_application" "appRegistration" {
display_name = var.instanceName
app_role {
allowed_member_types = ["User", "Application"]
description = "Admins can manage roles and perform all …Run Code Online (Sandbox Code Playgroud) azure azure-active-directory terraform terraform-provider-azure
我正在尝试使用 terraform 部署新的基础设施(第一次),但出现以下错误。我已经尝试了一切,但似乎没有任何办法可以解决问题。
\n看起来它正在要求提供者hashicorp/azure?
\n有人可以帮忙吗?
\nInitializing provider plugins...\n- Finding latest version of hashicorp/azure...\n- Finding hashicorp/azurerm versions matching "2.98.0"...\n- Installing hashicorp/azurerm v2.98.0...\n- Installed hashicorp/azurerm v2.98.0 (signed by HashiCorp)\n\xe2\x95\xb7\n\xe2\x94\x82 Error: Failed to query available provider packages\n\xe2\x94\x82 \n\xe2\x94\x82 Could not retrieve the list of available versions for provider hashicorp/azure: provider registry registry.terraform.io does not have a provider named registry.terraform.io/hashicorp/azure\n\xe2\x94\x82 \n\xe2\x94\x82 Did you intend to use terraform-providers/azure? If so, you must specify that source address in each module which …Run Code Online (Sandbox Code Playgroud) 我正在按照此文档页面使用应用程序设置部署 azure 功能https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/function_app
\n我的 terraform 文件如下所示:
\nterraform {\n required_providers {\n azurerm = {\n source = "hashicorp/azurerm"\n version = "3.10.0"\n }\n }\n}\n\nprovider "azurerm" {\n}\nresource "azurerm_resource_group" "example" {\n name = "azure-functions-test-rg"\n location = "West Europe"\n}\n\nresource "azurerm_storage_account" "example" {\n name = "funcdemo123shafiq"\n resource_group_name = azurerm_resource_group.example.name\n location = azurerm_resource_group.example.location\n account_tier = "Standard"\n account_replication_type = "LRS"\n}\n\nresource "azurerm_app_service_plan" "example" {\n name = "azure-functions-test-service-plan"\n location = azurerm_resource_group.example.location\n resource_group_name = azurerm_resource_group.example.name\n\n sku {\n tier = "Standard"\n size = "S1"\n }\n}\n\nresource "azurerm_function_app" "example" {\n name = …Run Code Online (Sandbox Code Playgroud)