1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. bastionhost
  5. getHostShareKeys
Alibaba Cloud v3.75.0 published on Friday, Mar 7, 2025 by Pulumi

alicloud.bastionhost.getHostShareKeys

Explore with Pulumi AI

Alibaba Cloud v3.75.0 published on Friday, Mar 7, 2025 by Pulumi

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

NOTE: Available in v1.165.0+.

Example Usage

Basic Usage

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

const ids = alicloud.bastionhost.getHostShareKeys({
    instanceId: "example_value",
    ids: [
        "example_value-1",
        "example_value-2",
    ],
});
export const bastionhostHostShareKeyId1 = ids.then(ids => ids.keys?.[0]?.id);
const nameRegex = alicloud.bastionhost.getHostShareKeys({
    instanceId: "example_value",
    nameRegex: "^my-HostShareKey",
});
export const bastionhostHostShareKeyId2 = nameRegex.then(nameRegex => nameRegex.keys?.[0]?.id);
Copy
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.bastionhost.get_host_share_keys(instance_id="example_value",
    ids=[
        "example_value-1",
        "example_value-2",
    ])
pulumi.export("bastionhostHostShareKeyId1", ids.keys[0].id)
name_regex = alicloud.bastionhost.get_host_share_keys(instance_id="example_value",
    name_regex="^my-HostShareKey")
