alicloud.bastionhost.HostAccountUserAttachment

Provides a Bastion Host Host Account Attachment resource to add list host accounts into one user.

NOTE: Available in v1.135.0+.

Example Usage

Basic Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var defaultHost = new AliCloud.BastionHost.Host("defaultHost", new()
    {
        InstanceId = "bastionhost-cn-tl32bh0no30",
        HostName = @var.Name,
        ActiveAddressType = "Private",
        HostPrivateAddress = "172.16.0.10",
        OsType = "Linux",
        Source = "Local",
    });

    var defaultHostAccount = new List<AliCloud.BastionHost.HostAccount>();
    for (var rangeIndex = 0; rangeIndex < 3; rangeIndex++)
    {
        var range = new { Value = rangeIndex };
        defaultHostAccount.Add(new AliCloud.BastionHost.HostAccount($"defaultHostAccount-{range.Value}", new()
        {
            InstanceId = defaultHost.InstanceId,
            HostAccountName = $"example_value-{range.Value}",
            HostId = defaultHost.HostId,
            ProtocolName = "SSH",
            Password = "YourPassword12345",
        }));
    }
    var defaultUser = new AliCloud.BastionHost.User("defaultUser", new()
    {
        InstanceId = defaultHost.InstanceId,
        MobileCountryCode = "CN",
        Mobile = "13312345678",
        Password = "YourPassword-123",
        Source = "Local",
        UserName = "my-local-user",
    });

    var defaultHostAccountUserAttachment = new AliCloud.BastionHost.HostAccountUserAttachment("defaultHostAccountUserAttachment", new()
    {
        InstanceId = defaultHost.InstanceId,
        UserId = defaultUser.UserId,
        HostId = defaultHost.HostId,
        HostAccountIds = defaultHostAccount.Select(__item => __item.HostAccountId).ToList(),
    });

});

