gpt4 book ai didi

azure - MongoDB Atlas 提供商 - Terraform

转载 作者:行者123 更新时间:2023-12-05 04:46:24 24 4
gpt4 key购买 nike

我无法使用 MongoDB Atlas 提供程序(版本 >= 0.9.1)在 Terraform (>= 0.13) 中计算出以下内容

如何设置以下 2 个属性。谷歌搜索了很多,但没有运气

根据此处的文档: https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/cluster

我想设置以下 2 个属性:

providerSettings.autoScaling.compute.maxInstanceSize
providerSettings.autoScaling.compute.minInstanceSize

我没有尝试过上面的按键,因为它有。里面有

尝试了下面的方法,但没有成功

  providerAutoScalingComputeMaxInstanceSize = "M20"
providerAutoScalingComputeMinInstanceSize = "M10"
  provider_autoScaling_compute_maxInstanceSize = "M20"
provider_autoScaling_compute_minInstanceSize = "M10"

在地形计划上。我看到错误:


Error: Unsupported argument

on .terraform/modules/mongodb_test_b/main.tf line 10, in resource "mongodbatlas_cluster" "mongodbatlas_cluster":
10: providerAutoScalingComputeMaxInstanceSize = var.providerAutoScalingComputeMaxInstanceSize

An argument named "providerAutoScalingComputeMaxInstanceSize" is not expected
here.


Error: Unsupported argument

on .terraform/modules/mongodb_test_b/main.tf line 12, in resource "mongodbatlas_cluster" "mongodbatlas_cluster":
12: providerAutoScalingComputeMinInstanceSize = var.providerAutoScalingComputeMinInstanceSize

An argument named "providerAutoScalingComputeMinInstanceSize" is not expected
here.


代码片段

resource "mongodbatlas_cluster" "mongodbatlas_cluster" {
project_id = var.project_id
provider_name = var.provider_name
name = var.name
provider_instance_size_name = var.provider_instance_size_name
provider_disk_type_name = var.provider_disk_type_name
auto_scaling_compute_enabled = var.auto_scaling_compute_enabled
providerAutoScalingComputeMaxInstanceSize = var.providerAutoScalingComputeMaxInstanceSize
auto_scaling_compute_scale_down_enabled = var.auto_scaling_compute_scale_down_enabled
providerAutoScalingComputeMinInstanceSize = var.providerAutoScalingComputeMinInstanceSize
pit_enabled = var.pit_enabled
cluster_type = var.cluster_type
replication_specs {
num_shards = var.replication_specs_num_shards
regions_config {
region_name = var.region_name
electable_nodes = var.replication_specs_regions_config_electable_nodes
priority = var.replication_specs_regions_config_priority
read_only_nodes = var.replication_specs_regions_config_read_only_nodes
analytics_nodes = var.analytics_nodes
}
}
mongo_db_major_version = var.mongo_db_major_version
provider_backup_enabled = var.provider_backup_enabled
auto_scaling_disk_gb_enabled = var.auto_scaling_disk_gb_enabled

}

任何帮助。非常感谢。

最佳答案

您使用了错误的参数名称,您需要这两个:

  1. provider_auto_scaling_compute_min_instance_size [1]
  2. provider_auto_scaling_compute_max_instance_size [2]

您的代码应如下所示:

  provider_auto_scaling_compute_max_instance_size = var.providerAutoScalingComputeMaxInstanceSize
provider_auto_scaling_compute_min_instance_size = var.providerAutoScalingComputeMinInstanceSize

您还可以考虑以不同的方式命名变量,即使用与参数名称相同的名称,因为这有助于映射参数是什么和它具有什么值。

[1] https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/cluster#provider_auto_scaling_compute_min_instance_size

[2] https://registry.terraform.io/providers/mongodb/mongodbatlas/latest/docs/resources/cluster#provider_auto_scaling_compute_max_instance_size

关于azure - MongoDB Atlas 提供商 - Terraform,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68819524/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com