Skip to content

A modern infrastructure as code project using Terraform 🌍 to manage AWS S3 buckets ☁️. It supports multi-environment configurations πŸ› οΈ, automated S3 bucket creation πŸ“¦, and Terraform state management πŸ”§ for seamless infrastructure management on AWS.

Notifications You must be signed in to change notification settings

rafaumeu/primeiro-projeto-iac

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Terraform AWS Infrastructure

A modern infrastructure as code project for AWS S3 and CloudFront integration using Terraform.

Terraform AWS License


πŸ“– Table of Contents

Tech Stack Features Prerequisites
Setup Project Structure Environment Variables

⚑ Tech Stack

Terraform AWS


πŸš€ Features

  • Multi-Environment Support:

    • Dynamic S3 bucket naming based on workspace
    • Environment-specific configurations
    • Context tagging for resource identification
  • AWS S3 Configuration:

    • Automated bucket creation
    • Static website hosting
    • Custom error/index documents
    • Resource tagging
    • Environment-based isolation
  • CloudFront Integration:

    • CDN distribution setup
    • HTTPS redirection
    • Custom origin configuration
    • Global content delivery
    • Price class management
  • Infrastructure Management:

    • Terraform state management
    • AWS provider configuration
    • Data source integration
    • Module-based architecture

πŸ“¦ Prerequisites

  • Terraform 1.0+
  • AWS CLI configured
  • AWS account with appropriate permissions
  • Basic understanding of S3 and CloudFront concepts

πŸ› οΈ Setup

  1. Clone the repository:
git clone https://github.com/yourusername/terraform-aws-infra.git
cd terraform-aws-infra
  1. Initialize Terraform:
terraform init
  1. Select workspace (environment):
terraform workspace select dev # or prod
  1. Plan the infrastructure:
terraform plan
  1. Apply the configuration:
terraform apply

πŸ“ Contributing

Commit Convention

We follow the Conventional Commits specification. Every commit message must follow this pattern:

<type>(<scope>): <description>

[optional body]

[optional footer(s)]

Types

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • chore: Changes to the build process or auxiliary tools

Scopes

  • infra: Changes to infrastructure configuration
  • s3: Changes related to S3 module
  • cdn: Changes related to CloudFront module
  • docs: Changes to documentation
  • ci: Changes to CI/CD pipeline

Examples

# Feature example
feat(s3): add website hosting configuration

- Add index.html configuration
- Configure error document
- Enable static website hosting
# Fix example
fix(cdn): correct origin protocol policy

- Update protocol policy to http-only
- Fix SSL protocols configuration
# Documentation example
docs(readme): update project documentation

- Add commit convention section
- Update prerequisites
- Include contribution guidelines

Pull Request Process

  1. Update the README.md with details of changes if needed
  2. Update the version numbers in files following SemVer
  3. Create your PR with a clear title and description
  4. Wait for review and approval from maintainers

πŸ—οΈ Project Structure

terraform-aws-infra/
β”œβ”€β”€ main.tf                    # Main configuration file
β”œβ”€β”€ providers.tf               # AWS provider configuration
β”œβ”€β”€ output.tf                  # Output definitions
β”œβ”€β”€ modules/
β”‚   β”œβ”€β”€ s3/                   # S3 bucket module
β”‚   β”‚   β”œβ”€β”€ main.tf          # S3 bucket configuration
β”‚   β”‚   β”œβ”€β”€ variables.tf     # Module variables
β”‚   β”‚   β”œβ”€β”€ outputs.tf       # Module outputs
β”‚   β”‚   └── datasources.tf   # S3 data sources
β”‚   └── cloudfront/          # CloudFront module
β”‚       β”œβ”€β”€ main.tf          # CloudFront configuration
β”‚       β”œβ”€β”€ variables.tf     # Module variables
β”‚       β”œβ”€β”€ outputs.tf       # Module outputs
β”‚       └── datasources.tf   # CloudFront data sources
└── .gitignore               # Git ignore rules

πŸ”§ Environment Variables

# AWS Configuration
AWS_ACCESS_KEY_ID="your-access-key"
AWS_SECRET_ACCESS_KEY="your-secret-key"
AWS_REGION="your-region"

πŸ“€ Outputs

After applying the infrastructure, you'll get:

  • S3 bucket domain name
  • CloudFront distribution domain name
  • CloudFront distribution ID

Made with ❀️ by Rafael Dias Zendron

LinkedIn GitHub

About

A modern infrastructure as code project using Terraform 🌍 to manage AWS S3 buckets ☁️. It supports multi-environment configurations πŸ› οΈ, automated S3 bucket creation πŸ“¦, and Terraform state management πŸ”§ for seamless infrastructure management on AWS.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages