alicloud.bastionhost.HostGroupAccountUserGroupAttachment

Provides a Bastion Host Host Account Attachment resource to add list host accounts into one user group 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 defaultUserGroup = new AliCloud.BastionHost.UserGroup("defaultUserGroup", new()
    {
        InstanceId = defaultHost.InstanceId,
        UserGroupName = "my-local-user",
    });

    var defaultHostGroup = new AliCloud.BastionHost.HostGroup("defaultHostGroup", new()
    {
        HostGroupName = "example_value",
        InstanceId = "bastionhost-cn-tl3xxxxxxx",
    });

    var defaultHostGroupAccountUserGroupAttachment = new AliCloud.BastionHost.HostGroupAccountUserGroupAttachment("defaultHostGroupAccountUserGroupAttachment", new()
    {
        InstanceId = defaultHost.InstanceId,
        UserGroupId = defaultUserGroup.UserGroupId,
        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.UserGroup;
import com.pulumi.alicloud.bastionhost.UserGroupArgs;
import com.pulumi.alicloud.bastionhost.HostGroup;
import com.pulumi.alicloud.bastionhost.HostGroupArgs;
import com.pulumi.alicloud.bastionhost.HostGroupAccountUserGroupAttachment;
import com.pulumi.alicloud.bastionhost.HostGroupAccountUserGroupAttachmentArgs;
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 defaultUserGroup = new UserGroup("defaultUserGroup", UserGroupArgs.builder()        
            .instanceId(defaultHost.instanceId())
            .userGroupName("my-local-user")
            .build());

        var defaultHostGroup = new HostGroup("defaultHostGroup", HostGroupArgs.builder()        
            .hostGroupName("example_value")
            .instanceId("bastionhost-cn-tl3xxxxxxx")
            .build());

        var defaultHostGroupAccountUserGroupAttachment = new HostGroupAccountUserGroupAttachment("defaultHostGroupAccountUserGroupAttachment", HostGroupAccountUserGroupAttachmentArgs.builder()        
            .instanceId(defaultHost.instanceId())
            .userGroupId(defaultUserGroup.userGroupId())
            .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_group = alicloud.bastionhost.UserGroup("defaultUserGroup",
    instance_id=default_host.instance_id,
    user_group_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_group_attachment = alicloud.bastionhost.HostGroupAccountUserGroupAttachment("defaultHostGroupAccountUserGroupAttachment",
    instance_id=default_host.instance_id,
    user_group_id=default_user_group.user_group_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 defaultUserGroup = new alicloud.bastionhost.UserGroup("defaultUserGroup", {
    instanceId: defaultHost.instanceId,
    userGroupName: "my-local-user",
});
const defaultHostGroup = new alicloud.bastionhost.HostGroup("defaultHostGroup", {
    hostGroupName: "example_value",
    instanceId: "bastionhost-cn-tl3xxxxxxx",
});
const defaultHostGroupAccountUserGroupAttachment = new alicloud.bastionhost.HostGroupAccountUserGroupAttachment("defaultHostGroupAccountUserGroupAttachment", {
    instanceId: defaultHost.instanceId,
    userGroupId: defaultUserGroup.userGroupId,
    hostGroupId: defaultHostGroup.hostGroupId,
    hostAccountNames: defaultHostAccount.map(__item => __item.hostAccountName),
});

Coming soon!

Create HostGroupAccountUserGroupAttachment Resource

new HostGroupAccountUserGroupAttachment(name: string, args: HostGroupAccountUserGroupAttachmentArgs, opts?: CustomResourceOptions);
@overload
def HostGroupAccountUserGroupAttachment(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_group_id: Optional[str] = None)
@overload
def HostGroupAccountUserGroupAttachment(resource_name: str,
                                        args: HostGroupAccountUserGroupAttachmentArgs,
                                        opts: Optional[ResourceOptions] = None)
func NewHostGroupAccountUserGroupAttachment(ctx *Context, name string, args HostGroupAccountUserGroupAttachmentArgs, opts ...ResourceOption) (*HostGroupAccountUserGroupAttachment, error)
public HostGroupAccountUserGroupAttachment(string name, HostGroupAccountUserGroupAttachmentArgs args, CustomResourceOptions? opts = null)
public HostGroupAccountUserGroupAttachment(String name, HostGroupAccountUserGroupAttachmentArgs args)
public HostGroupAccountUserGroupAttachment(String name, HostGroupAccountUserGroupAttachmentArgs args, CustomResourceOptions options)
type: alicloud:bastionhost:HostGroupAccountUserGroupAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

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

HostGroupAccountUserGroupAttachment 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 HostGroupAccountUserGroupAttachment 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.

UserGroupId string

The ID of the user group 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.

UserGroupId string

The ID of the user group 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.

userGroupId String

The ID of the user group 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.

userGroupId string

The ID of the user group 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_group_id str

The ID of the user group 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.

userGroupId String

The ID of the user group 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 HostGroupAccountUserGroupAttachment 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 HostGroupAccountUserGroupAttachment Resource

Get an existing HostGroupAccountUserGroupAttachment 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?: HostGroupAccountUserGroupAttachmentState, opts?: CustomResourceOptions): HostGroupAccountUserGroupAttachment
@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_group_id: Optional[str] = None) -> HostGroupAccountUserGroupAttachment
func GetHostGroupAccountUserGroupAttachment(ctx *Context, name string, id IDInput, state *HostGroupAccountUserGroupAttachmentState, opts ...ResourceOption) (*HostGroupAccountUserGroupAttachment, error)
public static HostGroupAccountUserGroupAttachment Get(string name, Input<string> id, HostGroupAccountUserGroupAttachmentState? state, CustomResourceOptions? opts = null)
public static HostGroupAccountUserGroupAttachment get(String name, Output<String> id, HostGroupAccountUserGroupAttachmentState 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.

UserGroupId string

The ID of the user group 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.

UserGroupId string

The ID of the user group 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.

userGroupId String

The ID of the user group 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.

userGroupId string

The ID of the user group 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_group_id str

The ID of the user group 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.

userGroupId String

The ID of the user group 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/hostGroupAccountUserGroupAttachment:HostGroupAccountUserGroupAttachment example <instance_id>:<user_group_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.