1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. bastionhost
  5. getHostAccounts
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.bastionhost.getHostAccounts

Explore with Pulumi AI

Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

This data source provides the Bastionhost Host Accounts of the current Alibaba Cloud user.

NOTE: Available in v1.135.0+.

Example Usage

Basic Usage

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

const ids = alicloud.bastionhost.getHostAccounts({
    hostId: "15",
    instanceId: "example_value",
    ids: [
        "1",
        "2",
    ],
});
export const bastionhostHostAccountId1 = ids.then(ids => ids.accounts?.[0]?.id);
const nameRegex = alicloud.bastionhost.getHostAccounts({
    hostId: "15",
    instanceId: "example_value",
    nameRegex: "^my-HostAccount",
});
export const bastionhostHostAccountId2 = nameRegex.then(nameRegex => nameRegex.accounts?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.bastionhost.get_host_accounts(host_id="15",
    instance_id="example_value",
    ids=[
        "1",
        "2",
    ])
pulumi.export("bastionhostHostAccountId1", ids.accounts[0].id)
name_regex = alicloud.bastionhost.get_host_accounts(host_id="15",
    instance_id="example_value",
    name_regex="^my-HostAccount")
pulumi.export("bastionhostHostAccountId2", name_regex.accounts[0].id)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/bastionhost"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := bastionhost.GetHostAccounts(ctx, &bastionhost.GetHostAccountsArgs{
			HostId:     "15",
			InstanceId: "example_value",
			Ids: []string{
				"1",
				"2",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("bastionhostHostAccountId1", ids.Accounts[0].Id)
		nameRegex, err := bastionhost.GetHostAccounts(ctx, &bastionhost.GetHostAccountsArgs{
			HostId:     "15",
			InstanceId: "example_value",
			NameRegex:  pulumi.StringRef("^my-HostAccount"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("bastionhostHostAccountId2", nameRegex.Accounts[0].Id)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.BastionHost.GetHostAccounts.Invoke(new()
    {
        HostId = "15",
        InstanceId = "example_value",
        Ids = new[]
        {
            "1",
            "2",
        },
    });

    var nameRegex = AliCloud.BastionHost.GetHostAccounts.Invoke(new()
    {
        HostId = "15",
        InstanceId = "example_value",
        NameRegex = "^my-HostAccount",
    });

    return new Dictionary<string, object?>
    {
        ["bastionhostHostAccountId1"] = ids.Apply(getHostAccountsResult => getHostAccountsResult.Accounts[0]?.Id),
        ["bastionhostHostAccountId2"] = nameRegex.Apply(getHostAccountsResult => getHostAccountsResult.Accounts[0]?.Id),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.bastionhost.BastionhostFunctions;
import com.pulumi.alicloud.bastionhost.inputs.GetHostAccountsArgs;
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 ids = BastionhostFunctions.getHostAccounts(GetHostAccountsArgs.builder()
            .hostId("15")
            .instanceId("example_value")
            .ids(            
                "1",
                "2")
            .build());

        ctx.export("bastionhostHostAccountId1", ids.applyValue(getHostAccountsResult -> getHostAccountsResult.accounts()[0].id()));
        final var nameRegex = BastionhostFunctions.getHostAccounts(GetHostAccountsArgs.builder()
            .hostId("15")
            .instanceId("example_value")
            .nameRegex("^my-HostAccount")
            .build());

        ctx.export("bastionhostHostAccountId2", nameRegex.applyValue(getHostAccountsResult -> getHostAccountsResult.accounts()[0].id()));
    }
}
Copy
variables:
  ids:
    fn::invoke:
      function: alicloud:bastionhost:getHostAccounts
      arguments:
        hostId: '15'
        instanceId: example_value
        ids:
          - '1'
          - '2'
  nameRegex:
    fn::invoke:
      function: alicloud:bastionhost:getHostAccounts
      arguments:
        hostId: '15'
        instanceId: example_value
        nameRegex: ^my-HostAccount
outputs:
  bastionhostHostAccountId1: ${ids.accounts[0].id}
  bastionhostHostAccountId2: ${nameRegex.accounts[0].id}
Copy

Using getHostAccounts

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 getHostAccounts(args: GetHostAccountsArgs, opts?: InvokeOptions): Promise<GetHostAccountsResult>
function getHostAccountsOutput(args: GetHostAccountsOutputArgs, opts?: InvokeOptions): Output<GetHostAccountsResult>
Copy
def get_host_accounts(host_account_name: Optional[str] = None,
                      host_id: Optional[str] = None,
                      ids: Optional[Sequence[str]] = None,
                      instance_id: Optional[str] = None,
                      name_regex: Optional[str] = None,
                      output_file: Optional[str] = None,
                      protocol_name: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetHostAccountsResult
def get_host_accounts_output(host_account_name: Optional[pulumi.Input[str]] = None,
                      host_id: Optional[pulumi.Input[str]] = None,
                      ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                      instance_id: Optional[pulumi.Input[str]] = None,
                      name_regex: Optional[pulumi.Input[str]] = None,
                      output_file: Optional[pulumi.Input[str]] = None,
                      protocol_name: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetHostAccountsResult]
Copy
func GetHostAccounts(ctx *Context, args *GetHostAccountsArgs, opts ...InvokeOption) (*GetHostAccountsResult, error)
func GetHostAccountsOutput(ctx *Context, args *GetHostAccountsOutputArgs, opts ...InvokeOption) GetHostAccountsResultOutput
Copy

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

public static class GetHostAccounts 
{
    public static Task<GetHostAccountsResult> InvokeAsync(GetHostAccountsArgs args, InvokeOptions? opts = null)
    public static Output<GetHostAccountsResult> Invoke(GetHostAccountsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetHostAccountsResult> getHostAccounts(GetHostAccountsArgs args, InvokeOptions options)
public static Output<GetHostAccountsResult> getHostAccounts(GetHostAccountsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:bastionhost/getHostAccounts:getHostAccounts
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

HostId
This property is required.
Changes to this property will trigger replacement.
string
Specifies the database where you want to create your hosting account's host ID.
InstanceId
This property is required.
Changes to this property will trigger replacement.
string
Specifies the database where you want to create your hosting account's host bastion host ID of.
HostAccountName Changes to this property will trigger replacement. string
Specify the new hosting account's name, support the longest 128 characters.
Ids Changes to this property will trigger replacement. List<string>
A list of Host Account IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Host Account name.
OutputFile string
File name where to save data source results (after running pulumi preview).
ProtocolName Changes to this property will trigger replacement. string
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
HostId
This property is required.
Changes to this property will trigger replacement.
string
Specifies the database where you want to create your hosting account's host ID.
InstanceId
This property is required.
Changes to this property will trigger replacement.
string
Specifies the database where you want to create your hosting account's host bastion host ID of.
HostAccountName Changes to this property will trigger replacement. string
Specify the new hosting account's name, support the longest 128 characters.
Ids Changes to this property will trigger replacement. []string
A list of Host Account IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Host Account name.
OutputFile string
File name where to save data source results (after running pulumi preview).
ProtocolName Changes to this property will trigger replacement. string
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
hostId
This property is required.
Changes to this property will trigger replacement.
String
Specifies the database where you want to create your hosting account's host ID.
instanceId
This property is required.
Changes to this property will trigger replacement.
String
Specifies the database where you want to create your hosting account's host bastion host ID of.
hostAccountName Changes to this property will trigger replacement. String
Specify the new hosting account's name, support the longest 128 characters.
ids Changes to this property will trigger replacement. List<String>
A list of Host Account IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Host Account name.
outputFile String
File name where to save data source results (after running pulumi preview).
protocolName Changes to this property will trigger replacement. String
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
hostId
This property is required.
Changes to this property will trigger replacement.
string
Specifies the database where you want to create your hosting account's host ID.
instanceId
This property is required.
Changes to this property will trigger replacement.
string
Specifies the database where you want to create your hosting account's host bastion host ID of.
hostAccountName Changes to this property will trigger replacement. string
Specify the new hosting account's name, support the longest 128 characters.
ids Changes to this property will trigger replacement. string[]
A list of Host Account IDs.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Host Account name.
outputFile string
File name where to save data source results (after running pulumi preview).
protocolName Changes to this property will trigger replacement. string
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
host_id
This property is required.
Changes to this property will trigger replacement.
str
Specifies the database where you want to create your hosting account's host ID.
instance_id
This property is required.
Changes to this property will trigger replacement.
str
Specifies the database where you want to create your hosting account's host bastion host ID of.
host_account_name Changes to this property will trigger replacement. str
Specify the new hosting account's name, support the longest 128 characters.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Host Account IDs.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by Host Account name.
output_file str
File name where to save data source results (after running pulumi preview).
protocol_name Changes to this property will trigger replacement. str
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
hostId
This property is required.
Changes to this property will trigger replacement.
String
Specifies the database where you want to create your hosting account's host ID.
instanceId
This property is required.
Changes to this property will trigger replacement.
String
Specifies the database where you want to create your hosting account's host bastion host ID of.
hostAccountName Changes to this property will trigger replacement. String
Specify the new hosting account's name, support the longest 128 characters.
ids Changes to this property will trigger replacement. List<String>
A list of Host Account IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Host Account name.
outputFile String
File name where to save data source results (after running pulumi preview).
protocolName Changes to this property will trigger replacement. String
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.

getHostAccounts Result

The following output properties are available:

Accounts List<Pulumi.AliCloud.BastionHost.Outputs.GetHostAccountsAccount>
HostId string
Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
InstanceId string
Names List<string>
HostAccountName string
NameRegex string
OutputFile string
ProtocolName string
Accounts []GetHostAccountsAccount
HostId string
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
InstanceId string
Names []string
HostAccountName string
NameRegex string
OutputFile string
ProtocolName string
accounts List<GetHostAccountsAccount>
hostId String
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
instanceId String
names List<String>
hostAccountName String
nameRegex String
outputFile String
protocolName String
accounts GetHostAccountsAccount[]
hostId string
id string
The provider-assigned unique ID for this managed resource.
ids string[]
instanceId string
names string[]
hostAccountName string
nameRegex string
outputFile string
protocolName string
accounts Sequence[GetHostAccountsAccount]
host_id str
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
instance_id str
names Sequence[str]
host_account_name str
name_regex str
output_file str
protocol_name str
accounts List<Property Map>
hostId String
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
instanceId String
names List<String>
hostAccountName String
nameRegex String
outputFile String
protocolName String

Supporting Types

GetHostAccountsAccount

HasPassword This property is required. bool
Whether to set a new password.
HostAccountId This property is required. string
Hosting account ID.
HostAccountName This property is required. string
Specify the new hosting account's name, support the longest 128 characters.
HostId This property is required. string
Specifies the database where you want to create your hosting account's host ID.
Id This property is required. string
The ID of the Host Account.
InstanceId This property is required. string
Specifies the database where you want to create your hosting account's host bastion host ID of.
PrivateKeyFingerprint This property is required. string
The situation where the private keys of the fingerprint information.
ProtocolName This property is required. string
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
HasPassword This property is required. bool
Whether to set a new password.
HostAccountId This property is required. string
Hosting account ID.
HostAccountName This property is required. string
Specify the new hosting account's name, support the longest 128 characters.
HostId This property is required. string
Specifies the database where you want to create your hosting account's host ID.
Id This property is required. string
The ID of the Host Account.
InstanceId This property is required. string
Specifies the database where you want to create your hosting account's host bastion host ID of.
PrivateKeyFingerprint This property is required. string
The situation where the private keys of the fingerprint information.
ProtocolName This property is required. string
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
hasPassword This property is required. Boolean
Whether to set a new password.
hostAccountId This property is required. String
Hosting account ID.
hostAccountName This property is required. String
Specify the new hosting account's name, support the longest 128 characters.
hostId This property is required. String
Specifies the database where you want to create your hosting account's host ID.
id This property is required. String
The ID of the Host Account.
instanceId This property is required. String
Specifies the database where you want to create your hosting account's host bastion host ID of.
privateKeyFingerprint This property is required. String
The situation where the private keys of the fingerprint information.
protocolName This property is required. String
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
hasPassword This property is required. boolean
Whether to set a new password.
hostAccountId This property is required. string
Hosting account ID.
hostAccountName This property is required. string
Specify the new hosting account's name, support the longest 128 characters.
hostId This property is required. string
Specifies the database where you want to create your hosting account's host ID.
id This property is required. string
The ID of the Host Account.
instanceId This property is required. string
Specifies the database where you want to create your hosting account's host bastion host ID of.
privateKeyFingerprint This property is required. string
The situation where the private keys of the fingerprint information.
protocolName This property is required. string
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
has_password This property is required. bool
Whether to set a new password.
host_account_id This property is required. str
Hosting account ID.
host_account_name This property is required. str
Specify the new hosting account's name, support the longest 128 characters.
host_id This property is required. str
Specifies the database where you want to create your hosting account's host ID.
id This property is required. str
The ID of the Host Account.
instance_id This property is required. str
Specifies the database where you want to create your hosting account's host bastion host ID of.
private_key_fingerprint This property is required. str
The situation where the private keys of the fingerprint information.
protocol_name This property is required. str
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.
hasPassword This property is required. Boolean
Whether to set a new password.
hostAccountId This property is required. String
Hosting account ID.
hostAccountName This property is required. String
Specify the new hosting account's name, support the longest 128 characters.
hostId This property is required. String
Specifies the database where you want to create your hosting account's host ID.
id This property is required. String
The ID of the Host Account.
instanceId This property is required. String
Specifies the database where you want to create your hosting account's host bastion host ID of.
privateKeyFingerprint This property is required. String
The situation where the private keys of the fingerprint information.
protocolName This property is required. String
Specify the new hosting account of the agreement name. Valid values: USING SSH and RDP.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi