Skip to content

Commit

Permalink
simple terraform code
Browse files Browse the repository at this point in the history
  • Loading branch information
pilsuu committed Dec 8, 2023
1 parent 45a5ab2 commit 3ae04c7
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 1 deletion.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# Terraform-example
# To Start

- Install AWS CLI
- Install Terraform CLI
- AWS Configure
- write terraform code
- terraform init
- terraform validate
- terraform plan
- terraform apply
- terraform destroy
36 changes: 36 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "> 1.0.4"
}
}
}

variable "vm_set" {
type = map
default = {
img_name = "ami-01123b84e2a4fba05"
vm_name = "MyInstance"
instance_type = "t2.micro"
key_name = "first-vm-key"
}

}

provider "aws" {
region = "ap-northeast-2"
}

resource "aws_instance" "web" {
ami = var.vm_set.img_name
key_name = var.vm_set.key_name
instance_type = var.vm_set.instance_type
root_block_device {
volume_size = 8
}
tags = {
Name = var.vm_set.vm_name
}
}

0 comments on commit 3ae04c7

Please sign in to comment.