-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.tf
57 lines (46 loc) · 1.28 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
49
50
51
52
53
54
55
56
57
variable "aws_access_key" {
description = "AWS access key"
}
variable "aws_secret_key" {
description = "AWS secret key"
}
variable "aws_region" {
description = "AWS region"
default = "us-east-1"
}
variable "deploy_stage"{
description = "Deployment Stage"
}
provider "aws" {
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
region = "${var.aws_region}"
}
# expose the discovered account_id etc
data "aws_caller_identity" "current" {}
output "aws_account_id" {
value = "${data.aws_caller_identity.current.account_id}"
}
output "caller_arn" {
value = "${data.aws_caller_identity.current.arn}"
}
output "caller_user" {
value = "${data.aws_caller_identity.current.user_id}"
}
module "graphql_lambda"{
source = "./infrastructure/aws/lambda"
name = "graphql"
zip_file_path = "./build/"
}
module "graphql_lambda_api_gateway"{
source = "./infrastructure/aws/api_gateway/aws_proxy"
api_name = "${var.graphql_api_name}"
api_path = "${var.graphql_api_path}"
lambda_arn ="${module.graphql_lambda.arn}"
region = "${var.aws_region}"
account_id = "${data.aws_caller_identity.current.account_id}"
deploy_stage = "${var.deploy_stage}"
}
output "url" {
value = "${module.graphql_lambda_api_gateway.url}/${var.graphql_api_path}"
}