From e666b64c978317b072c63d7777c47a89e39e4491 Mon Sep 17 00:00:00 2001 From: Cedric Girard Date: Tue, 12 May 2020 14:20:14 +0200 Subject: [PATCH] tfstate in s3 --- .gitignore | 4 ++-- project3/base.tf | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 project3/base.tf diff --git a/.gitignore b/.gitignore index 3ef70ca..b516fd2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,8 @@ **/.terraform/* # .tfstate files -#*.tfstate -#*.tfstate.* +*.tfstate +*.tfstate.* # Crash log files crash.log diff --git a/project3/base.tf b/project3/base.tf new file mode 100644 index 0000000..7753a9c --- /dev/null +++ b/project3/base.tf @@ -0,0 +1,29 @@ +terraform { + backend "s3"{ + bucket = "terraformsanofieu" + region = "eu-west-2" + key = "cedric/project3.tfstate" + } +} + +provider "aws" { + region = "eu-west-2" +} + +resource "aws_instance" "cedric-instance3" { + ami = "ami-01a6e31ac994bbc09" + instance_type = "t2.micro" + key_name = "cedric" + tags = { + Name = "cedric-instance3" + } +} + +resource "aws_instance" "cedric-instance4" { + ami = "ami-01a6e31ac994bbc09" + instance_type = "t2.micro" + key_name = "cedric" + tags = { + Name = "cedric-instance4" + } +}