pulumi_wasm_providers_gcp_mini::compute

Module organization_security_policy_association

source
Expand description

An association for the OrganizationSecurityPolicy.

To get more information about OrganizationSecurityPolicyAssociation, see:

§Example Usage

§Organization Security Policy Association Basic

use pulumi_wasm_rust::Output;
use pulumi_wasm_rust::{add_export, pulumi_main};
#[pulumi_main]
fn test_main() -> Result<(), Error> {
    let policy = organization_security_policy::create(
        "policy",
        OrganizationSecurityPolicyArgs::builder()
            .display_name("tf-test")
            .parent("${securityPolicyTarget.name}")
            .build_struct(),
    );
    let policyOrganizationSecurityPolicyAssociation = organization_security_policy_association::create(
        "policyOrganizationSecurityPolicyAssociation",
        OrganizationSecurityPolicyAssociationArgs::builder()
            .attachment_id("${policy.parent}")
            .name("tf-test")
            .policy_id("${policy.id}")
            .build_struct(),
    );
    let policyOrganizationSecurityPolicyRule = organization_security_policy_rule::create(
        "policyOrganizationSecurityPolicyRule",
        OrganizationSecurityPolicyRuleArgs::builder()
            .action("allow")
            .direction("INGRESS")
            .enable_logging(true)
            .match_(
                OrganizationSecurityPolicyRuleMatch::builder()
                    .config(
                        OrganizationSecurityPolicyRuleMatchConfig::builder()
                            .layer4Configs(
                                vec![
                                    OrganizationSecurityPolicyRuleMatchConfigLayer4Config::builder()
                                    .ipProtocol("tcp").ports(vec!["22",]).build_struct(),
                                    OrganizationSecurityPolicyRuleMatchConfigLayer4Config::builder()
                                    .ipProtocol("icmp").build_struct(),
                                ],
                            )
                            .srcIpRanges(vec!["192.168.0.0/16", "10.0.0.0/8",])
                            .build_struct(),
                    )
                    .build_struct(),
            )
            .policy_id("${policy.id}")
            .priority(100)
            .build_struct(),
    );
    let securityPolicyTarget = folder::create(
        "securityPolicyTarget",
        FolderArgs::builder()
            .deletion_protection(false)
            .display_name("tf-test-secpol")
            .parent("organizations/123456789")
            .build_struct(),
    );
}

§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}}

Structs§

Functions§

  • Registers a new resource with the given unique name and arguments