11
22provider "google" {
3- project = " httparchive "
4- region = " us-central1 "
3+ project = var . project
4+ region = var . region
55 request_timeout = " 60m"
66}
77
88terraform {
99 backend "gcs" {
1010 bucket = " tf-state-backingapi-20230314"
11- prefix = " dev "
11+ prefix = var . environment
1212 }
1313}
1414
1515resource "google_api_gateway_api" "api" {
1616 provider = google- beta
1717 api_id = " api-gw-dev"
1818 display_name = " The dev API Gateway"
19- project = " httparchive "
19+ project = var . project
2020}
2121
2222# A Configuration, consisting of an OpenAPI specification
2323resource "google_api_gateway_api_config" "api_config" {
2424 provider = google- beta
2525 api = google_api_gateway_api. api . api_id
2626 api_config_id_prefix = " api"
27- project = " httparchive "
27+ project = var . project
2828 display_name = " The dev Config"
2929 openapi_documents {
3030 document {
@@ -39,84 +39,65 @@ schemes:
3939 - https
4040produces:
4141 - application/json
42+ x-google-backend:
43+ address: https://us-central1-httparchive.cloudfunctions.net/tech-report-api-dev
44+ deadline: 60
45+ path_translation: APPEND_PATH_TO_ADDRESS
46+ protocol: h2
4247paths:
43- /v1/ categories:
48+ /categories:
4449 get:
4550 summary: categories
4651 operationId: getCategories
47- x-google-backend:
48- address: https://us-central1-httparchive.cloudfunctions.net/tech-report-api-dev/categories
49- deadline: 60
5052 responses:
5153 200:
5254 description: String
5355 /v1/adoption:
5456 get:
5557 summary: adoption
5658 operationId: getadoptionReports
57- x-google-backend:
58- address: https://us-central1-httparchive.cloudfunctions.net/tech-report-api-dev/adoption
59- deadline: 60
6059 responses:
6160 200:
6261 description: String
6362 /v1/page-weight:
6463 get:
6564 summary: pageWeight
6665 operationId: getpageWeight
67- x-google-backend:
68- address: https://us-central1-httparchive.cloudfunctions.net/tech-report-api-dev/page-weight
69- deadline: 60
7066 responses:
7167 200:
7268 description: String
7369 /v1/lighthouse:
7470 get:
7571 summary: lighthouse
7672 operationId: getLighthouseReports
77- x-google-backend:
78- address: https://us-central1-httparchive.cloudfunctions.net/tech-report-api-dev/lighthouse
79- deadline: 60
8073 responses:
8174 200:
8275 description: String
8376 /v1/cwv:
8477 get:
8578 summary: cwv
8679 operationId: getCwv
87- x-google-backend:
88- address: https://us-central1-httparchive.cloudfunctions.net/tech-report-api-dev/cwv
89- deadline: 60
9080 responses:
9181 200:
9282 description: String
9383 /v1/ranks:
9484 get:
9585 summary: ranks
9686 operationId: getRanks
97- x-google-backend:
98- address: https://us-central1-httparchive.cloudfunctions.net/tech-report-api-dev/ranks
99- deadline: 60
10087 responses:
10188 200:
10289 description: String
10390 /v1/geos:
10491 get:
10592 summary: geos
10693 operationId: getGeos
107- x-google-backend:
108- address: https://us-central1-httparchive.cloudfunctions.net/tech-report-api-dev/geos
109- deadline: 60
11094 responses:
11195 200:
11296 description: String
11397 /v1/technologies:
11498 get:
11599 summary: technologies
116100 operationId: getTechnologies
117- x-google-backend:
118- address: https://us-central1-httparchive.cloudfunctions.net/tech-report-api-dev/technologies
119- deadline: 60
120101 responses:
121102 200:
122103 description: String
133114# The actual API Gateway
134115resource "google_api_gateway_gateway" "gateway" {
135116 provider = google- beta
136- project = " httparchive "
137- region = " us-central1 "
117+ project = var . project
118+ region = var . region
138119 api_config = google_api_gateway_api_config. api_config . id
139120 gateway_id = " dev-gw"
140121 display_name = " devApi Gateway"
@@ -153,7 +134,7 @@ resource "google_api_gateway_gateway" "gateway" {
153134module "endpoints" {
154135 source = " ./../modules/run-service"
155136 entry_point = " app"
156- project = " httparchive "
137+ project = var . project
157138 environment = var. environment
158139 source_directory = " ../../src"
159140 function_name = " tech-report-api"
0 commit comments