ionoscloud.getNsg
Explore with Pulumi AI
The NSG Data source can be used to search for and return an existing security group. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search string so that it is specific enough to return only one result.
Example Usage
By ID
import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";
const example = ionoscloud.getNsg({
datacenterId: ionoscloud_datacenter.example.id,
id: nsg_id,
});
import pulumi
import pulumi_ionoscloud as ionoscloud
example = ionoscloud.get_nsg(datacenter_id=ionoscloud_datacenter["example"]["id"],
id=nsg_id)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ionoscloud.LookupNsg(ctx, &ionoscloud.LookupNsgArgs{
DatacenterId: ionoscloud_datacenter.Example.Id,
Id: pulumi.StringRef(nsg_id),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;
return await Deployment.RunAsync(() =>
{
var example = Ionoscloud.GetNsg.Invoke(new()
{
DatacenterId = ionoscloud_datacenter.Example.Id,
Id = nsg_id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.IonoscloudFunctions;
import com.pulumi.ionoscloud.inputs.GetNsgArgs;
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 = IonoscloudFunctions.getNsg(GetNsgArgs.builder()
.datacenterId(ionoscloud_datacenter.example().id())
.id(nsg_id)
.build());
}
}
variables:
example:
fn::invoke:
function: ionoscloud:getNsg
arguments:
datacenterId: ${ionoscloud_datacenter.example.id}
id: ${nsg_id}
By Name
import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";
const example = ionoscloud.getNsg({
datacenterId: ionoscloud_datacenter.example.id,
name: "NSG Example",
});
import pulumi
import pulumi_ionoscloud as ionoscloud
example = ionoscloud.get_nsg(datacenter_id=ionoscloud_datacenter["example"]["id"],
name="NSG Example")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ionoscloud.LookupNsg(ctx, &ionoscloud.LookupNsgArgs{
DatacenterId: ionoscloud_datacenter.Example.Id,
Name: pulumi.StringRef("NSG Example"),
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;
return await Deployment.RunAsync(() =>
{
var example = Ionoscloud.GetNsg.Invoke(new()
{
DatacenterId = ionoscloud_datacenter.Example.Id,
Name = "NSG Example",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.IonoscloudFunctions;
import com.pulumi.ionoscloud.inputs.GetNsgArgs;
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 = IonoscloudFunctions.getNsg(GetNsgArgs.builder()
.datacenterId(ionoscloud_datacenter.example().id())
.name("NSG Example")
.build());
}
}
variables:
example:
fn::invoke:
function: ionoscloud:getNsg
arguments:
datacenterId: ${ionoscloud_datacenter.example.id}
name: NSG Example
Using getNsg
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getNsg(args: GetNsgArgs, opts?: InvokeOptions): Promise<GetNsgResult>
function getNsgOutput(args: GetNsgOutputArgs, opts?: InvokeOptions): Output<GetNsgResult>
def get_nsg(datacenter_id: Optional[str] = None,
id: Optional[str] = None,
name: Optional[str] = None,
timeouts: Optional[GetNsgTimeouts] = None,
opts: Optional[InvokeOptions] = None) -> GetNsgResult
def get_nsg_output(datacenter_id: Optional[pulumi.Input[str]] = None,
id: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
timeouts: Optional[pulumi.Input[GetNsgTimeoutsArgs]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetNsgResult]
func LookupNsg(ctx *Context, args *LookupNsgArgs, opts ...InvokeOption) (*LookupNsgResult, error)
func LookupNsgOutput(ctx *Context, args *LookupNsgOutputArgs, opts ...InvokeOption) LookupNsgResultOutput
> Note: This function is named LookupNsg
in the Go SDK.
public static class GetNsg
{
public static Task<GetNsgResult> InvokeAsync(GetNsgArgs args, InvokeOptions? opts = null)
public static Output<GetNsgResult> Invoke(GetNsgInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetNsgResult> getNsg(GetNsgArgs args, InvokeOptions options)
public static Output<GetNsgResult> getNsg(GetNsgArgs args, InvokeOptions options)
fn::invoke:
function: ionoscloud:index/getNsg:getNsg
arguments:
# arguments dictionary
The following arguments are supported:
- Datacenter
Id string - Datacenter's UUID.
- Id string
- Id of an existing Network Security Group that you want to search for.
- Name string
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- Timeouts
Get
Nsg Timeouts
- Datacenter
Id string - Datacenter's UUID.
- Id string
- Id of an existing Network Security Group that you want to search for.
- Name string
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- Timeouts
Get
Nsg Timeouts
- datacenter
Id String - Datacenter's UUID.
- id String
- Id of an existing Network Security Group that you want to search for.
- name String
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- timeouts
Get
Nsg Timeouts
- datacenter
Id string - Datacenter's UUID.
- id string
- Id of an existing Network Security Group that you want to search for.
- name string
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- timeouts
Get
Nsg Timeouts
- datacenter_
id str - Datacenter's UUID.
- id str
- Id of an existing Network Security Group that you want to search for.
- name str
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- timeouts
Get
Nsg Timeouts
- datacenter
Id String - Datacenter's UUID.
- id String
- Id of an existing Network Security Group that you want to search for.
- name String
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- timeouts Property Map
getNsg Result
The following output properties are available:
- Datacenter
Id string - UUID of the Virtual Data Center
- Description string
- Description for the Network Security Group
- Id string
- UUID of the Network Security Group
- Name string
- The name of the Network Security Group
- Rule
Ids List<string> - List of IDs for the Firewall Rules attached to this group
- Rules
List<Get
Nsg Rule> - List of Firewall Rule objects attached to this group
- Timeouts
Get
Nsg Timeouts
- Datacenter
Id string - UUID of the Virtual Data Center
- Description string
- Description for the Network Security Group
- Id string
- UUID of the Network Security Group
- Name string
- The name of the Network Security Group
- Rule
Ids []string - List of IDs for the Firewall Rules attached to this group
- Rules
[]Get
Nsg Rule - List of Firewall Rule objects attached to this group
- Timeouts
Get
Nsg Timeouts
- datacenter
Id String - UUID of the Virtual Data Center
- description String
- Description for the Network Security Group
- id String
- UUID of the Network Security Group
- name String
- The name of the Network Security Group
- rule
Ids List<String> - List of IDs for the Firewall Rules attached to this group
- rules
List<Get
Nsg Rule> - List of Firewall Rule objects attached to this group
- timeouts
Get
Nsg Timeouts
- datacenter
Id string - UUID of the Virtual Data Center
- description string
- Description for the Network Security Group
- id string
- UUID of the Network Security Group
- name string
- The name of the Network Security Group
- rule
Ids string[] - List of IDs for the Firewall Rules attached to this group
- rules
Get
Nsg Rule[] - List of Firewall Rule objects attached to this group
- timeouts
Get
Nsg Timeouts
- datacenter_
id str - UUID of the Virtual Data Center
- description str
- Description for the Network Security Group
- id str
- UUID of the Network Security Group
- name str
- The name of the Network Security Group
- rule_
ids Sequence[str] - List of IDs for the Firewall Rules attached to this group
- rules
Sequence[Get
Nsg Rule] - List of Firewall Rule objects attached to this group
- timeouts
Get
Nsg Timeouts
- datacenter
Id String - UUID of the Virtual Data Center
- description String
- Description for the Network Security Group
- id String
- UUID of the Network Security Group
- name String
- The name of the Network Security Group
- rule
Ids List<String> - List of IDs for the Firewall Rules attached to this group
- rules List<Property Map>
- List of Firewall Rule objects attached to this group
- timeouts Property Map
Supporting Types
GetNsgRule
- Icmp
Code string - Icmp
Type string - Id string
- Id of an existing Network Security Group that you want to search for.
- Name string
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- Port
Range doubleEnd - Port
Range doubleStart - Protocol string
- Source
Ip string - Source
Mac string - Target
Ip string - Type string
- Icmp
Code string - Icmp
Type string - Id string
- Id of an existing Network Security Group that you want to search for.
- Name string
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- Port
Range float64End - Port
Range float64Start - Protocol string
- Source
Ip string - Source
Mac string - Target
Ip string - Type string
- icmp
Code String - icmp
Type String - id String
- Id of an existing Network Security Group that you want to search for.
- name String
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- port
Range DoubleEnd - port
Range DoubleStart - protocol String
- source
Ip String - source
Mac String - target
Ip String - type String
- icmp
Code string - icmp
Type string - id string
- Id of an existing Network Security Group that you want to search for.
- name string
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- port
Range numberEnd - port
Range numberStart - protocol string
- source
Ip string - source
Mac string - target
Ip string - type string
- icmp_
code str - icmp_
type str - id str
- Id of an existing Network Security Group that you want to search for.
- name str
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- port_
range_ floatend - port_
range_ floatstart - protocol str
- source_
ip str - source_
mac str - target_
ip str - type str
- icmp
Code String - icmp
Type String - id String
- Id of an existing Network Security Group that you want to search for.
- name String
Name of an existing Network Security Group that you want to search for.
Either
name
, orid
must be provided. If none, the datasource will return an error.- port
Range NumberEnd - port
Range NumberStart - protocol String
- source
Ip String - source
Mac String - target
Ip String - type String
GetNsgTimeouts
Package Details
- Repository
- ionoscloud ionos-cloud/terraform-provider-ionoscloud
- License
- Notes
- This Pulumi package is based on the
ionoscloud
Terraform Provider.