1. Packages
  2. Packages
  3. OVH
  4. API Docs
  5. getCloudSecurityGroup
Viewing docs for OVHCloud v2.17.0
published on Friday, Jul 17, 2026 by OVHcloud
ovh logo
Viewing docs for OVHCloud v2.17.0
published on Friday, Jul 17, 2026 by OVHcloud

    Use this data source to retrieve information about a security group in a public cloud project.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ovh from "@ovhcloud/pulumi-ovh";
    
    const sg = ovh.getCloudSecurityGroup({
        serviceName: "<public cloud project ID>",
        id: "<security group ID>",
    });
    export const securityGroupName = sg.then(sg => sg.name);
    
    import pulumi
    import pulumi_ovh as ovh
    
    sg = ovh.get_cloud_security_group(service_name="<public cloud project ID>",
        id="<security group ID>")
    pulumi.export("securityGroupName", sg.name)
    
    package main
    
    import (
    	"github.com/ovh/pulumi-ovh/sdk/v2/go/ovh"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		sg, err := ovh.LookupCloudSecurityGroup(ctx, &ovh.LookupCloudSecurityGroupArgs{
    			ServiceName: "<public cloud project ID>",
    			Id:          "<security group ID>",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("securityGroupName", sg.Name)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ovh = Pulumi.Ovh;
    
    return await Deployment.RunAsync(() => 
    {
        var sg = Ovh.GetCloudSecurityGroup.Invoke(new()
        {
            ServiceName = "<public cloud project ID>",
            Id = "<security group ID>",
        });
    
        return new Dictionary<string, object?>
        {
            ["securityGroupName"] = sg.Apply(getCloudSecurityGroupResult => getCloudSecurityGroupResult.Name),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ovh.OvhFunctions;
    import com.pulumi.ovh.inputs.GetCloudSecurityGroupArgs;
    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 sg = OvhFunctions.getCloudSecurityGroup(GetCloudSecurityGroupArgs.builder()
                .serviceName("<public cloud project ID>")
                .id("<security group ID>")
                .build());
    
            ctx.export("securityGroupName", sg.name());
        }
    }
    
    variables:
      sg:
        fn::invoke:
          function: ovh:getCloudSecurityGroup
          arguments:
            serviceName: <public cloud project ID>
            id: <security group ID>
    outputs:
      securityGroupName: ${sg.name}
    
    Example coming soon!
    

    Using getCloudSecurityGroup

    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 getCloudSecurityGroup(args: GetCloudSecurityGroupArgs, opts?: InvokeOptions): Promise<GetCloudSecurityGroupResult>
    function getCloudSecurityGroupOutput(args: GetCloudSecurityGroupOutputArgs, opts?: InvokeOptions): Output<GetCloudSecurityGroupResult>
    def get_cloud_security_group(id: Optional[str] = None,
                                 service_name: Optional[str] = None,
                                 opts: Optional[InvokeOptions] = None) -> GetCloudSecurityGroupResult
    def get_cloud_security_group_output(id: pulumi.Input[Optional[str]] = None,
                                 service_name: pulumi.Input[Optional[str]] = None,
                                 opts: Optional[InvokeOptions] = None) -> Output[GetCloudSecurityGroupResult]
    func LookupCloudSecurityGroup(ctx *Context, args *LookupCloudSecurityGroupArgs, opts ...InvokeOption) (*LookupCloudSecurityGroupResult, error)
    func LookupCloudSecurityGroupOutput(ctx *Context, args *LookupCloudSecurityGroupOutputArgs, opts ...InvokeOption) LookupCloudSecurityGroupResultOutput

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

    public static class GetCloudSecurityGroup 
    {
        public static Task<GetCloudSecurityGroupResult> InvokeAsync(GetCloudSecurityGroupArgs args, InvokeOptions? opts = null)
        public static Output<GetCloudSecurityGroupResult> Invoke(GetCloudSecurityGroupInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetCloudSecurityGroupResult> getCloudSecurityGroup(GetCloudSecurityGroupArgs args, InvokeOptions options)
    public static Output<GetCloudSecurityGroupResult> getCloudSecurityGroup(GetCloudSecurityGroupArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ovh:index/getCloudSecurityGroup:getCloudSecurityGroup
      arguments:
        # arguments dictionary
    data "ovh_get_cloud_security_group" "name" {
        # arguments
    }

    The following arguments are supported:

    Id string
    Security group ID.
    ServiceName string
    Service name of the resource representing the id of the cloud project.
    Id string
    Security group ID.
    ServiceName string
    Service name of the resource representing the id of the cloud project.
    id string
    Security group ID.
    service_name string
    Service name of the resource representing the id of the cloud project.
    id String
    Security group ID.
    serviceName String
    Service name of the resource representing the id of the cloud project.
    id string
    Security group ID.
    serviceName string
    Service name of the resource representing the id of the cloud project.
    id str
    Security group ID.
    service_name str
    Service name of the resource representing the id of the cloud project.
    id String
    Security group ID.
    serviceName String
    Service name of the resource representing the id of the cloud project.

    getCloudSecurityGroup Result

    The following output properties are available:

    Checksum string
    Computed hash representing the current target specification value.
    CreatedAt string
    Creation date of the security group.
    CurrentState GetCloudSecurityGroupCurrentState
    Current state of the security group:
    Description string
    Description of the rule.
    Id string
    Rule ID.
    Location GetCloudSecurityGroupLocation
    Location details:
    Name string
    Name of the security group.
    ResourceStatus string
    Security group readiness in the system (CREATING, DELETING, ERROR, OUT_OF_SYNC, READY, UPDATING).
    Rules List<GetCloudSecurityGroupRule>
    List of security group rules. Each rule exports:
    ServiceName string
    UpdatedAt string
    Last update date of the security group.
    Checksum string
    Computed hash representing the current target specification value.
    CreatedAt string
    Creation date of the security group.
    CurrentState GetCloudSecurityGroupCurrentState
    Current state of the security group:
    Description string
    Description of the rule.
    Id string
    Rule ID.
    Location GetCloudSecurityGroupLocation
    Location details:
    Name string
    Name of the security group.
    ResourceStatus string
    Security group readiness in the system (CREATING, DELETING, ERROR, OUT_OF_SYNC, READY, UPDATING).
    Rules []GetCloudSecurityGroupRule
    List of security group rules. Each rule exports:
    ServiceName string
    UpdatedAt string
    Last update date of the security group.
    checksum string
    Computed hash representing the current target specification value.
    created_at string
    Creation date of the security group.
    current_state object
    Current state of the security group:
    description string
    Description of the rule.
    id string
    Rule ID.
    location object
    Location details:
    name string
    Name of the security group.
    resource_status string
    Security group readiness in the system (CREATING, DELETING, ERROR, OUT_OF_SYNC, READY, UPDATING).
    rules list(object)
    List of security group rules. Each rule exports:
    service_name string
    updated_at string
    Last update date of the security group.
    checksum String
    Computed hash representing the current target specification value.
    createdAt String
    Creation date of the security group.
    currentState GetCloudSecurityGroupCurrentState
    Current state of the security group:
    description String
    Description of the rule.
    id String
    Rule ID.
    location GetCloudSecurityGroupLocation
    Location details:
    name String
    Name of the security group.
    resourceStatus String
    Security group readiness in the system (CREATING, DELETING, ERROR, OUT_OF_SYNC, READY, UPDATING).
    rules List<GetCloudSecurityGroupRule>
    List of security group rules. Each rule exports:
    serviceName String
    updatedAt String
    Last update date of the security group.
    checksum string
    Computed hash representing the current target specification value.
    createdAt string
    Creation date of the security group.
    currentState GetCloudSecurityGroupCurrentState
    Current state of the security group:
    description string
    Description of the rule.
    id string
    Rule ID.
    location GetCloudSecurityGroupLocation
    Location details:
    name string
    Name of the security group.
    resourceStatus string
    Security group readiness in the system (CREATING, DELETING, ERROR, OUT_OF_SYNC, READY, UPDATING).
    rules GetCloudSecurityGroupRule[]
    List of security group rules. Each rule exports:
    serviceName string
    updatedAt string
    Last update date of the security group.
    checksum str
    Computed hash representing the current target specification value.
    created_at str
    Creation date of the security group.
    current_state GetCloudSecurityGroupCurrentState
    Current state of the security group:
    description str
    Description of the rule.
    id str
    Rule ID.
    location GetCloudSecurityGroupLocation
    Location details:
    name str
    Name of the security group.
    resource_status str
    Security group readiness in the system (CREATING, DELETING, ERROR, OUT_OF_SYNC, READY, UPDATING).
    rules Sequence[GetCloudSecurityGroupRule]
    List of security group rules. Each rule exports:
    service_name str
    updated_at str
    Last update date of the security group.
    checksum String
    Computed hash representing the current target specification value.
    createdAt String
    Creation date of the security group.
    currentState Property Map
    Current state of the security group:
    description String
    Description of the rule.
    id String
    Rule ID.
    location Property Map
    Location details:
    name String
    Name of the security group.
    resourceStatus String
    Security group readiness in the system (CREATING, DELETING, ERROR, OUT_OF_SYNC, READY, UPDATING).
    rules List<Property Map>
    List of security group rules. Each rule exports:
    serviceName String
    updatedAt String
    Last update date of the security group.

    Supporting Types

    GetCloudSecurityGroupCurrentState

    DefaultRules List<GetCloudSecurityGroupCurrentStateDefaultRule>
    Default egress rules auto-created by OpenStack (same schema as rules).
    Description string
    Description of the rule.
    Location GetCloudSecurityGroupCurrentStateLocation
    Location details:
    Name string
    Name of the security group.
    Rules List<GetCloudSecurityGroupCurrentStateRule>
    User-specified security group rules with their IDs:
    DefaultRules []GetCloudSecurityGroupCurrentStateDefaultRule
    Default egress rules auto-created by OpenStack (same schema as rules).
    Description string
    Description of the rule.
    Location GetCloudSecurityGroupCurrentStateLocation
    Location details:
    Name string
    Name of the security group.
    Rules []GetCloudSecurityGroupCurrentStateRule
    User-specified security group rules with their IDs:
    default_rules list(object)
    Default egress rules auto-created by OpenStack (same schema as rules).
    description string
    Description of the rule.
    location object
    Location details:
    name string
    Name of the security group.
    rules list(object)
    User-specified security group rules with their IDs:
    defaultRules List<GetCloudSecurityGroupCurrentStateDefaultRule>
    Default egress rules auto-created by OpenStack (same schema as rules).
    description String
    Description of the rule.
    location GetCloudSecurityGroupCurrentStateLocation
    Location details:
    name String
    Name of the security group.
    rules List<GetCloudSecurityGroupCurrentStateRule>
    User-specified security group rules with their IDs:
    defaultRules GetCloudSecurityGroupCurrentStateDefaultRule[]
    Default egress rules auto-created by OpenStack (same schema as rules).
    description string
    Description of the rule.
    location GetCloudSecurityGroupCurrentStateLocation
    Location details:
    name string
    Name of the security group.
    rules GetCloudSecurityGroupCurrentStateRule[]
    User-specified security group rules with their IDs:
    default_rules Sequence[GetCloudSecurityGroupCurrentStateDefaultRule]
    Default egress rules auto-created by OpenStack (same schema as rules).
    description str
    Description of the rule.
    location GetCloudSecurityGroupCurrentStateLocation
    Location details:
    name str
    Name of the security group.
    rules Sequence[GetCloudSecurityGroupCurrentStateRule]
    User-specified security group rules with their IDs:
    defaultRules List<Property Map>
    Default egress rules auto-created by OpenStack (same schema as rules).
    description String
    Description of the rule.
    location Property Map
    Location details:
    name String
    Name of the security group.
    rules List<Property Map>
    User-specified security group rules with their IDs:

    GetCloudSecurityGroupCurrentStateDefaultRule

    Description string
    Description of the rule.
    Direction string
    Direction of the rule.
    EthernetType string
    Ethernet type.
    Id string
    Security group ID.
    PortRangeMax int
    Maximum port number.
    PortRangeMin int
    Minimum port number.
    Protocol string
    Protocol.
    RemoteGroupId string
    Remote security group ID.
    RemoteIpPrefix string
    Remote IP prefix.
    Description string
    Description of the rule.
    Direction string
    Direction of the rule.
    EthernetType string
    Ethernet type.
    Id string
    Security group ID.
    PortRangeMax int
    Maximum port number.
    PortRangeMin int
    Minimum port number.
    Protocol string
    Protocol.
    RemoteGroupId string
    Remote security group ID.
    RemoteIpPrefix string
    Remote IP prefix.
    description string
    Description of the rule.
    direction string
    Direction of the rule.
    ethernet_type string
    Ethernet type.
    id string
    Security group ID.
    port_range_max number
    Maximum port number.
    port_range_min number
    Minimum port number.
    protocol string
    Protocol.
    remote_group_id string
    Remote security group ID.
    remote_ip_prefix string
    Remote IP prefix.
    description String
    Description of the rule.
    direction String
    Direction of the rule.
    ethernetType String
    Ethernet type.
    id String
    Security group ID.
    portRangeMax Integer
    Maximum port number.
    portRangeMin Integer
    Minimum port number.
    protocol String
    Protocol.
    remoteGroupId String
    Remote security group ID.
    remoteIpPrefix String
    Remote IP prefix.
    description string
    Description of the rule.
    direction string
    Direction of the rule.
    ethernetType string
    Ethernet type.
    id string
    Security group ID.
    portRangeMax number
    Maximum port number.
    portRangeMin number
    Minimum port number.
    protocol string
    Protocol.
    remoteGroupId string
    Remote security group ID.
    remoteIpPrefix string
    Remote IP prefix.
    description str
    Description of the rule.
    direction str
    Direction of the rule.
    ethernet_type str
    Ethernet type.
    id str
    Security group ID.
    port_range_max int
    Maximum port number.
    port_range_min int
    Minimum port number.
    protocol str
    Protocol.
    remote_group_id str
    Remote security group ID.
    remote_ip_prefix str
    Remote IP prefix.
    description String
    Description of the rule.
    direction String
    Direction of the rule.
    ethernetType String
    Ethernet type.
    id String
    Security group ID.
    portRangeMax Number
    Maximum port number.
    portRangeMin Number
    Minimum port number.
    protocol String
    Protocol.
    remoteGroupId String
    Remote security group ID.
    remoteIpPrefix String
    Remote IP prefix.

    GetCloudSecurityGroupCurrentStateLocation

    Region string
    Region.
    Region string
    Region.
    region string
    Region.
    region String
    Region.
    region string
    Region.
    region str
    Region.
    region String
    Region.

    GetCloudSecurityGroupCurrentStateRule

    Description string
    Description of the rule.
    Direction string
    Direction of the rule.
    EthernetType string
    Ethernet type.
    Id string
    Security group ID.
    PortRangeMax int
    Maximum port number.
    PortRangeMin int
    Minimum port number.
    Protocol string
    Protocol.
    RemoteGroupId string
    Remote security group ID.
    RemoteIpPrefix string
    Remote IP prefix.
    Description string
    Description of the rule.
    Direction string
    Direction of the rule.
    EthernetType string
    Ethernet type.
    Id string
    Security group ID.
    PortRangeMax int
    Maximum port number.
    PortRangeMin int
    Minimum port number.
    Protocol string
    Protocol.
    RemoteGroupId string
    Remote security group ID.
    RemoteIpPrefix string
    Remote IP prefix.
    description string
    Description of the rule.
    direction string
    Direction of the rule.
    ethernet_type string
    Ethernet type.
    id string
    Security group ID.
    port_range_max number
    Maximum port number.
    port_range_min number
    Minimum port number.
    protocol string
    Protocol.
    remote_group_id string
    Remote security group ID.
    remote_ip_prefix string
    Remote IP prefix.
    description String
    Description of the rule.
    direction String
    Direction of the rule.
    ethernetType String
    Ethernet type.
    id String
    Security group ID.
    portRangeMax Integer
    Maximum port number.
    portRangeMin Integer
    Minimum port number.
    protocol String
    Protocol.
    remoteGroupId String
    Remote security group ID.
    remoteIpPrefix String
    Remote IP prefix.
    description string
    Description of the rule.
    direction string
    Direction of the rule.
    ethernetType string
    Ethernet type.
    id string
    Security group ID.
    portRangeMax number
    Maximum port number.
    portRangeMin number
    Minimum port number.
    protocol string
    Protocol.
    remoteGroupId string
    Remote security group ID.
    remoteIpPrefix string
    Remote IP prefix.
    description str
    Description of the rule.
    direction str
    Direction of the rule.
    ethernet_type str
    Ethernet type.
    id str
    Security group ID.
    port_range_max int
    Maximum port number.
    port_range_min int
    Minimum port number.
    protocol str
    Protocol.
    remote_group_id str
    Remote security group ID.
    remote_ip_prefix str
    Remote IP prefix.
    description String
    Description of the rule.
    direction String
    Direction of the rule.
    ethernetType String
    Ethernet type.
    id String
    Security group ID.
    portRangeMax Number
    Maximum port number.
    portRangeMin Number
    Minimum port number.
    protocol String
    Protocol.
    remoteGroupId String
    Remote security group ID.
    remoteIpPrefix String
    Remote IP prefix.

    GetCloudSecurityGroupLocation

    Region string
    Region.
    Region string
    Region.
    region string
    Region.
    region String
    Region.
    region string
    Region.
    region str
    Region.
    region String
    Region.

    GetCloudSecurityGroupRule

    Description string
    Description of the rule.
    Direction string
    Direction of the rule.
    EthernetType string
    Ethernet type.
    PortRangeMax int
    Maximum port number.
    PortRangeMin int
    Minimum port number.
    Protocol string
    Protocol.
    RemoteGroupId string
    Remote security group ID.
    RemoteIpPrefix string
    Remote IP prefix.
    Description string
    Description of the rule.
    Direction string
    Direction of the rule.
    EthernetType string
    Ethernet type.
    PortRangeMax int
    Maximum port number.
    PortRangeMin int
    Minimum port number.
    Protocol string
    Protocol.
    RemoteGroupId string
    Remote security group ID.
    RemoteIpPrefix string
    Remote IP prefix.
    description string
    Description of the rule.
    direction string
    Direction of the rule.
    ethernet_type string
    Ethernet type.
    port_range_max number
    Maximum port number.
    port_range_min number
    Minimum port number.
    protocol string
    Protocol.
    remote_group_id string
    Remote security group ID.
    remote_ip_prefix string
    Remote IP prefix.
    description String
    Description of the rule.
    direction String
    Direction of the rule.
    ethernetType String
    Ethernet type.
    portRangeMax Integer
    Maximum port number.
    portRangeMin Integer
    Minimum port number.
    protocol String
    Protocol.
    remoteGroupId String
    Remote security group ID.
    remoteIpPrefix String
    Remote IP prefix.
    description string
    Description of the rule.
    direction string
    Direction of the rule.
    ethernetType string
    Ethernet type.
    portRangeMax number
    Maximum port number.
    portRangeMin number
    Minimum port number.
    protocol string
    Protocol.
    remoteGroupId string
    Remote security group ID.
    remoteIpPrefix string
    Remote IP prefix.
    description str
    Description of the rule.
    direction str
    Direction of the rule.
    ethernet_type str
    Ethernet type.
    port_range_max int
    Maximum port number.
    port_range_min int
    Minimum port number.
    protocol str
    Protocol.
    remote_group_id str
    Remote security group ID.
    remote_ip_prefix str
    Remote IP prefix.
    description String
    Description of the rule.
    direction String
    Direction of the rule.
    ethernetType String
    Ethernet type.
    portRangeMax Number
    Maximum port number.
    portRangeMin Number
    Minimum port number.
    protocol String
    Protocol.
    remoteGroupId String
    Remote security group ID.
    remoteIpPrefix String
    Remote IP prefix.

    Package Details

    Repository
    ovh ovh/pulumi-ovh
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ovh Terraform Provider.
    ovh logo
    Viewing docs for OVHCloud v2.17.0
    published on Friday, Jul 17, 2026 by OVHcloud

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial