gcp.compute.OrganizationSecurityPolicyAssociation
Explore with Pulumi AI
An association for the OrganizationSecurityPolicy.
To get more information about OrganizationSecurityPolicyAssociation, see:
Example Usage
Organization Security Policy Association Basic
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var securityPolicyTarget = new Gcp.Organizations.Folder("securityPolicyTarget", new()
{
DisplayName = "tf-test-secpol",
Parent = "organizations/123456789",
}, new CustomResourceOptions
{
Provider = google_beta,
});
var policyOrganizationSecurityPolicy = new Gcp.Compute.OrganizationSecurityPolicy("policyOrganizationSecurityPolicy", new()
{
DisplayName = "tf-test",
Parent = securityPolicyTarget.Name,
}, new CustomResourceOptions
{
Provider = google_beta,
});
var policyOrganizationSecurityPolicyRule = new Gcp.Compute.OrganizationSecurityPolicyRule("policyOrganizationSecurityPolicyRule", new()
{
PolicyId = policyOrganizationSecurityPolicy.Id,
Action = "allow",
Direction = "INGRESS",
EnableLogging = true,
Match = new Gcp.Compute.Inputs.OrganizationSecurityPolicyRuleMatchArgs
{
Config = new Gcp.Compute.Inputs.OrganizationSecurityPolicyRuleMatchConfigArgs
{
SrcIpRanges = new[]
{
"192.168.0.0/16",
"10.0.0.0/8",
},
Layer4Configs = new[]
{
new Gcp.Compute.Inputs.OrganizationSecurityPolicyRuleMatchConfigLayer4ConfigArgs
{
IpProtocol = "tcp",
Ports = new[]
{
"22",
},
},
new Gcp.Compute.Inputs.OrganizationSecurityPolicyRuleMatchConfigLayer4ConfigArgs
{
IpProtocol = "icmp",
},
},
},
},
Priority = 100,
}, new CustomResourceOptions
{
Provider = google_beta,
});
var policyOrganizationSecurityPolicyAssociation = new Gcp.Compute.OrganizationSecurityPolicyAssociation("policyOrganizationSecurityPolicyAssociation", new()
{
AttachmentId = policyOrganizationSecurityPolicy.Parent,
PolicyId = policyOrganizationSecurityPolicy.Id,
}, new CustomResourceOptions
{
Provider = google_beta,
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
securityPolicyTarget, err := organizations.NewFolder(ctx, "securityPolicyTarget", &organizations.FolderArgs{
DisplayName: pulumi.String("tf-test-secpol"),
Parent: pulumi.String("organizations/123456789"),
}, pulumi.Provider(google_beta))
if err != nil {
return err
}
policyOrganizationSecurityPolicy, err := compute.NewOrganizationSecurityPolicy(ctx, "policyOrganizationSecurityPolicy", &compute.OrganizationSecurityPolicyArgs{
DisplayName: pulumi.String("tf-test"),
Parent: securityPolicyTarget.Name,
}, pulumi.Provider(google_beta))
if err != nil {
return err
}
_, err = compute.NewOrganizationSecurityPolicyRule(ctx, "policyOrganizationSecurityPolicyRule", &compute.OrganizationSecurityPolicyRuleArgs{
PolicyId: policyOrganizationSecurityPolicy.ID(),
Action: pulumi.String("allow"),
Direction: pulumi.String("INGRESS"),
EnableLogging: pulumi.Bool(true),
Match: &compute.OrganizationSecurityPolicyRuleMatchArgs{
Config: &compute.OrganizationSecurityPolicyRuleMatchConfigArgs{
SrcIpRanges: pulumi.StringArray{
pulumi.String("192.168.0.0/16"),
pulumi.String("10.0.0.0/8"),
},
Layer4Configs: compute.OrganizationSecurityPolicyRuleMatchConfigLayer4ConfigArray{
&compute.OrganizationSecurityPolicyRuleMatchConfigLayer4ConfigArgs{
IpProtocol: pulumi.String("tcp"),
Ports: pulumi.StringArray{
pulumi.String("22"),
},
},
&compute.OrganizationSecurityPolicyRuleMatchConfigLayer4ConfigArgs{
IpProtocol: pulumi.String("icmp"),
},
},
},
},
Priority: pulumi.Int(100),
}, pulumi.Provider(google_beta))
if err != nil {
return err
}
_, err = compute.NewOrganizationSecurityPolicyAssociation(ctx, "policyOrganizationSecurityPolicyAssociation", &compute.OrganizationSecurityPolicyAssociationArgs{
AttachmentId: policyOrganizationSecurityPolicy.Parent,
PolicyId: policyOrganizationSecurityPolicy.ID(),
}, pulumi.Provider(google_beta))
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.Folder;
import com.pulumi.gcp.organizations.FolderArgs;
import com.pulumi.gcp.compute.OrganizationSecurityPolicy;
import com.pulumi.gcp.compute.OrganizationSecurityPolicyArgs;
import com.pulumi.gcp.compute.OrganizationSecurityPolicyRule;
import com.pulumi.gcp.compute.OrganizationSecurityPolicyRuleArgs;
import com.pulumi.gcp.compute.inputs.OrganizationSecurityPolicyRuleMatchArgs;
import com.pulumi.gcp.compute.inputs.OrganizationSecurityPolicyRuleMatchConfigArgs;
import com.pulumi.gcp.compute.OrganizationSecurityPolicyAssociation;
import com.pulumi.gcp.compute.OrganizationSecurityPolicyAssociationArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
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 securityPolicyTarget = new Folder("securityPolicyTarget", FolderArgs.builder()
.displayName("tf-test-secpol")
.parent("organizations/123456789")
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var policyOrganizationSecurityPolicy = new OrganizationSecurityPolicy("policyOrganizationSecurityPolicy", OrganizationSecurityPolicyArgs.builder()
.displayName("tf-test")
.parent(securityPolicyTarget.name())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var policyOrganizationSecurityPolicyRule = new OrganizationSecurityPolicyRule("policyOrganizationSecurityPolicyRule", OrganizationSecurityPolicyRuleArgs.builder()
.policyId(policyOrganizationSecurityPolicy.id())
.action("allow")
.direction("INGRESS")
.enableLogging(true)
.match(OrganizationSecurityPolicyRuleMatchArgs.builder()
.config(OrganizationSecurityPolicyRuleMatchConfigArgs.builder()
.srcIpRanges(
"192.168.0.0/16",
"10.0.0.0/8")
.layer4Configs(
OrganizationSecurityPolicyRuleMatchConfigLayer4ConfigArgs.builder()
.ipProtocol("tcp")
.ports("22")
.build(),
OrganizationSecurityPolicyRuleMatchConfigLayer4ConfigArgs.builder()
.ipProtocol("icmp")
.build())
.build())
.build())
.priority(100)
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
var policyOrganizationSecurityPolicyAssociation = new OrganizationSecurityPolicyAssociation("policyOrganizationSecurityPolicyAssociation", OrganizationSecurityPolicyAssociationArgs.builder()
.attachmentId(policyOrganizationSecurityPolicy.parent())
.policyId(policyOrganizationSecurityPolicy.id())
.build(), CustomResourceOptions.builder()
.provider(google_beta)
.build());
}
}
import pulumi
import pulumi_gcp as gcp
security_policy_target = gcp.organizations.Folder("securityPolicyTarget",
display_name="tf-test-secpol",
parent="organizations/123456789",
opts=pulumi.ResourceOptions(provider=google_beta))
policy_organization_security_policy = gcp.compute.OrganizationSecurityPolicy("policyOrganizationSecurityPolicy",
display_name="tf-test",
parent=security_policy_target.name,
opts=pulumi.ResourceOptions(provider=google_beta))
policy_organization_security_policy_rule = gcp.compute.OrganizationSecurityPolicyRule("policyOrganizationSecurityPolicyRule",
policy_id=policy_organization_security_policy.id,
action="allow",
direction="INGRESS",
enable_logging=True,
match=gcp.compute.OrganizationSecurityPolicyRuleMatchArgs(
config=gcp.compute.OrganizationSecurityPolicyRuleMatchConfigArgs(
src_ip_ranges=[
"192.168.0.0/16",
"10.0.0.0/8",
],
layer4_configs=[
gcp.compute.OrganizationSecurityPolicyRuleMatchConfigLayer4ConfigArgs(
ip_protocol="tcp",
ports=["22"],
),
gcp.compute.OrganizationSecurityPolicyRuleMatchConfigLayer4ConfigArgs(
ip_protocol="icmp",
),
],
),
),
priority=100,
opts=pulumi.ResourceOptions(provider=google_beta))
policy_organization_security_policy_association = gcp.compute.OrganizationSecurityPolicyAssociation("policyOrganizationSecurityPolicyAssociation",
attachment_id=policy_organization_security_policy.parent,
policy_id=policy_organization_security_policy.id,
opts=pulumi.ResourceOptions(provider=google_beta))
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const securityPolicyTarget = new gcp.organizations.Folder("securityPolicyTarget", {
displayName: "tf-test-secpol",
parent: "organizations/123456789",
}, {
provider: google_beta,
});
const policyOrganizationSecurityPolicy = new gcp.compute.OrganizationSecurityPolicy("policyOrganizationSecurityPolicy", {
displayName: "tf-test",
parent: securityPolicyTarget.name,
}, {
provider: google_beta,
});
const policyOrganizationSecurityPolicyRule = new gcp.compute.OrganizationSecurityPolicyRule("policyOrganizationSecurityPolicyRule", {
policyId: policyOrganizationSecurityPolicy.id,
action: "allow",
direction: "INGRESS",
enableLogging: true,
match: {
config: {
srcIpRanges: [
"192.168.0.0/16",
"10.0.0.0/8",
],
layer4Configs: [
{
ipProtocol: "tcp",
ports: ["22"],
},
{
ipProtocol: "icmp",
},
],
},
},
priority: 100,
}, {
provider: google_beta,
});
const policyOrganizationSecurityPolicyAssociation = new gcp.compute.OrganizationSecurityPolicyAssociation("policyOrganizationSecurityPolicyAssociation", {
attachmentId: policyOrganizationSecurityPolicy.parent,
policyId: policyOrganizationSecurityPolicy.id,
}, {
provider: google_beta,
});
resources:
securityPolicyTarget:
type: gcp:organizations:Folder
properties:
displayName: tf-test-secpol
parent: organizations/123456789
options:
provider: ${["google-beta"]}
policyOrganizationSecurityPolicy:
type: gcp:compute:OrganizationSecurityPolicy
properties:
displayName: tf-test
parent: ${securityPolicyTarget.name}
options:
provider: ${["google-beta"]}
policyOrganizationSecurityPolicyRule:
type: gcp:compute:OrganizationSecurityPolicyRule
properties:
policyId: ${policyOrganizationSecurityPolicy.id}
action: allow
direction: INGRESS
enableLogging: true
match:
config:
srcIpRanges:
- 192.168.0.0/16
- 10.0.0.0/8
layer4Configs:
- ipProtocol: tcp
ports:
- '22'
- ipProtocol: icmp
priority: 100
options:
provider: ${["google-beta"]}
policyOrganizationSecurityPolicyAssociation:
type: gcp:compute:OrganizationSecurityPolicyAssociation
properties:
attachmentId: ${policyOrganizationSecurityPolicy.parent}
policyId: ${policyOrganizationSecurityPolicy.id}
options:
provider: ${["google-beta"]}
Create OrganizationSecurityPolicyAssociation Resource
new OrganizationSecurityPolicyAssociation(name: string, args: OrganizationSecurityPolicyAssociationArgs, opts?: CustomResourceOptions);
@overload
def OrganizationSecurityPolicyAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
attachment_id: Optional[str] = None,
name: Optional[str] = None,
policy_id: Optional[str] = None)
@overload
def OrganizationSecurityPolicyAssociation(resource_name: str,
args: OrganizationSecurityPolicyAssociationArgs,
opts: Optional[ResourceOptions] = None)
func NewOrganizationSecurityPolicyAssociation(ctx *Context, name string, args OrganizationSecurityPolicyAssociationArgs, opts ...ResourceOption) (*OrganizationSecurityPolicyAssociation, error)
public OrganizationSecurityPolicyAssociation(string name, OrganizationSecurityPolicyAssociationArgs args, CustomResourceOptions? opts = null)
public OrganizationSecurityPolicyAssociation(String name, OrganizationSecurityPolicyAssociationArgs args)
public OrganizationSecurityPolicyAssociation(String name, OrganizationSecurityPolicyAssociationArgs args, CustomResourceOptions options)
type: gcp:compute:OrganizationSecurityPolicyAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args OrganizationSecurityPolicyAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args OrganizationSecurityPolicyAssociationArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args OrganizationSecurityPolicyAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args OrganizationSecurityPolicyAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args OrganizationSecurityPolicyAssociationArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
OrganizationSecurityPolicyAssociation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The OrganizationSecurityPolicyAssociation resource accepts the following input properties:
- Attachment
Id string The resource that the security policy is attached to.
- Policy
Id string The security policy ID of the association.
- Name string
The name for an association.
- Attachment
Id string The resource that the security policy is attached to.
- Policy
Id string The security policy ID of the association.
- Name string
The name for an association.
- attachment
Id String The resource that the security policy is attached to.
- policy
Id String The security policy ID of the association.
- name String
The name for an association.
- attachment
Id string The resource that the security policy is attached to.
- policy
Id string The security policy ID of the association.
- name string
The name for an association.
- attachment_
id str The resource that the security policy is attached to.
- policy_
id str The security policy ID of the association.
- name str
The name for an association.
- attachment
Id String The resource that the security policy is attached to.
- policy
Id String The security policy ID of the association.
- name String
The name for an association.
Outputs
All input properties are implicitly available as output properties. Additionally, the OrganizationSecurityPolicyAssociation resource produces the following output properties:
- Display
Name string The display name of the security policy of the association.
- Id string
The provider-assigned unique ID for this managed resource.
- Display
Name string The display name of the security policy of the association.
- Id string
The provider-assigned unique ID for this managed resource.
- display
Name String The display name of the security policy of the association.
- id String
The provider-assigned unique ID for this managed resource.
- display
Name string The display name of the security policy of the association.
- id string
The provider-assigned unique ID for this managed resource.
- display_
name str The display name of the security policy of the association.
- id str
The provider-assigned unique ID for this managed resource.
- display
Name String The display name of the security policy of the association.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing OrganizationSecurityPolicyAssociation Resource
Get an existing OrganizationSecurityPolicyAssociation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: OrganizationSecurityPolicyAssociationState, opts?: CustomResourceOptions): OrganizationSecurityPolicyAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
attachment_id: Optional[str] = None,
display_name: Optional[str] = None,
name: Optional[str] = None,
policy_id: Optional[str] = None) -> OrganizationSecurityPolicyAssociation
func GetOrganizationSecurityPolicyAssociation(ctx *Context, name string, id IDInput, state *OrganizationSecurityPolicyAssociationState, opts ...ResourceOption) (*OrganizationSecurityPolicyAssociation, error)
public static OrganizationSecurityPolicyAssociation Get(string name, Input<string> id, OrganizationSecurityPolicyAssociationState? state, CustomResourceOptions? opts = null)
public static OrganizationSecurityPolicyAssociation get(String name, Output<String> id, OrganizationSecurityPolicyAssociationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Attachment
Id string The resource that the security policy is attached to.
- Display
Name string The display name of the security policy of the association.
- Name string
The name for an association.
- Policy
Id string The security policy ID of the association.
- Attachment
Id string The resource that the security policy is attached to.
- Display
Name string The display name of the security policy of the association.
- Name string
The name for an association.
- Policy
Id string The security policy ID of the association.
- attachment
Id String The resource that the security policy is attached to.
- display
Name String The display name of the security policy of the association.
- name String
The name for an association.
- policy
Id String The security policy ID of the association.
- attachment
Id string The resource that the security policy is attached to.
- display
Name string The display name of the security policy of the association.
- name string
The name for an association.
- policy
Id string The security policy ID of the association.
- attachment_
id str The resource that the security policy is attached to.
- display_
name str The display name of the security policy of the association.
- name str
The name for an association.
- policy_
id str The security policy ID of the association.
- attachment
Id String The resource that the security policy is attached to.
- display
Name String The display name of the security policy of the association.
- name String
The name for an association.
- policy
Id String The security policy ID of the association.
Import
OrganizationSecurityPolicyAssociation can be imported using any of these accepted formats* {{policy_id}}/association/{{name}}
In Terraform v1.5.0 and later, use an import
block to import OrganizationSecurityPolicyAssociation using one of the formats above. For exampletf import {
id = “{{policy_id}}/association/{{name}}”
to = google_compute_organization_security_policy_association.default }
$ pulumi import gcp:compute/organizationSecurityPolicyAssociation:OrganizationSecurityPolicyAssociation When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), OrganizationSecurityPolicyAssociation can be imported using one of the formats above. For example
$ pulumi import gcp:compute/organizationSecurityPolicyAssociation:OrganizationSecurityPolicyAssociation default {{policy_id}}/association/{{name}}
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
google-beta
Terraform Provider.