Skip to content

Commit 2e83a2d

Browse files
committed
func comments for getResourceName and getResourceLabel
1 parent f873ad5 commit 2e83a2d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

internal/convert/convert.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,8 @@ func setResourceName(resource *hclwrite.Block, name string) {
372372
resource.SetLabels(labels)
373373
}
374374

375+
// getResourceName returns the first label of a block, if it exists.
376+
// e.g. in resource "mongodbatlas_cluster" "mycluster", the first label is "mongodbatlas_cluster".
375377
func getResourceName(resource *hclwrite.Block) string {
376378
labels := resource.Labels()
377379
if len(labels) == 0 {
@@ -380,6 +382,8 @@ func getResourceName(resource *hclwrite.Block) string {
380382
return labels[0]
381383
}
382384

385+
// getResourceLabel returns the second label of a block, if it exists.
386+
// e.g. in resource "mongodbatlas_cluster" "mycluster", the second label is "mycluster".
383387
func getResourceLabel(resource *hclwrite.Block) string {
384388
labels := resource.Labels()
385389
if len(labels) <= 1 {

0 commit comments

Comments
 (0)