Commit 72d1987c authored by Ilia Lazebnik's avatar Ilia Lazebnik Committed by Anton Babenko

Add get_password_data (#105)

parent 80e54228
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.12.0
rev: v1.16.0
hooks:
- id: terraform_fmt
# - id: terraform_docs
- id: terraform_docs
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
hooks:
......
......@@ -98,34 +98,36 @@ data "aws_ami" "ubuntu-xenial" {
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| ami | ID of AMI to use for the instance | string | n/a | yes |
| associate\_public\_ip\_address | If true, the EC2 instance will have associated public IP address | string | `"false"` | no |
| associate\_public\_ip\_address | If true, the EC2 instance will have associated public IP address | bool | `"false"` | no |
| cpu\_credits | The credit option for CPU usage (unlimited or standard) | string | `"standard"` | no |
| disable\_api\_termination | If true, enables EC2 Instance Termination Protection | string | `"false"` | no |
| ebs\_block\_device | Additional EBS block devices to attach to the instance | list | `<list>` | no |
| ebs\_optimized | If true, the launched EC2 instance will be EBS-optimized | string | `"false"` | no |
| ephemeral\_block\_device | Customize Ephemeral (also known as Instance Store) volumes on the instance | list | `<list>` | no |
| disable\_api\_termination | If true, enables EC2 Instance Termination Protection | bool | `"false"` | no |
| ebs\_block\_device | Additional EBS block devices to attach to the instance | list(map(string)) | `[]` | no |
| ebs\_optimized | If true, the launched EC2 instance will be EBS-optimized | bool | `"false"` | no |
| ephemeral\_block\_device | Customize Ephemeral (also known as Instance Store) volumes on the instance | list(map(string)) | `[]` | no |
| get\_password\_data | If true, wait for password data to become available and retrieve it. | bool | `"false"` | no |
| iam\_instance\_profile | The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. | string | `""` | no |
| instance\_count | Number of instances to launch | string | `"1"` | no |
| instance\_count | Number of instances to launch | number | `"1"` | no |
| instance\_initiated\_shutdown\_behavior | Shutdown behavior for the instance | string | `""` | no |
| instance\_type | The type of instance to start | string | n/a | yes |
| ipv6\_address\_count | A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. | string | `"0"` | no |
| ipv6\_addresses | Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface | list | `<list>` | no |
| ipv6\_address\_count | A number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. | number | `"0"` | no |
| ipv6\_addresses | Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface | list(string) | `[]` | no |
| key\_name | The key name to use for the instance | string | `""` | no |
| monitoring | If true, the launched EC2 instance will have detailed monitoring enabled | string | `"false"` | no |
| monitoring | If true, the launched EC2 instance will have detailed monitoring enabled | bool | `"false"` | no |
| name | Name to be used on all resources as prefix | string | n/a | yes |
| network\_interface | Customize network interfaces to be attached at instance boot time | list | `<list>` | no |
| network\_interface | Customize network interfaces to be attached at instance boot time | list(map(string)) | `[]` | no |
| placement\_group | The Placement Group to start the instance in | string | `""` | no |
| private\_ip | Private IP address to associate with the instance in a VPC | string | `""` | no |
| root\_block\_device | Customize details about the root block device of the instance. See Block Devices below for details | list | `<list>` | no |
| source\_dest\_check | Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. | string | `"true"` | no |
| private\_ips | A list of private IP address to associate with the instance in a VPC. Should match the number of instances. | list(string) | `[]` | no |
| root\_block\_device | Customize details about the root block device of the instance. See Block Devices below for details | list(map(string)) | `[]` | no |
| source\_dest\_check | Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. | bool | `"true"` | no |
| subnet\_id | The VPC Subnet ID to launch in | string | `""` | no |
| subnet\_ids | A list of VPC Subnet IDs to launch in | list | `<list>` | no |
| tags | A mapping of tags to assign to the resource | map | `<map>` | no |
| subnet\_ids | A list of VPC Subnet IDs to launch in | list(string) | `[]` | no |
| tags | A mapping of tags to assign to the resource | map(string) | `{}` | no |
| tenancy | The tenancy of the instance (if the instance is running in a VPC). Available values: default, dedicated, host. | string | `"default"` | no |
| use\_num\_suffix | Always append numerical suffix to instance name, even if instance_count is 1 | string | `"false"` | no |
| use\_num\_suffix | Always append numerical suffix to instance name, even if instance_count is 1 | bool | `"false"` | no |
| user\_data | The user data to provide when launching the instance | string | `""` | no |
| volume\_tags | A mapping of tags to assign to the devices created by the instance at launch time | map | `<map>` | no |
| vpc\_security\_group\_ids | A list of security group IDs to associate with | list | n/a | yes |
| volume\_tags | A mapping of tags to assign to the devices created by the instance at launch time | map(string) | `{}` | no |
| vpc\_security\_group\_ids | A list of security group IDs to associate with | list(string) | n/a | yes |
## Outputs
......@@ -135,6 +137,7 @@ data "aws_ami" "ubuntu-xenial" {
| credit\_specification | List of credit specification of instances |
| id | List of IDs of instances |
| key\_name | List of key names of instances |
| password\_data | List of Base-64 encoded encrypted password data for the instance |
| placement\_group | List of placement groups of instances |
| primary\_network\_interface\_id | List of IDs of the primary network interface of instances |
| private\_dns | List of private DNS names assigned to the instances. Can only be used inside the Amazon EC2, and only available if you've enabled DNS hostnames for your VPC |
......
......@@ -29,7 +29,9 @@ Note that this example may create resources which can cost money. Run `terraform
| ids\_t2 | List of IDs of t2-type instances |
| instance\_id | EC2 instance ID |
| instance\_public\_dns | Public DNS name assigned to the EC2 instance |
| placement\_group | List of placement group |
| public\_dns | List of public DNS names assigned to the instances |
| t2\_instance\_id | EC2 instance ID |
| tags | List of tags |
| vpc\_security\_group\_ids | List of VPC security group ids assigned to the instances |
......
......@@ -20,6 +20,7 @@ resource "aws_instance" "this" {
)
key_name = var.key_name
monitoring = var.monitoring
get_password_data = var.get_password_data
vpc_security_group_ids = var.vpc_security_group_ids
iam_instance_profile = var.iam_instance_profile
......@@ -105,6 +106,7 @@ resource "aws_instance" "this_t2" {
)
key_name = var.key_name
monitoring = var.monitoring
get_password_data = var.get_password_data
vpc_security_group_ids = var.vpc_security_group_ids
iam_instance_profile = var.iam_instance_profile
......
......@@ -14,6 +14,7 @@ locals {
this_credit_specification = flatten(aws_instance.this_t2.*.credit_specification)
this_tags = coalescelist(aws_instance.this.*.tags, aws_instance.this_t2.*.tags, [""])
this_volume_tags = coalescelist(aws_instance.this.*.volume_tags, aws_instance.this_t2.*.volume_tags, [""])
this_password_data = coalescelist(aws_instance.this.*.password_data, aws_instance.this_t2.*.password_data, [""])
}
output "id" {
......@@ -61,6 +62,11 @@ output "private_ip" {
value = local.this_private_ip
}
output "password_data" {
description = "List of Base-64 encoded encrypted password data for the instance"
value = local.this_password_data
}
output "security_groups" {
description = "List of associated security groups of instances"
value = local.this_security_groups
......
......@@ -20,6 +20,12 @@ variable "placement_group" {
default = ""
}
variable "get_password_data" {
description = "If true, wait for password data to become available and retrieve it."
type = bool
default = false
}
variable "tenancy" {
description = "The tenancy of the instance (if the instance is running in a VPC). Available values: default, dedicated, host."
type = string
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment