Terraformを使ってみる

dockerを立てる

terraform {
	required_providers {
		docker = {
			source = "kreuzwerker/docker"
			version = "~> 2.15.0"
		}
	}
}

provider "docker" {}

resource "docker_image" "nginx" {
	name = "nginx:lastest"
	keep_locally = false
}

resource "docker_container" "nginx" {
	image = docker_image.nginx.latest
	name = "tutorial"
	ports {
		internal = 80
		external = 8080
	}
}
terraform {
	required_providers {
		aws = {
			source = "hashicorp/aws"
			version = "~> 3.0"
		}
	}
}

provider "aws" {
	profile = "default"
	region = "ap-northeast-1"
}

resource "aws_instance" "app_server" {
	ami = "ami-0e60b6d05dc38ff11"
	instance_type = "t2.micro"
	tags = {
		"Name" = "ec2-1115"
	}
}

なるほどー lambdaを勉強しないと駄目だなー