1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Bastion
  5. getBastions
Oracle Cloud Infrastructure v2.31.0 published on Thursday, Apr 17, 2025 by Pulumi

oci.Bastion.getBastions

Explore with Pulumi AI

Oracle Cloud Infrastructure v2.31.0 published on Thursday, Apr 17, 2025 by Pulumi

This data source provides the list of Bastions in Oracle Cloud Infrastructure Bastion service.

Retrieves a list of BastionSummary objects in a compartment. Bastions provide secured, public access to target resources in the cloud that you cannot otherwise reach from the internet.

Example Usage

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

const testBastions = oci.Bastion.getBastions({
    compartmentId: compartmentId,
    bastionId: testBastion.id,
    bastionLifecycleState: bastionBastionLifecycleState,
    name: bastionName,
});
Copy
import pulumi
import pulumi_oci as oci

test_bastions = oci.Bastion.get_bastions(compartment_id=compartment_id,
    bastion_id=test_bastion["id"],
    bastion_lifecycle_state=bastion_bastion_lifecycle_state,
    name=bastion_name)
Copy
package main

import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/bastion"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := bastion.GetBastions(ctx, &bastion.GetBastionsArgs{
			CompartmentId:         compartmentId,
			BastionId:             pulumi.StringRef(testBastion.Id),
			BastionLifecycleState: pulumi.StringRef(bastionBastionLifecycleState),
			Name:                  pulumi.StringRef(bastionName),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;

return await Deployment.RunAsync(() => 
{
    var testBastions = Oci.Bastion.GetBastions.Invoke(new()
    {
        CompartmentId = compartmentId,
        BastionId = testBastion.Id,
        BastionLifecycleState = bastionBastionLifecycleState,
        Name = bastionName,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Bastion.BastionFunctions;
import com.pulumi.oci.Bastion.inputs.GetBastionsArgs;
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 testBastions = BastionFunctions.getBastions(GetBastionsArgs.builder()
            .compartmentId(compartmentId)
            .bastionId(testBastion.id())
            .bastionLifecycleState(bastionBastionLifecycleState)
            .name(bastionName)
            .build());

    }
}
Copy
variables:
  testBastions:
    fn::invoke:
      function: oci:Bastion:getBastions
      arguments:
        compartmentId: ${compartmentId}
        bastionId: ${testBastion.id}
        bastionLifecycleState: ${bastionBastionLifecycleState}
        name: ${bastionName}
Copy

Using getBastions

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 getBastions(args: GetBastionsArgs, opts?: InvokeOptions): Promise<GetBastionsResult>
function getBastionsOutput(args: GetBastionsOutputArgs, opts?: InvokeOptions): Output<GetBastionsResult>
Copy
def get_bastions(bastion_id: Optional[str] = None,
                 bastion_lifecycle_state: Optional[str] = None,
                 compartment_id: Optional[str] = None,
                 filters: Optional[Sequence[_bastion.GetBastionsFilter]] = None,
                 name: Optional[str] = None,
                 opts: Optional[InvokeOptions] = None) -> GetBastionsResult
def get_bastions_output(bastion_id: Optional[pulumi.Input[str]] = None,
                 bastion_lifecycle_state: Optional[pulumi.Input[str]] = None,
                 compartment_id: Optional[pulumi.Input[str]] = None,
                 filters: Optional[pulumi.Input[Sequence[pulumi.Input[_bastion.GetBastionsFilterArgs]]]] = None,
                 name: Optional[pulumi.Input[str]] = None,
                 opts: Optional[InvokeOptions] = None) -> Output[GetBastionsResult]
Copy
func GetBastions(ctx *Context, args *GetBastionsArgs, opts ...InvokeOption) (*GetBastionsResult, error)
func GetBastionsOutput(ctx *Context, args *GetBastionsOutputArgs, opts ...InvokeOption) GetBastionsResultOutput
Copy

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

public static class GetBastions 
{
    public static Task<GetBastionsResult> InvokeAsync(GetBastionsArgs args, InvokeOptions? opts = null)
    public static Output<GetBastionsResult> Invoke(GetBastionsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetBastionsResult> getBastions(GetBastionsArgs args, InvokeOptions options)
public static Output<GetBastionsResult> getBastions(GetBastionsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: oci:Bastion/getBastions:getBastions
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

CompartmentId This property is required. string
The unique identifier (OCID) of the compartment in which to list resources.
BastionId string
The unique identifier (OCID) of the bastion in which to list resources.
BastionLifecycleState string
A filter to return only resources their lifecycleState matches the given lifecycleState.
Filters Changes to this property will trigger replacement. List<GetBastionsFilter>
Name string
A filter to return only resources that match the entire name given.
CompartmentId This property is required. string
The unique identifier (OCID) of the compartment in which to list resources.
BastionId string
The unique identifier (OCID) of the bastion in which to list resources.
BastionLifecycleState string
A filter to return only resources their lifecycleState matches the given lifecycleState.
Filters Changes to this property will trigger replacement. []GetBastionsFilter
Name string
A filter to return only resources that match the entire name given.
compartmentId This property is required. String
The unique identifier (OCID) of the compartment in which to list resources.
bastionId String
The unique identifier (OCID) of the bastion in which to list resources.
bastionLifecycleState String
A filter to return only resources their lifecycleState matches the given lifecycleState.
filters Changes to this property will trigger replacement. List<GetsFilter>
name String
A filter to return only resources that match the entire name given.
compartmentId This property is required. string
The unique identifier (OCID) of the compartment in which to list resources.
bastionId string
The unique identifier (OCID) of the bastion in which to list resources.
bastionLifecycleState string
A filter to return only resources their lifecycleState matches the given lifecycleState.
filters Changes to this property will trigger replacement. GetBastionsFilter[]
name string
A filter to return only resources that match the entire name given.
compartment_id This property is required. str
The unique identifier (OCID) of the compartment in which to list resources.
bastion_id str
The unique identifier (OCID) of the bastion in which to list resources.
bastion_lifecycle_state str
A filter to return only resources their lifecycleState matches the given lifecycleState.
filters Changes to this property will trigger replacement. Sequence[bastion.GetBastionsFilter]
name str
A filter to return only resources that match the entire name given.
compartmentId This property is required. String
The unique identifier (OCID) of the compartment in which to list resources.
bastionId String
The unique identifier (OCID) of the bastion in which to list resources.
bastionLifecycleState String
A filter to return only resources their lifecycleState matches the given lifecycleState.
filters Changes to this property will trigger replacement. List<Property Map>
name String
A filter to return only resources that match the entire name given.

getBastions Result

The following output properties are available:

Bastions List<GetBastionsBastion>
The list of bastions.
CompartmentId string
The unique identifier (OCID) of the compartment where the bastion is located.
Id string
The provider-assigned unique ID for this managed resource.
BastionId string
BastionLifecycleState string
Filters List<GetBastionsFilter>
Name string
The name of the bastion, which can't be changed after creation.
Bastions []GetBastionsBastion
The list of bastions.
CompartmentId string
The unique identifier (OCID) of the compartment where the bastion is located.
Id string
The provider-assigned unique ID for this managed resource.
BastionId string
BastionLifecycleState string
Filters []GetBastionsFilter
Name string
The name of the bastion, which can't be changed after creation.
bastions List<Gets>
The list of bastions.
compartmentId String
The unique identifier (OCID) of the compartment where the bastion is located.
id String
The provider-assigned unique ID for this managed resource.
bastionId String
bastionLifecycleState String
filters List<GetsFilter>
name String
The name of the bastion, which can't be changed after creation.
bastions GetBastionsBastion[]
The list of bastions.
compartmentId string
The unique identifier (OCID) of the compartment where the bastion is located.
id string
The provider-assigned unique ID for this managed resource.
bastionId string
bastionLifecycleState string
filters GetBastionsFilter[]
name string
The name of the bastion, which can't be changed after creation.
bastions Sequence[bastion.GetBastionsBastion]
The list of bastions.
compartment_id str
The unique identifier (OCID) of the compartment where the bastion is located.
id str
The provider-assigned unique ID for this managed resource.
bastion_id str
bastion_lifecycle_state str
filters Sequence[bastion.GetBastionsFilter]
name str
The name of the bastion, which can't be changed after creation.
bastions List<Property Map>
The list of bastions.
compartmentId String
The unique identifier (OCID) of the compartment where the bastion is located.
id String
The provider-assigned unique ID for this managed resource.
bastionId String
bastionLifecycleState String
filters List<Property Map>
name String
The name of the bastion, which can't be changed after creation.

Supporting Types

GetBastionsBastion

BastionType This property is required. string
The type of bastion.
ClientCidrBlockAllowLists This property is required. List<string>
A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
CompartmentId This property is required. string
The unique identifier (OCID) of the compartment in which to list resources.
DefinedTags This property is required. Dictionary<string, string>
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}
DnsProxyStatus This property is required. string
Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED, DISABLED
FreeformTags This property is required. Dictionary<string, string>
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
Id This property is required. string
The unique identifier (OCID) of the bastion, which can't be changed after creation.
LifecycleDetails This property is required. string
A message describing the current state in more detail.
MaxSessionTtlInSeconds This property is required. int
The maximum amount of time that any session on the bastion can remain active.
MaxSessionsAllowed This property is required. int
The maximum number of active sessions allowed on the bastion.
Name This property is required. string
A filter to return only resources that match the entire name given.
PhoneBookEntry This property is required. string
The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standard bastions.
PrivateEndpointIpAddress This property is required. string
The private IP address of the created private endpoint.
State This property is required. string
The current state of the bastion.
StaticJumpHostIpAddresses This property is required. List<string>
A list of IP addresses of the hosts that the bastion has access to. Not applicable to standard bastions.
SystemTags This property is required. Dictionary<string, string>
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
TargetSubnetId This property is required. string
The unique identifier (OCID) of the subnet that the bastion connects to.
TargetVcnId This property is required. string
The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
TimeCreated This property is required. string
The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
TimeUpdated This property is required. string
The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
BastionType This property is required. string
The type of bastion.
ClientCidrBlockAllowLists This property is required. []string
A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
CompartmentId This property is required. string
The unique identifier (OCID) of the compartment in which to list resources.
DefinedTags This property is required. map[string]string
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}
DnsProxyStatus This property is required. string
Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED, DISABLED
FreeformTags This property is required. map[string]string
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
Id This property is required. string
The unique identifier (OCID) of the bastion, which can't be changed after creation.
LifecycleDetails This property is required. string
A message describing the current state in more detail.
MaxSessionTtlInSeconds This property is required. int
The maximum amount of time that any session on the bastion can remain active.
MaxSessionsAllowed This property is required. int
The maximum number of active sessions allowed on the bastion.
Name This property is required. string
A filter to return only resources that match the entire name given.
PhoneBookEntry This property is required. string
The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standard bastions.
PrivateEndpointIpAddress This property is required. string
The private IP address of the created private endpoint.
State This property is required. string
The current state of the bastion.
StaticJumpHostIpAddresses This property is required. []string
A list of IP addresses of the hosts that the bastion has access to. Not applicable to standard bastions.
SystemTags This property is required. map[string]string
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
TargetSubnetId This property is required. string
The unique identifier (OCID) of the subnet that the bastion connects to.
TargetVcnId This property is required. string
The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
TimeCreated This property is required. string
The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
TimeUpdated This property is required. string
The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
bastionType This property is required. String
The type of bastion.
clientCidrBlockAllowLists This property is required. List<String>
A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
compartmentId This property is required. String
The unique identifier (OCID) of the compartment in which to list resources.
definedTags This property is required. Map<String,String>
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}
dnsProxyStatus This property is required. String
Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED, DISABLED
freeformTags This property is required. Map<String,String>
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
id This property is required. String
The unique identifier (OCID) of the bastion, which can't be changed after creation.
lifecycleDetails This property is required. String
A message describing the current state in more detail.
maxSessionTtlInSeconds This property is required. Integer
The maximum amount of time that any session on the bastion can remain active.
maxSessionsAllowed This property is required. Integer
The maximum number of active sessions allowed on the bastion.
name This property is required. String
A filter to return only resources that match the entire name given.
phoneBookEntry This property is required. String
The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standard bastions.
privateEndpointIpAddress This property is required. String
The private IP address of the created private endpoint.
state This property is required. String
The current state of the bastion.
staticJumpHostIpAddresses This property is required. List<String>
A list of IP addresses of the hosts that the bastion has access to. Not applicable to standard bastions.
systemTags This property is required. Map<String,String>
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
targetSubnetId This property is required. String
The unique identifier (OCID) of the subnet that the bastion connects to.
targetVcnId This property is required. String
The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
timeCreated This property is required. String
The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
timeUpdated This property is required. String
The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
bastionType This property is required. string
The type of bastion.
clientCidrBlockAllowLists This property is required. string[]
A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
compartmentId This property is required. string
The unique identifier (OCID) of the compartment in which to list resources.
definedTags This property is required. {[key: string]: string}
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}
dnsProxyStatus This property is required. string
Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED, DISABLED
freeformTags This property is required. {[key: string]: string}
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
id This property is required. string
The unique identifier (OCID) of the bastion, which can't be changed after creation.
lifecycleDetails This property is required. string
A message describing the current state in more detail.
maxSessionTtlInSeconds This property is required. number
The maximum amount of time that any session on the bastion can remain active.
maxSessionsAllowed This property is required. number
The maximum number of active sessions allowed on the bastion.
name This property is required. string
A filter to return only resources that match the entire name given.
phoneBookEntry This property is required. string
The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standard bastions.
privateEndpointIpAddress This property is required. string
The private IP address of the created private endpoint.
state This property is required. string
The current state of the bastion.
staticJumpHostIpAddresses This property is required. string[]
A list of IP addresses of the hosts that the bastion has access to. Not applicable to standard bastions.
systemTags This property is required. {[key: string]: string}
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
targetSubnetId This property is required. string
The unique identifier (OCID) of the subnet that the bastion connects to.
targetVcnId This property is required. string
The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
timeCreated This property is required. string
The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
timeUpdated This property is required. string
The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
bastion_type This property is required. str
The type of bastion.
client_cidr_block_allow_lists This property is required. Sequence[str]
A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
compartment_id This property is required. str
The unique identifier (OCID) of the compartment in which to list resources.
defined_tags This property is required. Mapping[str, str]
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}
dns_proxy_status This property is required. str
Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED, DISABLED
freeform_tags This property is required. Mapping[str, str]
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
id This property is required. str
The unique identifier (OCID) of the bastion, which can't be changed after creation.
lifecycle_details This property is required. str
A message describing the current state in more detail.
max_session_ttl_in_seconds This property is required. int
The maximum amount of time that any session on the bastion can remain active.
max_sessions_allowed This property is required. int
The maximum number of active sessions allowed on the bastion.
name This property is required. str
A filter to return only resources that match the entire name given.
phone_book_entry This property is required. str
The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standard bastions.
private_endpoint_ip_address This property is required. str
The private IP address of the created private endpoint.
state This property is required. str
The current state of the bastion.
static_jump_host_ip_addresses This property is required. Sequence[str]
A list of IP addresses of the hosts that the bastion has access to. Not applicable to standard bastions.
system_tags This property is required. Mapping[str, str]
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
target_subnet_id This property is required. str
The unique identifier (OCID) of the subnet that the bastion connects to.
target_vcn_id This property is required. str
The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
time_created This property is required. str
The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
time_updated This property is required. str
The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
bastionType This property is required. String
The type of bastion.
clientCidrBlockAllowLists This property is required. List<String>
A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
compartmentId This property is required. String
The unique identifier (OCID) of the compartment in which to list resources.
definedTags This property is required. Map<String>
Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}
dnsProxyStatus This property is required. String
Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED, DISABLED
freeformTags This property is required. Map<String>
Simple key-value pair that is applied without any predefined name, type or scope. Exists for cross-compatibility only. Example: {"bar-key": "value"}
id This property is required. String
The unique identifier (OCID) of the bastion, which can't be changed after creation.
lifecycleDetails This property is required. String
A message describing the current state in more detail.
maxSessionTtlInSeconds This property is required. Number
The maximum amount of time that any session on the bastion can remain active.
maxSessionsAllowed This property is required. Number
The maximum number of active sessions allowed on the bastion.
name This property is required. String
A filter to return only resources that match the entire name given.
phoneBookEntry This property is required. String
The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standard bastions.
privateEndpointIpAddress This property is required. String
The private IP address of the created private endpoint.
state This property is required. String
The current state of the bastion.
staticJumpHostIpAddresses This property is required. List<String>
A list of IP addresses of the hosts that the bastion has access to. Not applicable to standard bastions.
systemTags This property is required. Map<String>
Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
targetSubnetId This property is required. String
The unique identifier (OCID) of the subnet that the bastion connects to.
targetVcnId This property is required. String
The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
timeCreated This property is required. String
The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
timeUpdated This property is required. String
The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z

GetBastionsFilter

Name This property is required. string
A filter to return only resources that match the entire name given.
Values This property is required. List<string>
Regex bool
Name This property is required. string
A filter to return only resources that match the entire name given.
Values This property is required. []string
Regex bool
name This property is required. String
A filter to return only resources that match the entire name given.
values This property is required. List<String>
regex Boolean
name This property is required. string
A filter to return only resources that match the entire name given.
values This property is required. string[]
regex boolean
name This property is required. str
A filter to return only resources that match the entire name given.
values This property is required. Sequence[str]
regex bool
name This property is required. String
A filter to return only resources that match the entire name given.
values This property is required. List<String>
regex Boolean

Package Details

Repository
oci pulumi/pulumi-oci
License
Apache-2.0
Notes
This Pulumi package is based on the oci Terraform Provider.
Oracle Cloud Infrastructure v2.31.0 published on Thursday, Apr 17, 2025 by Pulumi