google_storage_insights_report_config

Represents an inventory report configuration.

To get more information about ReportConfig, see:

Open in Cloud Shell

Example Usage - Storage Insights Report Config

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"
}

Argument Reference

The following arguments are supported:

The csv_options block supports:


The frequency_options block supports:

The start_date block supports:

The end_date block supports:

The object_metadata_report_options block supports:

The storage_filters block supports:

The storage_destination_options block supports:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

ReportConfig can be imported using any of these accepted formats:

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}}

User Project Overrides

This resource supports User Project Overrides.