Skip to content

Commit

Permalink
Store terraform state in S3
Browse files Browse the repository at this point in the history
  • Loading branch information
suizman authored and iknite committed Feb 19, 2019
1 parent ff71620 commit e7e97a6
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
8 changes: 8 additions & 0 deletions deploy/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ resource "null_resource" "prebuild" {
}
}

# Bucket config must be here: https://github.com/hashicorp/terraform/issues/13589
terraform {
backend "s3" {
bucket = "terraform-qed-cluster"
key = "terraform.tfstate"
region = "eu-west-1"
}
}
module "leader" {
source = "./modules/qed"

Expand Down
24 changes: 24 additions & 0 deletions deploy/aws/pre-build/bucket.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
terraform {
required_version = ">= 0.11.11"
}

provider "aws" {
version = ">= 1.56.0, < 2.0"
region = "eu-west-1"
profile = "${var.aws_profile}"
}
resource "aws_s3_bucket" "terraform-qed-cluster" {
bucket = "terraform-qed-cluster"

versioning {
enabled = true
}

lifecycle {
prevent_destroy = true
}

tags {
Name = "S3 Remote Terraform State Store"
}
}
1 change: 1 addition & 0 deletions deploy/aws/pre-build/variables.tf

0 comments on commit e7e97a6

Please sign in to comment.