@@ -12,12 +12,157 @@ terraform {
12
12
}
13
13
}
14
14
15
- module "backend-api" {
16
- source = " ./../modules/api-gateway"
17
- environment = " prod"
18
- project = " httparchive"
19
- region = " us-east1"
20
- service_account_email = var. google_service_account_api_gateway
15
+ resource "google_api_gateway_api" "api" {
16
+ provider = google- beta
17
+ api_id = " api-gw-prod"
18
+ display_name = " The prod API Gateway"
19
+ project = " httparchive"
20
+ }
21
+
22
+ resource "google_api_gateway_api_config" "api_config" {
23
+ provider = google- beta
24
+ api = google_api_gateway_api. api . api_id
25
+ api_config_id_prefix = " api"
26
+ project = " httparchive"
27
+ display_name = " The prod Config"
28
+ openapi_documents {
29
+ document {
30
+ path = " spec.yaml"
31
+ contents = base64encode (<<- EOF
32
+ swagger: "2.0"
33
+ info:
34
+ title: reports-backend-api
35
+ description: API tech report
36
+ version: 1.0.0
37
+ schemes:
38
+ - https
39
+ produces:
40
+ - application/json
41
+ paths:
42
+ /v1/categories:
43
+ get:
44
+ summary: categories
45
+ operationId: getCategories
46
+ x-google-backend:
47
+ address: https://us-east1-httparchive.cloudfunctions.net/categories-prod
48
+ deadline: 60
49
+ # security:
50
+ # - api_key: []
51
+ responses:
52
+ 200:
53
+ description: String
54
+ /v1/adoption:
55
+ get:
56
+ summary: adoption
57
+ operationId: getadoptionReports
58
+ x-google-backend:
59
+ address: https://us-east1-httparchive.cloudfunctions.net/adoption-prod
60
+ deadline: 60
61
+ # security:
62
+ # - api_key: []
63
+ responses:
64
+ 200:
65
+ description: String
66
+ /v1/page-weight:
67
+ get:
68
+ summary: pageWeight
69
+ operationId: getpageWeight
70
+ x-google-backend:
71
+ address: https://us-east1-httparchive.cloudfunctions.net/page-weight-prod
72
+ deadline: 60
73
+ # security:
74
+ # - api_key: []
75
+ responses:
76
+ 200:
77
+ description: String
78
+ /v1/lighthouse:
79
+ get:
80
+ summary: lighthouse
81
+ operationId: getLighthouseReports
82
+ x-google-backend:
83
+ address: https://us-east1-httparchive.cloudfunctions.net/lighthouse-prod
84
+ deadline: 60
85
+ # security:
86
+ # - api_key: []
87
+ responses:
88
+ 200:
89
+ description: String
90
+ /v1/cwv:
91
+ get:
92
+ summary: cwv
93
+ operationId: getCwv
94
+ x-google-backend:
95
+ address: https://us-east1-httparchive.cloudfunctions.net/cwvtech-prod
96
+ deadline: 60
97
+ # security:
98
+ # - api_key: []
99
+ responses:
100
+ 200:
101
+ description: String
102
+ /v1/ranks:
103
+ get:
104
+ summary: ranks
105
+ operationId: getRanks
106
+ x-google-backend:
107
+ address: https://us-east1-httparchive.cloudfunctions.net/ranks-prod
108
+ deadline: 60
109
+ # security:
110
+ # - api_key: []
111
+ responses:
112
+ 200:
113
+ description: String
114
+ /v1/geos:
115
+ get:
116
+ summary: geos
117
+ operationId: getGeos
118
+ x-google-backend:
119
+ address: https://us-east1-httparchive.cloudfunctions.net/geos-prod
120
+ deadline: 60
121
+ # security:
122
+ # - api_key: []
123
+ responses:
124
+ 200:
125
+ description: String
126
+ /v1/technologies:
127
+ get:
128
+ summary: geos
129
+ operationId: getTechnologies
130
+ x-google-backend:
131
+ address: https://us-east1-httparchive.cloudfunctions.net/technologies-prod
132
+ deadline: 60
133
+ # security:
134
+ # - api_key: []
135
+ responses:
136
+ 200:
137
+ description: String
138
+ EOF
139
+ )
140
+ }
141
+ }
142
+ gateway_config {
143
+ backend_config {
144
+ google_service_account = var. google_service_account_api_gateway
145
+ }
146
+ }
147
+ }
148
+
149
+ resource "google_api_gateway_gateway" "gateway" {
150
+ provider = google- beta
151
+ project = " httparchive"
152
+ region = " us-east1"
153
+ api_config = google_api_gateway_api_config. api_config . id
154
+ gateway_id = " prod-gw"
155
+ display_name = " prod Api Gateway"
156
+ labels = {
157
+ owner = " tech_report_api"
158
+ environment = " prod"
159
+ }
160
+ depends_on = [google_api_gateway_api_config . api_config ]
161
+ lifecycle {
162
+ replace_triggered_by = [
163
+ google_api_gateway_api_config . api_config
164
+ ]
165
+ }
21
166
}
22
167
23
168
module "cwvtech" {
0 commit comments