Skip to content

sshivampeta/terraform_setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Project

This is a basic Terraform project setup for AWS infrastructure management.

Prerequisites

  1. Install Terraform: Download from terraform.io
  2. AWS CLI: Install and configure with your credentials
  3. AWS Account: Ensure you have appropriate permissions

Project Structure

terraform_setup/
├── main.tf                    # Main Terraform configuration
├── variables.tf               # Input variables
├── outputs.tf                 # Output values
├── terraform.tfvars.example   # Example variable values
├── .gitignore                 # Git ignore rules for Terraform
└── README.md                  # This file

Getting Started

1. Configure Variables

Copy the example variables file and customize it:

cp terraform.tfvars.example terraform.tfvars

Edit terraform.tfvars with your desired values.

2. Configure AWS Credentials

Make sure your AWS credentials are configured:

aws configure

Or set environment variables:

export AWS_ACCESS_KEY_ID="your-access-key"
export AWS_SECRET_ACCESS_KEY="your-secret-key"
export AWS_DEFAULT_REGION="us-west-2"

3. Initialize Terraform

terraform init

4. Plan the Deployment

terraform plan

5. Apply the Configuration

terraform apply

6. Destroy Resources (when done)

terraform destroy

What This Creates

This basic configuration creates:

  • A VPC with DNS support
  • An Internet Gateway
  • A public subnet in the first available AZ
  • Proper tagging for all resources

Customization

  • Modify variables.tf to add new variables
  • Update main.tf to add new resources
  • Add new output values in outputs.tf
  • Use modules for reusable components

Best Practices

  • Always run terraform plan before apply
  • Use version control for your Terraform code
  • Keep sensitive data in terraform.tfvars (not committed to git)
  • Use remote state for team collaboration
  • Tag all resources consistently

Troubleshooting

  • Ensure AWS credentials are properly configured
  • Check that your AWS account has necessary permissions
  • Verify the region and availability zones are correct
  • Review Terraform logs for detailed error messages

terraform_setup

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages