Oracle Cloud Infrastructure v2.27.0 published on Thursday, Mar 20, 2025 by Pulumi
oci.Bastion.getBastions
Explore with Pulumi AI
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,
});
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)
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
	})
}
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,
    });
});
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());
    }
}
variables:
  testBastions:
    fn::invoke:
      function: oci:Bastion:getBastions
      arguments:
        compartmentId: ${compartmentId}
        bastionId: ${testBastion.id}
        bastionLifecycleState: ${bastionBastionLifecycleState}
        name: ${bastionName}
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>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]func GetBastions(ctx *Context, args *GetBastionsArgs, opts ...InvokeOption) (*GetBastionsResult, error)
func GetBastionsOutput(ctx *Context, args *GetBastionsOutputArgs, opts ...InvokeOption) GetBastionsResultOutput> 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)
}public static CompletableFuture<GetBastionsResult> getBastions(GetBastionsArgs args, InvokeOptions options)
public static Output<GetBastionsResult> getBastions(GetBastionsArgs args, InvokeOptions options)
fn::invoke:
  function: oci:Bastion/getBastions:getBastions
  arguments:
    # arguments dictionaryThe following arguments are supported:
- CompartmentId 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.
- BastionLifecycle stringState 
- A filter to return only resources their lifecycleState matches the given lifecycleState.
- Filters
List<GetBastions Filter> 
- Name string
- A filter to return only resources that match the entire name given.
- CompartmentId 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.
- BastionLifecycle stringState 
- A filter to return only resources their lifecycleState matches the given lifecycleState.
- Filters
[]GetBastions Filter 
- Name string
- A filter to return only resources that match the entire name given.
- compartmentId 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.
- bastionLifecycle StringState 
- A filter to return only resources their lifecycleState matches the given lifecycleState.
- filters
List<GetsFilter> 
- name String
- A filter to return only resources that match the entire name given.
- compartmentId 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.
- bastionLifecycle stringState 
- A filter to return only resources their lifecycleState matches the given lifecycleState.
- filters
GetBastions Filter[] 
- name string
- A filter to return only resources that match the entire name given.
- compartment_id 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_ strstate 
- A filter to return only resources their lifecycleState matches the given lifecycleState.
- filters
Sequence[bastion.Get Bastions Filter] 
- name str
- A filter to return only resources that match the entire name given.
- compartmentId 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.
- bastionLifecycle StringState 
- A filter to return only resources their lifecycleState matches the given lifecycleState.
- filters 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<GetBastions Bastion> 
- 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
- BastionLifecycle stringState 
- Filters
List<GetBastions Filter> 
- Name string
- The name of the bastion, which can't be changed after creation.
- Bastions
[]GetBastions Bastion 
- 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
- BastionLifecycle stringState 
- Filters
[]GetBastions Filter 
- 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
- bastionLifecycle StringState 
- filters
List<GetsFilter> 
- name String
- The name of the bastion, which can't be changed after creation.
- bastions
GetBastions Bastion[] 
- 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
- bastionLifecycle stringState 
- filters
GetBastions Filter[] 
- name string
- The name of the bastion, which can't be changed after creation.
- bastions
Sequence[bastion.Get Bastions Bastion] 
- 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_ strstate 
- filters
Sequence[bastion.Get Bastions Filter] 
- 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
- bastionLifecycle StringState 
- filters List<Property Map>
- name String
- The name of the bastion, which can't be changed after creation.
Supporting Types
GetBastionsBastion  
- BastionType string
- The type of bastion.
- ClientCidr List<string>Block Allow Lists 
- A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
- CompartmentId string
- The unique identifier (OCID) of the compartment in which to list resources.
- Dictionary<string, string>
- Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}
- DnsProxy stringStatus 
- Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED,DISABLED
- 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 string
- The unique identifier (OCID) of the bastion, which can't be changed after creation.
- LifecycleDetails string
- A message describing the current state in more detail.
- MaxSession intTtl In Seconds 
- The maximum amount of time that any session on the bastion can remain active.
- MaxSessions intAllowed 
- The maximum number of active sessions allowed on the bastion.
- Name string
- A filter to return only resources that match the entire name given.
- PhoneBook stringEntry 
- The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standardbastions.
- PrivateEndpoint stringIp Address 
- The private IP address of the created private endpoint.
- State string
- The current state of the bastion.
- StaticJump List<string>Host Ip Addresses 
- A list of IP addresses of the hosts that the bastion has access to. Not applicable to standardbastions.
- Dictionary<string, string>
- Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
- TargetSubnet stringId 
- The unique identifier (OCID) of the subnet that the bastion connects to.
- TargetVcn stringId 
- The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
- TimeCreated string
- The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
- TimeUpdated string
- The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
- BastionType string
- The type of bastion.
- ClientCidr []stringBlock Allow Lists 
- A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
- CompartmentId string
- The unique identifier (OCID) of the compartment in which to list resources.
- map[string]string
- Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}
- DnsProxy stringStatus 
- Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED,DISABLED
- 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 string
- The unique identifier (OCID) of the bastion, which can't be changed after creation.
- LifecycleDetails string
- A message describing the current state in more detail.
- MaxSession intTtl In Seconds 
- The maximum amount of time that any session on the bastion can remain active.
- MaxSessions intAllowed 
- The maximum number of active sessions allowed on the bastion.
- Name string
- A filter to return only resources that match the entire name given.
- PhoneBook stringEntry 
- The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standardbastions.
- PrivateEndpoint stringIp Address 
- The private IP address of the created private endpoint.
- State string
- The current state of the bastion.
- StaticJump []stringHost Ip Addresses 
- A list of IP addresses of the hosts that the bastion has access to. Not applicable to standardbastions.
- map[string]string
- Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
- TargetSubnet stringId 
- The unique identifier (OCID) of the subnet that the bastion connects to.
- TargetVcn stringId 
- The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
- TimeCreated string
- The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
- TimeUpdated string
- The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
- bastionType String
- The type of bastion.
- clientCidr List<String>Block Allow Lists 
- A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
- compartmentId String
- The unique identifier (OCID) of the compartment in which to list resources.
- Map<String,String>
- Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}
- dnsProxy StringStatus 
- Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED,DISABLED
- 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 String
- The unique identifier (OCID) of the bastion, which can't be changed after creation.
- lifecycleDetails String
- A message describing the current state in more detail.
- maxSession IntegerTtl In Seconds 
- The maximum amount of time that any session on the bastion can remain active.
- maxSessions IntegerAllowed 
- The maximum number of active sessions allowed on the bastion.
- name String
- A filter to return only resources that match the entire name given.
- phoneBook StringEntry 
- The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standardbastions.
- privateEndpoint StringIp Address 
- The private IP address of the created private endpoint.
- state String
- The current state of the bastion.
- staticJump List<String>Host Ip Addresses 
- A list of IP addresses of the hosts that the bastion has access to. Not applicable to standardbastions.
- Map<String,String>
- Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
- targetSubnet StringId 
- The unique identifier (OCID) of the subnet that the bastion connects to.
- targetVcn StringId 
- The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
- timeCreated String
- The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
- timeUpdated String
- The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
- bastionType string
- The type of bastion.
- clientCidr string[]Block Allow Lists 
- A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
- compartmentId string
- The unique identifier (OCID) of the compartment in which to list resources.
- {[key: string]: string}
- Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}
- dnsProxy stringStatus 
- Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED,DISABLED
- {[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 string
- The unique identifier (OCID) of the bastion, which can't be changed after creation.
- lifecycleDetails string
- A message describing the current state in more detail.
- maxSession numberTtl In Seconds 
- The maximum amount of time that any session on the bastion can remain active.
- maxSessions numberAllowed 
- The maximum number of active sessions allowed on the bastion.
- name string
- A filter to return only resources that match the entire name given.
- phoneBook stringEntry 
- The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standardbastions.
- privateEndpoint stringIp Address 
- The private IP address of the created private endpoint.
- state string
- The current state of the bastion.
- staticJump string[]Host Ip Addresses 
- A list of IP addresses of the hosts that the bastion has access to. Not applicable to standardbastions.
- {[key: string]: string}
- Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
- targetSubnet stringId 
- The unique identifier (OCID) of the subnet that the bastion connects to.
- targetVcn stringId 
- The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
- timeCreated string
- The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
- timeUpdated string
- The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
- bastion_type str
- The type of bastion.
- client_cidr_ Sequence[str]block_ allow_ lists 
- A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
- compartment_id str
- The unique identifier (OCID) of the compartment in which to list resources.
- 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_ strstatus 
- Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED,DISABLED
- 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 str
- The unique identifier (OCID) of the bastion, which can't be changed after creation.
- lifecycle_details str
- A message describing the current state in more detail.
- max_session_ intttl_ in_ seconds 
- The maximum amount of time that any session on the bastion can remain active.
- max_sessions_ intallowed 
- The maximum number of active sessions allowed on the bastion.
- name str
- A filter to return only resources that match the entire name given.
- phone_book_ strentry 
- The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standardbastions.
- private_endpoint_ strip_ address 
- The private IP address of the created private endpoint.
- state str
- The current state of the bastion.
- static_jump_ Sequence[str]host_ ip_ addresses 
- A list of IP addresses of the hosts that the bastion has access to. Not applicable to standardbastions.
- Mapping[str, str]
- Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
- target_subnet_ strid 
- The unique identifier (OCID) of the subnet that the bastion connects to.
- target_vcn_ strid 
- The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
- time_created str
- The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
- time_updated str
- The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
- bastionType String
- The type of bastion.
- clientCidr List<String>Block Allow Lists 
- A list of address ranges in CIDR notation that you want to allow to connect to sessions hosted by this bastion.
- compartmentId String
- The unique identifier (OCID) of the compartment in which to list resources.
- Map<String>
- Defined tags for this resource. Each key is predefined and scoped to a namespace. Example: {"foo-namespace.bar-key": "value"}
- dnsProxy StringStatus 
- Flag to enable FQDN and SOCKS5 Proxy Support. Example: ENABLED,DISABLED
- 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 String
- The unique identifier (OCID) of the bastion, which can't be changed after creation.
- lifecycleDetails String
- A message describing the current state in more detail.
- maxSession NumberTtl In Seconds 
- The maximum amount of time that any session on the bastion can remain active.
- maxSessions NumberAllowed 
- The maximum number of active sessions allowed on the bastion.
- name String
- A filter to return only resources that match the entire name given.
- phoneBook StringEntry 
- The phonebook entry of the customer's team, which can't be changed after creation. Not applicable to standardbastions.
- privateEndpoint StringIp Address 
- The private IP address of the created private endpoint.
- state String
- The current state of the bastion.
- staticJump List<String>Host Ip Addresses 
- A list of IP addresses of the hosts that the bastion has access to. Not applicable to standardbastions.
- Map<String>
- Usage of system tag keys. These predefined keys are scoped to namespaces. Example: {"orcl-cloud.free-tier-retained": "true"}
- targetSubnet StringId 
- The unique identifier (OCID) of the subnet that the bastion connects to.
- targetVcn StringId 
- The unique identifier (OCID) of the virtual cloud network (VCN) that the bastion connects to.
- timeCreated String
- The time the bastion was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
- timeUpdated String
- The time the bastion was updated. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
GetBastionsFilter  
Package Details
- Repository
- oci pulumi/pulumi-oci
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the ociTerraform Provider.