gcp.compute.FirewallPolicyAssociation
Explore with Pulumi AI
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
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var defaultFirewallPolicy = new Gcp.Compute.FirewallPolicy("defaultFirewallPolicy", new()
{
Parent = "organizations/12345",
ShortName = "my-policy",
Description = "Example Resource",
});
var defaultFirewallPolicyAssociation = new Gcp.Compute.FirewallPolicyAssociation("defaultFirewallPolicyAssociation", new()
{
FirewallPolicy = defaultFirewallPolicy.Id,
AttachmentTarget = google_folder.Folder.Name,
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
defaultFirewallPolicy, err := compute.NewFirewallPolicy(ctx, "defaultFirewallPolicy", &compute.FirewallPolicyArgs{
Parent: pulumi.String("organizations/12345"),
ShortName: pulumi.String("my-policy"),
Description: pulumi.String("Example Resource"),
})
if err != nil {
return err
}
_, err = compute.NewFirewallPolicyAssociation(ctx, "defaultFirewallPolicyAssociation", &compute.FirewallPolicyAssociationArgs{
FirewallPolicy: defaultFirewallPolicy.ID(),
AttachmentTarget: pulumi.Any(google_folder.Folder.Name),
})
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.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 defaultFirewallPolicy = new FirewallPolicy("defaultFirewallPolicy", FirewallPolicyArgs.builder()
.parent("organizations/12345")
.shortName("my-policy")
.description("Example Resource")
.build());
var defaultFirewallPolicyAssociation = new FirewallPolicyAssociation("defaultFirewallPolicyAssociation", FirewallPolicyAssociationArgs.builder()
.firewallPolicy(defaultFirewallPolicy.id())
.attachmentTarget(google_folder.folder().name())
.build());
}
}
import pulumi
import pulumi_gcp as gcp
default_firewall_policy = gcp.compute.FirewallPolicy("defaultFirewallPolicy",
parent="organizations/12345",
short_name="my-policy",
description="Example Resource")
default_firewall_policy_association = gcp.compute.FirewallPolicyAssociation("defaultFirewallPolicyAssociation",
firewall_policy=default_firewall_policy.id,
attachment_target=google_folder["folder"]["name"])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const defaultFirewallPolicy = new gcp.compute.FirewallPolicy("defaultFirewallPolicy", {
parent: "organizations/12345",
shortName: "my-policy",
description: "Example Resource",
});
const defaultFirewallPolicyAssociation = new gcp.compute.FirewallPolicyAssociation("defaultFirewallPolicyAssociation", {
firewallPolicy: defaultFirewallPolicy.id,
attachmentTarget: google_folder.folder.name,
});
resources:
defaultFirewallPolicy:
type: gcp:compute:FirewallPolicy
properties:
parent: organizations/12345
shortName: my-policy
description: Example Resource
defaultFirewallPolicyAssociation:
type: gcp:compute:FirewallPolicyAssociation
properties:
firewallPolicy: ${defaultFirewallPolicy.id}
attachmentTarget: ${google_folder.folder.name}
Create FirewallPolicyAssociation Resource
new FirewallPolicyAssociation(name: string, args: FirewallPolicyAssociationArgs, opts?: CustomResourceOptions);
@overload
def FirewallPolicyAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
attachment_target: Optional[str] = None,
firewall_policy: Optional[str] = None,
name: Optional[str] = None)
@overload
def FirewallPolicyAssociation(resource_name: str,
args: FirewallPolicyAssociationArgs,
opts: Optional[ResourceOptions] = None)
func NewFirewallPolicyAssociation(ctx *Context, name string, args FirewallPolicyAssociationArgs, opts ...ResourceOption) (*FirewallPolicyAssociation, error)
public FirewallPolicyAssociation(string name, FirewallPolicyAssociationArgs args, CustomResourceOptions? opts = null)
public FirewallPolicyAssociation(String name, FirewallPolicyAssociationArgs args)
public FirewallPolicyAssociation(String name, FirewallPolicyAssociationArgs args, CustomResourceOptions options)
type: gcp:compute:FirewallPolicyAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FirewallPolicyAssociationArgs
- 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 FirewallPolicyAssociationArgs
- 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 FirewallPolicyAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args FirewallPolicyAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args FirewallPolicyAssociationArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
FirewallPolicyAssociation 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 FirewallPolicyAssociation resource accepts the following input properties:
- Attachment
Target string The target that the firewall policy is attached to.
- Firewall
Policy string The firewall policy ID of the association.
- Name string
The name for an association.
- Attachment
Target string The target that the firewall policy is attached to.
- Firewall
Policy string The firewall policy ID of the association.
- Name string
The name for an association.
- attachment
Target String The target that the firewall policy is attached to.
- firewall
Policy String The firewall policy ID of the association.
- name String
The name for an association.
- attachment
Target string The target that the firewall policy is attached to.
- firewall
Policy string The firewall policy ID of the association.
- name string
The name for an association.
- attachment_
target str The target that the firewall policy is attached to.
- firewall_
policy str The firewall policy ID of the association.
- name str
The name for an association.
- attachment
Target String The target that the firewall policy is attached to.
- firewall
Policy String The firewall policy ID of the association.
- name String
The name for an association.
Outputs
All input properties are implicitly available as output properties. Additionally, the FirewallPolicyAssociation resource produces the following output properties:
- id str
The provider-assigned unique ID for this managed resource.
- short_
name str The short name of the firewall policy of the association.
Look up Existing FirewallPolicyAssociation Resource
Get an existing FirewallPolicyAssociation 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?: FirewallPolicyAssociationState, opts?: CustomResourceOptions): FirewallPolicyAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
attachment_target: Optional[str] = None,
firewall_policy: Optional[str] = None,
name: Optional[str] = None,
short_name: Optional[str] = None) -> FirewallPolicyAssociation
func GetFirewallPolicyAssociation(ctx *Context, name string, id IDInput, state *FirewallPolicyAssociationState, opts ...ResourceOption) (*FirewallPolicyAssociation, error)
public static FirewallPolicyAssociation Get(string name, Input<string> id, FirewallPolicyAssociationState? state, CustomResourceOptions? opts = null)
public static FirewallPolicyAssociation get(String name, Output<String> id, FirewallPolicyAssociationState 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
Target string The target that the firewall policy is attached to.
- Firewall
Policy string The firewall policy ID of the association.
- Name string
The name for an association.
- Short
Name string The short name of the firewall policy of the association.
- Attachment
Target string The target that the firewall policy is attached to.
- Firewall
Policy string The firewall policy ID of the association.
- Name string
The name for an association.
- Short
Name string The short name of the firewall policy of the association.
- attachment
Target String The target that the firewall policy is attached to.
- firewall
Policy String The firewall policy ID of the association.
- name String
The name for an association.
- short
Name String The short name of the firewall policy of the association.
- attachment
Target string The target that the firewall policy is attached to.
- firewall
Policy string The firewall policy ID of the association.
- name string
The name for an association.
- short
Name string The short name of the firewall policy of the association.
- attachment_
target str The target that the firewall policy is attached to.
- firewall_
policy str The firewall policy ID of the association.
- name str
The name for an association.
- short_
name str The short name of the firewall policy of the association.
- attachment
Target String The target that the firewall policy is attached to.
- firewall
Policy String The firewall policy ID of the association.
- name String
The name for an association.
- short
Name String The short name of the firewall policy of the association.
Import
FirewallPolicyAssociation can be imported using any of these accepted formats
$ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default locations/global/firewallPolicies/{{firewall_policy}}/associations/{{name}}
$ pulumi import gcp:compute/firewallPolicyAssociation:FirewallPolicyAssociation default {{firewall_policy}}/{{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.