簡體   English   中英

已刪除/已創建資源的 Cloud Asset Organization 提要

[英]Cloud Asset Organization feed for deleted/created resource

我正在為已刪除/創建的資源創建資產提要。 下面的代碼和鏈接僅在創建資源時顯示表達式,但我只需要在刪除資源時使用另一個提要。 參考鏈接 - https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/cloud_asset_organization_feed

我只想收到有關創建和刪除沒有更新的通知。

resource "google_cloud_asset_organization_feed" "organization_feed" {
  billing_project = "my-project-name"
  org_id          = "123456789"
  feed_id         = "network-updates"
  content_type    = "RESOURCE"

  asset_types = [
    "compute.googleapis.com/Subnetwork",
    "compute.googleapis.com/Network",
  ]

  feed_output_config {
    pubsub_destination {
      topic = google_pubsub_topic.feed_output.id
    }
  }

  condition {
    expression = <<-EOT
    !temporal_asset.deleted &&
    temporal_asset.prior_asset_state == google.cloud.asset.v1.TemporalAsset.PriorAssetState.DOES_NOT_EXIST
    EOT
    title = "created"
    description = "Send notifications on creation events"
  }
}

要創建已刪除的資產提要,請將條件更改為:

  condition {
    expression =  temporal_asset.deleted
    title = "deleted"
    description = "Send notifications on deletion events"
  }

有條件地監控資產變化

臨時資產

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM