config

package
v0.31.16 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BasePackages = config.BasePackages{
		APIVersion: []string{
			"apis/v1alpha1",
			"apis/v1beta1",
		},
		Controller: []string{
			"internal/controller/providerconfig",
		},
	}
)
View Source
var ExternalNameConfigs = map[string]config.ExternalName{}/* 152 elements not displayed */

ExternalNameConfigs contains all external name configurations for this provider.

View Source
var ExternalNameNotTestedConfigs = map[string]config.ExternalName{}/* 225 elements not displayed */

ExternalNameNotTestedConfigs contains no-tested configurations for this provider.

View Source
var GroupMap = map[string]GroupKindCalculator{}/* 249 elements not displayed */

GroupMap contains all overrides we'd like to make to the default group search. It's written with data from TF Provider AWS repo service grouping in here: https://github.com/hashicorp/terraform-provider-aws/tree/main/internal/service

At the end, all of them are based on grouping of the AWS Go SDK. The initial grouping is calculated based on folder grouping of AWS TF Provider which is based on Go SDK. Here is the script used to fetch that list: https://gist.github.com/muvaf/8d61365ffc1df7757864422ba16d7819

View Source
var KindMap = map[string]string{
	"aws_autoscaling_group":                    "AutoscalingGroup",
	"aws_cloudformation_type":                  "CloudFormationType",
	"aws_cloudtrail":                           "Trail",
	"aws_config_configuration_recorder_status": "AWSConfigurationRecorderStatus",
}

KindMap contains kind string overrides.

Functions

func AddExternalTagsField

func AddExternalTagsField() config.ResourceOption

AddExternalTagsField adds ExternalTagsFieldName configuration for resources that have tags field.

func DocumentationForTags

func DocumentationForTags() config.ResourceOption

DocumentationForTags overrides the API documentation of the tags fields since it contains Terraform-specific feature call out.

func ExternalNameConfigurations

func ExternalNameConfigurations() config.ResourceOption

ExternalNameConfigurations applies all external name configs listed in the table ExternalNameConfigs and sets the version of those resources to v1beta1 assuming they will be tested.

func FormattedIdentifierFromProvider

func FormattedIdentifierFromProvider(separator string, keys ...string) config.ExternalName

FormattedIdentifierFromProvider is a helper function to construct Terraform IDs that use elements from the parameters in a certain string format. It should be used in cases where all information in the ID is gathered from the spec and not user defined like name. For example, zone_id:vpc_id.

func FormattedIdentifierUserDefinedNameFirst

func FormattedIdentifierUserDefinedNameFirst(param, separator string, keys ...string) config.ExternalName

FormattedIdentifierUserDefinedNameFirst is used in cases where the ID is constructed using some of the spec fields as well as a field that users use to name the resource. For example, budget_name:product_id where product_id comes from spec but budget_name is a naming field we can use external name for. This function assumes that the naming field is the FIRST component in the constructed identifier, which may not always hold (e.g., aws_eks_addon).

func FormattedIdentifierUserDefinedNameLast

func FormattedIdentifierUserDefinedNameLast(param, separator string, keys ...string) config.ExternalName

FormattedIdentifierUserDefinedNameLast is used in cases where the ID is constructed using some of the spec fields as well as a field that users use to name the resource. For example, vpc_id:cluster_name where vpc_id comes from spec but cluster_name is a naming field we can use external name for. This function assumes that the naming field is the LAST component in the constructed identifier, which may not always hold (e.g., aws_servicecatalog_budget_resource_association).

func GetProvider

func GetProvider() *config.Provider

GetProvider returns provider configuration

func GroupKindOverrides

func GroupKindOverrides() config.ResourceOption

GroupKindOverrides overrides the group and kind of the resource if it matches any entry in the GroupMap.

func IdentifierAssignedByAWS

func IdentifierAssignedByAWS() config.ResourceOption

IdentifierAssignedByAWS will work for all AWS types because even if the ID is assigned by user, we'll see it in the TF State ID. The resource-specific configurations should override this whenever possible.

func KindOverrides

func KindOverrides() config.ResourceOption

KindOverrides overrides the kind of the resources given in KindMap.

func KnownReferencers

func KnownReferencers() config.ResourceOption

KnownReferencers adds referencers for fields that are known and common among more than a few resources.

func NamePrefixRemoval

func NamePrefixRemoval() config.ResourceOption

NamePrefixRemoval makes sure we remove name_prefix from all since it is mostly for Terraform functionality.

func RegionAddition

func RegionAddition() config.ResourceOption

RegionAddition adds region to the spec of all resources except iam group which does not have a region notion.

func ResourcesWithExternalNameConfig

func ResourcesWithExternalNameConfig() []string

ResourcesWithExternalNameConfig returns the list of resources that have external name configured in ExternalNameConfigs table.

func TagsAllRemoval

func TagsAllRemoval() config.ResourceOption

TagsAllRemoval removes the tags_all field that is used only in tfstate to accumulate provider-wide default tags in TF, which is not something we support. So, we don't need it as a parameter while "tags" is already in place.

func TemplatedStringAsIdentifierWithNoName

func TemplatedStringAsIdentifierWithNoName(tmpl string) config.ExternalName

TemplatedStringAsIdentifierWithNoName uses TemplatedStringAsIdentifier but without the name initializer. This allows it to be used in cases where the ID is constructed with parameters and a provider-defined value, meaning no user-defined input. Since the external name is not user-defined, the name initializer has to be disabled.

Types

type GroupKindCalculator

type GroupKindCalculator func(resource string) (string, string)

GroupKindCalculator returns the correct group and kind name for given TF resource.

func ReplaceGroupWords

func ReplaceGroupWords(group string, count int) GroupKindCalculator

ReplaceGroupWords uses given group as the group of the resource and removes a number of words in resource name before calculating the kind of the resource.

Jump to

Keyboard shortcuts

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