繁体   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