Documentation ¶
Index ¶
- Variables
- func IsAttributeRequired(attrName string) bool
- func IsAttributeSupported(attrName string) bool
- func IsKubernetesKindSupported(obj runtime.Object) bool
- func NormalizeTerraformMapKey(s string) string
- func NormalizeTerraformName(s string, toSingular bool, path string) string
- func ResourceField(attrName string) *schema.Schema
- func ResourceSchema(name string) *schema.Resource
- func ToTerraformAttributeName(field *reflect.StructField, path string) string
- func ToTerraformResourceName(obj runtime.Object) string
- func ToTerraformResourceType(obj runtime.Object) string
- func ToTerraformSubBlockName(field *reflect.StructField, path string) string
Constants ¶
This section is empty.
Variables ¶
var ErrAttrNotFound = fmt.Errorf("could not find attribute in resource schema")
Functions ¶
func IsAttributeRequired ¶
IsAttributeRequired scans the Terraform resource to determine if the named attribute is required by the Kubernetes provider.
func IsAttributeSupported ¶
IsAttributeSupported scans the Terraform resource to determine if the named attribute is supported by the Kubernetes provider.
func IsKubernetesKindSupported ¶
IsKubernetesKindSupported returns true if a matching resource is found in the Terraform provider
func NormalizeTerraformMapKey ¶
NormalizeTerraformMapKey converts Map keys to a form suitable for Terraform HCL
e.g. map keys that include certain characters ( '/', '.' ) will be wrapped in double quotes.
func NormalizeTerraformName ¶
normalizeTerraformName converts the given string to snake case and optionally to singular form of the given word s is the string to normalize set toSingular to true to singularize the given word path is the full schema path to the named element
func ResourceField ¶
ResourceField returns the Terraform schema object for the named resource field attrName should be in the form <resource>.path.to.field
func ResourceSchema ¶
ResourceSchema returns the named Terraform Provider Resource schema as defined in the `terraform-provider-kubernetes` package
func ToTerraformAttributeName ¶
func ToTerraformAttributeName(field *reflect.StructField, path string) string
ToTerraformAttributeName takes the reflect.StructField data of a Kubernetes object attribute and translates it to the equivalent `terraform-kubernetes-provider` schema format.
Sometimes the Kubernetes attribute name doesn't match struct name
e.g. `type ContainerPort struct` -> "ports" in YAML
so we need to extract the JSON name from the StructField tag. Finally, the attribute name is converted to snake case.
func ToTerraformResourceName ¶
ToTerraformResourceName extract the Kubernetes API Objects' name from the ObjectMeta
func ToTerraformResourceType ¶
ToTerraformResourceType converts a Kubernetes API Object Type name to the equivalent `terraform-provider-kubernetes` schema name.
func ToTerraformSubBlockName ¶
func ToTerraformSubBlockName(field *reflect.StructField, path string) string
ToTerraformSubBlockName takes the reflect.StructField data of a Kubernetes object attribute and translates it to the equivalent `terraform-kubernetes-provider` schema format.
Sometimes the Kubernetes block name doesn't match struct name
e.g. `type ContainerPort struct` -> "ports" in YAML
so we need to extract the JSON name from the StructField tag. Next, the attribute name is converted to singular + snake case.
Types ¶
This section is empty.