|
| 1 | +# Contributing to AWS ARC ECS |
| 2 | + |
| 3 | +Thank you for considering contributing to AWS ARC ECS! We appreciate your time and effort. |
| 4 | +To ensure a smooth collaboration, please take a moment to review the following guidelines. |
| 5 | + |
| 6 | +## How to Contribute |
| 7 | + |
| 8 | +1. Fork the repository to your own GitHub account. |
| 9 | +2. Clone the repository to your local machine. |
| 10 | + ```bash |
| 11 | + git clone https://github.com/<your_organization>/<your_terraform_module>.git |
| 12 | + ``` |
| 13 | +3. Create a new branch for your feature / bugfix. |
| 14 | + ```bash |
| 15 | + git checkout -b feature/branch_name |
| 16 | + ``` |
| 17 | +4. Make your changes and commit them. |
| 18 | + ```bash |
| 19 | + git commit -m "Your descriptive commit message" |
| 20 | + ``` |
| 21 | +5. Push to your forked repository. |
| 22 | + ```bash |
| 23 | + git push origin feature/branch_name |
| 24 | + ``` |
| 25 | +6. Open a pull request in the original repository with a clear title and description. |
| 26 | + If your pull request addresses an issue, please reference the issue number in the pull request description. |
| 27 | + |
| 28 | +### Git commits |
| 29 | + |
| 30 | +while Contributing or doing git commit please specify the breaking change in your commit message whether its major,minor or patch |
| 31 | + |
| 32 | +For Example |
| 33 | + |
| 34 | +```sh |
| 35 | +git commit -m "your commit message #major" |
| 36 | +``` |
| 37 | +By specifying this , it will bump the version and if you don't specify this in your commit message then by default it will consider patch and will bump that accordingly |
| 38 | + |
| 39 | +# Terraform Code Collaboration Guidelines |
| 40 | + |
| 41 | +## File Naming Conventions |
| 42 | + |
| 43 | +1. **Variables File (variables.tf):** |
| 44 | + - All variable names should be in snake_case. |
| 45 | + - Each variable declaration must contain: |
| 46 | + - Description: A brief explanation of the variable's purpose. |
| 47 | + - Type: The data type of the variable. |
| 48 | + |
| 49 | + Example: |
| 50 | + ```hcl |
| 51 | + variable "example_variable" { |
| 52 | + description = "This is an example variable." |
| 53 | + type = string |
| 54 | + } |
| 55 | + ``` |
| 56 | +
|
| 57 | +2. **Outputs File (outputs.tf):** |
| 58 | + - All output names should be in snake_case. |
| 59 | + - Each output declaration must contain: |
| 60 | + - Description: A brief explanation of the output's purpose. |
| 61 | + - Value: The value that will be exposed as the output. |
| 62 | +
|
| 63 | + Example: |
| 64 | + ```hcl |
| 65 | + output "example_output" { |
| 66 | + description = "This is an example output." |
| 67 | + value = module.example_module.example_attribute |
| 68 | + } |
| 69 | + ``` |
| 70 | +
|
| 71 | +## Resource and Module Naming |
| 72 | +
|
| 73 | +1. **Terraform Resources/Modules:** |
| 74 | + - Resource and module names should be in snake_case. |
| 75 | + - Choose descriptive names that reflect the purpose of the resource or module. |
| 76 | +
|
| 77 | + Example: |
| 78 | + ```hcl |
| 79 | + resource "aws_instance" "web_server" { |
| 80 | + // ... |
| 81 | + } |
| 82 | +
|
| 83 | + module "networking" { |
| 84 | + // ... |
| 85 | + } |
| 86 | + ``` |
| 87 | +
|
| 88 | +## General Guidelines |
| 89 | +
|
| 90 | +1. **Consistent Formatting:** |
| 91 | + - Follow consistent code formatting to enhance readability. |
| 92 | + - Use indentation and line breaks appropriately. |
| 93 | +
|
| 94 | +2. **Comments:** |
| 95 | + - Add comments to explain complex logic, decisions, or any non-trivial code. |
| 96 | + - Keep comments up-to-date with the code. |
| 97 | +
|
| 98 | +3. **Module Documentation:** |
| 99 | + - Include a README.md file within each module directory, explaining its purpose, inputs, and outputs. |
| 100 | + - Use inline documentation within the code for complex modules. |
| 101 | +
|
| 102 | +4. **Avoid Hardcoding:** |
| 103 | + - Minimize hardcoded values; prefer using variables and references for increased flexibility. |
| 104 | +
|
| 105 | +5. **Sensitive Information:** |
| 106 | + - Do not hardcode sensitive information (e.g., passwords, API keys). Use appropriate methods for securing sensitive data. |
| 107 | +
|
| 108 | +6. **Error Handling:** |
| 109 | + - Implement proper error handling and consider the impact of potential failures. |
| 110 | +
|
| 111 | +## Version Control |
| 112 | +
|
| 113 | +1. **Commit Messages:** |
| 114 | + - Use descriptive and concise commit messages that explain the purpose of the changes. |
| 115 | +
|
| 116 | +2. **Branching:** |
| 117 | + - Follow a branching strategy (e.g., feature branches) for better collaboration. |
| 118 | +
|
| 119 | +## Pre-commit Hooks |
| 120 | +
|
| 121 | +1. **Install `pre-commit`:** |
| 122 | + - Install `pre-commit` hooks to automatically check and enforce code formatting, linting, and other pre-defined rules before each commit. |
| 123 | +
|
| 124 | + Example: |
| 125 | + ```bash |
| 126 | + brew install pre-commit (for mac users) |
| 127 | + ``` |
| 128 | + ```bash |
| 129 | + pre-commit run -a |
| 130 | + ``` |
| 131 | +
|
| 132 | + This ensures that your code adheres to the defined standards before being committed, reducing the likelihood of introducing issues into the repository. |
| 133 | +
|
| 134 | +## Code Style |
| 135 | +
|
| 136 | +Please follow the Terraform language conventions and formatting guidelines. Consider using an editor with Terraform support or a linter to ensure adherence to the style. |
| 137 | +
|
| 138 | +## Testing |
| 139 | +
|
| 140 | +!!! This section is a work-in-progress, as we are starting to adopt testing using Terratest. !!! |
| 141 | +
|
| 142 | +Before submitting a pull request, ensure that your changes pass all tests. If applicable, add new tests to cover your changes. |
| 143 | +
|
| 144 | +## Documentation |
| 145 | +
|
| 146 | +Keep the module documentation up-to-date. If you add new features or change existing functionality, update the [README](README.md) and any relevant documentation files. |
| 147 | +
|
| 148 | +## Security and Compliance Checks |
| 149 | +
|
| 150 | +GitHub Actions are in place to perform security and compliance checks. Please make sure your changes pass these checks before submitting a pull request. |
| 151 | +
|
| 152 | +## Licensing |
| 153 | +
|
| 154 | +By contributing, you agree that your contributions will be licensed under the project's [LICENSE](LICENSE). |
0 commit comments