FirewallPolicyRule

class FirewallPolicyRule : KotlinCustomResource

The Compute FirewallPolicyRule resource

Example Usage

Basic_fir_sec_rule

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.networksecurity.AddressGroup;
import com.pulumi.gcp.networksecurity.AddressGroupArgs;
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.FirewallPolicyRule;
import com.pulumi.gcp.compute.FirewallPolicyRuleArgs;
import com.pulumi.gcp.compute.inputs.FirewallPolicyRuleMatchArgs;
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 basicGlobalNetworksecurityAddressGroup = new AddressGroup("basicGlobalNetworksecurityAddressGroup", AddressGroupArgs.builder()
.parent("organizations/123456789")
.description("Sample global networksecurity_address_group")
.location("global")
.items("208.80.154.224/32")
.type("IPV4")
.capacity(100)
.build());
var folder = new Folder("folder", FolderArgs.builder()
.displayName("policy")
.parent("organizations/123456789")
.build());
var default_ = new FirewallPolicy("default", FirewallPolicyArgs.builder()
.parent(folder.id())
.shortName("policy")
.description("Resource created for Terraform acceptance testing")
.build());
var primary = new FirewallPolicyRule("primary", FirewallPolicyRuleArgs.builder()
.firewallPolicy(default_.name())
.description("Resource created for Terraform acceptance testing")
.priority(9000)
.enableLogging(true)
.action("allow")
.direction("EGRESS")
.disabled(false)
.match(FirewallPolicyRuleMatchArgs.builder()
.layer4Configs(
FirewallPolicyRuleMatchLayer4ConfigArgs.builder()
.ipProtocol("tcp")
.ports(8080)
.build(),
FirewallPolicyRuleMatchLayer4ConfigArgs.builder()
.ipProtocol("udp")
.ports(22)
.build())
.destIpRanges("11.100.0.1/32")
.destFqdns()
.destRegionCodes("US")
.destThreatIntelligences("iplist-known-malicious-ips")
.srcAddressGroups()
.destAddressGroups(basicGlobalNetworksecurityAddressGroup.id())
.build())
.targetServiceAccounts("my@service-account.com")
.build());
}
}

Import

FirewallPolicyRule can be imported using any of these accepted formats

$ pulumi import gcp:compute/firewallPolicyRule:FirewallPolicyRule default locations/global/firewallPolicies/{{firewall_policy}}/rules/{{priority}}
$ pulumi import gcp:compute/firewallPolicyRule:FirewallPolicyRule default {{firewall_policy}}/{{priority}}

Properties

Link copied to clipboard
val action: Output<String>

The Action to perform when the client connection triggers the rule. Valid actions are "allow", "deny" and "goto_next".

Link copied to clipboard
val description: Output<String>?

An optional description for this resource.

Link copied to clipboard
val direction: Output<String>

The direction in which this rule applies. Possible values: INGRESS, EGRESS

Link copied to clipboard
val disabled: Output<Boolean>?

Denotes whether the firewall policy rule is disabled. When set to true, the firewall policy rule is not enforced and traffic behaves as if it did not exist. If this is unspecified, the firewall policy rule will be enabled.

Link copied to clipboard
val enableLogging: Output<Boolean>?

Denotes whether to enable logging for a particular rule. If logging is enabled, logs will be exported to the configured export destination in Stackdriver. Logs may be exported to BigQuery or Pub/Sub. Note: you cannot enable logging on "goto_next" rules.

Link copied to clipboard
val firewallPolicy: Output<String>

The firewall policy of the resource.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val kind: Output<String>

Type of the resource. Always compute#firewallPolicyRule for firewall policy rules

Link copied to clipboard

A match condition that incoming traffic is evaluated against. If it evaluates to true, the corresponding 'action' is enforced.

Link copied to clipboard
val priority: Output<Int>

An integer indicating the priority of a rule in the list. The priority must be a positive value between 0 and 2147483647. Rules are evaluated from highest to lowest priority where 0 is the highest priority and 2147483647 is the lowest prority.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val ruleTupleCount: Output<Int>

Calculation of the complexity of a single firewall policy rule.

Link copied to clipboard
val targetResources: Output<List<String>>?

A list of network resource URLs to which this rule applies. This field allows you to control which network's VMs get this rule. If this field is left blank, all VMs within the organization will receive the rule.

Link copied to clipboard

A list of service accounts indicating the sets of instances that are applied with this rule.

Link copied to clipboard
val urn: Output<String>