Package com.pulumi.alicloud.bastionhost
Class HostGroupAccountUserAttachment
- java.lang.Object
-
- com.pulumi.resources.Resource
-
- com.pulumi.resources.CustomResource
-
- com.pulumi.alicloud.bastionhost.HostGroupAccountUserAttachment
-
public class HostGroupAccountUserAttachment extends com.pulumi.resources.CustomResource
Provides a Bastion Host Host Account Attachment resource to add list host accounts into one user and one host group. > **NOTE:** Available since v1.135.0. ## Example Usage Basic Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.alicloud.AlicloudFunctions; import com.pulumi.alicloud.inputs.GetZonesArgs; import com.pulumi.alicloud.vpc.VpcFunctions; import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs; import com.pulumi.alicloud.vpc.inputs.GetSwitchesArgs; import com.pulumi.alicloud.ecs.SecurityGroup; import com.pulumi.alicloud.ecs.SecurityGroupArgs; import com.pulumi.alicloud.bastionhost.Instance; import com.pulumi.alicloud.bastionhost.InstanceArgs; import com.pulumi.alicloud.bastionhost.User; import com.pulumi.alicloud.bastionhost.UserArgs; 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.HostGroup; import com.pulumi.alicloud.bastionhost.HostGroupArgs; import com.pulumi.alicloud.bastionhost.HostGroupAccountUserAttachment; import com.pulumi.alicloud.bastionhost.HostGroupAccountUserAttachmentArgs; 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) { final var config = ctx.config(); final var name = config.get("name").orElse("tf_example"); final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder() .availableResourceCreation("VSwitch") .build()); final var defaultNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder() .nameRegex("^default-NODELETING$") .cidrBlock("10.4.0.0/16") .build()); final var defaultSwitches = VpcFunctions.getSwitches(GetSwitchesArgs.builder() .cidrBlock("10.4.0.0/24") .vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0])) .zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id())) .build()); var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder() .vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0])) .build()); var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder() .description(name) .licenseCode("bhah_ent_50_asset") .planCode("cloudbastion") .storage("5") .bandwidth("5") .period("1") .vswitchId(defaultSwitches.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0])) .securityGroupIds(defaultSecurityGroup.id()) .build()); var localUser = new User("localUser", UserArgs.builder() .instanceId(defaultInstance.id()) .mobileCountryCode("CN") .mobile("13312345678") .password("YourPassword-123") .source("Local") .userName(String.format("%s_local_user", name)) .build()); var defaultHost = new Host("defaultHost", HostArgs.builder() .instanceId(defaultInstance.id()) .hostName(name) .activeAddressType("Private") .hostPrivateAddress("172.16.0.10") .osType("Linux") .source("Local") .build()); var defaultHostAccount = new HostAccount("defaultHostAccount", HostAccountArgs.builder() .hostAccountName(name) .hostId(defaultHost.hostId()) .instanceId(defaultHost.instanceId()) .protocolName("SSH") .password("YourPassword12345") .build()); var defaultHostGroup = new HostGroup("defaultHostGroup", HostGroupArgs.builder() .hostGroupName(name) .instanceId(defaultInstance.id()) .build()); var defaultHostGroupAccountUserAttachment = new HostGroupAccountUserAttachment("defaultHostGroupAccountUserAttachment", HostGroupAccountUserAttachmentArgs.builder() .instanceId(defaultHost.instanceId()) .userId(localUser.userId()) .hostGroupId(defaultHostGroup.hostGroupId()) .hostAccountNames(defaultHostAccount.hostAccountName()) .build()); } } ``` ## Import Bastion Host Host Account can be imported using the id, e.g. ```sh $ pulumi import alicloud:bastionhost/hostGroupAccountUserAttachment:HostGroupAccountUserAttachment example <instance_id>:<user_id>:<host_group_id> ```
-
-
Constructor Summary
Constructors Constructor Description HostGroupAccountUserAttachment(java.lang.String name)
HostGroupAccountUserAttachment(java.lang.String name, HostGroupAccountUserAttachmentArgs args)
HostGroupAccountUserAttachment(java.lang.String name, HostGroupAccountUserAttachmentArgs args, com.pulumi.resources.CustomResourceOptions options)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static HostGroupAccountUserAttachment
get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, HostGroupAccountUserAttachmentState state, com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.com.pulumi.core.Output<java.util.List<java.lang.String>>
hostAccountNames()
com.pulumi.core.Output<java.lang.String>
hostGroupId()
com.pulumi.core.Output<java.lang.String>
instanceId()
com.pulumi.core.Output<java.lang.String>
userId()
-
-
-
Constructor Detail
-
HostGroupAccountUserAttachment
public HostGroupAccountUserAttachment(java.lang.String name)
- Parameters:
name
- The _unique_ name of the resulting resource.
-
HostGroupAccountUserAttachment
public HostGroupAccountUserAttachment(java.lang.String name, HostGroupAccountUserAttachmentArgs args)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.
-
HostGroupAccountUserAttachment
public HostGroupAccountUserAttachment(java.lang.String name, HostGroupAccountUserAttachmentArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options)
- Parameters:
name
- The _unique_ name of the resulting resource.args
- The arguments to use to populate this resource's properties.options
- A bag of options that control this resource's behavior.
-
-
Method Detail
-
hostAccountNames
public com.pulumi.core.Output<java.util.List<java.lang.String>> hostAccountNames()
- Returns:
- A list names of the host account.
-
hostGroupId
public com.pulumi.core.Output<java.lang.String> hostGroupId()
- Returns:
- The ID of the host group.
-
instanceId
public com.pulumi.core.Output<java.lang.String> instanceId()
- Returns:
- The ID of the Bastionhost instance where you want to authorize the user to manage the specified hosts and host accounts.
-
userId
public com.pulumi.core.Output<java.lang.String> userId()
- Returns:
- The ID of the user that you want to authorize to manage the specified hosts and host accounts.
-
get
public static HostGroupAccountUserAttachment get(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, @Nullable HostGroupAccountUserAttachmentState state, @Nullable com.pulumi.resources.CustomResourceOptions options)
Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.- Parameters:
name
- The _unique_ name of the resulting resource.id
- The _unique_ provider ID of the resource to lookup.state
-options
- Optional settings to control the behavior of the CustomResource.
-
-