【发布时间】:2019-05-26 02:11:23
【问题描述】:
我正在 Terraform 中创建一个插件,我想向架构中添加一个字段,该字段只有在提供另一个字段时才能调用。
"host_name": &schema.Schema{
Type: schema.TypeString,
Optional: true,
DefaultFunc: schema.EnvDefaultFunc("host_name", nil),
Description: "Should give name in FQDN if being used for DNS puposes .",
},
"enableDns": &schema.Schema{
Type: schema.TypeString,
Required: true,
DefaultFunc: schema.EnvDefaultFunc("host_name", nil),
Description: "Should give name in FQDN if being used for DNS puposes .",
这里我想只在传递host_name 时传递.tf 文件中的enableDns 字符串。如果它没有给出并且我通过enableDns 它应该在计划期间抛出一个错误。
【问题讨论】: