FirewallPolicyAssociationArgs

data class FirewallPolicyAssociationArgs(val attachmentTarget: Output<String>? = null, val firewallPolicy: Output<String>? = null, val name: Output<String>? = null) : ConvertibleToJava<FirewallPolicyAssociationArgs>

Allows associating hierarchical firewall policies with the target where they are applied. This allows creating policies and rules in a different location than they are applied. For more information on applying hierarchical firewall policies see the official documentation To get more information about FirewallPolicyAssociation, see:

Example Usage

Firewall Policy Association

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const folder = new gcp.organizations.Folder("folder", {
displayName: "my-folder",
parent: "organizations/123456789",
deletionProtection: false,
});
const policy = new gcp.compute.FirewallPolicy("policy", {
parent: "organizations/123456789",
shortName: "my-policy",
description: "Example Resource",
});
const _default = new gcp.compute.FirewallPolicyAssociation("default", {
firewallPolicy: policy.id,
attachmentTarget: folder.name,
name: "my-association",
});
import pulumi
import pulumi_gcp as gcp
folder = gcp.organizations.Folder("folder",
display_name="my-folder",
parent="organizations/123456789",
deletion_protection=False)
policy = gcp.compute.FirewallPolicy("policy",
parent="organizations/123456789",
short_name="my-policy",
description="Example Resource")
default = gcp.compute.FirewallPolicyAssociation("default",
firewall_policy=policy.id,
attachment_target=folder.name,
name="my-association")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var folder = new Gcp.Organizations.Folder("folder", new()
{
DisplayName = "my-folder",
Parent = "organizations/123456789",
DeletionProtection = false,
});
var policy = new Gcp.Compute.FirewallPolicy("policy", new()
{
Parent = "organizations/123456789",
ShortName = "my-policy",
Description = "Example Resource",
});
var @default = new Gcp.Compute.FirewallPolicyAssociation("default", new()
{
FirewallPolicy = policy.Id,
AttachmentTarget = folder.Name,
Name = "my-association",
});
});
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 {
folder, err := organizations.NewFolder(ctx, "folder", &organizations.FolderArgs{
DisplayName: pulumi.String("my-folder"),
Parent: pulumi.String("organizations/123456789"),
DeletionProtection: pulumi.Bool(false),
})
if err != nil {
return err
}
policy, err := compute.NewFirewallPolicy(ctx, "policy", &compute.FirewallPolicyArgs{
Parent: pulumi.String("organizations/123456789"),
ShortName: pulumi.String("my-policy"),
Description: pulumi.String("Example Resource"),
})
if err != nil {
return err
}
_, err = compute.NewFirewallPolicyAssociation(ctx, "default", &compute.FirewallPolicyAssociationArgs{
FirewallPolicy: policy.ID(),
AttachmentTarget: folder.Name,
Name: pulumi.String("my-association"),
})
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.FirewallPolicy;
import com.pulumi.gcp.compute.FirewallPolicyArgs;
import com.pulumi.gcp.compute.FirewallPolicyAssociation;
import com.pulumi.gcp.compute.FirewallPolicyAssociationArgs;
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 folder = new Folder("folder", FolderArgs.builder()
.displayName("my-folder")
.parent("organizations/123456789")
.deletionProtection(false)
.build());
var policy = new FirewallPolicy("policy", FirewallPolicyArgs.builder()
.parent("organizations/123456789")
.shortName("my-policy")
.description("Example Resource")
.build());
var default_ = new FirewallPolicyAssociation("default", FirewallPolicyAssociationArgs.builder()
.firewallPolicy(policy.id())
.attachmentTarget(folder.name())
.name("my-association")
.build());
}
}
resources:
folder:
type: gcp:organizations:Folder
properties:
displayName: my-folder
parent: organizations/123456789
deletionProtection: false
policy:
type: gcp:compute:FirewallPolicy
properties:
parent: organizations/123456789
shortName: my-policy
description: Example Resource
default:
type: gcp:compute:FirewallPolicyAssociation
properties:
firewallPolicy: ${policy.id}
attachmentTarget: ${folder.name}
name: my-association

Import

FirewallPolicyAssociation can be imported using any of these accepted formats:

  • locations/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}

  • {{firewall_policy}}/{{name}} When using the pulumi import command, FirewallPolicyAssociation can be imported using one of the formats above. For example:

$ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default locations/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}
$ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default {{firewall_policy}}/{{name}}

Constructors

Link copied to clipboard
constructor(attachmentTarget: Output<String>? = null, firewallPolicy: Output<String>? = null, name: Output<String>? = null)

Properties

Link copied to clipboard
val attachmentTarget: Output<String>? = null

The target that the firewall policy is attached to.

Link copied to clipboard
val firewallPolicy: Output<String>? = null

The firewall policy of the resource. This field can be updated to refer to a different Firewall Policy, which will create a new association from that new firewall policy with the flag to override the existing attachmentTarget's policy association. Note Due to potential risks with this operation it is highly recommended to use the create_before_destroy life cycle option on your exisiting firewall policy so as to prevent a situation where your attachment target has no associated policy.

Link copied to clipboard
val name: Output<String>? = null

The name for an association.

Functions

Link copied to clipboard
open override fun toJava(): FirewallPolicyAssociationArgs