-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
01-providers.tf
55 lines (45 loc) · 1.65 KB
/
01-providers.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
terraform {
/*#
The "backend" block in the "01-providers.tf" must remain commented until the bucket and the DynamoDB table are created.
After all your resources will be created, you will need to replace empty values
for "region" and "bucket" in the "backend" block of the "00-providers.tf" since variables are not allowed in this block.
For "region" you need to specify the region where the S3 bucket and DynamoDB table are located.
You need to use the same value that you have in the "00-variables.tf" for the "region" variable.
For "bucket" you will get its values in the output after the first run of "terraform apply -auto-approve".
After your values are set, you can then uncomment the "backend" block and run again "terraform init" and then "terraform apply -auto-approve".
In this way, the "terraform.tfstate" file will be stored in an S3 bucket and DynamoDB will be used for state locking and consistency checking.
*/
/*#
backend "s3" {
region = ""
bucket = ""
key = "state/terraform.tfstate"
kms_key_id = "alias/terraform-bucket-key-route53-1"
dynamodb_table = "dynamodb-terraform-state-lock-route53-1"
encrypt = true
}
*/
# Terraform version (replace with yours)
required_version = "1.9.2"
# Terraform providers
required_providers {
aws = {
source = "hashicorp/aws"
# Provider versions
version = "~> 5.81.0"
}
tls = {
source = "hashicorp/tls"
# Provider versions
version = "~> 4.0.4"
}
random = {
source = "hashicorp/random"
# Provider versions
version = "~> 3.6.0"
}
}
}
provider "aws" {
region = var.region
}