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