config

package
v0.47.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 99 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CLIReconciledExternalNameConfigs = map[string]config.ExternalName{

	"aws_vpc_security_group_egress_rule": vpcSecurityGroupRule(),

	"aws_vpc_security_group_ingress_rule": vpcSecurityGroupRule(),

	"aws_appconfig_environment": config.IdentifierFromProvider,

	"aws_cognito_user_pool_client": FormattedIdentifierFromProvider("", "name"),

	"aws_simpledb_domain": config.NameAsIdentifier,
}
View Source
var ExternalNameNotTestedConfigs = map[string]config.ExternalName{}/* 203 elements not displayed */

ExternalNameNotTestedConfigs contains no-tested configurations for this provider.

View Source
var GroupMap = map[string]GroupKindCalculator{}/* 251 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.

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

NoForkExternalNameConfigs contains all external name configurations belonging to Terraform resources to be reconciled under the no-fork architecture for this provider.

Functions

func AddExternalTagsField

func AddExternalTagsField() config.ResourceOption

AddExternalTagsField adds ExternalTagsFieldName configuration for resources that have tags field.

func CLIReconciledResourceList added in v0.44.0

func CLIReconciledResourceList() []string

CLIReconciledResourceList returns the list of resources that have external name configured in ExternalNameConfigs table and to be reconciled under the TF CLI based architecture.

func DocumentationForTags added in v0.19.0

func DocumentationForTags() config.ResourceOption

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

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 added in v0.22.0

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 added in v0.22.0

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(ctx context.Context, generationProvider bool) (*config.Provider, error)

GetProvider returns the provider configuration. The `generationProvider` argument specifies whether the provider configuration is being read for the code generation pipelines. In that case, we will only use the JSON schema for generating the CRDs.

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 NoForkResourceList added in v0.44.0

func NoForkResourceList() []string

NoForkResourceList returns the list of resources that have external name configured in ExternalNameConfigs table and to be reconciled under the no-fork architecture.

func PermissionSetIdAsExternalName added in v0.46.0

func PermissionSetIdAsExternalName() config.ExternalName

PermissionSetIdAsExternalName uses the id of the permission set (ps-80383020jr9302rk) as the external name, with the comma-separated pair permission_set_arn,instance_arn as the terraform id, when both arns are parameters and known ahead of time. Example: arn:aws:sso:::permissionSet/ssoins-2938j0x8920sbj72/ps-80383020jr9302rk,arn:aws:sso:::instance/ssoins-2938j0x8920sbj72

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 ResourceConfigurator added in v0.44.0

func ResourceConfigurator() config.ResourceOption

ResourceConfigurator applies all external name configs listed in the table NoForkExternalNameConfigs and CLIReconciledExternalNameConfigs and sets the version of those resources to v1beta1. For those resource in NoForkExternalNameConfigs, it also sets config.Resource.UseNoForkClient to `true`.

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. TODO: This seems to have some problems with handling the initial creation, when the parameters in the template are defined but the external name is empty, because the provider hasn't assigned its provider-defined identifier yet.

func TemplatedStringAsProviderDefinedIdentifier added in v0.46.0

func TemplatedStringAsProviderDefinedIdentifier(tmpl string) config.ExternalName

TemplatedStringAsProviderDefinedIdentifier uses TemplatedStringAsIdentifier but without the name initializer, and with a GetIdFn that exits early if the external name is empty. 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