terraform azurerm_data_factory_pipeline 将类型分配给变量

发布于 2025-01-11 02:59:45 字数 388 浏览 0 评论 0原文

在 terraform 文档中,我找到了以下示例:

resource "azurerm_data_factory_pipeline" "test" {
  name                = .....
  resource_group_name = ...
  data_factory_id     = ...
  variables = {
  "bob" = "item1"
}

但我需要创建一个布尔变量,在门户 Azure 中我有类型字段。 我怎样才能像这样设置变量:

"variables": {
  "END": {
    "type": "Boolean",
    "defaultValue": false
  }
}

in terraform documentation i found the follow example:

resource "azurerm_data_factory_pipeline" "test" {
  name                = .....
  resource_group_name = ...
  data_factory_id     = ...
  variables = {
  "bob" = "item1"
}

but I need to create a boolean variable, in the portal Azure I have the type field.
how can I set the variable like this:

"variables": {
  "END": {
    "type": "Boolean",
    "defaultValue": false
  }
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随遇而安 2025-01-18 02:59:45

根据您的问题,如果您询问如何在 Terraform 中创建布尔类型的变量,则可以这样做:

variable "END" {
  type        = bool
  description = "End variable."

  default = false
}

您可以在资源定义中引用该变量:

resource "azurerm_data_factory_pipeline" "test" {
  name                = .....
  resource_group_name = ...
  data_factory_id     = ...
  
  variables = {
    "END" = var.END
  }
}

或者您可以在不定义 Terraform 变量的情况下设置它,如下所示:

resource "azurerm_data_factory_pipeline" "test" {
  name                = .....
  resource_group_name = ...
  data_factory_id     = ...
  
  variables = {
    "END" = false
  }
}

Based on your question, if you are asking how to create a variable of type boolean in Terraform, that is done like this:

variable "END" {
  type        = bool
  description = "End variable."

  default = false
}

You can reference that variable then in the resource definition:

resource "azurerm_data_factory_pipeline" "test" {
  name                = .....
  resource_group_name = ...
  data_factory_id     = ...
  
  variables = {
    "END" = var.END
  }
}

Or alternatively you can set it without defining the Terraform variable like this:

resource "azurerm_data_factory_pipeline" "test" {
  name                = .....
  resource_group_name = ...
  data_factory_id     = ...
  
  variables = {
    "END" = false
  }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文