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

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

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>

Properties

Link copied to clipboard

A list names of the host account.

Link copied to clipboard
val hostGroupId: Output<String>

The ID of the host group.

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 userGroupId: Output<String>

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