pulumi.export("bastionhostHostShareKeyId2", name_regex.keys[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.GetHostShareKeys(ctx, &bastionhost.GetHostShareKeysArgs{
			InstanceId: "example_value",
			Ids: []string{
				"example_value-1",
				"example_value-2",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("bastionhostHostShareKeyId1", ids.Keys[0].Id)
		nameRegex, err := bastionhost.GetHostShareKeys(ctx, &bastionhost.GetHostShareKeysArgs{
			InstanceId: "example_value",
			NameRegex:  pulumi.StringRef("^my-HostShareKey"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("bastionhostHostShareKeyId2", nameRegex.Keys[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.GetHostShareKeys.Invoke(new()
    {
        InstanceId = "example_value",
        Ids = new[]
        {
            "example_value-1",
            "example_value-2",
        },
    });

    var nameRegex = AliCloud.BastionHost.GetHostShareKeys.Invoke(new()
    {
        InstanceId = "example_value",
        NameRegex = "^my-HostShareKey",
    });

    return new Dictionary<string, object?>
    {
        ["bastionhostHostShareKeyId1"] = ids.Apply(getHostShareKeysResult => getHostShareKeysResult.Keys[0]?.Id),
        ["bastionhostHostShareKeyId2"] = nameRegex.Apply(getHostShareKeysResult => getHostShareKeysResult.Keys[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.GetHostShareKeysArgs;
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.getHostShareKeys(GetHostShareKeysArgs.builder()
            .instanceId("example_value")
            .ids(            
                "example_value-1",
                "example_value-2")
            .build());

        ctx.export("bastionhostHostShareKeyId1", ids.applyValue(getHostShareKeysResult -> getHostShareKeysResult.keys()[0].id()));
        final var nameRegex = BastionhostFunctions.getHostShareKeys(GetHostShareKeysArgs.builder()
            .instanceId("example_value")
            .nameRegex("^my-HostShareKey")
            .build());

        ctx.export("bastionhostHostShareKeyId2", nameRegex.applyValue(getHostShareKeysResult -> getHostShareKeysResult.keys()[0].id()));
    }
}
Copy
variables:
  ids:
    fn::invoke:
      function: alicloud:bastionhost:getHostShareKeys
      arguments:
        instanceId: example_value
        ids:
          - example_value-1
          - example_value-2
  nameRegex:
    fn::invoke:
      function: alicloud:bastionhost:getHostShareKeys
      arguments:
        instanceId: example_value
        nameRegex: ^my-HostShareKey
outputs:
  bastionhostHostShareKeyId1: ${ids.keys[0].id}
  bastionhostHostShareKeyId2: ${nameRegex.keys[0].id}
Copy

Using getHostShareKeys

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 getHostShareKeys(args: GetHostShareKeysArgs, opts?: InvokeOptions): Promise<GetHostShareKeysResult>
function getHostShareKeysOutput(args: GetHostShareKeysOutputArgs, opts?: InvokeOptions): Output<GetHostShareKeysResult>
Copy
def get_host_share_keys(enable_details: Optional[bool] = None,
                        ids: Optional[Sequence[str]] = None,
                        instance_id: Optional[str] = None,
                        name_regex: Optional[str] = None,
                        output_file: Optional[str] = None,
                        opts: Optional[InvokeOptions] = None) -> GetHostShareKeysResult
def get_host_share_keys_output(enable_details: Optional[pulumi.Input[bool]] = 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,
                        opts: Optional[InvokeOptions] = None) -> Output[GetHostShareKeysResult]
Copy
func GetHostShareKeys(ctx *Context, args *GetHostShareKeysArgs, opts ...InvokeOption) (*GetHostShareKeysResult, error)
func GetHostShareKeysOutput(ctx *Context, args *GetHostShareKeysOutputArgs, opts ...InvokeOption) GetHostShareKeysResultOutput
Copy

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

public static class GetHostShareKeys 
{
    public static Task<GetHostShareKeysResult> InvokeAsync(GetHostShareKeysArgs args, InvokeOptions? opts = null)
    public static Output<GetHostShareKeysResult> Invoke(GetHostShareKeysInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetHostShareKeysResult> getHostShareKeys(GetHostShareKeysArgs args, InvokeOptions options)
public static Output<GetHostShareKeysResult> getHostShareKeys(GetHostShareKeysArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: alicloud:bastionhost/getHostShareKeys:getHostShareKeys
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Bastion instance.
EnableDetails bool
Default to false. Set it to true can output more details about resource attributes.
Ids Changes to this property will trigger replacement. List<string>
A list of Host Share Key IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Host Share Key name.
OutputFile string
File name where to save data source results (after running pulumi preview).
InstanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Bastion instance.
EnableDetails bool
Default to false. Set it to true can output more details about resource attributes.
Ids Changes to this property will trigger replacement. []string
A list of Host Share Key IDs.
NameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Host Share Key name.
OutputFile string
File name where to save data source results (after running pulumi preview).
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Bastion instance.
enableDetails Boolean
Default to false. Set it to true can output more details about resource attributes.
ids Changes to this property will trigger replacement. List<String>
A list of Host Share Key IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Host Share Key name.
outputFile String
File name where to save data source results (after running pulumi preview).
instanceId
This property is required.
Changes to this property will trigger replacement.
string
The ID of the Bastion instance.
enableDetails boolean
Default to false. Set it to true can output more details about resource attributes.
ids Changes to this property will trigger replacement. string[]
A list of Host Share Key IDs.
nameRegex Changes to this property will trigger replacement. string
A regex string to filter results by Host Share Key name.
outputFile string
File name where to save data source results (after running pulumi preview).
instance_id
This property is required.
Changes to this property will trigger replacement.
str
The ID of the Bastion instance.
enable_details bool
Default to false. Set it to true can output more details about resource attributes.
ids Changes to this property will trigger replacement. Sequence[str]
A list of Host Share Key IDs.
name_regex Changes to this property will trigger replacement. str
A regex string to filter results by Host Share Key name.
output_file str
File name where to save data source results (after running pulumi preview).
instanceId
This property is required.
Changes to this property will trigger replacement.
String
The ID of the Bastion instance.
enableDetails Boolean
Default to false. Set it to true can output more details about resource attributes.
ids Changes to this property will trigger replacement. List<String>
A list of Host Share Key IDs.
nameRegex Changes to this property will trigger replacement. String
A regex string to filter results by Host Share Key name.
outputFile String
File name where to save data source results (after running pulumi preview).

getHostShareKeys Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
Ids List<string>
InstanceId string
Keys List<Pulumi.AliCloud.BastionHost.Outputs.GetHostShareKeysKey>
Names List<string>
EnableDetails bool
NameRegex string
OutputFile string
Id string
The provider-assigned unique ID for this managed resource.
Ids []string
InstanceId string
Keys []GetHostShareKeysKey
Names []string
EnableDetails bool
NameRegex string
OutputFile string
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
instanceId String
keys List<GetHostShareKeysKey>
names List<String>
enableDetails Boolean
nameRegex String
outputFile String
id string
The provider-assigned unique ID for this managed resource.
ids string[]
instanceId string
keys GetHostShareKeysKey[]
names string[]
enableDetails boolean
nameRegex string
outputFile string
id str
The provider-assigned unique ID for this managed resource.
ids Sequence[str]
instance_id str
keys Sequence[GetHostShareKeysKey]
names Sequence[str]
enable_details bool
name_regex str
output_file str
id String
The provider-assigned unique ID for this managed resource.
ids List<String>
instanceId String
keys List<Property Map>
names List<String>
enableDetails Boolean
nameRegex String
outputFile String

Supporting Types

GetHostShareKeysKey

HostShareKeyId This property is required. string
The first ID of the resource.
HostShareKeyName This property is required. string
The name of the host shared key.
Id This property is required. string
The ID of the Host Share Key.
InstanceId This property is required. string
The ID of the Bastion instance.
PrivateKeyFingerPrint This property is required. string
The fingerprint of the private key.
HostShareKeyId This property is required. string
The first ID of the resource.
HostShareKeyName This property is required. string
The name of the host shared key.
Id This property is required. string
The ID of the Host Share Key.
InstanceId This property is required. string
The ID of the Bastion instance.
PrivateKeyFingerPrint This property is required. string
The fingerprint of the private key.
hostShareKeyId This property is required. String
The first ID of the resource.
hostShareKeyName This property is required. String
The name of the host shared key.
id This property is required. String
The ID of the Host Share Key.
instanceId This property is required. String
The ID of the Bastion instance.
privateKeyFingerPrint This property is required. String
The fingerprint of the private key.
hostShareKeyId This property is required. string
The first ID of the resource.
hostShareKeyName This property is required. string
The name of the host shared key.
id This property is required. string
The ID of the Host Share Key.
instanceId This property is required. string
The ID of the Bastion instance.
privateKeyFingerPrint This property is required. string
The fingerprint of the private key.
host_share_key_id This property is required. str
The first ID of the resource.
host_share_key_name This property is required. str
The name of the host shared key.
id This property is required. str
The ID of the Host Share Key.
instance_id This property is required. str
The ID of the Bastion instance.
private_key_finger_print This property is required. str
The fingerprint of the private key.
hostShareKeyId This property is required. String
The first ID of the resource.
hostShareKeyName This property is required. String
The name of the host shared key.
id This property is required. String
The ID of the Host Share Key.
instanceId This property is required. String
The ID of the Bastion instance.
privateKeyFingerPrint This property is required. String
The fingerprint of the private key.

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.75.0 published on Friday, Mar 7, 2025 by Pulumi