OrganizationSecurityPolicy class

Organization security policies are used to control incoming/outgoing traffic.

To get more information about OrganizationSecurityPolicy, see:

Example Usage

Organization Security Policy Basic

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

const policy = new gcp.compute.OrganizationSecurityPolicy("policy", {
    shortName: "my-short-name",
    parent: "organizations/123456789",
    type: "CLOUD_ARMOR",
});
import pulumi
import pulumi_gcp as gcp

policy = gcp.compute.OrganizationSecurityPolicy("policy",
    short_name="my-short-name",
    parent="organizations/123456789",
    type="CLOUD_ARMOR")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var policy = new Gcp.Compute.OrganizationSecurityPolicy("policy", new()
    {
        ShortName = "my-short-name",
        Parent = "organizations/123456789",
        Type = "CLOUD_ARMOR",
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := compute.NewOrganizationSecurityPolicy(ctx, "policy", &compute.OrganizationSecurityPolicyArgs{
			ShortName: pulumi.String("my-short-name"),
			Parent:    pulumi.String("organizations/123456789"),
			Type:      pulumi.String("CLOUD_ARMOR"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_compute_organizationsecuritypolicy" "policy" {
  short_name = "my-short-name"
  parent     = "organizations/123456789"
  type       = "CLOUD_ARMOR"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.OrganizationSecurityPolicy;
import com.pulumi.gcp.compute.OrganizationSecurityPolicyArgs;
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 policy = new OrganizationSecurityPolicy("policy", OrganizationSecurityPolicyArgs.builder()
            .shortName("my-short-name")
            .parent("organizations/123456789")
            .type("CLOUD_ARMOR")
            .build());

    }
}
resources:
  policy:
    type: gcp:compute:OrganizationSecurityPolicy
    properties:
      shortName: my-short-name
      parent: organizations/123456789
      type: CLOUD_ARMOR

Organization Security Policy With Advanced Options

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

const policy = new gcp.compute.OrganizationSecurityPolicy("policy", {
    shortName: "security-policy",
    parent: "organizations/123456789",
    type: "CLOUD_ARMOR",
    advancedOptionsConfig: {
        jsonParsing: "STANDARD_WITH_GRAPHQL",
        logLevel: "VERBOSE",
        jsonCustomConfig: {
            contentTypes: ["application/vnd.api+json"],
        },
        userIpRequestHeaders: ["X-Forwarded-For"],
        requestBodyInspectionSize: "64KB",
    },
});
import pulumi
import pulumi_gcp as gcp

policy = gcp.compute.OrganizationSecurityPolicy("policy",
    short_name="security-policy",
    parent="organizations/123456789",
    type="CLOUD_ARMOR",
    advanced_options_config={
        "json_parsing": "STANDARD_WITH_GRAPHQL",
        "log_level": "VERBOSE",
        "json_custom_config": {
            "content_types": ["application/vnd.api+json"],
        },
        "user_ip_request_headers": ["X-Forwarded-For"],
        "request_body_inspection_size": "64KB",
    })
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var policy = new Gcp.Compute.OrganizationSecurityPolicy("policy", new()
    {
        ShortName = "security-policy",
        Parent = "organizations/123456789",
        Type = "CLOUD_ARMOR",
        AdvancedOptionsConfig = new Gcp.Compute.Inputs.OrganizationSecurityPolicyAdvancedOptionsConfigArgs
        {
            JsonParsing = "STANDARD_WITH_GRAPHQL",
            LogLevel = "VERBOSE",
            JsonCustomConfig = new Gcp.Compute.Inputs.OrganizationSecurityPolicyAdvancedOptionsConfigJsonCustomConfigArgs
            {
                ContentTypes = new[]
                {
                    "application/vnd.api+json",
                },
            },
            UserIpRequestHeaders = new[]
            {
                "X-Forwarded-For",
            },
            RequestBodyInspectionSize = "64KB",
        },
    });

});
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := compute.NewOrganizationSecurityPolicy(ctx, "policy", &compute.OrganizationSecurityPolicyArgs{
			ShortName: pulumi.String("security-policy"),
			Parent:    pulumi.String("organizations/123456789"),
			Type:      pulumi.String("CLOUD_ARMOR"),
			AdvancedOptionsConfig: &compute.OrganizationSecurityPolicyAdvancedOptionsConfigArgs{
				JsonParsing: pulumi.String("STANDARD_WITH_GRAPHQL"),
				LogLevel:    pulumi.String("VERBOSE"),
				JsonCustomConfig: &compute.OrganizationSecurityPolicyAdvancedOptionsConfigJsonCustomConfigArgs{
					ContentTypes: pulumi.StringArray{
						pulumi.String("application/vnd.api+json"),
					},
				},
				UserIpRequestHeaders: pulumi.StringArray{
					pulumi.String("X-Forwarded-For"),
				},
				RequestBodyInspectionSize: pulumi.String("64KB"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_compute_organizationsecuritypolicy" "policy" {
  short_name = "security-policy"
  parent     = "organizations/123456789"
  type       = "CLOUD_ARMOR"
  advanced_options_config = {
    json_parsing = "STANDARD_WITH_GRAPHQL"
    log_level    = "VERBOSE"
    json_custom_config = {
      content_types = ["application/vnd.api+json"]
    }
    user_ip_request_headers      = ["X-Forwarded-For"]
    request_body_inspection_size = "64KB"
  }
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.OrganizationSecurityPolicy;
import com.pulumi.gcp.compute.OrganizationSecurityPolicyArgs;
import com.pulumi.gcp.compute.inputs.OrganizationSecurityPolicyAdvancedOptionsConfigArgs;
import com.pulumi.gcp.compute.inputs.OrganizationSecurityPolicyAdvancedOptionsConfigJsonCustomConfigArgs;
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 policy = new OrganizationSecurityPolicy("policy", OrganizationSecurityPolicyArgs.builder()
            .shortName("security-policy")
            .parent("organizations/123456789")
            .type("CLOUD_ARMOR")
            .advancedOptionsConfig(OrganizationSecurityPolicyAdvancedOptionsConfigArgs.builder()
                .jsonParsing("STANDARD_WITH_GRAPHQL")
                .logLevel("VERBOSE")
                .jsonCustomConfig(OrganizationSecurityPolicyAdvancedOptionsConfigJsonCustomConfigArgs.builder()
                    .contentTypes("application/vnd.api+json")
                    .build())
                .userIpRequestHeaders("X-Forwarded-For")
                .requestBodyInspectionSize("64KB")
                .build())
            .build());

    }
}
resources:
  policy:
    type: gcp:compute:OrganizationSecurityPolicy
    properties:
      shortName: security-policy
      parent: organizations/123456789
      type: CLOUD_ARMOR
      advancedOptionsConfig:
        jsonParsing: STANDARD_WITH_GRAPHQL
        logLevel: VERBOSE
        jsonCustomConfig:
          contentTypes:
            - application/vnd.api+json
        userIpRequestHeaders:
          - X-Forwarded-For
        requestBodyInspectionSize: 64KB

Import

OrganizationSecurityPolicy can be imported using any of these accepted formats:

  • locations/global/securityPolicies/{{policy_id}}
  • {{policy_id}}

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

$ pulumi import gcp:compute/organizationSecurityPolicy:OrganizationSecurityPolicy default locations/global/securityPolicies/{{policy_id}}
$ pulumi import gcp:compute/organizationSecurityPolicy:OrganizationSecurityPolicy default {{policy_id}}

Constructors

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

Properties

advancedOptionsConfig ↔ Output<OrganizationSecurityPolicyAdvancedOptionsConfig?>
Additional options for this security policy. Structure is documented below.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
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
description ↔ Output<String?>
A textual description for the organization security policy.
latefinal
displayName ↔ Output<String?>
User-provided name of the organization security policy. The name should be unique in the organization in which the security policy is created. This should only be used when SecurityPolicyType is FIREWALL.
latefinal
fingerprint ↔ Output<String>
Fingerprint of this resource. This field is used internally during updates of this resource.
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
parent ↔ Output<String>
The parent of this OrganizationSecurityPolicy in the Cloud Resource Hierarchy. Format: organizations/{organization_id} or folders/{folder_id}
latefinal
policyId ↔ Output<String>
The unique identifier for the resource. This identifier is defined by the server.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shortName ↔ Output<String?>
User-provided name of the organization security policy. The name should be unique in the organization in which the security policy is created. This should only be used when SecurityPolicyType is CLOUD_ARMOR.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
type ↔ Output<String>
The type indicates the intended use of the security policy. This field can be set only at resource creation time. NOTE : 'FIREWALL' type is deprecated and will be removed in a future major release. Please use 'google_compute_firewall_policy' instead." Possible values are: FIREWALL, CLOUD_ARMOR, CLOUD_ARMOR_EDGE, CLOUD_ARMOR_INTERNAL_SERVICE, CLOUD_ARMOR_NETWORK.
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, {OrganizationSecurityPolicyState? state, CustomResourceOptions? options}) → OrganizationSecurityPolicy
Gets an existing OrganizationSecurityPolicy resource's state with the given name and id.