alicloud.bastionhost.HostGroupAccountUserAttachment

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

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-tl3xxxxxxx",
        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 defaultHostGroup = new AliCloud.BastionHost.HostGroup("defaultHostGroup", new()
    {
        HostGroupName = "example_value",
        InstanceId = "bastionhost-cn-tl3xxxxxxx",
    });

    var defaultHostGroupAccountUserAttachment = new AliCloud.BastionHost.HostGroupAccountUserAttachment("defaultHostGroupAccountUserAttachment", new()
    {
        InstanceId = defaultHost.InstanceId,
        UserId = defaultUser.UserId,
        HostGroupId = defaultHostGroup.HostGroupId,
        HostAccountNames = defaultHostAccount.Select(__item => __item.HostAccountName).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.HostGroup;
import com.pulumi.alicloud.bastionhost.HostGroupArgs;
import com.pulumi.alicloud.bastionhost.HostGroupAccountUserAttachment;
import com.pulumi.alicloud.bastionhost.HostGroupAccountUserAttachmentArgs;
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-tl3xxxxxxx")
            .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 defaultHostGroup = new HostGroup("defaultHostGroup", HostGroupArgs.builder()        
            .hostGroupName("example_value")
            .instanceId("bastionhost-cn-tl3xxxxxxx")
            .build());

        var defaultHostGroupAccountUserAttachment = new HostGroupAccountUserAttachment("defaultHostGroupAccountUserAttachment", HostGroupAccountUserAttachmentArgs.builder()        
            .instanceId(defaultHost.instanceId())
            .userId(defaultUser.userId())
            .hostGroupId(defaultHostGroup.hostGroupId())
            .hostAccountNames(defaultHostAccount.stream().map(element -> element.hostAccountName()).collect(toList()))
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

default_host = alicloud.bastionhost.Host("defaultHost",
    instance_id="bastionhost-cn-tl3xxxxxxx",
    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_group = alicloud.bastionhost.HostGroup("defaultHostGroup",
    host_group_name="example_value",
    instance_id="bastionhost-cn-tl3xxxxxxx")
default_host_group_account_user_attachment = alicloud.bastionhost.HostGroupAccountUserAttachment("defaultHostGroupAccountUserAttachment",
    instance_id=default_host.instance_id,
    user_id=default_user.user_id,
    host_group_id=default_host_group.host_group_id,
    host_account_names=[__item.host_account_name 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-tl3xxxxxxx",
    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 defaultHostGroup = new alicloud.bastionhost.HostGroup("defaultHostGroup", {
    hostGroupName: "example_value",
    instanceId: "bastionhost-cn-tl3xxxxxxx",
});
const defaultHostGroupAccountUserAttachment = new alicloud.bastionhost.HostGroupAccountUserAttachment("defaultHostGroupAccountUserAttachment", {
    instanceId: defaultHost.instanceId,
    userId: defaultUser.userId,
    hostGroupId: defaultHostGroup.hostGroupId,
    hostAccountNames: defaultHostAccount.map(__item => __item.hostAccountName),
});

Coming soon!

Create HostGroupAccountUserAttachment Resource

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

name string
The unique name of the resource.
args HostGroupAccountUserAttachmentArgs
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 HostGroupAccountUserAttachmentArgs
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 HostGroupAccountUserAttachmentArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args HostGroupAccountUserAttachmentArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args HostGroupAccountUserAttachmentArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

HostGroupAccountUserAttachment 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 HostGroupAccountUserAttachment resource accepts the following input properties:

HostAccountNames List<string>

A list names of the host account.

HostGroupId string

The ID of the host group.

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.

HostAccountNames []string

A list names of the host account.

HostGroupId string

The ID of the host group.

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.

hostAccountNames List<String>

A list names of the host account.

hostGroupId String

The ID of the host group.

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.

hostAccountNames string[]

A list names of the host account.

hostGroupId string

The ID of the host group.

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_names Sequence[str]

A list names of the host account.

host_group_id str

The ID of the host group.

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.

hostAccountNames List<String>

A list names of the host account.

hostGroupId String

The ID of the host group.

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 HostGroupAccountUserAttachment 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 HostGroupAccountUserAttachment Resource

Get an existing HostGroupAccountUserAttachment 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?: HostGroupAccountUserAttachmentState, opts?: CustomResourceOptions): HostGroupAccountUserAttachment
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        host_account_names: Optional[Sequence[str]] = None,
        host_group_id: Optional[str] = None,
        instance_id: Optional[str] = None,
        user_id: Optional[str] = None) -> HostGroupAccountUserAttachment
func GetHostGroupAccountUserAttachment(ctx *Context, name string, id IDInput, state *HostGroupAccountUserAttachmentState, opts ...ResourceOption) (*HostGroupAccountUserAttachment, error)
public static HostGroupAccountUserAttachment Get(string name, Input<string> id, HostGroupAccountUserAttachmentState? state, CustomResourceOptions? opts = null)
public static HostGroupAccountUserAttachment get(String name, Output<String> id, HostGroupAccountUserAttachmentState 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:
HostAccountNames List<string>

A list names of the host account.

HostGroupId string

The ID of the host group.

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.

HostAccountNames []string

A list names of the host account.

HostGroupId string

The ID of the host group.

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.

hostAccountNames List<String>

A list names of the host account.

hostGroupId String

The ID of the host group.

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.

hostAccountNames string[]

A list names of the host account.

hostGroupId string

The ID of the host group.

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_names Sequence[str]

A list names of the host account.

host_group_id str

The ID of the host group.

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.

hostAccountNames List<String>

A list names of the host account.

hostGroupId String

The ID of the host group.

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/hostGroupAccountUserAttachment:HostGroupAccountUserAttachment example <instance_id>:<user_id>:<host_group_id>

Package Details

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

This Pulumi package is based on the alicloud Terraform Provider.