Commit e6d2f70e authored by Anton Babenko's avatar Anton Babenko Committed by GitHub

Tags should be possible to override (fixed #53) (#66)

parent b9a4c558
...@@ -86,57 +86,56 @@ data "aws_ami" "ubuntu-xenial" { ...@@ -86,57 +86,56 @@ data "aws_ami" "ubuntu-xenial" {
* Changes in `ebs_block_device` argument will be ignored. Use [aws_volume_attachment](https://www.terraform.io/docs/providers/aws/r/volume_attachment.html) resource to attach and detach volumes from AWS EC2 instances. See [this example](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/examples/volume-attachment). * Changes in `ebs_block_device` argument will be ignored. Use [aws_volume_attachment](https://www.terraform.io/docs/providers/aws/r/volume_attachment.html) resource to attach and detach volumes from AWS EC2 instances. See [this example](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/examples/volume-attachment).
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs ## Inputs
| Name | Description | Type | Default | Required | | Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:| |------|-------------|:----:|:-----:|:-----:|
| ami | ID of AMI to use for the instance | string | - | yes | | 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 | string | `"false"` | no |
| cpu_credits | The credit option for CPU usage (unlimited or standard) | string | `standard` | 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 | | 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 | string | `<list>` | 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 | | 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 | string | `<list>` | no | | ephemeral\_block\_device | Customize Ephemeral (also known as Instance Store) volumes on the instance | list | `<list>` | no |
| iam_instance_profile | The IAM Instance Profile to launch the instance with. Specified as the name of the Instance Profile. | string | `` | 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 | string | `"1"` | no |
| instance_initiated_shutdown_behavior | Shutdown behavior for the instance | string | `` | no | | instance\_initiated\_shutdown\_behavior | Shutdown behavior for the instance | string | `""` | no |
| instance_type | The type of instance to start | string | - | yes | | 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\_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 | string | `<list>` | 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 |
| key_name | The key name to use for the instance | 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 | string | `"false"` | no |
| name | Name to be used on all resources as prefix | string | - | yes | | 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 | string | `<list>` | no | | network\_interface | Customize network interfaces to be attached at instance boot time | list | `<list>` | no |
| placement_group | The Placement Group to start the instance in | 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 | | 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 | string | `<list>` | 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 | | 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 |
| subnet_id | The VPC Subnet ID to launch in | string | - | yes | | subnet\_id | The VPC Subnet ID to launch in | string | n/a | yes |
| tags | A mapping of tags to assign to the resource | string | `<map>` | no | | tags | A mapping of tags to assign to the resource | map | `<map>` | no |
| tenancy | The tenancy of the instance (if the instance is running in a VPC). Available values: default, dedicated, host. | string | `default` | no | | tenancy | The tenancy of the instance (if the instance is running in a VPC). Available values: default, dedicated, host. | string | `"default"` | no |
| user_data | The user data to provide when launching the instance | string | `` | 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 | string | `<map>` | 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 | - | yes | | vpc\_security\_group\_ids | A list of security group IDs to associate with | list | n/a | yes |
## Outputs ## Outputs
| Name | Description | | Name | Description |
|------|-------------| |------|-------------|
| availability_zone | List of availability zones of instances | | availability\_zone | List of availability zones of instances |
| credit_specification | List of credit specification of instances | | credit\_specification | List of credit specification of instances |
| id | List of IDs of instances | | id | List of IDs of instances |
| key_name | List of key names of instances | | key\_name | List of key names of instances |
| network_interface_id | List of IDs of the network interface of instances | | network\_interface\_id | List of IDs of the network interface of instances |
| primary_network_interface_id | List of IDs of the primary network interface 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 | | 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 |
| private_ip | List of private IP addresses assigned to the instances | | private\_ip | List of private IP addresses assigned to the instances |
| 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 | | 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 |
| public_ip | List of public IP addresses assigned to the instances, if applicable | | public\_ip | List of public IP addresses assigned to the instances, if applicable |
| security_groups | List of associated security groups of instances | | security\_groups | List of associated security groups of instances |
| subnet_id | List of IDs of VPC subnets of instances | | subnet\_id | List of IDs of VPC subnets of instances |
| tags | List of tags of instances | | tags | List of tags of instances |
| vpc_security_group_ids | List of associated security groups of instances, if running in non-default VPC | | vpc\_security\_group\_ids | List of associated security groups of instances, if running in non-default VPC |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
......
...@@ -19,19 +19,18 @@ $ terraform apply ...@@ -19,19 +19,18 @@ $ terraform apply
Note that this example may create resources which can cost money. Run `terraform destroy` when you don't need these resources. Note that this example may create resources which can cost money. Run `terraform destroy` when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Outputs ## Outputs
| Name | Description | | Name | Description |
|------|-------------| |------|-------------|
| credit_specification | Credit specification of EC2 instance (empty list for not t2 instance types) | | credit\_specification | Credit specification of EC2 instance (empty list for not t2 instance types) |
| credit_specification_t2_unlimited | Credit specification of t2-type EC2 instance | | credit\_specification\_t2\_unlimited | Credit specification of t2-type EC2 instance |
| ids | List of IDs of instances | | ids | List of IDs of instances |
| ids_t2 | List of IDs of t2-type instances | | ids\_t2 | List of IDs of t2-type instances |
| instance_id | EC2 instance ID | | instance\_id | EC2 instance ID |
| instance_public_dns | Public DNS name assigned to the EC2 instance | | instance\_public\_dns | Public DNS name assigned to the EC2 instance |
| public_dns | List of public DNS names assigned to the instances | | public\_dns | List of public DNS names assigned to the instances |
| tags | List of tags | | tags | List of tags |
| vpc_security_group_ids | List of VPC security group ids assigned to the instances | | vpc\_security\_group\_ids | List of VPC security group ids assigned to the instances |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
...@@ -34,8 +34,8 @@ data "aws_ami" "amazon_linux" { ...@@ -34,8 +34,8 @@ data "aws_ami" "amazon_linux" {
} }
module "security_group" { module "security_group" {
source = "terraform-aws-modules/security-group/aws" source = "terraform-aws-modules/security-group/aws"
version = "2.7.0" version = "2.7.0"
name = "example" name = "example"
description = "Security group for example usage with EC2 instance" description = "Security group for example usage with EC2 instance"
......
...@@ -19,14 +19,13 @@ $ terraform apply ...@@ -19,14 +19,13 @@ $ terraform apply
Note that this example may create resources which can cost money. Run `terraform destroy` when you don't need these resources. Note that this example may create resources which can cost money. Run `terraform destroy` when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Outputs ## Outputs
| Name | Description | | Name | Description |
|------|-------------| |------|-------------|
| ebs_volume_attachment_id | The volume ID | | ebs\_volume\_attachment\_id | The volume ID |
| ebs_volume_attachment_instance_id | The instance ID | | ebs\_volume\_attachment\_instance\_id | The instance ID |
| instance_id | EC2 instance ID | | instance\_id | EC2 instance ID |
| instance_public_dns | Public DNS name assigned to the EC2 instance | | instance\_public\_dns | Public DNS name assigned to the EC2 instance |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
...@@ -34,8 +34,8 @@ data "aws_ami" "amazon_linux" { ...@@ -34,8 +34,8 @@ data "aws_ami" "amazon_linux" {
} }
module "security_group" { module "security_group" {
source = "terraform-aws-modules/security-group/aws" source = "terraform-aws-modules/security-group/aws"
version = "2.7.0" version = "2.7.0"
name = "example" name = "example"
description = "Security group for example usage with EC2 instance" description = "Security group for example usage with EC2 instance"
......
...@@ -34,7 +34,7 @@ resource "aws_instance" "this" { ...@@ -34,7 +34,7 @@ resource "aws_instance" "this" {
placement_group = "${var.placement_group}" placement_group = "${var.placement_group}"
tenancy = "${var.tenancy}" tenancy = "${var.tenancy}"
tags = "${merge(var.tags, map("Name", var.instance_count > 1 ? format("%s-%d", var.name, count.index+1) : var.name))}" tags = "${merge(map("Name", var.instance_count > 1 ? format("%s-%d", var.name, count.index+1) : var.name), var.tags)}"
lifecycle { lifecycle {
# Due to several known issues in Terraform AWS provider related to arguments of aws_instance: # Due to several known issues in Terraform AWS provider related to arguments of aws_instance:
...@@ -77,7 +77,7 @@ resource "aws_instance" "this_t2" { ...@@ -77,7 +77,7 @@ resource "aws_instance" "this_t2" {
cpu_credits = "${var.cpu_credits}" cpu_credits = "${var.cpu_credits}"
} }
tags = "${merge(var.tags, map("Name", var.instance_count > 1 ? format("%s-%d", var.name, count.index+1) : var.name))}" tags = "${merge(map("Name", var.instance_count > 1 ? format("%s-%d", var.name, count.index+1) : var.name), var.tags)}"
lifecycle { lifecycle {
# Due to several known issues in Terraform AWS provider related to arguments of aws_instance: # Due to several known issues in Terraform AWS provider related to arguments of aws_instance:
......
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