Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8cf45be

Browse files
committed
[#179688576] Add FQDN tag for instances
1 parent 1a0a8ff commit 8cf45be

File tree

4 files changed

+87
-58
lines changed

4 files changed

+87
-58
lines changed

‎.pre-commit-config.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
repos:
22
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.21.0
3+
rev: v1.62.3
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs
77
- repo: git://github.com/pre-commit/pre-commit-hooks
8-
rev: v2.4.0
8+
rev: v4.1.0
99
hooks:
1010
- id: check-merge-conflict

‎README.md‎

Lines changed: 76 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -92,70 +92,90 @@ data "aws_ami" "ubuntu-xenial" {
9292
* One of `subnet_id` or `subnet_ids` is required. If both are provided, the value of `subnet_id` is prepended to the value of `subnet_ids`.
9393

9494
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
95+
## Requirements
96+
97+
No requirements.
98+
99+
## Providers
100+
101+
| Name | Version |
102+
|------|---------|
103+
| <a name="provider_aws"></a> [aws](#provider\_aws) | n/a |
104+
105+
## Modules
106+
107+
No modules.
108+
109+
## Resources
110+
111+
| Name | Type |
112+
|------|------|
113+
| [aws_instance.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance) | resource |
114+
95115
## Inputs
96116

97117
| Name | Description | Type | Default | Required |
98-
|------|-------------|:----:|:-----:|:-----:|
99-
| ami | ID of AMI to use for the instance | string | n/a | yes |
100-
| associate\_public\_ip\_address | If true, the EC2 instance will have associated public IP address | bool | `"null"` | no |
101-
| cpu\_credits | The credit option for CPU usage \(unlimited or standard\) | string | `"standard"` | no |
102-
| disable\_api\_termination | If true, enables EC2 Instance Termination Protection | bool | `"false"` | no |
103-
| ebs\_block\_device | Additional EBS block devices to attach to the instance | list(map(string)) | `[]` | no |
104-
| ebs\_optimized | If true, the launched EC2 instance will be EBS-optimized | bool | `"false"` | no |
105-
| ephemeral\_block\_device | Customize Ephemeral \(also known as Instance Store\) volumes on the instance | list(map(string)) | `[]` | no |
106-
| get\_password\_data | If true, wait for password data to become available and retrieve it. | bool | `"false"` | no |
107-
| iam\_instance\_profile | The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. | string | `""` | no |
108-
| instance\_count | Number of instances to launch | number | `"1"` | no |
109-
| instance\_initiated\_shutdown\_behavior | Shutdown behavior for the instance | string | `""` | no |
110-
| instance\_type | The type of instance to start | string | n/a | yes |
111-
| 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 | `"null"` | no |
112-
| ipv6\_addresses | Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface | list(string) | `"null"` | no |
113-
| key\_name | The key name to use for the instance | string | `""` | no |
114-
| monitoring | If true, the launched EC2 instance will have detailed monitoring enabled | bool | `"false"` | no |
115-
| name | Name to be used on all resources as prefix | string | n/a | yes |
116-
| network\_interface | Customize network interfaces to be attached at instance boot time | list(map(string)) | `[]` | no |
117-
| placement\_group | The Placement Group to start the instance in | string | `""` | no |
118-
| private\_ip | Private IP address to associate with the instance in a VPC | string | `"null"` | no |
119-
| 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 |
120-
| root\_block\_device | Customize details about the root block device of the instance. See Block Devices below for details | list(map(string)) | `[]` | no |
121-
| 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 |
122-
| subnet\_id | The VPC Subnet ID to launch in | string | `""` | no |
123-
| subnet\_ids | A list of VPC Subnet IDs to launch in | list(string) | `[]` | no |
124-
| tags | A mapping of tags to assign to the resource | map(string) | `{}` | no |
125-
| tenancy | The tenancy of the instance \(if the instance is running in a VPC\). Available values: default, dedicated, host. | string | `"default"` | no |
126-
| use\_num\_suffix | Always append numerical suffix to instance name, even if instance\_count is 1 | bool | `"false"` | no |
127-
| user\_data | The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user\_data\_base64 instead. | string | `"null"` | no |
128-
| user\_data\_base64 | Can be used instead of user\_data to pass base64-encoded binary data directly. Use this instead of user\_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption. | string | `"null"` | no |
129-
| volume\_tags | A mapping of tags to assign to the devices created by the instance at launch time | map(string) | `{}` | no |
130-
| vpc\_security\_group\_ids | A list of security group IDs to associate with | list(string) | `"null"` | no |
118+
|------|-------------|------|---------|:--------:|
119+
| <a name="input_ami"></a> [ami](#input\_ami) | ID of AMI to use for the instance | `string` | n/a | yes |
120+
| <a name="input_associate_public_ip_address"></a> [associate\_public\_ip\_address](#input\_associate\_public\_ip\_address) | If true, the EC2 instance will have associated public IP address | `bool` | `null` | no |
121+
| <a name="input_cpu_credits"></a> [cpu\_credits](#input\_cpu\_credits) | The credit option for CPU usage (unlimited or standard) | `string` | `"standard"` | no |
122+
| <a name="input_disable_api_termination"></a> [disable\_api\_termination](#input\_disable\_api\_termination) | If true, enables EC2 Instance Termination Protection | `bool` | `false` | no |
123+
| <a name="input_ebs_block_device"></a> [ebs\_block\_device](#input\_ebs\_block\_device) | Additional EBS block devices to attach to the instance | `list(map(string))` | `[]` | no |
124+
| <a name="input_ebs_optimized"></a> [ebs\_optimized](#input\_ebs\_optimized) | If true, the launched EC2 instance will be EBS-optimized | `bool` | `false` | no |
125+
| <a name="input_ephemeral_block_device"></a> [ephemeral\_block\_device](#input\_ephemeral\_block\_device) | Customize Ephemeral (also known as Instance Store) volumes on the instance | `list(map(string))` | `[]` | no |
126+
| <a name="input_fqdn"></a> [fqdn](#input\_fqdn) | Value for FQDN instance tag with fully qualified domain name | `string` | `""` | no |
127+
| <a name="input_get_password_data"></a> [get\_password\_data](#input\_get\_password\_data) | If true, wait for password data to become available and retrieve it. | `bool` | `false` | no |
128+
| <a name="input_iam_instance_profile"></a> [iam\_instance\_profile](#input\_iam\_instance\_profile) | The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. | `string` | `""` | no |
129+
| <a name="input_instance_count"></a> [instance\_count](#input\_instance\_count) | Number of instances to launch | `number` | `1` | no |
130+
| <a name="input_instance_initiated_shutdown_behavior"></a> [instance\_initiated\_shutdown\_behavior](#input\_instance\_initiated\_shutdown\_behavior) | Shutdown behavior for the instance | `string` | `""` | no |
131+
| <a name="input_instance_type"></a> [instance\_type](#input\_instance\_type) | The type of instance to start | `string` | n/a | yes |
132+
| <a name="input_ipv6_address_count"></a> [ipv6\_address\_count](#input\_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` | `null` | no |
133+
| <a name="input_ipv6_addresses"></a> [ipv6\_addresses](#input\_ipv6\_addresses) | Specify one or more IPv6 addresses from the range of the subnet to associate with the primary network interface | `list(string)` | `null` | no |
134+
| <a name="input_key_name"></a> [key\_name](#input\_key\_name) | The key name to use for the instance | `string` | `""` | no |
135+
| <a name="input_monitoring"></a> [monitoring](#input\_monitoring) | If true, the launched EC2 instance will have detailed monitoring enabled | `bool` | `false` | no |
136+
| <a name="input_name"></a> [name](#input\_name) | Name to be used on all resources as prefix | `string` | n/a | yes |
137+
| <a name="input_network_interface"></a> [network\_interface](#input\_network\_interface) | Customize network interfaces to be attached at instance boot time | `list(map(string))` | `[]` | no |
138+
| <a name="input_placement_group"></a> [placement\_group](#input\_placement\_group) | The Placement Group to start the instance in | `string` | `""` | no |
139+
| <a name="input_private_ip"></a> [private\_ip](#input\_private\_ip) | Private IP address to associate with the instance in a VPC | `string` | `null` | no |
140+
| <a name="input_private_ips"></a> [private\_ips](#input\_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 |
141+
| <a name="input_root_block_device"></a> [root\_block\_device](#input\_root\_block\_device) | Customize details about the root block device of the instance. See Block Devices below for details | `list(map(string))` | `[]` | no |
142+
| <a name="input_source_dest_check"></a> [source\_dest\_check](#input\_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 |
143+
| <a name="input_subnet_id"></a> [subnet\_id](#input\_subnet\_id) | The VPC Subnet ID to launch in | `string` | `""` | no |
144+
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | A list of VPC Subnet IDs to launch in | `list(string)` | `[]` | no |
145+
| <a name="input_tags"></a> [tags](#input\_tags) | A mapping of tags to assign to the resource | `map(string)` | `{}` | no |
146+
| <a name="input_tenancy"></a> [tenancy](#input\_tenancy) | The tenancy of the instance (if the instance is running in a VPC). Available values: default, dedicated, host. | `string` | `"default"` | no |
147+
| <a name="input_use_num_suffix"></a> [use\_num\_suffix](#input\_use\_num\_suffix) | Always append numerical suffix to instance name, even if instance\_count is 1 | `bool` | `false` | no |
148+
| <a name="input_user_data"></a> [user\_data](#input\_user\_data) | The user data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see user\_data\_base64 instead. | `string` | `null` | no |
149+
| <a name="input_user_data_base64"></a> [user\_data\_base64](#input\_user\_data\_base64) | Can be used instead of user\_data to pass base64-encoded binary data directly. Use this instead of user\_data whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption. | `string` | `null` | no |
150+
| <a name="input_volume_tags"></a> [volume\_tags](#input\_volume\_tags) | A mapping of tags to assign to the devices created by the instance at launch time | `map(string)` | `{}` | no |
151+
| <a name="input_vpc_security_group_ids"></a> [vpc\_security\_group\_ids](#input\_vpc\_security\_group\_ids) | A list of security group IDs to associate with | `list(string)` | `null` | no |
131152

132153
## Outputs
133154

134155
| Name | Description |
135156
|------|-------------|
136-
| arn | List of ARNs of instances |
137-
| availability\_zone | List of availability zones of instances |
138-
| credit\_specification | List of credit specification of instances |
139-
| ebs\_block\_device\_volume\_ids | List of volume IDs of EBS block devices of instances |
140-
| id | List of IDs of instances |
141-
| instance\_count | Number of instances to launch specified as argument to this module |
142-
| instance\_state | List of instance states of instances |
143-
| ipv6\_addresses | List of assigned IPv6 addresses of instances |
144-
| key\_name | List of key names of instances |
145-
| password\_data | List of Base-64 encoded encrypted password data for the instance |
146-
| placement\_group | List of placement groups of instances |
147-
| primary\_network\_interface\_id | List of IDs of the primary network interface of instances |
148-
| 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 |
149-
| private\_ip | List of private IP addresses assigned to the instances |
150-
| public\_dns | List of public DNS names assigned to the instances. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC |
151-
| public\_ip | List of public IP addresses assigned to the instances, if applicable |
152-
| root\_block\_device\_volume\_ids | List of volume IDs of root block devices of instances |
153-
| security\_groups | List of associated security groups of instances |
154-
| subnet\_id | List of IDs of VPC subnets of instances |
155-
| tags | List of tags of instances |
156-
| volume\_tags | List of tags of volumes of instances |
157-
| vpc\_security\_group\_ids | List of associated security groups of instances, if running in non-default VPC |
158-
157+
| <a name="output_arn"></a> [arn](#output\_arn) | List of ARNs of instances |
158+
| <a name="output_availability_zone"></a> [availability\_zone](#output\_availability\_zone) | List of availability zones of instances |
159+
| <a name="output_credit_specification"></a> [credit\_specification](#output\_credit\_specification) | List of credit specification of instances |
160+
| <a name="output_ebs_block_device_volume_ids"></a> [ebs\_block\_device\_volume\_ids](#output\_ebs\_block\_device\_volume\_ids) | List of volume IDs of EBS block devices of instances |
161+
| <a name="output_id"></a> [id](#output\_id) | List of IDs of instances |
162+
| <a name="output_instance_count"></a> [instance\_count](#output\_instance\_count) | Number of instances to launch specified as argument to this module |
163+
| <a name="output_instance_state"></a> [instance\_state](#output\_instance\_state) | List of instance states of instances |
164+
| <a name="output_ipv6_addresses"></a> [ipv6\_addresses](#output\_ipv6\_addresses) | List of assigned IPv6 addresses of instances |
165+
| <a name="output_key_name"></a> [key\_name](#output\_key\_name) | List of key names of instances |
166+
| <a name="output_password_data"></a> [password\_data](#output\_password\_data) | List of Base-64 encoded encrypted password data for the instance |
167+
| <a name="output_placement_group"></a> [placement\_group](#output\_placement\_group) | List of placement groups of instances |
168+
| <a name="output_primary_network_interface_id"></a> [primary\_network\_interface\_id](#output\_primary\_network\_interface\_id) | List of IDs of the primary network interface of instances |
169+
| <a name="output_private_dns"></a> [private\_dns](#output\_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 |
170+
| <a name="output_private_ip"></a> [private\_ip](#output\_private\_ip) | List of private IP addresses assigned to the instances |
171+
| <a name="output_public_dns"></a> [public\_dns](#output\_public\_dns) | List of public DNS names assigned to the instances. For EC2-VPC, this is only available if you've enabled DNS hostnames for your VPC |
172+
| <a name="output_public_ip"></a> [public\_ip](#output\_public\_ip) | List of public IP addresses assigned to the instances, if applicable |
173+
| <a name="output_root_block_device_volume_ids"></a> [root\_block\_device\_volume\_ids](#output\_root\_block\_device\_volume\_ids) | List of volume IDs of root block devices of instances |
174+
| <a name="output_security_groups"></a> [security\_groups](#output\_security\_groups) | List of associated security groups of instances |
175+
| <a name="output_subnet_id"></a> [subnet\_id](#output\_subnet\_id) | List of IDs of VPC subnets of instances |
176+
| <a name="output_tags"></a> [tags](#output\_tags) | List of tags of instances |
177+
| <a name="output_volume_tags"></a> [volume\_tags](#output\_volume\_tags) | List of tags of volumes of instances |
178+
| <a name="output_vpc_security_group_ids"></a> [vpc\_security\_group\_ids](#output\_vpc\_security\_group\_ids) | List of associated security groups of instances, if running in non-default VPC |
159179
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
160180

161181
## Authors

‎main.tf‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ resource "aws_instance" "this" {
8080
{
8181
"Name" = var.instance_count > 1 || var.use_num_suffix ? format("%s-%d", var.name, count.index + 1) : var.name
8282
},
83+
{
84+
"FQDN" = var.instance_count > 1 || var.use_num_suffix ? format(var.fqdn, count.index + 1) : var.fqdn
85+
},
8386
var.tags,
8487
)
8588

‎variables.tf‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ variable "name" {
33
type = string
44
}
55

6+
variable "fqdn" {
7+
description = "Value for FQDN instance tag with fully qualified domain name"
8+
type = string
9+
default = ""
10+
}
11+
612
variable "instance_count" {
713
description = "Number of instances to launch"
814
type = number

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /