naming

package
v0.0.0-...-4f69453 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2020 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(name string, namePrefix string) string

Generate returns in order the name if non-empty, a prefix generated name if non-empty, or fully generated name prefixed with terraform-

func HasResourceUniqueIdPrefix

func HasResourceUniqueIdPrefix(s string) bool

HasResourceUniqueIdPrefix returns true if the string has the built-in unique ID prefix

func HasResourceUniqueIdSuffix

func HasResourceUniqueIdSuffix(s string) bool

HasResourceUniqueIdSuffix returns true if the string has the built-in unique ID suffix

func NamePrefixFromName

func NamePrefixFromName(name string) *string

NamePrefixFromName returns a name prefix if the string matches prefix criteria

The input to this function must be strictly the "name" and not any additional information such as a full Amazon Resource Name (ARN). The output is suitable for custom resource Importer State functions after nil checking to ensure differences are not reported with ImportStateVerify testing, e.g.

if namePrefix := naming.NamePrefixFromName(d.Id()); namePrefix != nil {
  d.Set("name_prefix", namePrefix)
}

func TestCheckResourceAttrNameFromPrefix

func TestCheckResourceAttrNameFromPrefix(resourceName string, attributeName string, prefix string) resource.TestCheckFunc

TestCheckResourceAttrNameFromPrefix verifies that the state attribute value matches name generated from given prefix

func TestCheckResourceAttrNameGenerated

func TestCheckResourceAttrNameGenerated(resourceName string, attributeName string) resource.TestCheckFunc

TestCheckResourceAttrNameGenerated verifies that the state attribute value matches name automatically generated without prefix

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL