@@ -2,9 +2,240 @@ package dynamic
2
2
3
3
import (
4
4
"github.com/overmindtech/cli/sdp-go"
5
+ gcpshared "github.com/overmindtech/cli/sources/gcp/shared"
5
6
"github.com/overmindtech/cli/sources/shared"
6
7
)
7
8
8
- // SDPAssetTypeToTerraformMappings contains mappings from GCP asset types to Terraform resources.
9
- // TODO: Populate SDPAssetTypeToTerraformMappings with mappings from GCP asset types to Terraform resources.
10
- var SDPAssetTypeToTerraformMappings = map [shared.ItemType ][]* sdp.TerraformMapping {}
9
+ type TerraformMapping struct {
10
+ Reference string
11
+ Description string
12
+ Mappings []* sdp.TerraformMapping
13
+ }
14
+
15
+ var SDPAssetTypeToTerraformMappings = map [shared.ItemType ]TerraformMapping {
16
+ gcpshared .AIPlatformCustomJob : {
17
+ Description : "There is no terraform resource for this type." ,
18
+ },
19
+ gcpshared .AIPlatformPipelineJob : {
20
+ Description : "There is no terraform resource for this type." ,
21
+ },
22
+ gcpshared .ArtifactRegistryDockerImage : {
23
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/artifact_registry_docker_image" ,
24
+ Description : "name => projects/{{project}}/locations/{{location}}/repository/{{repository_id}}/dockerImages/{{docker_image}}. We should use search to extract relevant fields." ,
25
+ Mappings : []* sdp.TerraformMapping {
26
+ {
27
+ TerraformMethod : sdp .QueryMethod_SEARCH ,
28
+ TerraformQueryMap : "google_artifact_registry_docker_image.name" ,
29
+ },
30
+ },
31
+ },
32
+ gcpshared .BigQueryDataset : {
33
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/bigquery_dataset" ,
34
+ Mappings : []* sdp.TerraformMapping {
35
+ {
36
+ TerraformMethod : sdp .QueryMethod_GET ,
37
+ TerraformQueryMap : "google_bigquery_dataset.dataset_id" ,
38
+ },
39
+ },
40
+ },
41
+ gcpshared .BigQueryTable : {
42
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/bigquery_table" ,
43
+ Description : "id => projects/{{project}}/datasets/{{dataset}}/tables/{{table}}" ,
44
+ Mappings : []* sdp.TerraformMapping {
45
+ {
46
+ TerraformMethod : sdp .QueryMethod_SEARCH ,
47
+ TerraformQueryMap : "google_bigquery_table.id" ,
48
+ },
49
+ },
50
+ },
51
+ gcpshared .BigTableAdminAppProfile : {
52
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/bigtable_app_profile" ,
53
+ Description : "id => projects/{{project}}/instances/{{instance}}/appProfiles/{{app_profile_id}}" ,
54
+ Mappings : []* sdp.TerraformMapping {
55
+ {
56
+ TerraformMethod : sdp .QueryMethod_SEARCH ,
57
+ TerraformQueryMap : "google_bigtable_app_profile.id" ,
58
+ },
59
+ },
60
+ },
61
+ gcpshared .BigTableAdminBackup : {
62
+ Description : "There is no terraform resource for this type." ,
63
+ },
64
+ gcpshared .BigTableAdminTable : {
65
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/bigtable_table" ,
66
+ Description : "id => projects/{{project}}/instances/{{instance_name}}/tables/{{name}}" ,
67
+ Mappings : []* sdp.TerraformMapping {
68
+ {
69
+ TerraformMethod : sdp .QueryMethod_SEARCH ,
70
+ TerraformQueryMap : "google_bigtable_table.id" ,
71
+ },
72
+ },
73
+ },
74
+ gcpshared .CloudBuildBuild : {
75
+ Description : "There is no terraform resource for this type." ,
76
+ },
77
+ gcpshared .CloudBillingBillingInfo : {
78
+ Description : "There is no terraform resource for this type." ,
79
+ },
80
+ gcpshared .CloudResourceManagerProject : {
81
+ Description : "There is no terraform resource for this type." ,
82
+ },
83
+ gcpshared .ComputeFirewall : {
84
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_firewall" ,
85
+ Mappings : []* sdp.TerraformMapping {
86
+ {
87
+ TerraformMethod : sdp .QueryMethod_GET ,
88
+ TerraformQueryMap : "google_compute_firewall.name" ,
89
+ },
90
+ },
91
+ },
92
+ gcpshared .ComputeInstance : {
93
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance" ,
94
+ Mappings : []* sdp.TerraformMapping {
95
+ {
96
+ TerraformMethod : sdp .QueryMethod_GET ,
97
+ TerraformQueryMap : "google_compute_instance.name" ,
98
+ },
99
+ },
100
+ },
101
+ gcpshared .ComputeInstanceTemplate : {
102
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance_template" ,
103
+ Mappings : []* sdp.TerraformMapping {
104
+ {
105
+ TerraformMethod : sdp .QueryMethod_GET ,
106
+ TerraformQueryMap : "google_compute_instance_template.name" ,
107
+ },
108
+ },
109
+ },
110
+ gcpshared .ComputeNetwork : {
111
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_network" ,
112
+ Mappings : []* sdp.TerraformMapping {
113
+ {
114
+ TerraformMethod : sdp .QueryMethod_GET ,
115
+ TerraformQueryMap : "google_compute_network.name" ,
116
+ },
117
+ },
118
+ },
119
+ gcpshared .ComputeProject : {
120
+ Description : "There is no terraform resource for this type." ,
121
+ },
122
+ gcpshared .ComputeRoute : {
123
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_route" ,
124
+ Mappings : []* sdp.TerraformMapping {
125
+ {
126
+ TerraformMethod : sdp .QueryMethod_GET ,
127
+ TerraformQueryMap : "google_compute_route.name" ,
128
+ },
129
+ },
130
+ },
131
+ gcpshared .ComputeSubnetwork : {
132
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_subnetwork" ,
133
+ Mappings : []* sdp.TerraformMapping {
134
+ {
135
+ TerraformMethod : sdp .QueryMethod_GET ,
136
+ TerraformQueryMap : "google_compute_subnetwork.name" ,
137
+ },
138
+ },
139
+ },
140
+ gcpshared .DataformRepository : {
141
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dataform_repository" ,
142
+ Description : "id => projects/{{project}}/locations/{{region}}/repositories/{{name}}" ,
143
+ Mappings : []* sdp.TerraformMapping {
144
+ {
145
+ TerraformMethod : sdp .QueryMethod_SEARCH ,
146
+ TerraformQueryMap : "google_dataform_repository.id" ,
147
+ },
148
+ },
149
+ },
150
+ gcpshared .DataplexEntryGroup : {
151
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dataplex_entry_group#entry_group_id" ,
152
+ Description : "id => projects/{{project}}/locations/{{location}}/entryGroups/{{entry_group_id}}" ,
153
+ Mappings : []* sdp.TerraformMapping {
154
+ {
155
+ TerraformMethod : sdp .QueryMethod_SEARCH ,
156
+ TerraformQueryMap : "google_dataplex_entry_group.id" ,
157
+ },
158
+ },
159
+ },
160
+ gcpshared .DNSManagedZone : {
161
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dns_managed_zone#name" ,
162
+ Mappings : []* sdp.TerraformMapping {
163
+ {
164
+ TerraformMethod : sdp .QueryMethod_GET ,
165
+ TerraformQueryMap : "google_dns_managed_zone.name" ,
166
+ },
167
+ },
168
+ },
169
+ gcpshared .EssentialContactsContact : {
170
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/essential_contacts_contact#email" ,
171
+ Description : "id => {resourceType}/{resource_id}/contacts/{contact_id}" ,
172
+ Mappings : []* sdp.TerraformMapping {
173
+ {
174
+ TerraformMethod : sdp .QueryMethod_SEARCH ,
175
+ TerraformQueryMap : "google_essential_contacts_contact.id" ,
176
+ },
177
+ },
178
+ },
179
+ gcpshared .IAMRole : {
180
+ Description : "There is no terraform resource for this type." ,
181
+ },
182
+ gcpshared .MonitoringCustomDashboard : {
183
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/monitoring_dashboard" ,
184
+ Description : "id => projects/{{project}}/dashboards/{{dashboard_id}}" ,
185
+ Mappings : []* sdp.TerraformMapping {
186
+ {
187
+ TerraformMethod : sdp .QueryMethod_SEARCH ,
188
+ TerraformQueryMap : "google_monitoring_dashboard.id" ,
189
+ },
190
+ },
191
+ },
192
+ gcpshared .PubSubSubscription : {
193
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/pubsub_subscription" ,
194
+ Mappings : []* sdp.TerraformMapping {
195
+ {
196
+ TerraformMethod : sdp .QueryMethod_GET ,
197
+ TerraformQueryMap : "google_pubsub_subscription.name" ,
198
+ },
199
+ },
200
+ },
201
+ gcpshared .PubSubTopic : {
202
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/pubsub_topic" ,
203
+ Mappings : []* sdp.TerraformMapping {
204
+ {
205
+ TerraformMethod : sdp .QueryMethod_GET ,
206
+ TerraformQueryMap : "google_pubsub_topic.name" ,
207
+ },
208
+ },
209
+ },
210
+ gcpshared .RunRevision : {
211
+ Description : "There is no terraform resource for this type." ,
212
+ },
213
+ gcpshared .ServiceDirectoryEndpoint : {
214
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/service_directory_endpoint" ,
215
+ Description : "id => projects/*/locations/*/namespaces/*/services/*/endpoints/*" ,
216
+ Mappings : []* sdp.TerraformMapping {
217
+ {
218
+ TerraformMethod : sdp .QueryMethod_SEARCH ,
219
+ TerraformQueryMap : "google_service_directory_endpoint.id" ,
220
+ },
221
+ },
222
+ },
223
+ gcpshared .ServiceUsageService : {
224
+ Description : "There is no terraform resource for this type." ,
225
+ },
226
+ gcpshared .SQLAdminBackup : {
227
+ Description : "There is no terraform resource for this type." ,
228
+ },
229
+ gcpshared .SQLAdminBackupRun : {
230
+ Description : "There is no terraform resource for this type." ,
231
+ },
232
+ gcpshared .StorageBucket : {
233
+ Reference : "https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket" ,
234
+ Mappings : []* sdp.TerraformMapping {
235
+ {
236
+ TerraformMethod : sdp .QueryMethod_GET ,
237
+ TerraformQueryMap : "google_storage_bucket.name" ,
238
+ },
239
+ },
240
+ },
241
+ }
0 commit comments