InsightsReportConfig class

Represents an inventory report configuration.

To get more information about ReportConfig, see:

Example Usage

Storage Insights Report Config

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const project = gcp.organizations.getProject({});
const reportBucket = new gcp.storage.Bucket("report_bucket", {
    name: "my-bucket",
    location: "us-central1",
    forceDestroy: true,
    uniformBucketLevelAccess: true,
});
const admin = new gcp.storage.BucketIAMMember("admin", {
    bucket: reportBucket.name,
    role: "roles/storage.admin",
    member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-storageinsights.iam.gserviceaccount.com`),
});
const config = new gcp.storage.InsightsReportConfig("config", {
    displayName: "Test Report Config",
    location: "us-central1",
    frequencyOptions: {
        frequency: "WEEKLY",
        startDate: {
            day: 15,
            month: 3,
            year: 2050,
        },
        endDate: {
            day: 15,
            month: 4,
            year: 2050,
        },
    },
    csvOptions: {
        recordSeparator: "\n",
        delimiter: ",",
        headerRequired: false,
    },
    objectMetadataReportOptions: {
        metadataFields: [
            "bucket",
            "name",
            "project",
        ],
        storageFilters: {
            bucket: reportBucket.name,
        },
        storageDestinationOptions: {
            bucket: reportBucket.name,
            destinationPath: "test-insights-reports",
        },
    },
}, {
    dependsOn: [admin],
});
import pulumi
import pulumi_gcp as gcp

project = gcp.organizations.get_project()
report_bucket = gcp.storage.Bucket("report_bucket",
    name="my-bucket",
    location="us-central1",
    force_destroy=True,
    uniform_bucket_level_access=True)
admin = gcp.storage.BucketIAMMember("admin",
    bucket=report_bucket.name,
    role="roles/storage.admin",
    member=f"serviceAccount:service-{project.number}@gcp-sa-storageinsights.iam.gserviceaccount.com")
config = gcp.storage.InsightsReportConfig("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": report_bucket.name,
        },
        "storage_destination_options": {
            "bucket": report_bucket.name,
            "destination_path": "test-insights-reports",
        },
    },
    opts = pulumi.ResourceOptions(depends_on=[admin]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var project = Gcp.Organizations.GetProject.Invoke();

    var reportBucket = new Gcp.Storage.Bucket("report_bucket", new()
    {
        Name = "my-bucket",
        Location = "us-central1",
        ForceDestroy = true,
        UniformBucketLevelAccess = true,
    });

    var admin = new Gcp.Storage.BucketIAMMember("admin", new()
    {
        Bucket = reportBucket.Name,
        Role = "roles/storage.admin",
        Member = $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-storageinsights.iam.gserviceaccount.com",
    });

    var config = new Gcp.Storage.InsightsReportConfig("config", new()
    {
        DisplayName = "Test Report Config",
        Location = "us-central1",
        FrequencyOptions = new Gcp.Storage.Inputs.InsightsReportConfigFrequencyOptionsArgs
        {
            Frequency = "WEEKLY",
            StartDate = new Gcp.Storage.Inputs.InsightsReportConfigFrequencyOptionsStartDateArgs
            {
                Day = 15,
                Month = 3,
                Year = 2050,
            },
            EndDate = new Gcp.Storage.Inputs.InsightsReportConfigFrequencyOptionsEndDateArgs
            {
                Day = 15,
                Month = 4,
                Year = 2050,
            },
        },
        CsvOptions = new Gcp.Storage.Inputs.InsightsReportConfigCsvOptionsArgs
        {
            RecordSeparator = @"
",
            Delimiter = ",",
            HeaderRequired = false,
        },
        ObjectMetadataReportOptions = new Gcp.Storage.Inputs.InsightsReportConfigObjectMetadataReportOptionsArgs
        {
            MetadataFields = new[]
            {
                "bucket",
                "name",
                "project",
            },
            StorageFilters = new Gcp.Storage.Inputs.InsightsReportConfigObjectMetadataReportOptionsStorageFiltersArgs
            {
                Bucket = reportBucket.Name,
            },
            StorageDestinationOptions = new Gcp.Storage.Inputs.InsightsReportConfigObjectMetadataReportOptionsStorageDestinationOptionsArgs
            {
                Bucket = reportBucket.Name,
                DestinationPath = "test-insights-reports",
            },
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            admin,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/storage"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		reportBucket, err := storage.NewBucket(ctx, "report_bucket", &storage.BucketArgs{
			Name:                     pulumi.String("my-bucket"),
			Location:                 pulumi.String("us-central1"),
			ForceDestroy:             pulumi.Bool(true),
			UniformBucketLevelAccess: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		admin, err := storage.NewBucketIAMMember(ctx, "admin", &storage.BucketIAMMemberArgs{
			Bucket: reportBucket.Name,
			Role:   pulumi.String("roles/storage.admin"),
			Member: pulumi.Sprintf("serviceAccount:service-%v@gcp-sa-storageinsights.iam.gserviceaccount.com", project.Number),
		})
		if err != nil {
			return err
		}
		_, err = storage.NewInsightsReportConfig(ctx, "config", &storage.InsightsReportConfigArgs{
			DisplayName: pulumi.String("Test Report Config"),
			Location:    pulumi.String("us-central1"),
			FrequencyOptions: &storage.InsightsReportConfigFrequencyOptionsArgs{
				Frequency: pulumi.String("WEEKLY"),
				StartDate: &storage.InsightsReportConfigFrequencyOptionsStartDateArgs{
					Day:   pulumi.Int(15),
					Month: pulumi.Int(3),
					Year:  pulumi.Int(2050),
				},
				EndDate: &storage.InsightsReportConfigFrequencyOptionsEndDateArgs{
					Day:   pulumi.Int(15),
					Month: pulumi.Int(4),
					Year:  pulumi.Int(2050),
				},
			},
			CsvOptions: &storage.InsightsReportConfigCsvOptionsArgs{
				RecordSeparator: pulumi.String("\n"),
				Delimiter:       pulumi.String(","),
				HeaderRequired:  pulumi.Bool(false),
			},
			ObjectMetadataReportOptions: &storage.InsightsReportConfigObjectMetadataReportOptionsArgs{
				MetadataFields: pulumi.StringArray{
					pulumi.String("bucket"),
					pulumi.String("name"),
					pulumi.String("project"),
				},
				StorageFilters: &storage.InsightsReportConfigObjectMetadataReportOptionsStorageFiltersArgs{
					Bucket: reportBucket.Name,
				},
				StorageDestinationOptions: &storage.InsightsReportConfigObjectMetadataReportOptionsStorageDestinationOptionsArgs{
					Bucket:          reportBucket.Name,
					DestinationPath: pulumi.String("test-insights-reports"),
				},
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			admin,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_organizations_getproject" "project" {
}

resource "gcp_storage_insightsreportconfig" "config" {
  depends_on   = [gcp_storage_bucketiammember.admin]
  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 = gcp_storage_bucket.report_bucket.name
    }
    storage_destination_options = {
      bucket           = gcp_storage_bucket.report_bucket.name
      destination_path = "test-insights-reports"
    }
  }
}
resource "gcp_storage_bucket" "report_bucket" {
  name                        = "my-bucket"
  location                    = "us-central1"
  force_destroy               = true
  uniform_bucket_level_access = true
}
resource "gcp_storage_bucketiammember" "admin" {
  bucket = gcp_storage_bucket.report_bucket.name
  role   = "roles/storage.admin"
  member ="serviceAccount:service-${data.gcp_organizations_getproject.project.number}@gcp-sa-storageinsights.iam.gserviceaccount.com"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.storage.BucketIAMMember;
import com.pulumi.gcp.storage.BucketIAMMemberArgs;
import com.pulumi.gcp.storage.InsightsReportConfig;
import com.pulumi.gcp.storage.InsightsReportConfigArgs;
import com.pulumi.gcp.storage.inputs.InsightsReportConfigFrequencyOptionsArgs;
import com.pulumi.gcp.storage.inputs.InsightsReportConfigFrequencyOptionsStartDateArgs;
import com.pulumi.gcp.storage.inputs.InsightsReportConfigFrequencyOptionsEndDateArgs;
import com.pulumi.gcp.storage.inputs.InsightsReportConfigCsvOptionsArgs;
import com.pulumi.gcp.storage.inputs.InsightsReportConfigObjectMetadataReportOptionsArgs;
import com.pulumi.gcp.storage.inputs.InsightsReportConfigObjectMetadataReportOptionsStorageFiltersArgs;
import com.pulumi.gcp.storage.inputs.InsightsReportConfigObjectMetadataReportOptionsStorageDestinationOptionsArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var project = OrganizationsFunctions.getProject(GetProjectArgs.builder()
            .build());

        var reportBucket = new Bucket("reportBucket", BucketArgs.builder()
            .name("my-bucket")
            .location("us-central1")
            .forceDestroy(true)
            .uniformBucketLevelAccess(true)
            .build());

        var admin = new BucketIAMMember("admin", BucketIAMMemberArgs.builder()
            .bucket(reportBucket.name())
            .role("roles/storage.admin")
            .member(String.format("serviceAccount:service-%s@gcp-sa-storageinsights.iam.gserviceaccount.com", project.number()))
            .build());

        var config = new InsightsReportConfig("config", InsightsReportConfigArgs.builder()
            .displayName("Test Report Config")
            .location("us-central1")
            .frequencyOptions(InsightsReportConfigFrequencyOptionsArgs.builder()
                .frequency("WEEKLY")
                .startDate(InsightsReportConfigFrequencyOptionsStartDateArgs.builder()
                    .day(15)
                    .month(3)
                    .year(2050)
                    .build())
                .endDate(InsightsReportConfigFrequencyOptionsEndDateArgs.builder()
                    .day(15)
                    .month(4)
                    .year(2050)
                    .build())
                .build())
            .csvOptions(InsightsReportConfigCsvOptionsArgs.builder()
                .recordSeparator("""

                """)
                .delimiter(",")
                .headerRequired(false)
                .build())
            .objectMetadataReportOptions(InsightsReportConfigObjectMetadataReportOptionsArgs.builder()
                .metadataFields(
                    "bucket",
                    "name",
                    "project")
                .storageFilters(InsightsReportConfigObjectMetadataReportOptionsStorageFiltersArgs.builder()
                    .bucket(reportBucket.name())
                    .build())
                .storageDestinationOptions(InsightsReportConfigObjectMetadataReportOptionsStorageDestinationOptionsArgs.builder()
                    .bucket(reportBucket.name())
                    .destinationPath("test-insights-reports")
                    .build())
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(admin)
                .build());

    }
}
resources:
  config:
    type: gcp:storage:InsightsReportConfig
    properties:
      displayName: Test Report Config
      location: us-central1
      frequencyOptions:
        frequency: WEEKLY
        startDate:
          day: 15
          month: 3
          year: 2050
        endDate:
          day: 15
          month: 4
          year: 2050
      csvOptions:
        recordSeparator: |2+
        delimiter: ','
        headerRequired: false
      objectMetadataReportOptions:
        metadataFields:
          - bucket
          - name
          - project
        storageFilters:
          bucket: ${reportBucket.name}
        storageDestinationOptions:
          bucket: ${reportBucket.name}
          destinationPath: test-insights-reports
    options:
      dependsOn:
        - ${admin}
  reportBucket:
    type: gcp:storage:Bucket
    name: report_bucket
    properties:
      name: my-bucket
      location: us-central1
      forceDestroy: true
      uniformBucketLevelAccess: true
  admin:
    type: gcp:storage:BucketIAMMember
    properties:
      bucket: ${reportBucket.name}
      role: roles/storage.admin
      member: serviceAccount:service-${project.number}@gcp-sa-storageinsights.iam.gserviceaccount.com
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}

Import

ReportConfig can be imported using any of these accepted formats:

  • projects/{{project}}/locations/{{location}}/reportConfigs/{{name}}
  • {{project}}/{{location}}/{{name}}
  • {{location}}/{{name}}

When using the pulumi import command, ReportConfig can be imported using one of the formats above. For example:

$ pulumi import gcp:storage/insightsReportConfig:InsightsReportConfig default projects/{{project}}/locations/{{location}}/reportConfigs/{{name}}
$ pulumi import gcp:storage/insightsReportConfig:InsightsReportConfig default {{project}}/{{location}}/{{name}}
$ pulumi import gcp:storage/insightsReportConfig:InsightsReportConfig default {{location}}/{{name}}

Constructors

InsightsReportConfig(String name, {InsightsReportConfigArgs? args, CustomResourceOptions? options})
Creates a new InsightsReportConfig. name The Pulumi resource name. args Arguments used to configure this InsightsReportConfig. The set of arguments for InsightsReportConfig. options Resource options controlling this resource's behavior.
InsightsReportConfig.reference(String urn)
Creates a typed reference to an existing InsightsReportConfig resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
csvOptions ↔ Output<InsightsReportConfigCsvOptions?>
Options for configuring the format of the inventory report CSV file. Structure is documented below.
latefinal
deletionPolicy ↔ Output<String>
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE. When a 'terraform destroy' or 'pulumi up' would delete the resource, the command will fail if this field is set to "PREVENT" in Terraform state. When set to "ABANDON", the command will remove the resource from Terraform management without updating or deleting the resource in the API. When set to "DELETE", deleting the resource is allowed.
latefinal
displayName ↔ Output<String?>
The editable display name of the inventory report configuration. Has a limit of 256 characters. Can be empty.
latefinal
forceDestroy ↔ Output<bool?>
If set, all the inventory report details associated with this report configuration are deleted.
latefinal
frequencyOptions ↔ Output<InsightsReportConfigFrequencyOptions?>
Options for configuring how inventory reports are generated. Structure is documented below.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
location ↔ Output<String>
The location of the ReportConfig. The source and destination buckets specified in the ReportConfig must be in the same location.
latefinal
name ↔ Output<String>
The UUID of the inventory report configuration.
latefinal
objectMetadataReportOptions ↔ Output<InsightsReportConfigObjectMetadataReportOptions?>
Options for including metadata in an inventory report. Structure is documented below.
latefinal
parquetOptions ↔ Output<Map<String, dynamic>?>
An option for outputting inventory reports as parquet files.
latefinal
project ↔ Output<String>
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {InsightsReportConfigState? state, CustomResourceOptions? options}) → InsightsReportConfig
Gets an existing InsightsReportConfig resource's state with the given name and id.