ProjectCustomModule class

Represents an instance of a Security Health Analytics custom module, including its full module name, display name, enablement state, and last updated time. You can create a custom module at the organization, folder, or project level. Custom modules that you create at the organization or folder level are inherited by the child folders and projects.

To get more information about ProjectCustomModule, see:

Example Usage

Scc Project Custom Module Basic

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

const example = new gcp.securitycenter.ProjectCustomModule("example", {
    displayName: "basic_custom_module",
    enablementState: "ENABLED",
    customConfig: {
        predicate: {
            expression: "resource.rotationPeriod > duration(\"2592000s\")",
        },
        resourceSelector: {
            resourceTypes: ["cloudkms.googleapis.com/CryptoKey"],
        },
        description: "The rotation period of the identified cryptokey resource exceeds 30 days.",
        recommendation: "Set the rotation period to at most 30 days.",
        severity: "MEDIUM",
    },
});
import pulumi
import pulumi_gcp as gcp

example = gcp.securitycenter.ProjectCustomModule("example",
    display_name="basic_custom_module",
    enablement_state="ENABLED",
    custom_config={
        "predicate": {
            "expression": "resource.rotationPeriod > duration(\"2592000s\")",
        },
        "resource_selector": {
            "resource_types": ["cloudkms.googleapis.com/CryptoKey"],
        },
        "description": "The rotation period of the identified cryptokey resource exceeds 30 days.",
        "recommendation": "Set the rotation period to at most 30 days.",
        "severity": "MEDIUM",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var example = new Gcp.SecurityCenter.ProjectCustomModule("example", new()
    {
        DisplayName = "basic_custom_module",
        EnablementState = "ENABLED",
        CustomConfig = new Gcp.SecurityCenter.Inputs.ProjectCustomModuleCustomConfigArgs
        {
            Predicate = new Gcp.SecurityCenter.Inputs.ProjectCustomModuleCustomConfigPredicateArgs
            {
                Expression = "resource.rotationPeriod > duration(\"2592000s\")",
            },
            ResourceSelector = new Gcp.SecurityCenter.Inputs.ProjectCustomModuleCustomConfigResourceSelectorArgs
            {
                ResourceTypes = new[]
                {
                    "cloudkms.googleapis.com/CryptoKey",
                },
            },
            Description = "The rotation period of the identified cryptokey resource exceeds 30 days.",
            Recommendation = "Set the rotation period to at most 30 days.",
            Severity = "MEDIUM",
        },
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := securitycenter.NewProjectCustomModule(ctx, "example", &securitycenter.ProjectCustomModuleArgs{
			DisplayName:     pulumi.String("basic_custom_module"),
			EnablementState: pulumi.String("ENABLED"),
			CustomConfig: &securitycenter.ProjectCustomModuleCustomConfigArgs{
				Predicate: &securitycenter.ProjectCustomModuleCustomConfigPredicateArgs{
					Expression: pulumi.String("resource.rotationPeriod > duration(\"2592000s\")"),
				},
				ResourceSelector: &securitycenter.ProjectCustomModuleCustomConfigResourceSelectorArgs{
					ResourceTypes: pulumi.StringArray{
						pulumi.String("cloudkms.googleapis.com/CryptoKey"),
					},
				},
				Description:    pulumi.String("The rotation period of the identified cryptokey resource exceeds 30 days."),
				Recommendation: pulumi.String("Set the rotation period to at most 30 days."),
				Severity:       pulumi.String("MEDIUM"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_securitycenter_projectcustommodule" "example" {
  display_name     = "basic_custom_module"
  enablement_state = "ENABLED"
  custom_config = {
    predicate = {
      expression = "resource.rotationPeriod > duration(\"2592000s\")"
    }
    resource_selector = {
      resource_types = ["cloudkms.googleapis.com/CryptoKey"]
    }
    description    = "The rotation period of the identified cryptokey resource exceeds 30 days."
    recommendation = "Set the rotation period to at most 30 days."
    severity       = "MEDIUM"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.securitycenter.ProjectCustomModule;
import com.pulumi.gcp.securitycenter.ProjectCustomModuleArgs;
import com.pulumi.gcp.securitycenter.inputs.ProjectCustomModuleCustomConfigArgs;
import com.pulumi.gcp.securitycenter.inputs.ProjectCustomModuleCustomConfigPredicateArgs;
import com.pulumi.gcp.securitycenter.inputs.ProjectCustomModuleCustomConfigResourceSelectorArgs;
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) {
        var example = new ProjectCustomModule("example", ProjectCustomModuleArgs.builder()
            .displayName("basic_custom_module")
            .enablementState("ENABLED")
            .customConfig(ProjectCustomModuleCustomConfigArgs.builder()
                .predicate(ProjectCustomModuleCustomConfigPredicateArgs.builder()
                    .expression("resource.rotationPeriod > duration(\"2592000s\")")
                    .build())
                .resourceSelector(ProjectCustomModuleCustomConfigResourceSelectorArgs.builder()
                    .resourceTypes("cloudkms.googleapis.com/CryptoKey")
                    .build())
                .description("The rotation period of the identified cryptokey resource exceeds 30 days.")
                .recommendation("Set the rotation period to at most 30 days.")
                .severity("MEDIUM")
                .build())
            .build());

    }
}
resources:
  example:
    type: gcp:securitycenter:ProjectCustomModule
    properties:
      displayName: basic_custom_module
      enablementState: ENABLED
      customConfig:
        predicate:
          expression: resource.rotationPeriod > duration("2592000s")
        resourceSelector:
          resourceTypes:
            - cloudkms.googleapis.com/CryptoKey
        description: The rotation period of the identified cryptokey resource exceeds 30 days.
        recommendation: Set the rotation period to at most 30 days.
        severity: MEDIUM

Scc Project Custom Module Full

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

const example = new gcp.securitycenter.ProjectCustomModule("example", {
    displayName: "full_custom_module",
    enablementState: "ENABLED",
    customConfig: {
        predicate: {
            expression: "resource.rotationPeriod > duration(\"2592000s\")",
            title: "Purpose of the expression",
            description: "description of the expression",
            location: "location of the expression",
        },
        customOutput: {
            properties: [{
                name: "duration",
                valueExpression: {
                    expression: "resource.rotationPeriod",
                    title: "Purpose of the expression",
                    description: "description of the expression",
                    location: "location of the expression",
                },
            }],
        },
        resourceSelector: {
            resourceTypes: ["cloudkms.googleapis.com/CryptoKey"],
        },
        severity: "LOW",
        description: "Description of the custom module",
        recommendation: "Steps to resolve violation",
    },
});
import pulumi
import pulumi_gcp as gcp

example = gcp.securitycenter.ProjectCustomModule("example",
    display_name="full_custom_module",
    enablement_state="ENABLED",
    custom_config={
        "predicate": {
            "expression": "resource.rotationPeriod > duration(\"2592000s\")",
            "title": "Purpose of the expression",
            "description": "description of the expression",
            "location": "location of the expression",
        },
        "custom_output": {
            "properties": [{
                "name": "duration",
                "value_expression": {
                    "expression": "resource.rotationPeriod",
                    "title": "Purpose of the expression",
                    "description": "description of the expression",
                    "location": "location of the expression",
                },
            }],
        },
        "resource_selector": {
            "resource_types": ["cloudkms.googleapis.com/CryptoKey"],
        },
        "severity": "LOW",
        "description": "Description of the custom module",
        "recommendation": "Steps to resolve violation",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var example = new Gcp.SecurityCenter.ProjectCustomModule("example", new()
    {
        DisplayName = "full_custom_module",
        EnablementState = "ENABLED",
        CustomConfig = new Gcp.SecurityCenter.Inputs.ProjectCustomModuleCustomConfigArgs
        {
            Predicate = new Gcp.SecurityCenter.Inputs.ProjectCustomModuleCustomConfigPredicateArgs
            {
                Expression = "resource.rotationPeriod > duration(\"2592000s\")",
                Title = "Purpose of the expression",
                Description = "description of the expression",
                Location = "location of the expression",
            },
            CustomOutput = new Gcp.SecurityCenter.Inputs.ProjectCustomModuleCustomConfigCustomOutputArgs
            {
                Properties = new[]
                {
                    new Gcp.SecurityCenter.Inputs.ProjectCustomModuleCustomConfigCustomOutputPropertyArgs
                    {
                        Name = "duration",
                        ValueExpression = new Gcp.SecurityCenter.Inputs.ProjectCustomModuleCustomConfigCustomOutputPropertyValueExpressionArgs
                        {
                            Expression = "resource.rotationPeriod",
                            Title = "Purpose of the expression",
                            Description = "description of the expression",
                            Location = "location of the expression",
                        },
                    },
                },
            },
            ResourceSelector = new Gcp.SecurityCenter.Inputs.ProjectCustomModuleCustomConfigResourceSelectorArgs
            {
                ResourceTypes = new[]
                {
                    "cloudkms.googleapis.com/CryptoKey",
                },
            },
            Severity = "LOW",
            Description = "Description of the custom module",
            Recommendation = "Steps to resolve violation",
        },
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := securitycenter.NewProjectCustomModule(ctx, "example", &securitycenter.ProjectCustomModuleArgs{
			DisplayName:     pulumi.String("full_custom_module"),
			EnablementState: pulumi.String("ENABLED"),
			CustomConfig: &securitycenter.ProjectCustomModuleCustomConfigArgs{
				Predicate: &securitycenter.ProjectCustomModuleCustomConfigPredicateArgs{
					Expression:  pulumi.String("resource.rotationPeriod > duration(\"2592000s\")"),
					Title:       pulumi.String("Purpose of the expression"),
					Description: pulumi.String("description of the expression"),
					Location:    pulumi.String("location of the expression"),
				},
				CustomOutput: securitycenter.ProjectCustomModuleCustomConfigCustomOutputArgs{
					Properties: securitycenter.ProjectCustomModuleCustomConfigCustomOutputPropertyArray{
						&securitycenter.ProjectCustomModuleCustomConfigCustomOutputPropertyArgs{
							Name: pulumi.String("duration"),
							ValueExpression: &securitycenter.ProjectCustomModuleCustomConfigCustomOutputPropertyValueExpressionArgs{
								Expression:  pulumi.String("resource.rotationPeriod"),
								Title:       pulumi.String("Purpose of the expression"),
								Description: pulumi.String("description of the expression"),
								Location:    pulumi.String("location of the expression"),
							},
						},
					},
				},
				ResourceSelector: &securitycenter.ProjectCustomModuleCustomConfigResourceSelectorArgs{
					ResourceTypes: pulumi.StringArray{
						pulumi.String("cloudkms.googleapis.com/CryptoKey"),
					},
				},
				Severity:       pulumi.String("LOW"),
				Description:    pulumi.String("Description of the custom module"),
				Recommendation: pulumi.String("Steps to resolve violation"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_securitycenter_projectcustommodule" "example" {
  display_name     = "full_custom_module"
  enablement_state = "ENABLED"
  custom_config = {
    predicate = {
      expression  = "resource.rotationPeriod > duration(\"2592000s\")"
      title       = "Purpose of the expression"
      description = "description of the expression"
      location    = "location of the expression"
    }
    custom_output = {
      properties = [{
        "name" = "duration"
        "valueExpression" = {
          "expression"  = "resource.rotationPeriod"
          "title"       = "Purpose of the expression"
          "description" = "description of the expression"
          "location"    = "location of the expression"
        }
      }]
    }
    resource_selector = {
      resource_types = ["cloudkms.googleapis.com/CryptoKey"]
    }
    severity       = "LOW"
    description    = "Description of the custom module"
    recommendation = "Steps to resolve violation"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.securitycenter.ProjectCustomModule;
import com.pulumi.gcp.securitycenter.ProjectCustomModuleArgs;
import com.pulumi.gcp.securitycenter.inputs.ProjectCustomModuleCustomConfigArgs;
import com.pulumi.gcp.securitycenter.inputs.ProjectCustomModuleCustomConfigPredicateArgs;
import com.pulumi.gcp.securitycenter.inputs.ProjectCustomModuleCustomConfigCustomOutputArgs;
import com.pulumi.gcp.securitycenter.inputs.ProjectCustomModuleCustomConfigCustomOutputPropertyArgs;
import com.pulumi.gcp.securitycenter.inputs.ProjectCustomModuleCustomConfigCustomOutputPropertyValueExpressionArgs;
import com.pulumi.gcp.securitycenter.inputs.ProjectCustomModuleCustomConfigResourceSelectorArgs;
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) {
        var example = new ProjectCustomModule("example", ProjectCustomModuleArgs.builder()
            .displayName("full_custom_module")
            .enablementState("ENABLED")
            .customConfig(ProjectCustomModuleCustomConfigArgs.builder()
                .predicate(ProjectCustomModuleCustomConfigPredicateArgs.builder()
                    .expression("resource.rotationPeriod > duration(\"2592000s\")")
                    .title("Purpose of the expression")
                    .description("description of the expression")
                    .location("location of the expression")
                    .build())
                .customOutput(ProjectCustomModuleCustomConfigCustomOutputArgs.builder()
                    .properties(ProjectCustomModuleCustomConfigCustomOutputPropertyArgs.builder()
                        .name("duration")
                        .valueExpression(ProjectCustomModuleCustomConfigCustomOutputPropertyValueExpressionArgs.builder()
                            .expression("resource.rotationPeriod")
                            .title("Purpose of the expression")
                            .description("description of the expression")
                            .location("location of the expression")
                            .build())
                        .build())
                    .build())
                .resourceSelector(ProjectCustomModuleCustomConfigResourceSelectorArgs.builder()
                    .resourceTypes("cloudkms.googleapis.com/CryptoKey")
                    .build())
                .severity("LOW")
                .description("Description of the custom module")
                .recommendation("Steps to resolve violation")
                .build())
            .build());

    }
}
resources:
  example:
    type: gcp:securitycenter:ProjectCustomModule
    properties:
      displayName: full_custom_module
      enablementState: ENABLED
      customConfig:
        predicate:
          expression: resource.rotationPeriod > duration("2592000s")
          title: Purpose of the expression
          description: description of the expression
          location: location of the expression
        customOutput:
          properties:
            - name: duration
              valueExpression:
                expression: resource.rotationPeriod
                title: Purpose of the expression
                description: description of the expression
                location: location of the expression
        resourceSelector:
          resourceTypes:
            - cloudkms.googleapis.com/CryptoKey
        severity: LOW
        description: Description of the custom module
        recommendation: Steps to resolve violation

Import

ProjectCustomModule can be imported using any of these accepted formats:

  • projects/{{project}}/securityHealthAnalyticsSettings/customModules/{{name}}
  • {{project}}/{{name}}
  • {{name}}

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

$ pulumi import gcp:securitycenter/projectCustomModule:ProjectCustomModule default projects/{{project}}/securityHealthAnalyticsSettings/customModules/{{name}}
$ pulumi import gcp:securitycenter/projectCustomModule:ProjectCustomModule default {{project}}/{{name}}
$ pulumi import gcp:securitycenter/projectCustomModule:ProjectCustomModule default {{name}}

Constructors

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

Properties

ancestorModule ↔ Output<String>
If empty, indicates that the custom module was created in the organization,folder, or project in which you are viewing the custom module. Otherwise, ancestorModule specifies the organization or folder from which the custom module is inherited.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
customConfig ↔ Output<ProjectCustomModuleCustomConfig>
The user specified custom configuration for the module. 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 display name of the Security Health Analytics custom module. This display name becomes the finding category for all findings that are returned by this custom module. The display name must be between 1 and 128 characters, start with a lowercase letter, and contain alphanumeric characters or underscores only.
latefinal
enablementState ↔ Output<String>
The enablement state of the custom module. Possible values are: ENABLED, DISABLED.
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
lastEditor ↔ Output<String>
The editor that last updated the custom module.
latefinal
name ↔ Output<String>
The resource name of the custom module. Its format is "projects/{project}/securityHealthAnalyticsSettings/customModules/{customModule}". The id {customModule} is server-generated and is not user settable. It will be a numeric id containing 1-20 digits.
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
updateTime ↔ Output<String>
The time at which the custom module was last updated. A timestamp in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. Examples: "2014-10-02T15:01:23Z" and "2014-10-02T15:01:23.045123456Z".
latefinal
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, {ProjectCustomModuleState? state, CustomResourceOptions? options}) → ProjectCustomModule
Gets an existing ProjectCustomModule resource's state with the given name and id.