-
Notifications
You must be signed in to change notification settings - Fork 156
/
Copy pathbase.tf
85 lines (66 loc) · 1.56 KB
/
base.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
terraform {
required_version = "> 1.4.2"
required_providers {
aws = {
source = "hashicorp/aws"
# Lock version to prevent unexpected problems
version = "4.43.0"
}
null = {
source = "hashicorp/null"
version = "~> 3.1.0"
}
external = {
source = "hashicorp/external"
version = "~> 2.1.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "2.13.1"
}
helm = {
source = "hashicorp/helm"
version = "~> 2.4.1"
}
local = {
source = "hashicorp/local"
version = "~> 2.1.0"
}
}
backend "s3" {
bucket = local.BUCKET_NAME
key = local.BKEY
region = local.BREG
dynamodb_table = local.DTAB
encrypt = "true"
}
}
provider "aws" {
region = var.region
shared_credentials_files = ["~/.aws/credentials"]
profile = var.profile
}
provider "null" {}
provider "external" {}
data "aws_region" "current" {}
data "aws_caller_identity" "current" {}
data "aws_availability_zones" "az" {
state = "available"
}
resource "aws_dynamodb_table" "terraform_lock" {
# switch var
name = format("tf_lock_%s_%s", data.aws_ssm_parameter.tf-eks-id.value, lower(basename(path.cwd)))
billing_mode = "PAY_PER_REQUEST"
hash_key = "LockID"
attribute {
name = "LockID"
type = "S"
}
point_in_time_recovery {
enabled = true
}
server_side_encryption {
enabled = true
kms_key_arn = data.aws_ssm_parameter.tf-eks-keyarn.value
}
}