@@ -46,9 +46,12 @@ const (
46
46
const KnownAfterApply = `(known after apply)`
47
47
48
48
type PlannedChangeMapResult struct {
49
- // The name of the resource in the Terraform plan
49
+ // The full name of the resource in the Terraform plan
50
50
TerraformName string
51
51
52
+ // The terraform resource type
53
+ TerraformType string
54
+
52
55
// The status of the mapping
53
56
Status MapStatus
54
57
@@ -200,6 +203,7 @@ func MappedItemDiffsFromPlan(ctx context.Context, planJson []byte, fileName stri
200
203
log .WithContext (ctx ).WithFields (lf ).WithField ("terraform-address" , resourceChange .Address ).Debug ("Skipping unmapped resource" )
201
204
results .Results = append (results .Results , PlannedChangeMapResult {
202
205
TerraformName : resourceChange .Address ,
206
+ TerraformType : resourceChange .Type ,
203
207
Status : MapStatusUnsupported ,
204
208
Message : "unsupported" ,
205
209
MappedItemDiff : & sdp.MappedItemDiff {
@@ -243,6 +247,7 @@ func MappedItemDiffsFromPlan(ctx context.Context, planJson []byte, fileName stri
243
247
attribute .String ("ovm.climap.status" , result .Status .String ()),
244
248
attribute .String ("ovm.climap.message" , result .Message ),
245
249
attribute .String ("ovm.climap.terraform-name" , result .TerraformName ),
250
+ attribute .String ("ovm.climap.terraform-type" , result .TerraformType ),
246
251
))
247
252
case MapStatusSuccess :
248
253
// Don't include these
@@ -263,6 +268,7 @@ func mapResourceToQuery(itemDiff *sdp.ItemDiff, terraformResource *Resource, map
263
268
if len (mappings ) == 0 {
264
269
return PlannedChangeMapResult {
265
270
TerraformName : terraformResource .Address ,
271
+ TerraformType : terraformResource .Type ,
266
272
Status : MapStatusUnsupported ,
267
273
Message : "unsupported" ,
268
274
MappedItemDiff : & sdp.MappedItemDiff {
@@ -300,6 +306,7 @@ func mapResourceToQuery(itemDiff *sdp.ItemDiff, terraformResource *Resource, map
300
306
301
307
return PlannedChangeMapResult {
302
308
TerraformName : terraformResource .Address ,
309
+ TerraformType : terraformResource .Type ,
303
310
Status : MapStatusSuccess ,
304
311
Message : "mapped" ,
305
312
MappedItemDiff : & sdp.MappedItemDiff {
@@ -317,6 +324,7 @@ func mapResourceToQuery(itemDiff *sdp.ItemDiff, terraformResource *Resource, map
317
324
// If we get to this point, we haven't found a mapping
318
325
return PlannedChangeMapResult {
319
326
TerraformName : terraformResource .Address ,
327
+ TerraformType : terraformResource .Type ,
320
328
Status : MapStatusNotEnoughInfo ,
321
329
Message : fmt .Sprintf ("missing mapping attribute: %v" , strings .Join (attemptedMappings , ", " )),
322
330
MappedItemDiff : & sdp.MappedItemDiff {
0 commit comments