Represents an inventory report configuration.
To get more information about ReportConfig, see:
data "google_project" "project" {
}
resource "google_storage_insights_report_config" "config" {
display_name = "Test Report Config"
location = "us-central1"
frequency_options {
frequency = "WEEKLY"
start_date {
day = 15
month = 3
year = 2050
}
end_date {
day = 15
month = 4
year = 2050
}
}
csv_options {
record_separator = "\n"
delimiter = ","
header_required = false
}
object_metadata_report_options {
metadata_fields = ["bucket", "name", "project"]
storage_filters {
bucket = google_storage_bucket.report_bucket.name
}
storage_destination_options {
bucket = google_storage_bucket.report_bucket.name
destination_path = "test-insights-reports"
}
}
depends_on = [
google_storage_bucket_iam_member.admin
]
}
resource "google_storage_bucket" "report_bucket" {
name = "my-bucket"
location = "us-central1"
force_destroy = true
uniform_bucket_level_access = true
}
resource "google_storage_bucket_iam_member" "admin" {
bucket = google_storage_bucket.report_bucket.name
role = "roles/storage.admin"
member = "serviceAccount:service-${data.google_project.project.number}@gcp-sa-storageinsights.iam.gserviceaccount.com"
}
The following arguments are supported:
csv_options
-
(Required)
Options for configuring the format of the inventory report CSV file.
Structure is documented below.
location
-
(Required)
The location of the ReportConfig. The source and destination buckets specified in the ReportConfig
must be in the same location.
The csv_options
block supports:
record_separator
-
(Optional)
The character used to separate the records in the inventory report CSV file.
delimiter
-
(Optional)
The delimiter used to separate the fields in the inventory report CSV file.
header_required
-
(Optional)
The boolean that indicates whether or not headers are included in the inventory report CSV file.
frequency_options
-
(Optional)
Options for configuring how inventory reports are generated.
Structure is documented below.
object_metadata_report_options
-
(Optional)
Options for including metadata in an inventory report.
Structure is documented below.
display_name
-
(Optional)
The editable display name of the inventory report configuration. Has a limit of 256 characters. Can be empty.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
The frequency_options
block supports:
frequency
-
(Required)
The frequency in which inventory reports are generated. Values are DAILY or WEEKLY.
Possible values are: DAILY
, WEEKLY
.
start_date
-
(Required)
The date to start generating inventory reports. For example, {"day": 15, "month": 8, "year": 2022}.
Structure is documented below.
end_date
-
(Required)
The date to stop generating inventory reports. For example, {"day": 15, "month": 9, "year": 2022}.
Structure is documented below.
The start_date
block supports:
day
-
(Required)
The day of the month to start generating inventory reports.
month
-
(Required)
The month to start generating inventory reports.
year
-
(Required)
The year to start generating inventory reports
day
-
(Required)
The day of the month to stop generating inventory reports.
month
-
(Required)
The month to stop generating inventory reports.
year
-
(Required)
The year to stop generating inventory reports
The object_metadata_report_options
block supports:
metadata_fields
-
(Required)
The metadata fields included in an inventory report.
storage_filters
-
(Optional)
A nested object resource
Structure is documented below.
storage_destination_options
-
(Required)
Options for where the inventory reports are stored.
Structure is documented below.
The storage_filters
block supports:
bucket
-
(Optional)
The filter to use when specifying which bucket to generate inventory reports for.The storage_destination_options
block supports:
bucket
-
(Required)
The destination bucket that stores the generated inventory reports.
destination_path
-
(Optional)
The path within the destination bucket to store generated inventory reports.
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/locations/{{location}}/reportConfigs/{{name}}
name
-
The UUID of the inventory report configuration.
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.ReportConfig can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/reportConfigs/{{name}}
{{project}}/{{location}}/{{name}}
{{location}}/{{name}}
In Terraform v1.5.0 and later, use an import
block to import ReportConfig using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/{{location}}/reportConfigs/{{name}}"
to = google_storage_insights_report_config.default
}
When using the terraform import
command, ReportConfig can be imported using one of the formats above. For example:
$ terraform import google_storage_insights_report_config.default projects/{{project}}/locations/{{location}}/reportConfigs/{{name}}
$ terraform import google_storage_insights_report_config.default {{project}}/{{location}}/{{name}}
$ terraform import google_storage_insights_report_config.default {{location}}/{{name}}
This resource supports User Project Overrides.