Code Monkey home page Code Monkey logo

terraform-state's Issues

Changes in terraform 0.12.x breaks tags block

Terraform v0.12.2

  • provider.aws v2.14.0
Error: Unsupported block type

  on .terraform/modules/s3-state/s3/main.tf line 17, in resource "aws_s3_bucket" "state":
  17:   tags {

Blocks of type "tags" are not expected here. Did you mean to define argument
"tags"? If so, use the equals sign to assign it a value.

Expected Usage

I have a couple of questions about how you all intended this module to be used. I have an existing Terraform definition with an existing state for two workspaces: default and development.

terraform {
  backend "s3" {
    encrypt        = true
    bucket         = "app-terraform-remote-state-storage-s3"
    dynamodb_table = "app-terraform-remote-state-lock-dynamo"
    region         = "us-west-2"
    key            = "terraform.tfstate"
  }
}

Is the expectation that I'd add this as a module, change the bucket and dynamodb_table values to match module.s3.bucket_id and module.s3.locktable_id and all would be fine? Or is there some other expected workflow? e.g.

diff --git a/main.tf b/main.tf
index 93526f6..57bf1b8 100644
--- a/terraform.tf
+++ b/terraform.tf
@@ -17,14 +17,21 @@ provider "template" {
   version = "~> 1.0"
 }
 
+module "s3" {
+  source  = "github.com/skyscrapers/terraform-state//s3?ref=3.0.0"
+  project = "app"
+}
+
 terraform {
   required_version = "~> 0.11"
 
   backend "s3" {
     encrypt        = true
-    bucket         = "app-terraform-remote-state-storage-s3"
-    dynamodb_table = "app-terraform-remote-state-lock-dynamo"
+    bucket         = "terraform-remote-state-app"
+    dynamodb_table = "terraform-remote-state-lock-app"
     region         = "us-west-2"
     key            = "terraform.tfstate"
   }
 }

The reason I ask is that it seems to be a bit of a chicken and egg scenario. I need these resources before I can provision my environment so I can store state and yet it is will be part of the environment too.

Also, what is the expected way to handle multiple workspaces? It seems like switching workspaces will cause the environment to try and reprovision the state storage resources.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.