1. Packages
  2. Openstack Provider
  3. API Docs
  4. networking
  5. getSecGroup
OpenStack v5.0.3 published on Wednesday, Feb 12, 2025 by Pulumi

openstack.networking.getSecGroup

Explore with Pulumi AI

OpenStack v5.0.3 published on Wednesday, Feb 12, 2025 by Pulumi

Use this data source to get the ID of an available OpenStack security group.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as openstack from "@pulumi/openstack";

const secgroup = openstack.networking.getSecGroup({
    name: "tf_test_secgroup",
});
Copy
import pulumi
import pulumi_openstack as openstack

secgroup = openstack.networking.get_sec_group(name="tf_test_secgroup")
Copy
package main

import (
	"github.com/pulumi/pulumi-openstack/sdk/v5/go/openstack/networking"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := networking.LookupSecGroup(ctx, &networking.LookupSecGroupArgs{
			Name: pulumi.StringRef("tf_test_secgroup"),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using OpenStack = Pulumi.OpenStack;

return await Deployment.RunAsync(() => 
{
    var secgroup = OpenStack.Networking.GetSecGroup.Invoke(new()
    {
        Name = "tf_test_secgroup",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.openstack.networking.NetworkingFunctions;
import com.pulumi.openstack.networking.inputs.GetSecGroupArgs;
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 secgroup = NetworkingFunctions.getSecGroup(GetSecGroupArgs.builder()
            .name("tf_test_secgroup")
            .build());

    }
}
Copy
variables:
  secgroup:
    fn::invoke:
      function: openstack:networking:getSecGroup
      arguments:
        name: tf_test_secgroup
Copy

Using getSecGroup

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 getSecGroup(args: GetSecGroupArgs, opts?: InvokeOptions): Promise<GetSecGroupResult>
function getSecGroupOutput(args: GetSecGroupOutputArgs, opts?: InvokeOptions): Output<GetSecGroupResult>
Copy
def get_sec_group(description: Optional[str] = None,
                  name: Optional[str] = None,
                  region: Optional[str] = None,
                  secgroup_id: Optional[str] = None,
                  stateful: Optional[bool] = None,
                  tags: Optional[Sequence[str]] = None,
                  tenant_id: Optional[str] = None,
                  opts: Optional[InvokeOptions] = None) -> GetSecGroupResult
def get_sec_group_output(description: Optional[pulumi.Input[str]] = None,
                  name: Optional[pulumi.Input[str]] = None,
                  region: Optional[pulumi.Input[str]] = None,
                  secgroup_id: Optional[pulumi.Input[str]] = None,
                  stateful: Optional[pulumi.Input[bool]] = None,
                  tags: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                  tenant_id: Optional[pulumi.Input[str]] = None,
                  opts: Optional[InvokeOptions] = None) -> Output[GetSecGroupResult]
Copy
func LookupSecGroup(ctx *Context, args *LookupSecGroupArgs, opts ...InvokeOption) (*LookupSecGroupResult, error)
func LookupSecGroupOutput(ctx *Context, args *LookupSecGroupOutputArgs, opts ...InvokeOption) LookupSecGroupResultOutput
Copy

> Note: This function is named LookupSecGroup in the Go SDK.

public static class GetSecGroup 
{
    public static Task<GetSecGroupResult> InvokeAsync(GetSecGroupArgs args, InvokeOptions? opts = null)
    public static Output<GetSecGroupResult> Invoke(GetSecGroupInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetSecGroupResult> getSecGroup(GetSecGroupArgs args, InvokeOptions options)
public static Output<GetSecGroupResult> getSecGroup(GetSecGroupArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: openstack:networking/getSecGroup:getSecGroup
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Description string
Human-readable description the the subnet.
Name string
The name of the security group.
Region Changes to this property will trigger replacement. string
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve security groups ids. If omitted, the region argument of the provider is used.
SecgroupId string
The ID of the security group.
Stateful bool
Whether the security group is stateful or not.
Tags List<string>
The list of security group tags to filter.
TenantId Changes to this property will trigger replacement. string
The owner of the security group.
Description string
Human-readable description the the subnet.
Name string
The name of the security group.
Region Changes to this property will trigger replacement. string
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve security groups ids. If omitted, the region argument of the provider is used.
SecgroupId string
The ID of the security group.
Stateful bool
Whether the security group is stateful or not.
Tags []string
The list of security group tags to filter.
TenantId Changes to this property will trigger replacement. string
The owner of the security group.
description String
Human-readable description the the subnet.
name String
The name of the security group.
region Changes to this property will trigger replacement. String
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve security groups ids. If omitted, the region argument of the provider is used.
secgroupId String
The ID of the security group.
stateful Boolean
Whether the security group is stateful or not.
tags List<String>
The list of security group tags to filter.
tenantId Changes to this property will trigger replacement. String
The owner of the security group.
description string
Human-readable description the the subnet.
name string
The name of the security group.
region Changes to this property will trigger replacement. string
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve security groups ids. If omitted, the region argument of the provider is used.
secgroupId string
The ID of the security group.
stateful boolean
Whether the security group is stateful or not.
tags string[]
The list of security group tags to filter.
tenantId Changes to this property will trigger replacement. string
The owner of the security group.
description str
Human-readable description the the subnet.
name str
The name of the security group.
region Changes to this property will trigger replacement. str
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve security groups ids. If omitted, the region argument of the provider is used.
secgroup_id str
The ID of the security group.
stateful bool
Whether the security group is stateful or not.
tags Sequence[str]
The list of security group tags to filter.
tenant_id Changes to this property will trigger replacement. str
The owner of the security group.
description String
Human-readable description the the subnet.
name String
The name of the security group.
region Changes to this property will trigger replacement. String
The region in which to obtain the V2 Neutron client. A Neutron client is needed to retrieve security groups ids. If omitted, the region argument of the provider is used.
secgroupId String
The ID of the security group.
stateful Boolean
Whether the security group is stateful or not.
tags List<String>
The list of security group tags to filter.
tenantId Changes to this property will trigger replacement. String
The owner of the security group.

getSecGroup Result

The following output properties are available:

AllTags List<string>
The set of string tags applied on the security group.
Id string
The provider-assigned unique ID for this managed resource.
Region string
See Argument Reference above.
Stateful bool
See Argument Reference above.
TenantId string
Description string
See Argument Reference above.
Name string
See Argument Reference above.
SecgroupId string
Tags List<string>
AllTags []string
The set of string tags applied on the security group.
Id string
The provider-assigned unique ID for this managed resource.
Region string
See Argument Reference above.
Stateful bool
See Argument Reference above.
TenantId string
Description string
See Argument Reference above.
Name string
See Argument Reference above.
SecgroupId string
Tags []string
allTags List<String>
The set of string tags applied on the security group.
id String
The provider-assigned unique ID for this managed resource.
region String
See Argument Reference above.
stateful Boolean
See Argument Reference above.
tenantId String
description String
See Argument Reference above.
name String
See Argument Reference above.
secgroupId String
tags List<String>
allTags string[]
The set of string tags applied on the security group.
id string
The provider-assigned unique ID for this managed resource.
region string
See Argument Reference above.
stateful boolean
See Argument Reference above.
tenantId string
description string
See Argument Reference above.
name string
See Argument Reference above.
secgroupId string
tags string[]
all_tags Sequence[str]
The set of string tags applied on the security group.
id str
The provider-assigned unique ID for this managed resource.
region str
See Argument Reference above.
stateful bool
See Argument Reference above.
tenant_id str
description str
See Argument Reference above.
name str
See Argument Reference above.
secgroup_id str
tags Sequence[str]
allTags List<String>
The set of string tags applied on the security group.
id String
The provider-assigned unique ID for this managed resource.
region String
See Argument Reference above.
stateful Boolean
See Argument Reference above.
tenantId String
description String
See Argument Reference above.
name String
See Argument Reference above.
secgroupId String
tags List<String>

Package Details

Repository
OpenStack pulumi/pulumi-openstack
License
Apache-2.0
Notes
This Pulumi package is based on the openstack Terraform Provider.
OpenStack v5.0.3 published on Wednesday, Feb 12, 2025 by Pulumi