by shigemk2

当面は技術的なことしか書かない

cannot find a common base type for all elements.

自分はterraform-google-modules/cloud-storageのsimple_bucketサブモジュールで遭遇したんだけど、必要なelementが足りてないってこと?あまりにも情報量が少ないのでめんくらっちゃった。 こういうふうに書いてterraform planしたらばrefreshing state自体はやってくれるんだけどGCSバケットのところでcannot find a common base type for all elements.になった

  lifecycle_rules = [
    {
      action = {
        type = "Delete"
      }
      condition = {
        num_newer_versions         = 99
        with_state                 = "ARCHIVED"
        matches_storage_class      = []
      }
    },
    {
      action = {
        type = "Delete"
      }
      condition = {
        days_since_noncurrent_time = 5
        with_state                 = "ANY"
        matches_storage_class      = []
      }
    },
  ]

必要な設定が足りてないっぽくって、ちゃんと設定を記載したらterraform plan成功した。

  lifecycle_rules = [
    {
      action = {
        type = "Delete"
      }
      condition = {
        age                        = 0
        days_since_custom_time     = 0
        days_since_noncurrent_time = 0
        num_newer_versions         = 99
        with_state                 = "ARCHIVED"
        matches_storage_class      = []
      }
    },
    {
      action = {
        type = "Delete"
      }
      condition = {
        age                        = 0
        days_since_custom_time     = 0
        days_since_noncurrent_time = 5
        num_newer_versions         = 0
        with_state                 = "ANY"
        matches_storage_class      = []
      }
    },
  ]

github.com