【问题标题】:terraform error of unsupported argument when running TF plan运行 TF 计划时不支持参数的 terraform 错误
【发布时间】:2021-01-30 09:52:02
【问题描述】:

我在运行 terraform plan 时收到此错误,并且似乎重复了 4-5 个参数。

Error: Unsupported argument

  on ec2_asg.tf line 56, in module "ec2_asg":
  56:   addtional_ssm_bootstrap_step_count     = var.addtional_ssm_bootstrap_step_count

An argument named "addtional_ssm_bootstrap_step_count" is not expected here.
Did you mean "additional_ssm_bootstrap_step_count"?


Error: Unsupported argument

  on ec2_asg.tf line 19, in module "ec2_asg":
  19:   encrypt_ebs_volume                     = var.encrypt_ebs_volume

An argument named "encrypt_ebs_volume" is not expected here.

我该如何解决这个问题?

这是完整的代码:

module "ec2_asg" {
  source = "github.com/****"

  resource_name       = var.resource_name_bi
  environment         = var.environment
  key_pair            = var.key_pair_internal
  ec2_os              = var.ec2_os_bi
  image_id            = var.image_id_bi
  instance_type       = var.instance_type_bi
  asg_count           = var.asg_count_bi
  scaling_min         = var.scaling_min_bi
  scaling_max         = var.scaling_max_bi
  subnets             = [module.vpc.private_subnets]
  security_group_list = [aws_security_group.bi_asg.id]

  primary_ebs_volume_size                = var.primary_ebs_volume_size_bi
  primary_ebs_volume_type                = var.primary_ebs_volume_type_bi
  primary_ebs_volume_iops                = var.primary_ebs_volume_iops_bi
  encrypt_ebs_volume                     = var.encrypt_ebs_volume_bi
  secondary_ebs_volume_size              = var.secondary_ebs_volume_size_bi
  secondary_ebs_volume_type              = var.secondary_ebs_volume_type_bi
  secondary_ebs_volume_iops              = var.secondary_ebs_volume_iops_bi

【问题讨论】:

  • 第一个是由于拼写错误。您能否包含您尝试提供的资源的代码?
  • @MontgomeryWatts 哦,是的,我修好了,谢谢!第二个呢?我正在创建一个 ec2 自动缩放组。
  • 您在使用aws_autoscaling_group 资源吗?
  • @MontgomeryWatts 我在问题中添加了我的 .tf 代码,请参阅

标签: amazon-web-services syntax-error terraform terraform-provider-aws terraform-modules


【解决方案1】:

我建议您查看您导入的模块的源代码,以确定需要传递哪些变量。 convention 将它们放在一个 variables.tf 文件中,该文件将描述它们的使用。

【讨论】:

    猜你喜欢
    • 2021-01-16
    • 2021-06-27
    • 2021-01-16
    • 2021-02-18
    • 2021-01-09
    • 1970-01-01
    • 1970-01-01
    • 2018-10-11
    • 2021-01-20
    相关资源
    最近更新 更多