From 0a6a75047d2e82d47a3730bd5bfba7acbf89146c Mon Sep 17 00:00:00 2001 From: Anton Babenko Date: Wed, 16 May 2018 20:38:49 +0200 Subject: [PATCH] Added pre-commit hook to autogenerate terraform-docs --- .pre-commit-config.yaml | 5 +-- README.md | 71 +++++++++++++++++++++++++++++++++------- examples/basic/README.md | 19 ++++++++--- 3 files changed, 77 insertions(+), 18 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 974e1339..8189a755 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,10 @@ repos: - repo: git://github.com/antonbabenko/pre-commit-terraform - sha: v1.5.0 + rev: v1.7.0 hooks: - id: terraform_fmt + - id: terraform_docs - repo: git://github.com/pre-commit/pre-commit-hooks - sha: v1.2.0 + rev: v1.2.3 hooks: - id: check-merge-conflict diff --git a/README.md b/README.md index a36d13f8..e34b1b04 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -AWS EC2 Instance Terraform module -================================= +# AWS EC2 Instance Terraform module Terraform module which creates EC2 instance(s) on AWS. @@ -7,8 +6,7 @@ These types of resources are supported: * [EC2 instance](https://www.terraform.io/docs/providers/aws/r/instance.html) -Usage ------ +## Usage ```hcl module "ec2_cluster" { @@ -31,23 +29,72 @@ module "ec2_cluster" { } ``` -Examples --------- +## Examples * [Basic EC2 instance](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/tree/master/examples/basic) -Limitations ------------ +## Limitations * `network_interface` can't be specified together with `associate_public_ip_address`, which makes `network_interface` not configurable using this module at the moment -Authors -------- + + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|:----:|:-----:|:-----:| +| ami | ID of AMI to use for the instance | string | - | yes | +| associate_public_ip_address | If true, the EC2 instance will have associated public IP address | 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 | `` | 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 | `` | 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_initiated_shutdown_behavior | Shutdown behavior for the instance | string | `` | no | +| instance_type | The type of instance to start | string | - | 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 | 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 | +| name | Name to be used on all resources as prefix | string | - | yes | +| network_interface | Customize network interfaces to be attached at instance boot time | 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 | 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. | string | `true` | no | +| subnet_id | The VPC Subnet ID to launch in | string | - | yes | +| tags | A mapping of tags to assign to the resource | string | `` | 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 | +| volume_tags | A mapping of tags to assign to the devices created by the instance at launch time | string | `` | no | +| vpc_security_group_ids | A list of security group IDs to associate with | list | - | yes | + +## Outputs + +| Name | Description | +|------|-------------| +| availability_zone | List of availability zones of instances | +| id | List of IDs of instances | +| key_name | List of key names 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 | +| 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 | +| 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 | +| security_groups | List of associated security groups of instances | +| subnet_id | List of IDs of VPC subnets 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 | + + + +## Authors Module managed by [Anton Babenko](https://github.com/antonbabenko). -License -------- +## License Apache 2 Licensed. See LICENSE for full details. diff --git a/examples/basic/README.md b/examples/basic/README.md index 97bb2531..afb3c61d 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -1,5 +1,4 @@ -Basic EC2 instance -================== +# Basic EC2 instance Configuration in this directory creates single EC2 instance with minimum set of arguments: AMI ID and instance type. It will also assign Elastic IP (EIP) to an instance. @@ -7,8 +6,7 @@ Unspecified arguments for security group id and subnet are inherited from the de This example outputs instance id and public DNS name as a single value and as a list. -Usage -===== +## Usage To run this example you need to execute: @@ -19,3 +17,16 @@ $ terraform apply ``` Note that this example may create resources which can cost money. Run `terraform destroy` when you don't need these resources. + + + +## Outputs + +| Name | Description | +|------|-------------| +| id | List of IDs of instances | +| instance_id | EC2 instance ID | +| instance_public_dns | Public DNS name assigned to the EC2 instance | +| public_dns | List of public DNS names assigned to the instances | + +