-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added contributing file and module usage guide
- Loading branch information
1 parent
1720cb6
commit e8193f7
Showing
3 changed files
with
285 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
# Contributing to AWS Cloudfront | ||
Thank you for considering contributing to AWS Cloudfront! We appreciate your time and effort. | ||
To ensure a smooth collaboration, please take a moment to review the following guidelines. | ||
|
||
## How to Contribute | ||
1. Fork the repository to your own GitHub account. | ||
2. Clone the repository to your local machine. | ||
```bash | ||
git clone https://github.com/<your_organization>/<your_terraform_module>.git | ||
``` | ||
3. Create a new branch for your feature / bugfix. | ||
```bash | ||
git checkout -b feature/branch_name | ||
|
||
4. Make your changes and commit them. | ||
```bash | ||
git commit -m "Your descriptive commit message" | ||
5. Install pre commit | ||
```bash | ||
pre-commit install | ||
``` | ||
|
||
6. Run pre-commit checks | ||
```bash | ||
pre-commit run --all-files | ||
|
||
7. Push to your forked repository. | ||
```bash | ||
git push origin feature/branch_name | ||
``` | ||
8. Open a pull request in the original repository with a clear title and description. | ||
If your pull request addresses an issue, please reference the issue number in the pull request description. | ||
|
||
## Git commits | ||
while Contributing or doing git commit please specify the breaking change in your commit message whether its major,minor or patch | ||
|
||
For Example | ||
|
||
```sh | ||
git commit -m "your commit message #major" | ||
``` | ||
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 | ||
# Terraform Code Collaboration Guidelines | ||
## File Naming Conventions | ||
1. **Variables File (variables.tf):** | ||
- All variable names should be in snake_case. | ||
- Each variable declaration must contain: | ||
- Description: A brief explanation of the variable's purpose. | ||
- Type: The data type of the variable. | ||
|
||
Example: | ||
```hcl | ||
variable "example_variable" { | ||
description = "This is an example variable." | ||
type = string | ||
} | ||
``` | ||
|
||
2. **Outputs File (outputs.tf):** | ||
- All output names should be in snake_case. | ||
- Each output declaration must contain: | ||
- Description: A brief explanation of the output's purpose. | ||
- Value: The value that will be exposed as the output. | ||
Example: | ||
```hcl | ||
output "example_output" { | ||
description = "This is an example output." | ||
value = module.example_module.example_attribute | ||
} | ||
``` | ||
## Resource and Module Naming | ||
1. **Terraform Resources/Modules:** | ||
- Resource and module names should be in snake_case. | ||
- Choose descriptive names that reflect the purpose of the resource or module. | ||
Example: | ||
```hcl | ||
resource "aws_instance" "web_server" { | ||
// ... | ||
} | ||
module "cloudfront" { | ||
// ... | ||
} | ||
``` | ||
## General Guidelines | ||
1. **Consistent Formatting:** | ||
- Follow consistent code formatting to enhance readability. | ||
- Use indentation and line breaks appropriately. | ||
2. **Comments:** | ||
- Add comments to explain complex logic, decisions, or any non-trivial code. | ||
- Keep comments up-to-date with the code. | ||
3. **Module Documentation:** | ||
- Include a README.md file within each module directory, explaining its purpose, inputs, and outputs. | ||
- Use inline documentation within the code for complex modules. | ||
4. **Avoid Hardcoding:** | ||
- Minimize hardcoded values; prefer using variables and references for increased flexibility. | ||
5. **Sensitive Information:** | ||
- Do not hardcode sensitive information (e.g., passwords, API keys). Use appropriate methods for securing sensitive data. | ||
6. **Error Handling:** | ||
- Implement proper error handling and consider the impact of potential failures. | ||
## Version Control | ||
1. **Commit Messages:** | ||
- Use descriptive and concise commit messages that explain the purpose of the changes. | ||
2. **Branching:** | ||
- Follow a branching strategy (e.g., feature branches) for better collaboration. | ||
## Code Style | ||
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. | ||
## Testing | ||
!!! This section is a work-in-progress, as we are starting to adopt testing using Terratest. !!! | ||
Before submitting a pull request, ensure that your changes pass all tests. If applicable, add new tests to cover your changes. | ||
## Documentation | ||
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. | ||
## Security and Compliance Checks | ||
GitHub Actions are in place to perform security and compliance checks. Please make sure your changes pass these checks before submitting a pull request. | ||
## Licensing | ||
By contributing, you agree that your contributions will be licensed under the project's [LICENSE](LICENSE). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# Terraform AWS ARC Cloudfront Module Usage Guide | ||
|
||
## Introduction | ||
|
||
### Purpose of the Document | ||
|
||
This document provides guidelines and instructions for users looking to implement Terraform module for managing Cloudfront, S3, Route53 and ACM | ||
|
||
### Module Overview | ||
|
||
The [terraform-aws-arc-cloudfront](https://github.com/sourcefuse/terraform-aws-arc-cloudfront) module provides a secure and modular foundation for managing Cloudfront, S3, Route53 and ACM | ||
|
||
### Prerequisites | ||
|
||
Before using this module, ensure you have the following: | ||
|
||
- AWS credentials configured. | ||
- Terraform installed. | ||
- A working knowledge of AWS Cloudfront, Route53 | ||
|
||
## Getting Started | ||
|
||
### Module Source | ||
|
||
To use the module in your Terraform configuration, include the following source block: | ||
|
||
```hcl | ||
module "cloudfront" { | ||
source = "sourcefuse/arc-cloudfront/aws" | ||
version = "4.0.3" | ||
# insert the required variables here | ||
} | ||
``` | ||
|
||
### Integration with Existing Terraform Configurations | ||
|
||
Integrate the module with your existing Terraform mono repo configuration, follow the steps below: | ||
|
||
1. Create a new folder in `terraform/` named `cloudfront`. | ||
2. Create the required files, see the [examples](https://github.com/sourcefuse/terraform-aws-arc-cloudfront/tree/main/examples/simple) to base off of. | ||
3. Configure with your backend | ||
- Create the environment backend configuration file: `config.<environment>.hcl` | ||
- **region**: Where the backend resides | ||
- **key**: `<working_directory>/terraform.tfstate` | ||
- **bucket**: Bucket name where the terraform state will reside | ||
- **dynamodb_table**: Lock table so there are not duplicate tfplans in the mix | ||
- **encrypt**: Encrypt all traffic to and from the backend | ||
|
||
### Required AWS Permissions | ||
|
||
Ensure that the AWS credentials used to execute Terraform have the necessary permissions to set up a CloudFront distribution. | ||
|
||
## Module Configuration | ||
|
||
### Input Variables | ||
|
||
For a list of input variables, see the README [Inputs](https://github.com/sourcefuse/terraform-aws-arc-cloudfront?tab=readme-ov-file#inputs) section. | ||
|
||
### Output Values | ||
|
||
For a list of outputs, see the README [Outputs](https://github.com/sourcefuse/terraform-aws-arc-cloudfront?tab=readme-ov-file#outputs) section. | ||
|
||
## Module Usage | ||
|
||
### Basic Usage | ||
|
||
For basic usage, see the [example](https://github.com/sourcefuse/terraform-aws-arc-cloudfront/tree/main/example) folder. | ||
|
||
This example will create: | ||
|
||
It creates the CloudFront distribution. It includes configurations for: | ||
|
||
Origins: These are the places where CloudFront will fetch the content. In this case, it's a custom origin with the domain name "test.wpengine.com". | ||
|
||
Cache behaviors: These define how CloudFront caches and serves content. There are two cache behaviors defined, one for the default cache behavior and one for the path "/content/immutable/*". | ||
|
||
Viewer certificate: This is the SSL certificate that CloudFront will use to serve HTTPS requests. It's configured to use an ACM certificate. | ||
|
||
ACM details: These are the details of the ACM certificate that CloudFront will use. | ||
|
||
Cache policies: These define how CloudFront will cache content. There's one cache policy defined named "cache-policy-1". | ||
|
||
Origin request policies: These define how CloudFront will forward requests to the origin. There's one origin request policy defined named "origin-req-policy-1". | ||
|
||
Custom error responses: These define how CloudFront will respond when it encounters specific HTTP status codes. There's one custom error response defined for the 404 status code. | ||
|
||
S3 KMS details: These are the details of the KMS key that will be used to encrypt the S3 bucket where CloudFront logs will be stored. | ||
|
||
Response headers policy: This defines the response headers that CloudFront will include in its responses. There's one response headers policy defined named "test-security-headers-policy" | ||
|
||
locals: This block defines local values that can be used throughout the Terraform script. In this case, it's defining the details of the "test-security-headers-policy" response headers policy. | ||
|
||
### Tips and Recommendations | ||
|
||
The module focuses on setting up setting up a AWS CloudFront distribution with various configurations. Adjust the configuration parameters as needed for your specific use case. | ||
|
||
## Troubleshooting | ||
|
||
### Reporting Issues | ||
|
||
If you encounter a bug or issue, please report it on the [GitHub repository](https://github.com/sourcefuse/terraform-aws-arc-cloudfront/issues). | ||
|
||
## Security Considerations | ||
|
||
### AWS VPC | ||
|
||
Understand the security considerations related to AWS CloudFront distribution when using this module. | ||
|
||
### Best Practices for AWS CloudFront distribution | ||
|
||
Follow best practices to ensure best Security configurations. | ||
[CLoudFront Security on AWS](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/security.html) | ||
|
||
## Contributing and Community Support | ||
|
||
### Contributing Guidelines | ||
|
||
Contribute to the module by following the guidelines outlined in the [CONTRIBUTING.md](https://github.com/sourcefuse/terraform-aws-arc-cloudfront/blob/main/CONTRIBUTING.md) file. | ||
|
||
### Reporting Bugs and Issues | ||
|
||
If you find a bug or issue, report it on the [GitHub repository](https://github.com/sourcefuse/terraform-aws-arc-cloudfront/issues). | ||
|
||
## License | ||
|
||
### License Information | ||
|
||
This module is licensed under the Apache 2.0 license. Refer to the [LICENSE](https://github.com/sourcefuse/terraform-aws-arc-cloudfront/blob/main/LICENSE) file for more details. | ||
|
||
### Open Source Contribution | ||
|
||
Contribute to open source by using and enhancing this module. Your contributions are welcome! |