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
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const securityPolicyTarget = new gcp.organizations.Folder("security_policy_target", {
displayName: "tf-test-secpol",
parent: "organizations/123456789",
deletionProtection: false,
});
const policy = new gcp.compute.OrganizationSecurityPolicy("policy", {
displayName: "tf-test",
parent: securityPolicyTarget.name,
});
const policyOrganizationSecurityPolicyRule = new gcp.compute.OrganizationSecurityPolicyRule("policy", {
policyId: policy.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,
});
const policyOrganizationSecurityPolicyAssociation = new gcp.compute.OrganizationSecurityPolicyAssociation("policy", {
name: "tf-test",
attachmentId: policy.parent,
policyId: policy.id,
});
import pulumi
import pulumi_gcp as gcp
security_policy_target = gcp.organizations.Folder("security_policy_target",
display_name="tf-test-secpol",
parent="organizations/123456789",
deletion_protection=False)
policy = gcp.compute.OrganizationSecurityPolicy("policy",
display_name="tf-test",
parent=security_policy_target.name)
policy_organization_security_policy_rule = gcp.compute.OrganizationSecurityPolicyRule("policy",
policy_id=policy.id,
action="allow",
direction="INGRESS",
enable_logging=True,
match={
"config": {
"src_ip_ranges": [
"192.168.0.0/16",
"10.0.0.0/8",
],
"layer4_configs": [
{
"ip_protocol": "tcp",
"ports": ["22"],
},
{
"ip_protocol": "icmp",
},
],
},
},
priority=100)
policy_organization_security_policy_association = gcp.compute.OrganizationSecurityPolicyAssociation("policy",
name="tf-test",
attachment_id=policy.parent,
policy_id=policy.id)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
"github.com/pulumi/pulumi-gcp/sdk/v8/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, "security_policy_target", &organizations.FolderArgs{
DisplayName: pulumi.String("tf-test-secpol"),
Parent: pulumi.String("organizations/123456789"),
DeletionProtection: pulumi.Bool(false),
})
if err != nil {
return err
}
policy, err := compute.NewOrganizationSecurityPolicy(ctx, "policy", &compute.OrganizationSecurityPolicyArgs{
DisplayName: pulumi.String("tf-test"),
Parent: securityPolicyTarget.Name,
})
if err != nil {
return err
}
_, err = compute.NewOrganizationSecurityPolicyRule(ctx, "policy", &compute.OrganizationSecurityPolicyRuleArgs{
PolicyId: policy.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),
})
if err != nil {
return err
}
_, err = compute.NewOrganizationSecurityPolicyAssociation(ctx, "policy", &compute.OrganizationSecurityPolicyAssociationArgs{
Name: pulumi.String("tf-test"),
AttachmentId: policy.Parent,
PolicyId: policy.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var securityPolicyTarget = new Gcp.Organizations.Folder("security_policy_target", new()
{
DisplayName = "tf-test-secpol",
Parent = "organizations/123456789",
DeletionProtection = false,
});
var policy = new Gcp.Compute.OrganizationSecurityPolicy("policy", new()
{
DisplayName = "tf-test",
Parent = securityPolicyTarget.Name,
});
var policyOrganizationSecurityPolicyRule = new Gcp.Compute.OrganizationSecurityPolicyRule("policy", new()
{
PolicyId = policy.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,
});
var policyOrganizationSecurityPolicyAssociation = new Gcp.Compute.OrganizationSecurityPolicyAssociation("policy", new()
{
Name = "tf-test",
AttachmentId = policy.Parent,
PolicyId = policy.Id,
});
});
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 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")
.deletionProtection(false)
.build());
var policy = new OrganizationSecurityPolicy("policy", OrganizationSecurityPolicyArgs.builder()
.displayName("tf-test")
.parent(securityPolicyTarget.name())
.build());
var policyOrganizationSecurityPolicyRule = new OrganizationSecurityPolicyRule("policyOrganizationSecurityPolicyRule", OrganizationSecurityPolicyRuleArgs.builder()
.policyId(policy.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());
var policyOrganizationSecurityPolicyAssociation = new OrganizationSecurityPolicyAssociation("policyOrganizationSecurityPolicyAssociation", OrganizationSecurityPolicyAssociationArgs.builder()
.name("tf-test")
.attachmentId(policy.parent())
.policyId(policy.id())
.build());
}
}
resources:
securityPolicyTarget:
type: gcp:organizations:Folder
name: security_policy_target
properties:
displayName: tf-test-secpol
parent: organizations/123456789
deletionProtection: false
policy:
type: gcp:compute:OrganizationSecurityPolicy
properties:
displayName: tf-test
parent: ${securityPolicyTarget.name}
policyOrganizationSecurityPolicyRule:
type: gcp:compute:OrganizationSecurityPolicyRule
name: policy
properties:
policyId: ${policy.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
policyOrganizationSecurityPolicyAssociation:
type: gcp:compute:OrganizationSecurityPolicyAssociation
name: policy
properties:
name: tf-test
attachmentId: ${policy.parent}
policyId: ${policy.id}
Create OrganizationSecurityPolicyAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new OrganizationSecurityPolicyAssociation(name: string, args: OrganizationSecurityPolicyAssociationArgs, opts?: CustomResourceOptions);
@overload
def OrganizationSecurityPolicyAssociation(resource_name: str,
args: OrganizationSecurityPolicyAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def OrganizationSecurityPolicyAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
attachment_id: Optional[str] = None,
policy_id: Optional[str] = None,
name: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var organizationSecurityPolicyAssociationResource = new Gcp.Compute.OrganizationSecurityPolicyAssociation("organizationSecurityPolicyAssociationResource", new()
{
AttachmentId = "string",
PolicyId = "string",
Name = "string",
});
example, err := compute.NewOrganizationSecurityPolicyAssociation(ctx, "organizationSecurityPolicyAssociationResource", &compute.OrganizationSecurityPolicyAssociationArgs{
AttachmentId: pulumi.String("string"),
PolicyId: pulumi.String("string"),
Name: pulumi.String("string"),
})
var organizationSecurityPolicyAssociationResource = new OrganizationSecurityPolicyAssociation("organizationSecurityPolicyAssociationResource", OrganizationSecurityPolicyAssociationArgs.builder()
.attachmentId("string")
.policyId("string")
.name("string")
.build());
organization_security_policy_association_resource = gcp.compute.OrganizationSecurityPolicyAssociation("organizationSecurityPolicyAssociationResource",
attachment_id="string",
policy_id="string",
name="string")
const organizationSecurityPolicyAssociationResource = new gcp.compute.OrganizationSecurityPolicyAssociation("organizationSecurityPolicyAssociationResource", {
attachmentId: "string",
policyId: "string",
name: "string",
});
type: gcp:compute:OrganizationSecurityPolicyAssociation
properties:
attachmentId: string
name: string
policyId: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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}}
When using the pulumi import
command, OrganizationSecurityPolicyAssociation can be imported using one of the formats above. For example:
$ pulumi import gcp:compute/organizationSecurityPolicyAssociation:OrganizationSecurityPolicyAssociation default {{policy_id}}/association/{{name}}
To learn more about importing existing cloud resources, see Importing resources.
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.