blob: a1f689bf4c18bdcb4905aa879b0cfd91a1dd6b71 [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Cloud Asset Inventory"
description: |-
Describes a Cloud Asset Inventory feed used to to listen to asset updates.
---
# google\_cloud\_asset\_folder\_feed
Describes a Cloud Asset Inventory feed used to to listen to asset updates.
To get more information about FolderFeed, see:
* [API documentation](https://cloud.google.com/asset-inventory/docs/reference/rest/)
* How-to Guides
* [Official Documentation](https://cloud.google.com/asset-inventory/docs)
## Example Usage - Cloud Asset Folder Feed
```hcl
# Create a feed that sends notifications about network resource updates under a
# particular folder.
resource "google_cloud_asset_folder_feed" "folder_feed" {
billing_project = "my-project-name"
folder = google_folder.my_folder.folder_id
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"
}
}
# The topic where the resource change notifications will be sent.
resource "google_pubsub_topic" "feed_output" {
project = "my-project-name"
name = "network-updates"
}
# The folder that will be monitored for resource updates.
resource "google_folder" "my_folder" {
display_name = "Networking"
parent = "organizations/123456789"
}
# Find the project number of the project whose identity will be used for sending
# the asset change notifications.
data "google_project" "project" {
project_id = "my-project-name"
}
```
## Argument Reference
The following arguments are supported:
* `billing_project` -
(Required)
The project whose identity will be used when sending messages to the
destination pubsub topic. It also specifies the project for API
enablement check, quota, and billing.
* `feed_id` -
(Required)
This is the client-assigned asset feed identifier and it needs to be unique under a specific parent.
* `feed_output_config` -
(Required)
Output configuration for asset feed destination.
Structure is [documented below](#nested_feed_output_config).
* `folder` -
(Required)
The folder this feed should be created in.
<a name="nested_feed_output_config"></a>The `feed_output_config` block supports:
* `pubsub_destination` -
(Required)
Destination on Cloud Pubsub.
Structure is [documented below](#nested_pubsub_destination).
<a name="nested_pubsub_destination"></a>The `pubsub_destination` block supports:
* `topic` -
(Required)
Destination on Cloud Pubsub topic.
- - -
* `asset_names` -
(Optional)
A list of the full names of the assets to receive updates. You must specify either or both of
assetNames and assetTypes. Only asset updates matching specified assetNames and assetTypes are
exported to the feed. For example: //compute.googleapis.com/projects/my_project_123/zones/zone1/instances/instance1.
See https://cloud.google.com/apis/design/resourceNames#fullResourceName for more info.
* `asset_types` -
(Optional)
A list of types of the assets to receive updates. You must specify either or both of assetNames
and assetTypes. Only asset updates matching specified assetNames and assetTypes are exported to
the feed. For example: "compute.googleapis.com/Disk"
See https://cloud.google.com/asset-inventory/docs/supported-asset-types for a list of all
supported asset types.
* `content_type` -
(Optional)
Asset content type. If not specified, no content but the asset name and type will be returned.
Possible values are: `CONTENT_TYPE_UNSPECIFIED`, `RESOURCE`, `IAM_POLICY`, `ORG_POLICY`, `OS_INVENTORY`, `ACCESS_POLICY`.
* `condition` -
(Optional)
A condition which determines whether an asset update should be published. If specified, an asset
will be returned only when the expression evaluates to true. When set, expression field
must be a valid CEL expression on a TemporalAsset with name temporal_asset. Example: a Feed with
expression "temporal_asset.deleted == true" will only publish Asset deletions. Other fields of
condition are optional.
Structure is [documented below](#nested_condition).
<a name="nested_condition"></a>The `condition` block supports:
* `expression` -
(Required)
Textual representation of an expression in Common Expression Language syntax.
* `title` -
(Optional)
Title for the expression, i.e. a short string describing its purpose.
This can be used e.g. in UIs which allow to enter the expression.
* `description` -
(Optional)
Description of the expression. This is a longer text which describes the expression,
e.g. when hovered over it in a UI.
* `location` -
(Optional)
String indicating the location of the expression for error reporting, e.g. a file
name and a position in the file.
## Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
* `id` - an identifier for the resource with format `{{name}}`
* `folder_id` -
The ID of the folder where this feed has been created. Both [FOLDER_NUMBER]
and folders/[FOLDER_NUMBER] are accepted.
* `name` -
The format will be folders/{folder_number}/feeds/{client-assigned_feed_identifier}.
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 20 minutes.
- `update` - Default is 20 minutes.
- `delete` - Default is 20 minutes.
## Import
FolderFeed can be imported using any of these accepted formats:
* `folders/{{folder_id}}/feeds/{{name}}`
* `{{folder_id}}/{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import FolderFeed using one of the formats above. For example:
```tf
import {
id = "folders/{{folder_id}}/feeds/{{name}}"
to = google_cloud_asset_folder_feed.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), FolderFeed can be imported using one of the formats above. For example:
```
$ terraform import google_cloud_asset_folder_feed.default folders/{{folder_id}}/feeds/{{name}}
$ terraform import google_cloud_asset_folder_feed.default {{folder_id}}/{{name}}
```
## User Project Overrides
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).