Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.pulumi.azure.network.kotlin.Firewall.kt Maven / Gradle / Ivy
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.network.kotlin
import com.pulumi.azure.network.kotlin.outputs.FirewallIpConfiguration
import com.pulumi.azure.network.kotlin.outputs.FirewallManagementIpConfiguration
import com.pulumi.azure.network.kotlin.outputs.FirewallVirtualHub
import com.pulumi.core.Output
import com.pulumi.kotlin.KotlinCustomResource
import com.pulumi.kotlin.PulumiTagMarker
import com.pulumi.kotlin.ResourceMapper
import com.pulumi.kotlin.options.CustomResourceOptions
import com.pulumi.kotlin.options.CustomResourceOptionsBuilder
import com.pulumi.resources.Resource
import kotlin.Boolean
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.network.kotlin.outputs.FirewallIpConfiguration.Companion.toKotlin as firewallIpConfigurationToKotlin
import com.pulumi.azure.network.kotlin.outputs.FirewallManagementIpConfiguration.Companion.toKotlin as firewallManagementIpConfigurationToKotlin
import com.pulumi.azure.network.kotlin.outputs.FirewallVirtualHub.Companion.toKotlin as firewallVirtualHubToKotlin
/**
* Builder for [Firewall].
*/
@PulumiTagMarker
public class FirewallResourceBuilder internal constructor() {
public var name: String? = null
public var args: FirewallArgs = FirewallArgs()
public var opts: CustomResourceOptions = CustomResourceOptions()
/**
* @param name The _unique_ name of the resulting resource.
*/
public fun name(`value`: String) {
this.name = value
}
/**
* @param block The arguments to use to populate this resource's properties.
*/
public suspend fun args(block: suspend FirewallArgsBuilder.() -> Unit) {
val builder = FirewallArgsBuilder()
block(builder)
this.args = builder.build()
}
/**
* @param block A bag of options that control this resource's behavior.
*/
public suspend fun opts(block: suspend CustomResourceOptionsBuilder.() -> Unit) {
this.opts = com.pulumi.kotlin.options.CustomResourceOptions.opts(block)
}
internal fun build(): Firewall {
val builtJavaResource = com.pulumi.azure.network.Firewall(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return Firewall(builtJavaResource)
}
}
/**
* Manages an Azure Firewall.
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as azure from "@pulumi/azure";
* const example = new azure.core.ResourceGroup("example", {
* name: "example-resources",
* location: "West Europe",
* });
* const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
* name: "testvnet",
* addressSpaces: ["10.0.0.0/16"],
* location: example.location,
* resourceGroupName: example.name,
* });
* const exampleSubnet = new azure.network.Subnet("example", {
* name: "AzureFirewallSubnet",
* resourceGroupName: example.name,
* virtualNetworkName: exampleVirtualNetwork.name,
* addressPrefixes: ["10.0.1.0/24"],
* });
* const examplePublicIp = new azure.network.PublicIp("example", {
* name: "testpip",
* location: example.location,
* resourceGroupName: example.name,
* allocationMethod: "Static",
* sku: "Standard",
* });
* const exampleFirewall = new azure.network.Firewall("example", {
* name: "testfirewall",
* location: example.location,
* resourceGroupName: example.name,
* skuName: "AZFW_VNet",
* skuTier: "Standard",
* ipConfigurations: [{
* name: "configuration",
* subnetId: exampleSubnet.id,
* publicIpAddressId: examplePublicIp.id,
* }],
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* example_virtual_network = azure.network.VirtualNetwork("example",
* name="testvnet",
* address_spaces=["10.0.0.0/16"],
* location=example.location,
* resource_group_name=example.name)
* example_subnet = azure.network.Subnet("example",
* name="AzureFirewallSubnet",
* resource_group_name=example.name,
* virtual_network_name=example_virtual_network.name,
* address_prefixes=["10.0.1.0/24"])
* example_public_ip = azure.network.PublicIp("example",
* name="testpip",
* location=example.location,
* resource_group_name=example.name,
* allocation_method="Static",
* sku="Standard")
* example_firewall = azure.network.Firewall("example",
* name="testfirewall",
* location=example.location,
* resource_group_name=example.name,
* sku_name="AZFW_VNet",
* sku_tier="Standard",
* ip_configurations=[{
* "name": "configuration",
* "subnet_id": example_subnet.id,
* "public_ip_address_id": example_public_ip.id,
* }])
* ```
* ```csharp
* using System.Collections.Generic;
* using System.Linq;
* using Pulumi;
* using Azure = Pulumi.Azure;
* return await Deployment.RunAsync(() =>
* {
* var example = new Azure.Core.ResourceGroup("example", new()
* {
* Name = "example-resources",
* Location = "West Europe",
* });
* var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
* {
* Name = "testvnet",
* AddressSpaces = new[]
* {
* "10.0.0.0/16",
* },
* Location = example.Location,
* ResourceGroupName = example.Name,
* });
* var exampleSubnet = new Azure.Network.Subnet("example", new()
* {
* Name = "AzureFirewallSubnet",
* ResourceGroupName = example.Name,
* VirtualNetworkName = exampleVirtualNetwork.Name,
* AddressPrefixes = new[]
* {
* "10.0.1.0/24",
* },
* });
* var examplePublicIp = new Azure.Network.PublicIp("example", new()
* {
* Name = "testpip",
* Location = example.Location,
* ResourceGroupName = example.Name,
* AllocationMethod = "Static",
* Sku = "Standard",
* });
* var exampleFirewall = new Azure.Network.Firewall("example", new()
* {
* Name = "testfirewall",
* Location = example.Location,
* ResourceGroupName = example.Name,
* SkuName = "AZFW_VNet",
* SkuTier = "Standard",
* IpConfigurations = new[]
* {
* new Azure.Network.Inputs.FirewallIpConfigurationArgs
* {
* Name = "configuration",
* SubnetId = exampleSubnet.Id,
* PublicIpAddressId = examplePublicIp.Id,
* },
* },
* });
* });
* ```
* ```go
* package main
* import (
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
* "github.com/pulumi/pulumi-azure/sdk/v5/go/azure/network"
* "github.com/pulumi/pulumi/sdk/v3/go/pulumi"
* )
* func main() {
* pulumi.Run(func(ctx *pulumi.Context) error {
* example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
* Name: pulumi.String("example-resources"),
* Location: pulumi.String("West Europe"),
* })
* if err != nil {
* return err
* }
* exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
* Name: pulumi.String("testvnet"),
* AddressSpaces: pulumi.StringArray{
* pulumi.String("10.0.0.0/16"),
* },
* Location: example.Location,
* ResourceGroupName: example.Name,
* })
* if err != nil {
* return err
* }
* exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
* Name: pulumi.String("AzureFirewallSubnet"),
* ResourceGroupName: example.Name,
* VirtualNetworkName: exampleVirtualNetwork.Name,
* AddressPrefixes: pulumi.StringArray{
* pulumi.String("10.0.1.0/24"),
* },
* })
* if err != nil {
* return err
* }
* examplePublicIp, err := network.NewPublicIp(ctx, "example", &network.PublicIpArgs{
* Name: pulumi.String("testpip"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* AllocationMethod: pulumi.String("Static"),
* Sku: pulumi.String("Standard"),
* })
* if err != nil {
* return err
* }
* _, err = network.NewFirewall(ctx, "example", &network.FirewallArgs{
* Name: pulumi.String("testfirewall"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* SkuName: pulumi.String("AZFW_VNet"),
* SkuTier: pulumi.String("Standard"),
* IpConfigurations: network.FirewallIpConfigurationArray{
* &network.FirewallIpConfigurationArgs{
* Name: pulumi.String("configuration"),
* SubnetId: exampleSubnet.ID(),
* PublicIpAddressId: examplePublicIp.ID(),
* },
* },
* })
* if err != nil {
* return err
* }
* return nil
* })
* }
* ```
* ```java
* package generated_program;
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.azure.core.ResourceGroup;
* import com.pulumi.azure.core.ResourceGroupArgs;
* import com.pulumi.azure.network.VirtualNetwork;
* import com.pulumi.azure.network.VirtualNetworkArgs;
* import com.pulumi.azure.network.Subnet;
* import com.pulumi.azure.network.SubnetArgs;
* import com.pulumi.azure.network.PublicIp;
* import com.pulumi.azure.network.PublicIpArgs;
* import com.pulumi.azure.network.Firewall;
* import com.pulumi.azure.network.FirewallArgs;
* import com.pulumi.azure.network.inputs.FirewallIpConfigurationArgs;
* 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 ResourceGroup("example", ResourceGroupArgs.builder()
* .name("example-resources")
* .location("West Europe")
* .build());
* var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
* .name("testvnet")
* .addressSpaces("10.0.0.0/16")
* .location(example.location())
* .resourceGroupName(example.name())
* .build());
* var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
* .name("AzureFirewallSubnet")
* .resourceGroupName(example.name())
* .virtualNetworkName(exampleVirtualNetwork.name())
* .addressPrefixes("10.0.1.0/24")
* .build());
* var examplePublicIp = new PublicIp("examplePublicIp", PublicIpArgs.builder()
* .name("testpip")
* .location(example.location())
* .resourceGroupName(example.name())
* .allocationMethod("Static")
* .sku("Standard")
* .build());
* var exampleFirewall = new Firewall("exampleFirewall", FirewallArgs.builder()
* .name("testfirewall")
* .location(example.location())
* .resourceGroupName(example.name())
* .skuName("AZFW_VNet")
* .skuTier("Standard")
* .ipConfigurations(FirewallIpConfigurationArgs.builder()
* .name("configuration")
* .subnetId(exampleSubnet.id())
* .publicIpAddressId(examplePublicIp.id())
* .build())
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* exampleVirtualNetwork:
* type: azure:network:VirtualNetwork
* name: example
* properties:
* name: testvnet
* addressSpaces:
* - 10.0.0.0/16
* location: ${example.location}
* resourceGroupName: ${example.name}
* exampleSubnet:
* type: azure:network:Subnet
* name: example
* properties:
* name: AzureFirewallSubnet
* resourceGroupName: ${example.name}
* virtualNetworkName: ${exampleVirtualNetwork.name}
* addressPrefixes:
* - 10.0.1.0/24
* examplePublicIp:
* type: azure:network:PublicIp
* name: example
* properties:
* name: testpip
* location: ${example.location}
* resourceGroupName: ${example.name}
* allocationMethod: Static
* sku: Standard
* exampleFirewall:
* type: azure:network:Firewall
* name: example
* properties:
* name: testfirewall
* location: ${example.location}
* resourceGroupName: ${example.name}
* skuName: AZFW_VNet
* skuTier: Standard
* ipConfigurations:
* - name: configuration
* subnetId: ${exampleSubnet.id}
* publicIpAddressId: ${examplePublicIp.id}
* ```
*
* ## Import
* Azure Firewalls can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:network/firewall:Firewall example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/azureFirewalls/testfirewall
* ```
*/
public class Firewall internal constructor(
override val javaResource: com.pulumi.azure.network.Firewall,
) : KotlinCustomResource(javaResource, FirewallMapper) {
/**
* Whether DNS proxy is enabled. It will forward DNS requests to the DNS servers when set to `true`. It will be set to `true` if `dns_servers` provided with a not empty list.
*/
public val dnsProxyEnabled: Output
get() = javaResource.dnsProxyEnabled().applyValue({ args0 -> args0 })
/**
* A list of DNS servers that the Azure Firewall will direct DNS traffic to the for name resolution.
*/
public val dnsServers: Output>?
get() = javaResource.dnsServers().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0
})
}).orElse(null)
})
/**
* The ID of the Firewall Policy applied to this Firewall.
*/
public val firewallPolicyId: Output?
get() = javaResource.firewallPolicyId().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* An `ip_configuration` block as documented below.
*/
public val ipConfigurations: Output>?
get() = javaResource.ipConfigurations().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
firewallIpConfigurationToKotlin(args0)
})
})
}).orElse(null)
})
/**
* Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* A `management_ip_configuration` block as documented below, which allows force-tunnelling of traffic to be performed by the firewall. Adding or removing this block or changing the `subnet_id` in an existing block forces a new resource to be created. Changing this forces a new resource to be created.
*/
public val managementIpConfiguration: Output?
get() = javaResource.managementIpConfiguration().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> firewallManagementIpConfigurationToKotlin(args0) })
}).orElse(null)
})
/**
* Specifies the name of the Firewall. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* A list of SNAT private CIDR IP ranges, or the special string `IANAPrivateRanges`, which indicates Azure Firewall does not SNAT when the destination IP address is a private range per IANA RFC 1918.
*/
public val privateIpRanges: Output>?
get() = javaResource.privateIpRanges().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 -> args0 })
}).orElse(null)
})
/**
* The name of the resource group in which to create the resource. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* SKU name of the Firewall. Possible values are `AZFW_Hub` and `AZFW_VNet`. Changing this forces a new resource to be created.
*/
public val skuName: Output
get() = javaResource.skuName().applyValue({ args0 -> args0 })
/**
* SKU tier of the Firewall. Possible values are `Premium`, `Standard` and `Basic`.
*/
public val skuTier: Output
get() = javaResource.skuTier().applyValue({ args0 -> args0 })
/**
* A mapping of tags to assign to the resource.
*/
public val tags: Output>?
get() = javaResource.tags().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0.key.to(args0.value)
}).toMap()
}).orElse(null)
})
/**
* The operation mode for threat intelligence-based filtering. Possible values are: `Off`, `Alert` and `Deny`. Defaults to `Alert`.
*/
public val threatIntelMode: Output
get() = javaResource.threatIntelMode().applyValue({ args0 -> args0 })
/**
* A `virtual_hub` block as documented below.
*/
public val virtualHub: Output?
get() = javaResource.virtualHub().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
firewallVirtualHubToKotlin(args0)
})
}).orElse(null)
})
/**
* Specifies a list of Availability Zones in which this Azure Firewall should be located. Changing this forces a new Azure Firewall to be created.
* > **Please Note**: Availability Zones are [only supported in several regions at this time](https://docs.microsoft.com/azure/availability-zones/az-overview).
*/
public val zones: Output>?
get() = javaResource.zones().applyValue({ args0 ->
args0.map({ args0 ->
args0.map({ args0 ->
args0
})
}).orElse(null)
})
}
public object FirewallMapper : ResourceMapper {
override fun supportsMappingOfType(javaResource: Resource): Boolean =
com.pulumi.azure.network.Firewall::class == javaResource::class
override fun map(javaResource: Resource): Firewall = Firewall(
javaResource as
com.pulumi.azure.network.Firewall,
)
}
/**
* @see [Firewall].
* @param name The _unique_ name of the resulting resource.
* @param block Builder for [Firewall].
*/
public suspend fun firewall(name: String, block: suspend FirewallResourceBuilder.() -> Unit): Firewall {
val builder = FirewallResourceBuilder()
builder.name(name)
block(builder)
return builder.build()
}
/**
* @see [Firewall].
* @param name The _unique_ name of the resulting resource.
*/
public fun firewall(name: String): Firewall {
val builder = FirewallResourceBuilder()
builder.name(name)
return builder.build()
}