Skip to content

katayama8000/terraform-aws

Repository files navigation

Terraform AWS

Prerequisites

  • AWS Account
  • AWS CLI configured
  • Terraform installed

Setup

  1. Copy .env.local to .env and fill in your AWS credentials:
cp .env.local .env
  1. Edit .env with your AWS credentials:
AWS_ACCESS_KEY_ID=your-access-key-id
AWS_SECRET_ACCESS_KEY=your-secret-access-key
AWS_DEFAULT_REGION=ap-northeast-1

Commonly Used Commands

Initialize Terraform

terraform init

Initialize the Terraform working directory. Downloads provider plugins and modules.

Validate Configuration

terraform validate

Check whether the configuration is valid.

Format Code

terraform fmt

Automatically format Terraform configuration files to a canonical format.

Plan Changes

terraform plan

Show what changes Terraform will make to your infrastructure.

Apply Changes

terraform apply

Apply the changes required to reach the desired state of the configuration.

Apply with Auto-Approve

terraform apply -auto-approve

Apply changes without prompting for confirmation.

Destroy Infrastructure

terraform destroy

Destroy all resources managed by this Terraform configuration.

Show Current State

terraform show

Display the current state or a saved plan.

List Resources

terraform state list

List all resources in the state file.

Output Values

terraform output

Display output values from the state file.

Refresh State

terraform refresh

Update the state file with real infrastructure.

AWS CLI Commands

Check AWS Identity

aws sts get-caller-identity

Verify which AWS account and user you're authenticated as.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published