forked from Superformula/cloud-backend-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
68 lines (55 loc) · 1.44 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
58
59
60
61
62
63
64
65
66
67
68
variable "graphql_api_name" {
description = "Name of pai"
default = "graphql_api"
}
variable "graphql_api_path" {
description = "Api Path"
default = "graphql"
}
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"
default = "staging"
}
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 = "./iac/aws/lambda"
name = "graphql"
zip_file_path = "./dist/"
}
module "graphql_lambda_api_gateway"{
source = "./iac/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}"
}