getSubnet

Use this data source to access information about an existing Subnet within a Virtual Network.

Example Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.network.NetworkFunctions;
import com.pulumi.azure.network.inputs.GetSubnetArgs;
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) {
final var example = NetworkFunctions.getSubnet(GetSubnetArgs.builder()
.name("backend")
.virtualNetworkName("production")
.resourceGroupName("networking")
.build());
ctx.export("subnetId", example.applyValue(getSubnetResult -> getSubnetResult.id()));
}
}

Return

A collection of values returned by getSubnet.

Parameters

argument

A collection of arguments for invoking getSubnet.


suspend fun getSubnet(name: String, resourceGroupName: String, virtualNetworkName: String): GetSubnetResult

Return

A collection of values returned by getSubnet.

See also

Parameters

name

Specifies the name of the Subnet.

resourceGroupName

Specifies the name of the resource group the Virtual Network is located in.

virtualNetworkName

Specifies the name of the Virtual Network this Subnet is located within.


suspend fun getSubnet(argument: suspend GetSubnetPlainArgsBuilder.() -> Unit): GetSubnetResult

Return

A collection of values returned by getSubnet.

See also

Parameters

argument

Builder for com.pulumi.azure.network.kotlin.inputs.GetSubnetPlainArgs.