Skip to content

Commit a55d7a6

Browse files
authored
Properly pin providers. Update readme (#28)
* Update README * Properly pin providers * Properly pin providers
1 parent e2ff068 commit a55d7a6

File tree

5 files changed

+38
-76
lines changed

5 files changed

+38
-76
lines changed

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ Instead pin to the release tag (e.g. `?ref=tags/x.y.z`) of one of our [latest re
6464

6565
1. Define the module in your `.tf` file using local state:
6666
```hcl
67-
module "terraform_state_backend" {
68-
source = "git::https://github.com/cloudposse/terraform-aws-tfstate-backend.git?ref=master"
69-
namespace = "eg"
70-
stage = "test"
71-
name = "terraform"
72-
attributes = ["state"]
73-
region = "us-east-1"
74-
}
67+
module "terraform_state_backend" {
68+
source = "git::https://github.com/cloudposse/terraform-aws-tfstate-backend.git?ref=master"
69+
namespace = "eg"
70+
stage = "test"
71+
name = "terraform"
72+
attributes = ["state"]
73+
region = "us-east-1"
74+
}
7575
```
7676

7777
1. `terraform init`
@@ -80,18 +80,18 @@ Instead pin to the release tag (e.g. `?ref=tags/x.y.z`) of one of our [latest re
8080

8181
1. Then add a `backend` that uses the new bucket and table:
8282
```hcl
83-
backend "s3" {
83+
backend "s3" {
8484
region = "us-east-1"
8585
bucket = "< the name of the S3 bucket >"
8686
key = "terraform.tfstate"
8787
dynamodb_table = "< the name of the DynamoDB table >"
8888
encrypt = true
89-
}
90-
}
89+
}
90+
}
9191
92-
module "another_module" {
93-
source = "....."
94-
}
92+
module "another_module" {
93+
source = "....."
94+
}
9595
```
9696

9797
1. `terraform init`. Terraform will detect that you're trying to move your state into S3 and ask, "Do you want to copy existing state to the new backend?" Enter "yes". Now state is stored in the bucket and the DynamoDB table will be used to lock the state to prevent concurrent modifications.

README.yaml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ description: |-
6060
usage: |-
6161
1. Define the module in your `.tf` file using local state:
6262
```hcl
63-
module "terraform_state_backend" {
64-
source = "git::https://github.com/cloudposse/terraform-aws-tfstate-backend.git?ref=master"
65-
namespace = "eg"
66-
stage = "test"
67-
name = "terraform"
68-
attributes = ["state"]
69-
region = "us-east-1"
70-
}
63+
module "terraform_state_backend" {
64+
source = "git::https://github.com/cloudposse/terraform-aws-tfstate-backend.git?ref=master"
65+
namespace = "eg"
66+
stage = "test"
67+
name = "terraform"
68+
attributes = ["state"]
69+
region = "us-east-1"
70+
}
7171
```
7272
7373
1. `terraform init`
@@ -76,18 +76,18 @@ usage: |-
7676
7777
1. Then add a `backend` that uses the new bucket and table:
7878
```hcl
79-
backend "s3" {
79+
backend "s3" {
8080
region = "us-east-1"
8181
bucket = "< the name of the S3 bucket >"
8282
key = "terraform.tfstate"
8383
dynamodb_table = "< the name of the DynamoDB table >"
8484
encrypt = true
85-
}
86-
}
85+
}
86+
}
8787
88-
module "another_module" {
89-
source = "....."
90-
}
88+
module "another_module" {
89+
source = "....."
90+
}
9191
```
9292
9393
1. `terraform init`. Terraform will detect that you're trying to move your state into S3 and ask, "Do you want to copy existing state to the new backend?" Enter "yes". Now state is stored in the bucket and the DynamoDB table will be used to lock the state to prevent concurrent modifications.

examples/complete/main.tf

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1+
provider "aws" {
2+
region = var.region
3+
}
4+
15
module "tfstate_backend" {
26
source = "../../"
37

4-
providers = {
5-
aws = "aws"
6-
null = "null"
7-
local = "local"
8-
template = "template"
9-
}
10-
118
region = var.region
129
namespace = var.namespace
1310
stage = var.stage

examples/complete/versions.tf

Lines changed: 0 additions & 23 deletions
This file was deleted.

versions.tf

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
11
terraform {
22
required_version = "~> 0.12.0"
3-
}
4-
5-
# Pin the providers
6-
# https://www.terraform.io/docs/configuration/providers.html
7-
# Any non-beta version >= 2.0.0 and < 3.0.0, e.g. 2.X.Y
8-
provider "aws" {
9-
version = "~> 2.0"
10-
}
11-
12-
provider "null" {
13-
version = "~> 2.0"
14-
}
15-
16-
provider "local" {
17-
version = "~> 1.2"
18-
}
193

20-
provider "template" {
21-
version = "~> 2.0"
4+
required_providers {
5+
aws = "~> 2.0"
6+
template = "~> 2.0"
7+
local = "~> 1.2"
8+
null = "~> 2.0"
9+
}
2210
}

0 commit comments

Comments
 (0)