alicloud.bastionhost.HostAccountUserGroupAttachment
Provides a Bastion Host Host Account Attachment resource to add list host accounts into one user 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-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 defaultUserGroup = new AliCloud.BastionHost.UserGroup("defaultUserGroup", new()
{
InstanceId = "bastionhost-cn-tl32bh0no30",
UserGroupName = @var.Name,
});
var defaultHostAccountUserGroupAttachment = new AliCloud.BastionHost.HostAccountUserGroupAttachment("defaultHostAccountUserGroupAttachment", new()
{
InstanceId = defaultHost.InstanceId,
UserGroupId = defaultUserGroup.UserGroupId,
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.UserGroup;
import com.pulumi.alicloud.bastionhost.UserGroupArgs;
import com.pulumi.alicloud.bastionhost.HostAccountUserGroupAttachment;
import com.pulumi.alicloud.bastionhost.HostAccountUserGroupAttachmentArgs;
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 defaultUserGroup = new UserGroup("defaultUserGroup", UserGroupArgs.builder()
.instanceId("bastionhost-cn-tl32bh0no30")
.userGroupName(var_.name())
.build());
var defaultHostAccountUserGroupAttachment = new HostAccountUserGroupAttachment("defaultHostAccountUserGroupAttachment", HostAccountUserGroupAttachmentArgs.builder()
.instanceId(defaultHost.instanceId())
.userGroupId(defaultUserGroup.userGroupId())
.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_group = alicloud.bastionhost.UserGroup("defaultUserGroup",
instance_id="bastionhost-cn-tl32bh0no30",
user_group_name=var["name"])
default_host_account_user_group_attachment = alicloud.bastionhost.HostAccountUserGroupAttachment("defaultHostAccountUserGroupAttachment",
instance_id=default_host.instance_id,
user_group_id=default_user_group.user_group_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 defaultUserGroup = new alicloud.bastionhost.UserGroup("defaultUserGroup", {
instanceId: "bastionhost-cn-tl32bh0no30",
userGroupName: _var.name,
});
const defaultHostAccountUserGroupAttachment = new alicloud.bastionhost.HostAccountUserGroupAttachment("defaultHostAccountUserGroupAttachment", {
instanceId: defaultHost.instanceId,
userGroupId: defaultUserGroup.userGroupId,
hostId: defaultHost.hostId,
hostAccountIds: defaultHostAccount.map(__item => __item.hostAccountId),
});
Coming soon!
Create HostAccountUserGroupAttachment Resource
new HostAccountUserGroupAttachment(name: string, args: HostAccountUserGroupAttachmentArgs, opts?: CustomResourceOptions);
@overload
def HostAccountUserGroupAttachment(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_group_id: Optional[str] = None)
@overload
def HostAccountUserGroupAttachment(resource_name: str,
args: HostAccountUserGroupAttachmentArgs,
opts: Optional[ResourceOptions] = None)
func NewHostAccountUserGroupAttachment(ctx *Context, name string, args HostAccountUserGroupAttachmentArgs, opts ...ResourceOption) (*HostAccountUserGroupAttachment, error)
public HostAccountUserGroupAttachment(string name, HostAccountUserGroupAttachmentArgs args, CustomResourceOptions? opts = null)
public HostAccountUserGroupAttachment(String name, HostAccountUserGroupAttachmentArgs args)
public HostAccountUserGroupAttachment(String name, HostAccountUserGroupAttachmentArgs args, CustomResourceOptions options)
type: alicloud:bastionhost:HostAccountUserGroupAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args HostAccountUserGroupAttachmentArgs
- 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 HostAccountUserGroupAttachmentArgs
- 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 HostAccountUserGroupAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args HostAccountUserGroupAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args HostAccountUserGroupAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
HostAccountUserGroupAttachment 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 HostAccountUserGroupAttachment resource accepts the following input properties:
- Host
Account List<string>Ids A list IDs of the host account.
- Host
Id string The ID of the host.
- Instance
Id string The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
- User
Group stringId The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
- Host
Account []stringIds A list IDs of the host account.
- Host
Id string The ID of the host.
- Instance
Id string The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
- User
Group stringId The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
- host
Account List<String>Ids A list IDs of the host account.
- host
Id String The ID of the host.
- instance
Id String The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
- user
Group StringId The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
- host
Account string[]Ids A list IDs of the host account.
- host
Id string The ID of the host.
- instance
Id string The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
- user
Group stringId The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
- host_
account_ Sequence[str]ids 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 group to manage the specified hosts and host accounts.
- user_
group_ strid The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
- host
Account List<String>Ids A list IDs of the host account.
- host
Id String The ID of the host.
- instance
Id String The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
- user
Group StringId 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 HostAccountUserGroupAttachment 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 HostAccountUserGroupAttachment Resource
Get an existing HostAccountUserGroupAttachment 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?: HostAccountUserGroupAttachmentState, opts?: CustomResourceOptions): HostAccountUserGroupAttachment
@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_group_id: Optional[str] = None) -> HostAccountUserGroupAttachment
func GetHostAccountUserGroupAttachment(ctx *Context, name string, id IDInput, state *HostAccountUserGroupAttachmentState, opts ...ResourceOption) (*HostAccountUserGroupAttachment, error)
public static HostAccountUserGroupAttachment Get(string name, Input<string> id, HostAccountUserGroupAttachmentState? state, CustomResourceOptions? opts = null)
public static HostAccountUserGroupAttachment get(String name, Output<String> id, HostAccountUserGroupAttachmentState 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.
- Host
Account List<string>Ids A list IDs of the host account.
- Host
Id string The ID of the host.
- Instance
Id string The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
- User
Group stringId The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
- Host
Account []stringIds A list IDs of the host account.
- Host
Id string The ID of the host.
- Instance
Id string The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
- User
Group stringId The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
- host
Account List<String>Ids A list IDs of the host account.
- host
Id String The ID of the host.
- instance
Id String The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
- user
Group StringId The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
- host
Account string[]Ids A list IDs of the host account.
- host
Id string The ID of the host.
- instance
Id string The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
- user
Group stringId The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
- host_
account_ Sequence[str]ids 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 group to manage the specified hosts and host accounts.
- user_
group_ strid The ID of the user group that you want to authorize to manage the specified hosts and host accounts.
- host
Account List<String>Ids A list IDs of the host account.
- host
Id String The ID of the host.
- instance
Id String The ID of the Bastionhost instance where you want to authorize the user group to manage the specified hosts and host accounts.
- user
Group StringId 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/hostAccountUserGroupAttachment:HostAccountUserGroupAttachment example <instance_id>:<user_group_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.