-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.tf
48 lines (42 loc) · 1.05 KB
/
main.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
provider "aws" {
region = "us-east-1"
}
terraform {
backend "s3" {
bucket = "tfstate-store-bj"
encrypt = true
key = "terraform.tfstate"
region = "us-east-1"
dynamodb_table = "terraform-state-lock-dynamo"
}
}
resource "aws_dynamodb_table" "dynamodb-terraform-state-lock" {
name = "terraform-state-lock-dynamo"
hash_key = "LockID"
read_capacity = 20
write_capacity = 20
attribute {
name = "LockID"
type = "S"
}
tags = {
Name = "tfstate-store-bj Terraform State Lock Table"
}
}
resource "aws_iam_role" "ff_exec_role" {
name = "ff_exec_role"
assume_role_policy = "${file("iam/ff_lambda_assume_role.json")}"
}
resource "aws_iam_role_policy" "ff_policy" {
name = "ff_policy"
role = aws_iam_role.ff_exec_role.id
policy = "${file("iam/ff_lambda_cloudwatch_policy.json")}"
}
resource "aws_lambda_function" "ff_lambda" {
function_name = "ff"
handler = "index.handler"
runtime = "nodejs12.x"
filename = "ff.zip"
source_code_hash = "${filebase64sha256("ff.zip")}"
role = "${aws_iam_role.ff_exec_role.arn}"
}