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.
@file:Suppress("NAME_SHADOWING", "DEPRECATION")
package com.pulumi.azure.network.kotlin
import com.pulumi.azure.network.kotlin.outputs.VirtualNetworkDdosProtectionPlan
import com.pulumi.azure.network.kotlin.outputs.VirtualNetworkEncryption
import com.pulumi.azure.network.kotlin.outputs.VirtualNetworkSubnet
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.Int
import kotlin.String
import kotlin.Suppress
import kotlin.Unit
import kotlin.collections.List
import kotlin.collections.Map
import com.pulumi.azure.network.kotlin.outputs.VirtualNetworkDdosProtectionPlan.Companion.toKotlin as virtualNetworkDdosProtectionPlanToKotlin
import com.pulumi.azure.network.kotlin.outputs.VirtualNetworkEncryption.Companion.toKotlin as virtualNetworkEncryptionToKotlin
import com.pulumi.azure.network.kotlin.outputs.VirtualNetworkSubnet.Companion.toKotlin as virtualNetworkSubnetToKotlin
/**
* Builder for [VirtualNetwork].
*/
@PulumiTagMarker
public class VirtualNetworkResourceBuilder internal constructor() {
public var name: String? = null
public var args: VirtualNetworkArgs = VirtualNetworkArgs()
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 VirtualNetworkArgsBuilder.() -> Unit) {
val builder = VirtualNetworkArgsBuilder()
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(): VirtualNetwork {
val builtJavaResource = com.pulumi.azure.network.VirtualNetwork(
this.name,
this.args.toJava(),
this.opts.toJava(),
)
return VirtualNetwork(builtJavaResource)
}
}
/**
* Manages a virtual network including any configured subnets. Each subnet can
* optionally be configured with a security group to be associated with the subnet.
* > **NOTE on Virtual Networks and Subnet's:** This provider currently
* provides both a standalone Subnet resource, and allows for Subnets to be defined in-line within the Virtual Network resource.
* At this time you cannot use a Virtual Network with in-line Subnets in conjunction with any Subnet resources. Doing so will cause a conflict of Subnet configurations and will overwrite Subnet's.
* > **NOTE on Virtual Networks and DNS Servers:** This provider currently provides both a standalone virtual network DNS Servers resource, and allows for DNS servers to be defined in-line within the Virtual Network resource.
* At this time you cannot use a Virtual Network with in-line DNS servers in conjunction with any Virtual Network DNS Servers resources. Doing so will cause a conflict of Virtual Network DNS Servers configurations and will overwrite virtual networks DNS servers.
* ## 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 exampleNetworkSecurityGroup = new azure.network.NetworkSecurityGroup("example", {
* name: "example-security-group",
* location: example.location,
* resourceGroupName: example.name,
* });
* const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
* name: "example-network",
* location: example.location,
* resourceGroupName: example.name,
* addressSpaces: ["10.0.0.0/16"],
* dnsServers: [
* "10.0.0.4",
* "10.0.0.5",
* ],
* subnets: [
* {
* name: "subnet1",
* addressPrefix: "10.0.1.0/24",
* },
* {
* name: "subnet2",
* addressPrefix: "10.0.2.0/24",
* securityGroup: exampleNetworkSecurityGroup.id,
* },
* ],
* tags: {
* environment: "Production",
* },
* });
* ```
* ```python
* import pulumi
* import pulumi_azure as azure
* example = azure.core.ResourceGroup("example",
* name="example-resources",
* location="West Europe")
* example_network_security_group = azure.network.NetworkSecurityGroup("example",
* name="example-security-group",
* location=example.location,
* resource_group_name=example.name)
* example_virtual_network = azure.network.VirtualNetwork("example",
* name="example-network",
* location=example.location,
* resource_group_name=example.name,
* address_spaces=["10.0.0.0/16"],
* dns_servers=[
* "10.0.0.4",
* "10.0.0.5",
* ],
* subnets=[
* {
* "name": "subnet1",
* "address_prefix": "10.0.1.0/24",
* },
* {
* "name": "subnet2",
* "address_prefix": "10.0.2.0/24",
* "security_group": example_network_security_group.id,
* },
* ],
* tags={
* "environment": "Production",
* })
* ```
* ```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 exampleNetworkSecurityGroup = new Azure.Network.NetworkSecurityGroup("example", new()
* {
* Name = "example-security-group",
* Location = example.Location,
* ResourceGroupName = example.Name,
* });
* var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
* {
* Name = "example-network",
* Location = example.Location,
* ResourceGroupName = example.Name,
* AddressSpaces = new[]
* {
* "10.0.0.0/16",
* },
* DnsServers = new[]
* {
* "10.0.0.4",
* "10.0.0.5",
* },
* Subnets = new[]
* {
* new Azure.Network.Inputs.VirtualNetworkSubnetArgs
* {
* Name = "subnet1",
* AddressPrefix = "10.0.1.0/24",
* },
* new Azure.Network.Inputs.VirtualNetworkSubnetArgs
* {
* Name = "subnet2",
* AddressPrefix = "10.0.2.0/24",
* SecurityGroup = exampleNetworkSecurityGroup.Id,
* },
* },
* Tags =
* {
* { "environment", "Production" },
* },
* });
* });
* ```
* ```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
* }
* exampleNetworkSecurityGroup, err := network.NewNetworkSecurityGroup(ctx, "example", &network.NetworkSecurityGroupArgs{
* Name: pulumi.String("example-security-group"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* })
* if err != nil {
* return err
* }
* _, err = network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
* Name: pulumi.String("example-network"),
* Location: example.Location,
* ResourceGroupName: example.Name,
* AddressSpaces: pulumi.StringArray{
* pulumi.String("10.0.0.0/16"),
* },
* DnsServers: pulumi.StringArray{
* pulumi.String("10.0.0.4"),
* pulumi.String("10.0.0.5"),
* },
* Subnets: network.VirtualNetworkSubnetArray{
* &network.VirtualNetworkSubnetArgs{
* Name: pulumi.String("subnet1"),
* AddressPrefix: pulumi.String("10.0.1.0/24"),
* },
* &network.VirtualNetworkSubnetArgs{
* Name: pulumi.String("subnet2"),
* AddressPrefix: pulumi.String("10.0.2.0/24"),
* SecurityGroup: exampleNetworkSecurityGroup.ID(),
* },
* },
* Tags: pulumi.StringMap{
* "environment": pulumi.String("Production"),
* },
* })
* 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.NetworkSecurityGroup;
* import com.pulumi.azure.network.NetworkSecurityGroupArgs;
* import com.pulumi.azure.network.VirtualNetwork;
* import com.pulumi.azure.network.VirtualNetworkArgs;
* import com.pulumi.azure.network.inputs.VirtualNetworkSubnetArgs;
* 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 exampleNetworkSecurityGroup = new NetworkSecurityGroup("exampleNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
* .name("example-security-group")
* .location(example.location())
* .resourceGroupName(example.name())
* .build());
* var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
* .name("example-network")
* .location(example.location())
* .resourceGroupName(example.name())
* .addressSpaces("10.0.0.0/16")
* .dnsServers(
* "10.0.0.4",
* "10.0.0.5")
* .subnets(
* VirtualNetworkSubnetArgs.builder()
* .name("subnet1")
* .addressPrefix("10.0.1.0/24")
* .build(),
* VirtualNetworkSubnetArgs.builder()
* .name("subnet2")
* .addressPrefix("10.0.2.0/24")
* .securityGroup(exampleNetworkSecurityGroup.id())
* .build())
* .tags(Map.of("environment", "Production"))
* .build());
* }
* }
* ```
* ```yaml
* resources:
* example:
* type: azure:core:ResourceGroup
* properties:
* name: example-resources
* location: West Europe
* exampleNetworkSecurityGroup:
* type: azure:network:NetworkSecurityGroup
* name: example
* properties:
* name: example-security-group
* location: ${example.location}
* resourceGroupName: ${example.name}
* exampleVirtualNetwork:
* type: azure:network:VirtualNetwork
* name: example
* properties:
* name: example-network
* location: ${example.location}
* resourceGroupName: ${example.name}
* addressSpaces:
* - 10.0.0.0/16
* dnsServers:
* - 10.0.0.4
* - 10.0.0.5
* subnets:
* - name: subnet1
* addressPrefix: 10.0.1.0/24
* - name: subnet2
* addressPrefix: 10.0.2.0/24
* securityGroup: ${exampleNetworkSecurityGroup.id}
* tags:
* environment: Production
* ```
*
* ## Import
* Virtual Networks can be imported using the `resource id`, e.g.
* ```sh
* $ pulumi import azure:network/virtualNetwork:VirtualNetwork exampleNetwork /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/virtualNetworks/myvnet1
* ```
*/
public class VirtualNetwork internal constructor(
override val javaResource: com.pulumi.azure.network.VirtualNetwork,
) : KotlinCustomResource(javaResource, VirtualNetworkMapper) {
/**
* The address space that is used the virtual network. You can supply more than one address space.
*/
public val addressSpaces: Output>
get() = javaResource.addressSpaces().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* The BGP community attribute in format `:`.
* > **NOTE** The `as-number` segment is the Microsoft ASN, which is always `12076` for now.
*/
public val bgpCommunity: Output?
get() = javaResource.bgpCommunity().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* A `ddos_protection_plan` block as documented below.
*/
public val ddosProtectionPlan: Output?
get() = javaResource.ddosProtectionPlan().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 -> virtualNetworkDdosProtectionPlanToKotlin(args0) })
}).orElse(null)
})
/**
* List of IP addresses of DNS servers
* > **NOTE** Since `dns_servers` can be configured both inline and via the separate `azure.network.VirtualNetworkDnsServers` resource, we have to explicitly set it to empty slice (`[]`) to remove it.
*/
public val dnsServers: Output>
get() = javaResource.dnsServers().applyValue({ args0 -> args0.map({ args0 -> args0 }) })
/**
* Specifies the Edge Zone within the Azure Region where this Virtual Network should exist. Changing this forces a new Virtual Network to be created.
*/
public val edgeZone: Output?
get() = javaResource.edgeZone().applyValue({ args0 -> args0.map({ args0 -> args0 }).orElse(null) })
/**
* A `encryption` block as defined below.
*/
public val encryption: Output?
get() = javaResource.encryption().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
virtualNetworkEncryptionToKotlin(args0)
})
}).orElse(null)
})
/**
* The flow timeout in minutes for the Virtual Network, which is used to enable connection tracking for intra-VM flows. Possible values are between `4` and `30` minutes.
*/
public val flowTimeoutInMinutes: Output?
get() = javaResource.flowTimeoutInMinutes().applyValue({ args0 ->
args0.map({ args0 ->
args0
}).orElse(null)
})
/**
* The GUID of the virtual network.
*/
public val guid: Output
get() = javaResource.guid().applyValue({ args0 -> args0 })
/**
* The location/region where the virtual network is created. Changing this forces a new resource to be created.
*/
public val location: Output
get() = javaResource.location().applyValue({ args0 -> args0 })
/**
* The name of the virtual network. Changing this forces a new resource to be created.
*/
public val name: Output
get() = javaResource.name().applyValue({ args0 -> args0 })
/**
* The name of the resource group in which to create the virtual network. Changing this forces a new resource to be created.
*/
public val resourceGroupName: Output
get() = javaResource.resourceGroupName().applyValue({ args0 -> args0 })
/**
* Can be specified multiple times to define multiple subnets. Each `subnet` block supports fields documented below.
* > **NOTE** Since `subnet` can be configured both inline and via the separate `azure.network.Subnet` resource, we have to explicitly set it to empty slice (`[]`) to remove it.
*/
public val subnets: Output>
get() = javaResource.subnets().applyValue({ args0 ->
args0.map({ args0 ->
args0.let({ args0 ->
virtualNetworkSubnetToKotlin(args0)
})
})
})
/**
* A mapping of tags to assign to the resource.
*/
public val tags: Output