From 1309b415767a61dbb6da993b61a05f018e08e37a Mon Sep 17 00:00:00 2001 From: Erik Stambaugh Date: Sun, 26 Dec 2021 17:38:18 -0800 Subject: [PATCH] incremental update - add ec2 instance --- Makefile | 5 +++++ nextcloud.tf | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b28b04f..d203d3c 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,8 @@ +default: + terraform init + terraform apply + + diff --git a/nextcloud.tf b/nextcloud.tf index 1f7fe11..0693663 100644 --- a/nextcloud.tf +++ b/nextcloud.tf @@ -5,9 +5,57 @@ provider "aws" { resource "random_pet" "name" {} -resource "aws_s3_bucket" "bucket" { +#resource "aws_s3_bucket" "bucket" { +# bucket = "nextcloud-${random_pet.name.id}" +# acl = "private" +#} + +# https://registry.terraform.io/modules/terraform-aws-modules/s3-bucket/aws/latest +module "s3_bucket" { + source = "terraform-aws-modules/s3-bucket/aws" + bucket = "nextcloud-${random_pet.name.id}" acl = "private" + + versioning = { + enabled = false + } + } +# https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws/latest +module "vpc" { + source = "terraform-aws-modules/vpc/aws" + + name = "nextcloud-vpc" + cidr = "10.69.0.0/16" + + azs = ["us-west-1a"] +# private_subnets = ["10.69.101.0/24"] + private_subnets = [] + public_subnets = ["10.69.1.0/24"] + + enable_nat_gateway = false + enable_vpn_gateway = false + +# tags = { +# Terraform = "true" +# Environment = "dev" +# } +} + +resource "aws_instance" "nextcloud" { + ami = "ami-078278691222aee06" + instance_type = "t4g.micro" + subnet_id = module.vpc.public_subnets.0 + + tags = { + Name = "nextcloud" + } +} + +#resource "aws_eip" "nextcloud" { +# vpc = true +# instance = aws_instance.nextcloud.id +#}