【问题标题】:Cdktf Optional blockcdktf 可选块
【发布时间】:2022-06-16 17:30:00
【问题描述】:

如果未提供以下块的值,如何使块可选?

const BackupType=new TerraformVariable(this,"BackupType",{
      description:"(Required) The type of the backup. Possible values are Continuous and Periodic. Defaults to Periodic. Migration of Periodic to Continuous is one-way, changing Continuous to Periodic forces a new resource to be created."
    })
    const  BackupIntervalInMinutes=new TerraformVariable(this,"BackupIntervalInMinutes",{
      description:"(Optional) The interval in minutes between two backups. This is configurable only when type is Periodic. Possible values are between 60 and 1440."
    })
   const  BackupRetenti`enter code here`onInHours=new TerraformVariable(this,"BackupRetentionInHours",{
      description:"(Optional) The time in hours that each backup is retained. This is configurable only when type is Periodic. Possible values are between 8 and 720."
    })
   const  BackupStorageRedundancy=new TerraformVariable(this,"BackupStorageRedundancy",{
      description:"(Optional) The storage redundancy which is used to indicate type of backup residency. This is configurable only when type is Periodic. Possible values are Geo, Local and Zone."
    }) 

backup:{
      type:BackupType.value,
      intervalInMinutes:BackupIntervalInMinutes.value,
      retentionInHours:BackupRetentionInHours.value,
      storageRedundancy:BackupStorageRedundancy.value,
    },

【问题讨论】:

    标签: typescript cdktf


    【解决方案1】:

    如果未传递 terraform 变量,则该值将被合成为输入的引用,但在编译时它将没有数据,因此应以与未传递相同的方式处理。

    【讨论】:

      猜你喜欢
      • 2023-01-20
      • 2023-01-20
      • 2023-01-20
      • 2023-02-11
      • 1970-01-01
      • 2021-07-10
      • 2022-01-18
      • 2022-10-25
      • 2021-11-26
      相关资源
      最近更新 更多