Coming soon!

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.bastionhost.Host;
import com.pulumi.alicloud.bastionhost.HostArgs;
import com.pulumi.alicloud.bastionhost.HostAccount;
import com.pulumi.alicloud.bastionhost.HostAccountArgs;
import com.pulumi.alicloud.bastionhost.User;
import com.pulumi.alicloud.bastionhost.UserArgs;
import com.pulumi.alicloud.bastionhost.HostAccountUserAttachment;
import com.pulumi.alicloud.bastionhost.HostAccountUserAttachmentArgs;
import com.pulumi.codegen.internal.KeyedValue;
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) {
        var defaultHost = new Host("defaultHost", HostArgs.builder()        
            .instanceId("bastionhost-cn-tl32bh0no30")
            .hostName(var_.name())
            .activeAddressType("Private")
            .hostPrivateAddress("172.16.0.10")
            .osType("Linux")
            .source("Local")
            .build());

        for (var i = 0; i < 3; i++) {
            new HostAccount("defaultHostAccount-" + i, HostAccountArgs.builder()            
                .instanceId(defaultHost.instanceId())
                .hostAccountName(String.format("example_value-%s", range.value()))
                .hostId(defaultHost.hostId())
                .protocolName("SSH")
                .password("YourPassword12345")
                .build());

        
}
        var defaultUser = new User("defaultUser", UserArgs.builder()        
            .instanceId(defaultHost.instanceId())
            .mobileCountryCode("CN")
            .mobile("13312345678")
            .password("YourPassword-123")
            .source("Local")
            .userName("my-local-user")
            .build());

        var defaultHostAccountUserAttachment = new HostAccountUserAttachment("defaultHostAccountUserAttachment", HostAccountUserAttachmentArgs.builder()        
            .instanceId(defaultHost.instanceId())
            .userId(defaultUser.userId())
            .hostId(defaultHost.hostId())
            .hostAccountIds(defaultHostAccount.stream().map(element -> element.hostAccountId()).collect(toList()))
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

default_host = alicloud.bastionhost.Host("defaultHost",
    instance_id="bastionhost-cn-tl32bh0no30",
    host_name=var["name"],
    active_address_type="Private",
    host_private_address="172.16.0.10",
    os_type="Linux",
    source="Local")
default_host_account = []
for range in [{"value": i} for i in range(0, 3)]:
    default_host_account.append(alicloud.bastionhost.HostAccount(f"defaultHostAccount-{range['value']}",
        instance_id=default_host.instance_id,
        host_account_name=f"example_value-{range['value']}",
        host_id=default_host.host_id,
        protocol_name="SSH",
        password="YourPassword12345"))
default_user = alicloud.bastionhost.User("defaultUser",
    instance_id=default_host.instance_id,
    mobile_country_code="CN",
    mobile="13312345678",
    password="YourPassword-123",
    source="Local",
    user_name="my-local-user")
default_host_account_user_attachment = alicloud.bastionhost.HostAccountUserAttachment("defaultHostAccountUserAttachment",
    instance_id=default_host.instance_id,
    user_id=default_user.user_id,
    host_id=default_host.host_id,
    host_account_ids=[__item.host_account_id for __item in default_host_account])
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const defaultHost = new alicloud.bastionhost.Host("defaultHost", {
    instanceId: "bastionhost-cn-tl32bh0no30",
    hostName: _var.name,
    activeAddressType: "Private",
    hostPrivateAddress: "172.16.0.10",
    osType: "Linux",
    source: "Local",
});
const defaultHostAccount: alicloud.bastionhost.HostAccount[] = [];
for (const range = {value: 0}; range.value < 3; range.value++) {
    defaultHostAccount.push(new alicloud.bastionhost.HostAccount(`defaultHostAccount-${range.value}`, {
        instanceId: defaultHost.instanceId,
        hostAccountName: `example_value-${range.value}`,
        hostId: defaultHost.hostId,
        protocolName: "SSH",
        password: "YourPassword12345",
    }));
}
const defaultUser = new alicloud.bastionhost.User("defaultUser", {
    instanceId: defaultHost.instanceId,
    mobileCountryCode: "CN",
    mobile: "13312345678",
    password: "YourPassword-123",
    source: "Local",
    userName: "my-local-user",
});
const defaultHostAccountUserAttachment = new alicloud.bastionhost.HostAccountUserAttachment("defaultHostAccountUserAttachment", {
    instanceId: defaultHost.instanceId,
    userId: defaultUser.userId,
    hostId: defaultHost.hostId,
    hostAccountIds: defaultHostAccount.map(__item => __item.hostAccountId),
});

Coming soon!

Create HostAccountUserAttachment Resource

new HostAccountUserAttachment(name: string, args: HostAccountUserAttachmentArgs, opts?: CustomResourceOptions);
@overload
def HostAccountUserAttachment(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              host_account_ids: Optional[Sequence[str]] = None,
                              host_id: Optional[str] = None,
                              instance_id: Optional[str] = None,
                              user_id: Optional[str] = None)
@overload
def HostAccountUserAttachment(resource_name: str,
                              args: HostAccountUserAttachmentArgs,
                              opts: Optional[ResourceOptions] = None)
func NewHostAccountUserAttachment(ctx *Context, name string, args HostAccountUserAttachmentArgs, opts ...ResourceOption) (*HostAccountUserAttachment, error)
public HostAccountUserAttachment(string name, HostAccountUserAttachmentArgs args, CustomResourceOptions? opts = null)
public HostAccountUserAttachment(String name, HostAccountUserAttachmentArgs args)
public HostAccountUserAttachment(String name, HostAccountUserAttachmentArgs args, CustomResourceOptions options)
type: alicloud:bastionhost:HostAccountUserAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args HostAccountUserAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args HostAccountUserAttachmentArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args HostAccountUserAttachmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args HostAccountUserAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args HostAccountUserAttachmentArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

HostAccountUserAttachment Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The HostAccountUserAttachment resource accepts the following input properties:

HostAccountIds List<string>

A list IDs of the host account.

HostId string

The ID of the host.

InstanceId string

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

UserId string

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

HostAccountIds []string

A list IDs of the host account.

HostId string

The ID of the host.

InstanceId string

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

UserId string

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

hostAccountIds List<String>

A list IDs of the host account.

hostId String

The ID of the host.

instanceId String

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

userId String

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

hostAccountIds string[]

A list IDs of the host account.

hostId string

The ID of the host.

instanceId string

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

userId string

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

host_account_ids Sequence[str]

A list IDs of the host account.

host_id str

The ID of the host.

instance_id str

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

user_id str

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

hostAccountIds List<String>

A list IDs of the host account.

hostId String

The ID of the host.

instanceId String

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

userId String

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

Outputs

All input properties are implicitly available as output properties. Additionally, the HostAccountUserAttachment resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing HostAccountUserAttachment Resource

Get an existing HostAccountUserAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: HostAccountUserAttachmentState, opts?: CustomResourceOptions): HostAccountUserAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        host_account_ids: Optional[Sequence[str]] = None,
        host_id: Optional[str] = None,
        instance_id: Optional[str] = None,
        user_id: Optional[str] = None) -> HostAccountUserAttachment
func GetHostAccountUserAttachment(ctx *Context, name string, id IDInput, state *HostAccountUserAttachmentState, opts ...ResourceOption) (*HostAccountUserAttachment, error)
public static HostAccountUserAttachment Get(string name, Input<string> id, HostAccountUserAttachmentState? state, CustomResourceOptions? opts = null)
public static HostAccountUserAttachment get(String name, Output<String> id, HostAccountUserAttachmentState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
HostAccountIds List<string>

A list IDs of the host account.

HostId string

The ID of the host.

InstanceId string

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

UserId string

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

HostAccountIds []string

A list IDs of the host account.

HostId string

The ID of the host.

InstanceId string

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

UserId string

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

hostAccountIds List<String>

A list IDs of the host account.

hostId String

The ID of the host.

instanceId String

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

userId String

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

hostAccountIds string[]

A list IDs of the host account.

hostId string

The ID of the host.

instanceId string

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

userId string

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

host_account_ids Sequence[str]

A list IDs of the host account.

host_id str

The ID of the host.

instance_id str

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

user_id str

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

hostAccountIds List<String>

A list IDs of the host account.

hostId String

The ID of the host.

instanceId String

The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.

userId String

The ID of the user that you want to authorize to manage the specified hosts and host accounts.

Import

Bastion Host Host Account can be imported using the id, e.g.

 $ pulumi import alicloud:bastionhost/hostAccountUserAttachment:HostAccountUserAttachment example <instance_id>:<user_id>:<host_id>

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.