FirewallPolicyAssociation class
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: "folder-fpa",
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="folder-fpa",
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 = "folder-fpa",
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/v9/go/gcp/compute"
"github.com/pulumi/pulumi-gcp/sdk/v9/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("folder-fpa"),
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().ToIDOutput().ToStringOutput(),
AttachmentTarget: folder.Name,
Name: pulumi.String("my-association"),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_organizations_folder" "folder" {
display_name = "folder-fpa"
parent = "organizations/123456789"
deletion_protection = false
}
resource "gcp_compute_firewallpolicy" "policy" {
parent = "organizations/123456789"
short_name = "my-policy"
description = "Example Resource"
}
resource "gcp_compute_firewallpolicyassociation" "default" {
firewall_policy = gcp_compute_firewallpolicy.policy.id
attachment_target = gcp_organizations_folder.folder.name
name = "my-association"
}
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.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 folder = new Folder("folder", FolderArgs.builder()
.displayName("folder-fpa")
.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: folder-fpa
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
- FirewallPolicyAssociation(String name, {FirewallPolicyAssociationArgs? args, CustomResourceOptions? options})
-
Creates a new FirewallPolicyAssociation.
nameThe Pulumi resource name.argsArguments used to configure this FirewallPolicyAssociation. The set of arguments for FirewallPolicyAssociation.optionsResource options controlling this resource's behavior. - FirewallPolicyAssociation.reference(String urn)
- Creates a typed reference to an existing FirewallPolicyAssociation resource.
Properties
-
attachmentTarget
↔ Output<
String> -
The target that the firewall policy is attached to.
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
-
firewallPolicy
↔ Output<
String> -
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
createBeforeDestroylife cycle option on your exisiting firewall policy so as to prevent a situation where your attachment target has no associated policy.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
-
name
↔ Output<
String> -
The name for an association.
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> -
The short name of the firewall policy of the association.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
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, {FirewallPolicyAssociationState? state, CustomResourceOptions? options}) → FirewallPolicyAssociation -
Gets an existing FirewallPolicyAssociation resource's state with the given
nameandid.