alicloud.bastionhost.HostAccountShareKeyAttachment
Provides a Bastion Host Account Share Key Attachment resource.
For information about Bastion Host Host Account Share Key Attachment and how to use it, see What is Host Account Share Key Attachment.
NOTE: Available in v1.165.0+.
Example Usage
Basic Usage
using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tfacc_host_account_share_key_attachment";
var defaultInstances = AliCloud.BastionHost.GetInstances.Invoke();
var defaultHostShareKey = new AliCloud.BastionHost.HostShareKey("defaultHostShareKey", new()
{
HostShareKeyName = "example_name",
InstanceId = defaultInstances.Apply(getInstancesResult => getInstancesResult.Instances[0]?.Id),
PassPhrase = "example_value",
PrivateKey = "example_value",
});
var defaultHost = new AliCloud.BastionHost.Host("defaultHost", new()
{
InstanceId = defaultInstances.Apply(getInstancesResult => getInstancesResult.Ids[0]),
HostName = name,
ActiveAddressType = "Private",
HostPrivateAddress = "172.16.0.10",
OsType = "Linux",
Source = "Local",
});
var defaultHostAccount = new AliCloud.BastionHost.HostAccount("defaultHostAccount", new()
{
InstanceId = defaultInstances.Apply(getInstancesResult => getInstancesResult.Ids[0]),
HostAccountName = name,
HostId = defaultHost.HostId,
ProtocolName = "SSH",
Password = "YourPassword12345",
});
var defaultHostAccountShareKeyAttachment = new AliCloud.BastionHost.HostAccountShareKeyAttachment("defaultHostAccountShareKeyAttachment", new()
{
InstanceId = defaultInstances.Apply(getInstancesResult => getInstancesResult.Instances[0]?.Id),
HostShareKeyId = defaultHostShareKey.HostShareKeyId,
HostAccountId = defaultHostAccount.HostAccountId,
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/bastionhost"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
cfg := config.New(ctx, "")
name := "tfacc_host_account_share_key_attachment"
if param := cfg.Get("name"); param != "" {
name = param
}
defaultInstances, err := bastionhost.GetInstances(ctx, nil, nil)
if err != nil {
return err
}
defaultHostShareKey, err := bastionhost.NewHostShareKey(ctx, "defaultHostShareKey", &bastionhost.HostShareKeyArgs{
HostShareKeyName: pulumi.String("example_name"),
InstanceId: *pulumi.String(defaultInstances.Instances[0].Id),
PassPhrase: pulumi.String("example_value"),
PrivateKey: pulumi.String("example_value"),
})
if err != nil {
return err
}
defaultHost, err := bastionhost.NewHost(ctx, "defaultHost", &bastionhost.HostArgs{
InstanceId: *pulumi.String(defaultInstances.Ids[0]),
HostName: pulumi.String(name),
ActiveAddressType: pulumi.String("Private"),
HostPrivateAddress: pulumi.String("172.16.0.10"),
OsType: pulumi.String("Linux"),
Source: pulumi.String("Local"),
})
if err != nil {
return err
}
defaultHostAccount, err := bastionhost.NewHostAccount(ctx, "defaultHostAccount", &bastionhost.HostAccountArgs{
InstanceId: *pulumi.String(defaultInstances.Ids[0]),
HostAccountName: pulumi.String(name),
HostId: defaultHost.HostId,
ProtocolName: pulumi.String("SSH"),
Password: pulumi.String("YourPassword12345"),
})
if err != nil {
return err
}
_, err = bastionhost.NewHostAccountShareKeyAttachment(ctx, "defaultHostAccountShareKeyAttachment", &bastionhost.HostAccountShareKeyAttachmentArgs{
InstanceId: *pulumi.String(defaultInstances.Instances[0].Id),
HostShareKeyId: defaultHostShareKey.HostShareKeyId,
HostAccountId: defaultHostAccount.HostAccountId,
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.bastionhost.BastionhostFunctions;
import com.pulumi.alicloud.bastionhost.inputs.GetInstancesArgs;
import com.pulumi.alicloud.bastionhost.HostShareKey;
import com.pulumi.alicloud.bastionhost.HostShareKeyArgs;
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.HostAccountShareKeyAttachment;
import com.pulumi.alicloud.bastionhost.HostAccountShareKeyAttachmentArgs;
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("tfacc_host_account_share_key_attachment");
final var defaultInstances = BastionhostFunctions.getInstances();
var defaultHostShareKey = new HostShareKey("defaultHostShareKey", HostShareKeyArgs.builder()
.hostShareKeyName("example_name")
.instanceId(defaultInstances.applyValue(getInstancesResult -> getInstancesResult.instances()[0].id()))
.passPhrase("example_value")
.privateKey("example_value")
.build());
var defaultHost = new Host("defaultHost", HostArgs.builder()
.instanceId(defaultInstances.applyValue(getInstancesResult -> getInstancesResult.ids()[0]))
.hostName(name)
.activeAddressType("Private")
.hostPrivateAddress("172.16.0.10")
.osType("Linux")
.source("Local")
.build());
var defaultHostAccount = new HostAccount("defaultHostAccount", HostAccountArgs.builder()
.instanceId(defaultInstances.applyValue(getInstancesResult -> getInstancesResult.ids()[0]))
.hostAccountName(name)
.hostId(defaultHost.hostId())
.protocolName("SSH")
.password("YourPassword12345")
.build());
var defaultHostAccountShareKeyAttachment = new HostAccountShareKeyAttachment("defaultHostAccountShareKeyAttachment", HostAccountShareKeyAttachmentArgs.builder()
.instanceId(defaultInstances.applyValue(getInstancesResult -> getInstancesResult.instances()[0].id()))
.hostShareKeyId(defaultHostShareKey.hostShareKeyId())
.hostAccountId(defaultHostAccount.hostAccountId())
.build());
}
}
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tfacc_host_account_share_key_attachment"
default_instances = alicloud.bastionhost.get_instances()
default_host_share_key = alicloud.bastionhost.HostShareKey("defaultHostShareKey",
host_share_key_name="example_name",
instance_id=default_instances.instances[0].id,
pass_phrase="example_value",
private_key="example_value")
default_host = alicloud.bastionhost.Host("defaultHost",
instance_id=default_instances.ids[0],
host_name=name,
active_address_type="Private",
host_private_address="172.16.0.10",
os_type="Linux",
source="Local")
default_host_account = alicloud.bastionhost.HostAccount("defaultHostAccount",
instance_id=default_instances.ids[0],
host_account_name=name,
host_id=default_host.host_id,
protocol_name="SSH",
password="YourPassword12345")
default_host_account_share_key_attachment = alicloud.bastionhost.HostAccountShareKeyAttachment("defaultHostAccountShareKeyAttachment",
instance_id=default_instances.instances[0].id,
host_share_key_id=default_host_share_key.host_share_key_id,
host_account_id=default_host_account.host_account_id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "tfacc_host_account_share_key_attachment";
const defaultInstances = alicloud.bastionhost.getInstances({});
const defaultHostShareKey = new alicloud.bastionhost.HostShareKey("defaultHostShareKey", {
hostShareKeyName: "example_name",
instanceId: defaultInstances.then(defaultInstances => defaultInstances.instances?.[0]?.id),
passPhrase: "example_value",
privateKey: "example_value",
});
const defaultHost = new alicloud.bastionhost.Host("defaultHost", {
instanceId: defaultInstances.then(defaultInstances => defaultInstances.ids?.[0]),
hostName: name,
activeAddressType: "Private",
hostPrivateAddress: "172.16.0.10",
osType: "Linux",
source: "Local",
});
const defaultHostAccount = new alicloud.bastionhost.HostAccount("defaultHostAccount", {
instanceId: defaultInstances.then(defaultInstances => defaultInstances.ids?.[0]),
hostAccountName: name,
hostId: defaultHost.hostId,
protocolName: "SSH",
password: "YourPassword12345",
});
const defaultHostAccountShareKeyAttachment = new alicloud.bastionhost.HostAccountShareKeyAttachment("defaultHostAccountShareKeyAttachment", {
instanceId: defaultInstances.then(defaultInstances => defaultInstances.instances?.[0]?.id),
hostShareKeyId: defaultHostShareKey.hostShareKeyId,
hostAccountId: defaultHostAccount.hostAccountId,
});
configuration:
name:
type: string
default: tfacc_host_account_share_key_attachment
resources:
defaultHostShareKey:
type: alicloud:bastionhost:HostShareKey
properties:
hostShareKeyName: example_name
instanceId: ${defaultInstances.instances[0].id}
passPhrase: example_value
privateKey: example_value
defaultHost:
type: alicloud:bastionhost:Host
properties:
instanceId: ${defaultInstances.ids[0]}
hostName: ${name}
activeAddressType: Private
hostPrivateAddress: 172.16.0.10
osType: Linux
source: Local
defaultHostAccount:
type: alicloud:bastionhost:HostAccount
properties:
instanceId: ${defaultInstances.ids[0]}
hostAccountName: ${name}
hostId: ${defaultHost.hostId}
protocolName: SSH
password: YourPassword12345
defaultHostAccountShareKeyAttachment:
type: alicloud:bastionhost:HostAccountShareKeyAttachment
properties:
instanceId: ${defaultInstances.instances[0].id}
hostShareKeyId: ${defaultHostShareKey.hostShareKeyId}
hostAccountId: ${defaultHostAccount.hostAccountId}
variables:
defaultInstances:
fn::invoke:
Function: alicloud:bastionhost:getInstances
Arguments: {}
Create HostAccountShareKeyAttachment Resource
new HostAccountShareKeyAttachment(name: string, args: HostAccountShareKeyAttachmentArgs, opts?: CustomResourceOptions);
@overload
def HostAccountShareKeyAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
host_account_id: Optional[str] = None,
host_share_key_id: Optional[str] = None,
instance_id: Optional[str] = None)
@overload
def HostAccountShareKeyAttachment(resource_name: str,
args: HostAccountShareKeyAttachmentArgs,
opts: Optional[ResourceOptions] = None)
func NewHostAccountShareKeyAttachment(ctx *Context, name string, args HostAccountShareKeyAttachmentArgs, opts ...ResourceOption) (*HostAccountShareKeyAttachment, error)
public HostAccountShareKeyAttachment(string name, HostAccountShareKeyAttachmentArgs args, CustomResourceOptions? opts = null)
public HostAccountShareKeyAttachment(String name, HostAccountShareKeyAttachmentArgs args)
public HostAccountShareKeyAttachment(String name, HostAccountShareKeyAttachmentArgs args, CustomResourceOptions options)
type: alicloud:bastionhost:HostAccountShareKeyAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args HostAccountShareKeyAttachmentArgs
- 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 HostAccountShareKeyAttachmentArgs
- 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 HostAccountShareKeyAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args HostAccountShareKeyAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args HostAccountShareKeyAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
HostAccountShareKeyAttachment 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 HostAccountShareKeyAttachment resource accepts the following input properties:
- Host
Account stringId The ID list of the host account.
- string
The ID of the host shared key.
- Instance
Id string The ID of the Bastion machine instance.
- Host
Account stringId The ID list of the host account.
- string
The ID of the host shared key.
- Instance
Id string The ID of the Bastion machine instance.
- host
Account StringId The ID list of the host account.
- String
The ID of the host shared key.
- instance
Id String The ID of the Bastion machine instance.
- host
Account stringId The ID list of the host account.
- string
The ID of the host shared key.
- instance
Id string The ID of the Bastion machine instance.
- host_
account_ strid The ID list of the host account.
- str
The ID of the host shared key.
- instance_
id str The ID of the Bastion machine instance.
- host
Account StringId The ID list of the host account.
- String
The ID of the host shared key.
- instance
Id String The ID of the Bastion machine instance.
Outputs
All input properties are implicitly available as output properties. Additionally, the HostAccountShareKeyAttachment 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 HostAccountShareKeyAttachment Resource
Get an existing HostAccountShareKeyAttachment 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?: HostAccountShareKeyAttachmentState, opts?: CustomResourceOptions): HostAccountShareKeyAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
host_account_id: Optional[str] = None,
host_share_key_id: Optional[str] = None,
instance_id: Optional[str] = None) -> HostAccountShareKeyAttachment
func GetHostAccountShareKeyAttachment(ctx *Context, name string, id IDInput, state *HostAccountShareKeyAttachmentState, opts ...ResourceOption) (*HostAccountShareKeyAttachment, error)
public static HostAccountShareKeyAttachment Get(string name, Input<string> id, HostAccountShareKeyAttachmentState? state, CustomResourceOptions? opts = null)
public static HostAccountShareKeyAttachment get(String name, Output<String> id, HostAccountShareKeyAttachmentState 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 stringId The ID list of the host account.
- string
The ID of the host shared key.
- Instance
Id string The ID of the Bastion machine instance.
- Host
Account stringId The ID list of the host account.
- string
The ID of the host shared key.
- Instance
Id string The ID of the Bastion machine instance.
- host
Account StringId The ID list of the host account.
- String
The ID of the host shared key.
- instance
Id String The ID of the Bastion machine instance.
- host
Account stringId The ID list of the host account.
- string
The ID of the host shared key.
- instance
Id string The ID of the Bastion machine instance.
- host_
account_ strid The ID list of the host account.
- str
The ID of the host shared key.
- instance_
id str The ID of the Bastion machine instance.
- host
Account StringId The ID list of the host account.
- String
The ID of the host shared key.
- instance
Id String The ID of the Bastion machine instance.
Import
Bastion Host Account Share Key Attachment can be imported using the id, e.g.
$ pulumi import alicloud:bastionhost/hostAccountShareKeyAttachment:HostAccountShareKeyAttachment example <instance_id>:<host_share_key_id>:<host_account_id>
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.