mirror of
https://github.com/hashicorp/packer.git
synced 2026-05-28 04:35:38 -04:00
23 lines
359 B
Go
23 lines
359 B
Go
// Copyright IBM Corp. 2013, 2025
|
|
// SPDX-License-Identifier: BUSL-1.1
|
|
|
|
package hcl2template
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
func sourceRefFromString(in string) SourceRef {
|
|
args := strings.Split(in, ".")
|
|
if len(args) < 2 {
|
|
return NoSource
|
|
}
|
|
if len(args) > 2 {
|
|
// source.type.name
|
|
args = args[1:]
|
|
}
|
|
return SourceRef{
|
|
Type: args[0],
|
|
Name: args[1],
|
|
}
|
|
}
|