MagicFirewallRulesetArgs

data class MagicFirewallRulesetArgs(val accountId: Output<String>? = null, val description: Output<String>? = null, val name: Output<String>? = null, val rules: Output<List<Map<String, String>>>? = null) : ConvertibleToJava<MagicFirewallRulesetArgs>

Magic Firewall is a network-level firewall to protect networks that are onboarded to Cloudflare's Magic Transit. This resource creates a root ruleset on the account level and contains one or more rules. Rules can be crafted in Wireshark syntax and are evaluated in order, with the first rule having the highest priority.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";
const example = new cloudflare.MagicFirewallRuleset("example", {
accountId: "d41d8cd98f00b204e9800998ecf8427e",
name: "Magic Transit Ruleset",
description: "Global mitigations",
rules: [
{
action: "allow",
expression: "tcp.dstport in { 32768..65535 }",
description: "Allow TCP Ephemeral Ports",
enabled: "true",
},
{
action: "block",
expression: "ip.len >= 0",
description: "Block all",
enabled: "true",
},
],
});
import pulumi
import pulumi_cloudflare as cloudflare
example = cloudflare.MagicFirewallRuleset("example",
account_id="d41d8cd98f00b204e9800998ecf8427e",
name="Magic Transit Ruleset",
description="Global mitigations",
rules=[
{
"action": "allow",
"expression": "tcp.dstport in { 32768..65535 }",
"description": "Allow TCP Ephemeral Ports",
"enabled": "true",
},
{
"action": "block",
"expression": "ip.len >= 0",
"description": "Block all",
"enabled": "true",
},
])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Cloudflare = Pulumi.Cloudflare;
return await Deployment.RunAsync(() =>
{
var example = new Cloudflare.MagicFirewallRuleset("example", new()
{
AccountId = "d41d8cd98f00b204e9800998ecf8427e",
Name = "Magic Transit Ruleset",
Description = "Global mitigations",
Rules = new[]
{
{
{ "action", "allow" },
{ "expression", "tcp.dstport in { 32768..65535 }" },
{ "description", "Allow TCP Ephemeral Ports" },
{ "enabled", "true" },
},
{
{ "action", "block" },
{ "expression", "ip.len >= 0" },
{ "description", "Block all" },
{ "enabled", "true" },
},
},
});
});
package main
import (
"github.com/pulumi/pulumi-cloudflare/sdk/v5/go/cloudflare"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := cloudflare.NewMagicFirewallRuleset(ctx, "example", &cloudflare.MagicFirewallRulesetArgs{
AccountId: pulumi.String("d41d8cd98f00b204e9800998ecf8427e"),
Name: pulumi.String("Magic Transit Ruleset"),
Description: pulumi.String("Global mitigations"),
Rules: pulumi.StringMapArray{
pulumi.StringMap{
"action": pulumi.String("allow"),
"expression": pulumi.String("tcp.dstport in { 32768..65535 }"),
"description": pulumi.String("Allow TCP Ephemeral Ports"),
"enabled": pulumi.String("true"),
},
pulumi.StringMap{
"action": pulumi.String("block"),
"expression": pulumi.String("ip.len >= 0"),
"description": pulumi.String("Block all"),
"enabled": pulumi.String("true"),
},
},
})
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.cloudflare.MagicFirewallRuleset;
import com.pulumi.cloudflare.MagicFirewallRulesetArgs;
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 example = new MagicFirewallRuleset("example", MagicFirewallRulesetArgs.builder()
.accountId("d41d8cd98f00b204e9800998ecf8427e")
.name("Magic Transit Ruleset")
.description("Global mitigations")
.rules(
Map.ofEntries(
Map.entry("action", "allow"),
Map.entry("expression", "tcp.dstport in { 32768..65535 }"),
Map.entry("description", "Allow TCP Ephemeral Ports"),
Map.entry("enabled", "true")
),
Map.ofEntries(
Map.entry("action", "block"),
Map.entry("expression", "ip.len >= 0"),
Map.entry("description", "Block all"),
Map.entry("enabled", "true")
))
.build());
}
}
resources:
example:
type: cloudflare:MagicFirewallRuleset
properties:
accountId: d41d8cd98f00b204e9800998ecf8427e
name: Magic Transit Ruleset
description: Global mitigations
rules:
- action: allow
expression: tcp.dstport in { 32768..65535 }
description: Allow TCP Ephemeral Ports
enabled: 'true'
- action: block
expression: ip.len >= 0
description: Block all
enabled: 'true'

Import

An existing Magic Firewall Ruleset can be imported using the account ID and ruleset ID

$ pulumi import cloudflare:index/magicFirewallRuleset:MagicFirewallRuleset example d41d8cd98f00b204e9800998ecf8427e/cb029e245cfdd66dc8d2e570d5dd3322

Constructors

Link copied to clipboard
constructor(accountId: Output<String>? = null, description: Output<String>? = null, name: Output<String>? = null, rules: Output<List<Map<String, String>>>? = null)

Properties

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

The ID of the account where the ruleset is being created.

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

A note that can be used to annotate the rule.

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

The name of the ruleset.

Link copied to clipboard
val rules: Output<List<Map<String, String>>>? = null

Functions

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