From 80761951d043734f31910f6aabb7f864ac422eeb Mon Sep 17 00:00:00 2001 From: Saravanan Gnanaguru Date: Tue, 31 Oct 2023 02:42:47 +0530 Subject: [PATCH] updated tf readme with tf-docs --- tfcloud_samples/amazon_ec2/TF_README.md | 25 ++++++++--- .../modules/aws_two_tier/TF_README.md | 45 +++++++++++++++++++ 2 files changed, 63 insertions(+), 7 deletions(-) create mode 100644 tfcloud_samples/modules/aws_two_tier/TF_README.md diff --git a/tfcloud_samples/amazon_ec2/TF_README.md b/tfcloud_samples/amazon_ec2/TF_README.md index c313c7e..17b53c8 100644 --- a/tfcloud_samples/amazon_ec2/TF_README.md +++ b/tfcloud_samples/amazon_ec2/TF_README.md @@ -1,20 +1,30 @@ +## Terraform Cloud Sample + +### How this works +- Terraform cloud runs the `terraform apply` run in Terraform Cloud workspace, since we have declared the terraform cloud as a remote backend in the code. +- We need to configure Terraform source code path in the `Settings > General` page for the given workspace in Terraform Cloud +- Change the Terraform Working Directory setting to specify the path of the config, relative to the relevant root directory - in this case: `tfcloud_samples/amazon_ec2` +- In case of variable override, add the variables into `variables` section in Teraform cloud workspace. Otherwise declare `*.auto.tfvars` file. + ## Requirements | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.14.9 | +| [terraform](#requirement\_terraform) | >= 1.0.0 | | [aws](#requirement\_aws) | ~> 3.27 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | 3.75.1 | +| [aws](#provider\_aws) | 3.76.1 | ## Modules -No modules. +| Name | Source | Version | +|------|--------|---------| +| [ec2\_instances](#module\_ec2\_instances) | ../modules/aws_two_tier | n/a | ## Resources @@ -26,11 +36,12 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [instance\_count](#input\_instance\_count) | n/a | `number` | `2` | no | -| [instance\_count\_needed](#input\_instance\_count\_needed) | n/a | `string` | `"true"` | no | -| [region](#input\_region) | n/a | `string` | `"us-west-2"` | no | +| [region](#input\_region) | Variables Block Common values used across the terraform code can be added as variables We can override the values using .tfvars files while running terraform plan/apply | `string` | `"us-west-2"` | no | ## Outputs -No outputs. +| Name | Description | +|------|-------------| +| [instance\_id](#output\_instance\_id) | ID of the EC2 instance(s) | +| [instance\_state](#output\_instance\_state) | State of the EC2 instance(s) | \ No newline at end of file diff --git a/tfcloud_samples/modules/aws_two_tier/TF_README.md b/tfcloud_samples/modules/aws_two_tier/TF_README.md new file mode 100644 index 0000000..14da3b1 --- /dev/null +++ b/tfcloud_samples/modules/aws_two_tier/TF_README.md @@ -0,0 +1,45 @@ + +## Requirements + +| Name | Version | +|------|---------| +| [aws](#requirement\_aws) | ~> 3.0 | + +## Providers + +| Name | Version | +|------|---------| +| [aws](#provider\_aws) | ~> 3.0 | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [aws_instance.web](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance) | resource | +| [aws_internet_gateway.igw](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/internet_gateway) | resource | +| [aws_route_table.public_rt](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table) | resource | +| [aws_route_table_association.public_rt_asso](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route_table_association) | resource | +| [aws_security_group.sg](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource | +| [aws_subnet.public_subnet](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/subnet) | resource | +| [aws_vpc.app_vpc](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [instance\_type](#input\_instance\_type) | n/a | `string` | `"t2.micro"` | no | +| [profile\_name](#input\_profile\_name) | n/a | `string` | `"default"` | no | +| [public\_subnet\_cidr](#input\_public\_subnet\_cidr) | n/a | `string` | `"178.0.10.0/24"` | no | +| [region](#input\_region) | n/a | `string` | `"us-west-2"` | no | +| [vpc\_cidr](#input\_vpc\_cidr) | variable "instance\_key" { default = "saravanan-ec2-key" } | `string` | `"178.0.0.0/16"` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [web\_instance\_ip](#output\_web\_instance\_ip) | n/a | + \ No newline at end of file