|
1 |
| -# Terraform Module Template |
| 1 | +# terraform-aws-security-group |
2 | 2 |
|
3 |
| -This repository serves as a template for creating Terraform modules. It provides a structured approach to organizing and maintaining Terraform code, along with examples and best practices. |
| 3 | +Terraform module to create security groups and rules |
4 | 4 |
|
5 |
| -## Table of Contents |
| 5 | +## Requirements |
6 | 6 |
|
7 |
| -- [Prerequisites](#prerequisites) |
8 |
| -- [Usage](#usage) |
9 |
| -- [Examples](#examples) |
10 |
| -- [Module Structure](#module-structure) |
| 7 | +| Name | Version | |
| 8 | +|------|---------| |
| 9 | +| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.8.4 | |
| 10 | +| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.51.0 | |
11 | 11 |
|
12 |
| -## Prerequisites |
| 12 | +## Providers |
13 | 13 |
|
14 |
| -Before you begin, ensure you have met the following requirements: |
| 14 | +| Name | Version | |
| 15 | +|------|---------| |
| 16 | +| <a name="provider_aws"></a> [aws](#provider\_aws) | 5.59.0 | |
15 | 17 |
|
16 |
| -1. [install terraform](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli) |
17 |
| -2. [install pre-commit](https://pre-commit.com/#install) |
18 |
| -3. configure pre-commit: `pre-commit install` |
19 |
| -4. install required tools |
20 |
| - - [tflint](https://github.com/terraform-linters/tflint) |
21 |
| - - [terraform-docs](https://github.com/terraform-docs/terraform-docs) |
| 18 | +## Modules |
22 | 19 |
|
23 |
| -## Usage |
| 20 | +No modules. |
24 | 21 |
|
25 |
| -To use this template, clone the repository and customize it according to your module's requirements. Below is a quick start guide: |
| 22 | +## Resources |
26 | 23 |
|
27 |
| -1. **Clone the repository:** |
| 24 | +| Name | Type | |
| 25 | +|------|------| |
| 26 | +| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource | |
| 27 | +| [aws_vpc.default](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/vpc) | data source | |
28 | 28 |
|
29 |
| - ```sh |
30 |
| - git clone https://github.com/your-username/terraform-module-template.git |
31 |
| - cd terraform-module-template |
32 |
| - ``` |
33 |
| -2. **Customize the module:** |
| 29 | +## Inputs |
34 | 30 |
|
35 |
| - - Update `main.tf`, `variables.tf`, `outputs.tf`, and `versions.tf` files as needed. |
36 |
| - - Add your own resources and logic. |
37 |
| -3. **Run Terraform commands:** |
| 31 | +| Name | Description | Type | Default | Required | |
| 32 | +|------|-------------|------|---------|:--------:| |
| 33 | +| <a name="input_description"></a> [description](#input\_description) | (Optional, Forces new resource) Security group description. | `string` | `"Managed by Terraform"` | no | |
| 34 | +| <a name="input_name"></a> [name](#input\_name) | (Optional, Forces new resource) Name of the security group. | `string` | n/a | yes | |
| 35 | +| <a name="input_tags"></a> [tags](#input\_tags) | (Optional) Map of tags to assign to the resource. | `map(string)` | `{}` | no | |
| 36 | +| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | (Optional, Forces new resource) VPC ID. | `string` | `null` | no | |
38 | 37 |
|
39 |
| - ```sh |
40 |
| - terraform init |
41 |
| - terraform plan |
42 |
| - terraform apply |
43 |
| - ``` |
| 38 | +## Outputs |
44 | 39 |
|
45 |
| -## Examples |
46 |
| - |
47 |
| -This repository includes example configurations to help you understand how to use the module: |
48 |
| - |
49 |
| -- **Complete Example:** Located in `examples/complete` |
50 |
| - |
51 |
| - - Demonstrates a full-featured usage of the module. |
52 |
| - |
53 |
| - ```sh |
54 |
| - cd examples/complete |
55 |
| - terraform init |
56 |
| - terraform apply |
57 |
| - ``` |
58 |
| -- **Minimal Example:** Located in `examples/minimal` |
59 |
| - |
60 |
| - - Shows a minimal configuration for using the module. |
61 |
| - |
62 |
| - ```sh |
63 |
| - cd examples/minimal |
64 |
| - terraform init |
65 |
| - terraform apply |
66 |
| - ``` |
67 |
| - |
68 |
| -## Module Structure |
69 |
| - |
70 |
| -The repository is organized as follows: |
71 |
| - |
72 |
| -```plaintext |
73 |
| -. |
74 |
| -├── .editorconfig |
75 |
| -├── examples |
76 |
| -│ ├── complete |
77 |
| -│ │ ├── main.tf |
78 |
| -│ │ ├── outputs.tf |
79 |
| -│ │ ├── provider.tf |
80 |
| -│ │ ├── README.md |
81 |
| -│ │ ├── variables.tf |
82 |
| -│ │ └── versions.tf |
83 |
| -│ └── minimal |
84 |
| -│ ├── main.tf |
85 |
| -│ ├── outputs.tf |
86 |
| -│ ├── provider.tf |
87 |
| -│ ├── README.md |
88 |
| -│ ├── variables.tf |
89 |
| -│ └── versions.tf |
90 |
| -├── .github |
91 |
| -│ └── workflows |
92 |
| -│ ├── documentation.yaml |
93 |
| -│ ├── pre-commit.yaml |
94 |
| -│ └── pr-title.yaml |
95 |
| -├── .gitignore |
96 |
| -├── main.tf |
97 |
| -├── modules |
98 |
| -│ └── sample-resource |
99 |
| -│ ├── main.tf |
100 |
| -│ ├── outputs.tf |
101 |
| -│ ├── variables.tf |
102 |
| -│ └── version.tf |
103 |
| -├── outputs.tf |
104 |
| -├── .pre-commit-config.yaml |
105 |
| -├── README.md |
106 |
| -├── .terraform-docs.yml |
107 |
| -├── tests |
108 |
| -│ ├── examples_minimal.tftest.hcl |
109 |
| -│ └── unit_tests.tftest.hcl |
110 |
| -├── .tflint.hcl |
111 |
| -├── variables.tf |
112 |
| -└── versions.tf |
113 |
| -``` |
114 |
| - |
115 |
| -## Reference [Getoutline](https://infraspec.getoutline.com/doc/terraform-Xkko7xHwM5) Document for Conventions to follow in your module |
| 40 | +| Name | Description | |
| 41 | +|------|-------------| |
| 42 | +| <a name="output_security_group_arn"></a> [security\_group\_arn](#output\_security\_group\_arn) | The ARN of the security group | |
| 43 | +| <a name="output_security_group_id"></a> [security\_group\_id](#output\_security\_group\_id) | The ID of the security group | |
0 commit comments