Documentation ¶
Index ¶
- Constants
- Variables
- func Base64Encode(data []byte) string
- func DiffStringMaps(oldMap, newMap map[string]interface{}) (map[string]*string, map[string]*string, map[string]*string)
- func ErrorISOUnsupported(partition string, err error) bool
- func FloatGreaterThan(threshold float64) schema.SchemaValidateFunc
- func IsBase64Encoded(data []byte) bool
- func IsIPv4CIDRBlockOrIPv6CIDRBlock(ipv4Validator, ipv6Validator schema.SchemaValidateFunc) schema.SchemaValidateFunc
- func IsServicePrincipal(value string) (valid bool)
- func JSONBytesEqual(b1, b2 []byte) bool
- func JSONStringsEqual(s1, s2 string) bool
- func LegacyPolicyNormalize(policy interface{}) (string, error)
- func LegacyPolicyToSet(exist, new string) (string, error)
- func NormalizeJSONOrYAMLString(templateString interface{}) (string, error)
- func PolicyToSet(exist, new string) (string, error)
- func SecondJSONUnlessEquivalent(old, new string) (string, error)
- func SemVerGreaterThanOrEqual(s1, s2 string) bool
- func SemVerLessThan(s1, s2 string) bool
- func SetTagsDiff(ctx context.Context, diff *schema.ResourceDiff, meta interface{}) error
- func SliceContainsString(slice []interface{}, s string) (int, bool)
- func SuppressEquivalentJSONDiffs(k, old, new string, d *schema.ResourceData) bool
- func SuppressEquivalentJSONOrYAMLDiffs(k, old, new string, d *schema.ResourceData) bool
- func SuppressEquivalentPolicyDiffs(k, old, new string, d *schema.ResourceData) bool
- func SuppressEquivalentRoundedTime(layout string, d time.Duration) schema.SchemaDiffSuppressFunc
- func SuppressEquivalentStringCaseInsensitive(k, old, new string, d *schema.ResourceData) bool
- func SuppressMissingOptionalConfigurationBlock(k, old, new string, d *schema.ResourceData) bool
- func Valid4ByteASN(v interface{}, k string) (ws []string, errors []error)
- func ValidARNCheck(f ...ARNCheckFunc) schema.SchemaValidateFunc
- func ValidAccountID(v interface{}, k string) (ws []string, errors []error)
- func ValidAmazonSideASN(v interface{}, k string) (ws []string, errors []error)
- func ValidCIDRNetworkAddress(v interface{}, k string) (ws []string, errors []error)
- func ValidDuration(v interface{}, k string) (ws []string, errors []error)
- func ValidIAMPolicyJSON(v interface{}, k string) (ws []string, errors []error)
- func ValidIPv4CIDRNetworkAddress(v interface{}, k string) (ws []string, errors []error)
- func ValidIPv6CIDRNetworkAddress(v interface{}, k string) (ws []string, errors []error)
- func ValidKMSKeyID(v interface{}, k string) (ws []string, errors []error)
- func ValidLaunchTemplateID(v interface{}, k string) (ws []string, errors []error)
- func ValidLaunchTemplateName(v interface{}, k string) (ws []string, errors []error)
- func ValidMulticastIPAddress(v interface{}, k string) (ws []string, errors []error)
- func ValidOnceADayWindowFormat(v interface{}, k string) (ws []string, errors []error)
- func ValidOnceAWeekWindowFormat(v interface{}, k string) (ws []string, errors []error)
- func ValidRegionName(v interface{}, k string) (ws []string, errors []error)
- func ValidServicePrincipal(v interface{}, k string) (ws []string, errors []error)
- func ValidStringIsJSONOrYAML(v interface{}, k string) (ws []string, errors []error)
- func ValidTypeStringNullableFloat(v interface{}, k string) (ws []string, es []error)
- func ValidUTCTimestamp(v interface{}, k string) (ws []string, errors []error)
- func ValidateIPv4CIDRBlock(cidr string) error
- func ValidateIPv6CIDRBlock(cidr string) error
- type ARNCheckFunc
- type ResourceDiffer
Constants ¶
const ( ErrCodeAccessDenied = "AccessDenied" ErrCodeAuthorizationError = "AuthorizationError" ErrCodeInternalException = "InternalException" ErrCodeInternalServiceError = "InternalServiceError" ErrCodeInvalidAction = "InvalidAction" ErrCodeInvalidParameterException = "InvalidParameterException" ErrCodeInvalidParameterValue = "InvalidParameterValue" ErrCodeInvalidRequest = "InvalidRequest" ErrCodeOperationDisabledException = "OperationDisabledException" ErrCodeOperationNotPermitted = "OperationNotPermitted" ErrCodeUnknownOperationException = "UnknownOperationException" ErrCodeUnsupportedFeatureException = "UnsupportedFeatureException" ErrCodeUnsupportedOperation = "UnsupportedOperation" ErrCodeValidationError = "ValidationError" ErrCodeValidationException = "ValidationException" )
const UUIDRegexPattern = `[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[ab89][0-9a-f]{3}-[0-9a-f]{12}`
Variables ¶
var ValidARN = ValidARNCheck()
ValidARN validates that a string value matches a generic ARN format
var ValidStringDateOrPositiveInt = validation.Any( validation.IsRFC3339Time, validation.StringMatch(regexache.MustCompile(`^\d+$`), "must be a positive integer value"), )
Functions ¶
func Base64Encode ¶
Base64Encode encodes data if the input isn't already encoded using base64.StdEncoding.EncodeToString. If the input is already base64 encoded, return the original input unchanged.
func DiffStringMaps ¶
func DiffStringMaps(oldMap, newMap map[string]interface{}) (map[string]*string, map[string]*string, map[string]*string)
DiffStringMaps returns the set of keys and values that must be created, the set of keys and values that must be destroyed, and the set of keys and values that are unchanged.
func ErrorISOUnsupported ¶
ErrorISOUnsupported checks the partition and specific error to make an educated guess about whether the problem stems from a feature not being available in ISO (or non standard partitions) that is normally available. true means that there is an error AND it suggests a feature is not supported in ISO. Be careful with false, which means either there is NO error or there is an error but not one that suggests an unsupported feature in ISO.
func FloatGreaterThan ¶
func FloatGreaterThan(threshold float64) schema.SchemaValidateFunc
FloatGreaterThan returns a SchemaValidateFunc which tests if the provided value is of type float and is greater than threshold.
func IsBase64Encoded ¶
func IsIPv4CIDRBlockOrIPv6CIDRBlock ¶
func IsIPv4CIDRBlockOrIPv6CIDRBlock(ipv4Validator, ipv6Validator schema.SchemaValidateFunc) schema.SchemaValidateFunc
IsIPv4CIDRBlockOrIPv6CIDRBlock returns a SchemaValidateFunc that test if the provided value: - Is a valid IPv4 CIDR block and passes the specified validation, or - Is a valid IPv6 CIDR block and passes the specified validation
func IsServicePrincipal ¶
func JSONBytesEqual ¶
func JSONStringsEqual ¶
func LegacyPolicyNormalize ¶
LegacyPolicyNormalize returns a "normalized" JSON policy document except the Version element is first in the JSON as required by AWS in many places. Version not being first is one reason for this error: MalformedPolicyDocument: The policy failed legacy parsing
func LegacyPolicyToSet ¶
LegacyPolicyToSet returns the existing policy if the new policy is equivalent. Otherwise, it returns the new policy. Either policy is legacy normalized.
func PolicyToSet ¶
PolicyToSet returns the existing policy if the new policy is equivalent. Otherwise, it returns the new policy. Either policy is normalized.
func SemVerGreaterThanOrEqual ¶
SemVerGreaterThanOrEqual returns whether or not the first version string is greater than or equal to the second according to Semantic Versioning rules (https://semver.org/).
func SemVerLessThan ¶
SemVerLessThan returns whether or not the first version string is less than the second according to Semantic Versioning rules (https://semver.org/).
func SetTagsDiff ¶
func SetTagsDiff(ctx context.Context, diff *schema.ResourceDiff, meta interface{}) error
SetTagsDiff sets the new plan difference with the result of merging resource tags on to those defined at the provider-level; returns an error if unsuccessful or if the resource tags are identical to those configured at the provider-level to avoid non-empty plans after resource READ operations as resource and provider-level tags will be indistinguishable when returned from an AWS API.
func SliceContainsString ¶
func SuppressEquivalentJSONDiffs ¶
func SuppressEquivalentJSONDiffs(k, old, new string, d *schema.ResourceData) bool
func SuppressEquivalentJSONOrYAMLDiffs ¶
func SuppressEquivalentJSONOrYAMLDiffs(k, old, new string, d *schema.ResourceData) bool
func SuppressEquivalentPolicyDiffs ¶
func SuppressEquivalentPolicyDiffs(k, old, new string, d *schema.ResourceData) bool
func SuppressEquivalentRoundedTime ¶
func SuppressEquivalentRoundedTime(layout string, d time.Duration) schema.SchemaDiffSuppressFunc
SuppressEquivalentRoundedTime returns a difference suppression function that compares two time value with the specified layout rounded to the specified duration.
func SuppressEquivalentStringCaseInsensitive ¶
func SuppressEquivalentStringCaseInsensitive(k, old, new string, d *schema.ResourceData) bool
SuppressEquivalentStringCaseInsensitive provides custom difference suppression for strings that are equal under case-insensitivity.
func SuppressMissingOptionalConfigurationBlock ¶
func SuppressMissingOptionalConfigurationBlock(k, old, new string, d *schema.ResourceData) bool
SuppressMissingOptionalConfigurationBlock handles configuration block attributes in the following scenario:
- The resource schema includes an optional configuration block with defaults
- The API response includes those defaults to refresh into the Terraform state
- The operator's configuration omits the optional configuration block
func Valid4ByteASN ¶
func ValidARNCheck ¶
func ValidARNCheck(f ...ARNCheckFunc) schema.SchemaValidateFunc
ValidARNCheck validates that a string value matches an ARN format with additional validation on the parsed ARN value It must: * Be parseable as an ARN * Have a valid partition * Have a valid region * Have either an empty or valid account ID * Have a non-empty resource part * Pass the supplied checks
func ValidAccountID ¶
func ValidAmazonSideASN ¶
func ValidCIDRNetworkAddress ¶
ValidCIDRNetworkAddress ensures that the string value is a valid CIDR that represents a network address - it adds an error otherwise
func ValidDuration ¶
func ValidIAMPolicyJSON ¶
func ValidIPv4CIDRNetworkAddress ¶
ValidIPv4CIDRNetworkAddress ensures that the string value is a valid IPv4 CIDR that represents a network address - it adds an error otherwise
func ValidIPv6CIDRNetworkAddress ¶
ValidIPv6CIDRNetworkAddress ensures that the string value is a valid IPv6 CIDR that represents a network address - it adds an error otherwise
func ValidKMSKeyID ¶
KMS Key IDs (a subset of KMS Key Identifiers) can be be key ID, key ARN, alias name, or alias ARN. There's no guarantee about the format of a Key ID other than a string between 1 and 2048 characters (per KMS API documentation and internal AWS conversations). ref: https://docs.aws.amazon.com/kms/latest/developerguide/concepts.html#key-id ref: https://docs.aws.amazon.com/kms/latest/APIReference/API_Encrypt.html#KMS-Encrypt-request-KeyId
func ValidLaunchTemplateID ¶
func ValidLaunchTemplateName ¶
func ValidMulticastIPAddress ¶
func ValidRegionName ¶
func ValidServicePrincipal ¶
func ValidStringIsJSONOrYAML ¶
func ValidTypeStringNullableFloat ¶
ValidTypeStringNullableFloat provides custom error messaging for TypeString floats Some arguments require a floating point value or an unspecified, empty field.
func ValidUTCTimestamp ¶
ValidUTCTimestamp validates a string in UTC Format required by APIs including: https://docs.aws.amazon.com/iot/latest/apireference/API_CloudwatchMetricAction.html https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RestoreDBInstanceToPointInTime.html
func ValidateIPv4CIDRBlock ¶
ValidateIPv4CIDRBlock validates that the specified CIDR block is valid: - The CIDR block parses to an IP address and network - The IP address is an IPv4 address - The CIDR block is the CIDR block for the network
func ValidateIPv6CIDRBlock ¶
ValidateIPv6CIDRBlock validates that the specified CIDR block is valid: - The CIDR block parses to an IP address and network - The IP address is an IPv6 address - The CIDR block is the CIDR block for the network
Types ¶
type ResourceDiffer ¶
ResourceDiffer exposes the interface for accessing changes in a resource Implementations: * schema.ResourceData * schema.ResourceDiff FIXME: can be removed if https://github.com/hashicorp/terraform-plugin-sdk/pull/626/files is merged