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

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

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>

Properties

Link copied to clipboard
val hostAccountIds: Output<List<String>>

A list IDs of the host account.

Link copied to clipboard
val hostId: Output<String>

The ID of the host.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val instanceId: Output<String>

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

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val urn: Output<String>
Link copied to clipboard
val userId: Output<String>

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