From 7794d684579479bbfdbba4e7fb1db9e71934093d Mon Sep 17 00:00:00 2001 From: Vadivel Date: Sat, 27 Mar 2021 08:55:10 -0500 Subject: [PATCH] Merge hashicorp 3.34.0 into main (#1) * tests/provider: Use string matching in testAccErrorCheckCommon() and catch all InvalidAction (#18283) Reference: https://github.com/hashicorp/terraform-provider-aws/issues/17566 Previously in AWS GovCloud (US): ``` === CONT TestAccAwsEc2ClientVpn_serial/NetworkAssociation_multipleSubnets resource_aws_ec2_client_vpn_network_association_test.go:144: Step 1/3 error: Error running apply: exit status 1 Error: Error creating Client VPN endpoint: InvalidAction: The action CreateClientVpnEndpoint is not valid for this web service. status code: 400, request id: 387e7807-e2b8-4314-9aa8-6cf2e33a0ded on terraform_plugin_test.tf line 61, in resource "aws_ec2_client_vpn_endpoint" "test": 61: resource "aws_ec2_client_vpn_endpoint" "test" { === CONT TestAccAwsEc2ClientVpn_serial/NetworkAssociation_securityGroups resource_aws_ec2_client_vpn_network_association_test.go:211: Step 1/3 error: Error running apply: exit status 1 Error: Error creating Client VPN endpoint: InvalidAction: The action CreateClientVpnEndpoint is not valid for this web service. status code: 400, request id: ad7a3b32-b650-4683-a7e0-945481550c6d on terraform_plugin_test.tf line 57, in resource "aws_ec2_client_vpn_endpoint" "test": 57: resource "aws_ec2_client_vpn_endpoint" "test" { === CONT TestAccAwsEc2ClientVpn_serial/NetworkAssociation_disappears resource_aws_ec2_client_vpn_network_association_test.go:186: Step 1/1 error: Error running apply: exit status 1 Error: Error creating Client VPN endpoint: InvalidAction: The action CreateClientVpnEndpoint is not valid for this web service. status code: 400, request id: feed7ccb-95a7-411f-b633-da58e8340392 on terraform_plugin_test.tf line 56, in resource "aws_ec2_client_vpn_endpoint" "test": 56: resource "aws_ec2_client_vpn_endpoint" "test" { === CONT TestAccAwsEc2ClientVpn_serial/NetworkAssociation_basic resource_aws_ec2_client_vpn_network_association_test.go:105: Step 1/2 error: Error running apply: exit status 1 Error: Error creating Client VPN endpoint: InvalidAction: The action CreateClientVpnEndpoint is not valid for this web service. status code: 400, request id: 3f31766a-9288-4e46-9f35-6d7922e938ac on terraform_plugin_test.tf line 56, in resource "aws_ec2_client_vpn_endpoint" "test": 56: resource "aws_ec2_client_vpn_endpoint" "test" { --- FAIL: TestAccAwsEc2ClientVpn_serial (0.54s) --- FAIL: TestAccAwsEc2ClientVpn_serial/NetworkAssociation_securityGroups (32.03s) --- FAIL: TestAccAwsEc2ClientVpn_serial/NetworkAssociation_multipleSubnets (32.06s) --- FAIL: TestAccAwsEc2ClientVpn_serial/NetworkAssociation_disappears (31.96s) --- FAIL: TestAccAwsEc2ClientVpn_serial/NetworkAssociation_basic (33.01s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAwsEc2ClientVpn_serial (0.41s) --- SKIP: TestAccAwsEc2ClientVpn_serial/NetworkAssociation_disappears (30.61s) --- SKIP: TestAccAwsEc2ClientVpn_serial/NetworkAssociation_securityGroups (31.10s) --- SKIP: TestAccAwsEc2ClientVpn_serial/NetworkAssociation_basic (31.01s) ``` * tests/provider: Fix and enable linting for immediate dereference after AWS SDK Go pointer conversion (#18024) Reference: https://github.com/hashicorp/terraform-provider-aws/issues/12992 This is akin to `*&var`, which is flagged by the Go toolchain. * tests/provider: Fix compilation-time randomization in test configuration, enable semgrep rule to catch coding issue (#18220) Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18175 Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18204 Also adds `ErrorCheck` while adjusting these tests. Previously: ``` aws/data_source_aws_cloudfront_distribution_test.go severity:warning rule:helper-acctest-RandInt-compiled: Using `acctest.RandInt()` in constant or variable declaration will execute during compilation and not randomize, pass into string generating function instead 36:var testAccAWSCloudFrontDistributionData = fmt.Sprintf(` 37:%s 38: 39:data "aws_cloudfront_distribution" "test" { 40: id = aws_cloudfront_distribution.s3_distribution.id 41:} 42:`, fmt.Sprintf(testAccAWSCloudFrontDistributionS3ConfigWithTags, acctest.RandInt(), originBucket, logBucket, testAccAWSCloudFrontDistributionRetainConfig())) aws/data_source_aws_ecs_cluster_test.go severity:warning rule:helper-acctest-RandInt-compiled: Using `acctest.RandInt()` in constant or variable declaration will execute during compilation and not randomize, pass into string generating function instead 50:var testAccCheckAwsEcsClusterDataSourceConfig = fmt.Sprintf(` 51:resource "aws_ecs_cluster" "default" { 52: name = "default-%d" 53:} 54: 55:data "aws_ecs_cluster" "default" { 56: cluster_name = aws_ecs_cluster.default.name 57:} 58:`, acctest.RandInt()) -------------------------------------------------------------------------------- 60:var testAccCheckAwsEcsClusterDataSourceConfigContainerInsights = fmt.Sprintf(` 61:resource "aws_ecs_cluster" "default" { 62: name = "default-%d" 63: 64: setting { 65: name = "containerInsights" 66: value = "enabled" 67: } 68:} 69: -------- [hid 4 additional lines, adjust with --max-lines-per-finding] --------- aws/data_source_aws_ecs_service_test.go severity:warning rule:helper-acctest-RandInt-compiled: Using `acctest.RandInt()` in constant or variable declaration will execute during compilation and not randomize, pass into string generating function instead 34:var testAccCheckAwsEcsServiceDataSourceConfig = fmt.Sprintf(` 35:resource "aws_ecs_cluster" "test" { 36: name = "tf-acc-%d" 37:} 38: 39:resource "aws_ecs_task_definition" "test" { 40: family = "mongodb" 41: 42: container_definitions = < * tests: Enable XAT001, last fix * provider: Enable tfproviderdocs enhanced contents checking (#18138) Reference: https://github.com/hashicorp/terraform-provider-aws/issues/15842 Fixes remaining reports and enables the additional checking. The tooling also supports flags for requiring alphabetical list sorting, but that can be enabled in the future. Previously: ``` Error checking Terraform Provider documentation: 12 errors occurred: * website/docs/r/acmpca_certificate.html.markdown: error checking file contents: attributes section heading (Attribute Reference) should be: Attributes Reference * website/docs/r/acmpca_certificate_authority_certificate.html.markdown: error checking file contents: missing attributes section: ## Attributes Reference * website/docs/r/cognito_identity_provider.html.markdown: error checking file contents: missing attributes section: ## Attributes Reference * website/docs/r/config_conformance_pack.html.markdown: error checking file contents: attributes section byline (In addition to all arguments above (except for template_body and template_s3_uri), the following attributes are exported:) should be: "In addition to all arguments above, the following attributes are exported:" or "No additional attributes are exported." * website/docs/r/iam_user_group_membership.html.markdown: error checking file contents: attributes section byline should be: "In addition to all arguments above, the following attributes are exported:" or "No additional attributes are exported." * website/docs/r/networkfirewall_resource_policy.html.markdown: error checking file contents: attributes section byline (In addition to all arguments above, the following attribute is exported:) should be: "In addition to all arguments above, the following attributes are exported:" or "No additional attributes are exported." * website/docs/r/pinpoint_baidu_channel.markdown: error checking file contents: missing attributes section: ## Attributes Reference * website/docs/r/pinpoint_event_stream.markdown: error checking file contents: missing attributes section: ## Attributes Reference * website/docs/r/pinpoint_gcm_channel.markdown: error checking file contents: missing attributes section: ## Attributes Reference * website/docs/r/securityhub_invite_accepter.markdown: error checking file contents: attributes section byline (The following attributes are exported in addition to the arguments listed above:) should be: "In addition to all arguments above, the following attributes are exported:" or "No additional attributes are exported." * website/docs/r/ses_identity_notification_topic.markdown: error checking file contents: import section code block text should contain resource name: aws_ses_identity_notification_topic * website/docs/r/transfer_ssh_key.html.markdown: error checking file contents: missing attributes section: ## Attributes Reference Error checking Terraform Provider documentation: 1 error occurred: * website/docs/r/securityhub_invite_accepter.markdown: error checking file contents: import section code block text should contain resource name: aws_securityhub_invite_accepter ``` * docs/resource/aws_kinesis_stream_consumer: Adjust example code block language from hcl to terraform * docs/provider: Adjust remaining hcl code blocks to terraform * r/aws_apigatewayv2_domain_name: Use internal finder and waiter packages. Acceptance test output: $ ACM_CERTIFICATE_ROOT_DOMAIN=<> make testacc TEST=./aws TESTARGS='-run=TestAccAWSAPIGatewayV2DomainName_' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSAPIGatewayV2DomainName_ -timeout 180m === RUN TestAccAWSAPIGatewayV2DomainName_basic === PAUSE TestAccAWSAPIGatewayV2DomainName_basic === RUN TestAccAWSAPIGatewayV2DomainName_disappears === PAUSE TestAccAWSAPIGatewayV2DomainName_disappears === RUN TestAccAWSAPIGatewayV2DomainName_Tags === PAUSE TestAccAWSAPIGatewayV2DomainName_Tags === RUN TestAccAWSAPIGatewayV2DomainName_UpdateCertificate === PAUSE TestAccAWSAPIGatewayV2DomainName_UpdateCertificate === RUN TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication === PAUSE TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication === CONT TestAccAWSAPIGatewayV2DomainName_basic === CONT TestAccAWSAPIGatewayV2DomainName_UpdateCertificate === CONT TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication === CONT TestAccAWSAPIGatewayV2DomainName_Tags === CONT TestAccAWSAPIGatewayV2DomainName_disappears --- PASS: TestAccAWSAPIGatewayV2DomainName_disappears (24.80s) === CONT TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication resource_aws_apigatewayv2_domain_name_test.go:279: Step 2/4 error: Error running apply: exit status 1 2021/03/22 17:15:26 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.13.0 Error: error updating API Gateway v2 domain name (tf-acc-01xy3s6uqmlgijxzyxaupimtxq7sqdaldcnzlpdqz8.ewbankkit.com): BadRequestException: Invalid input. Expected one domain name configuration on terraform_plugin_test.tf line 62, in resource "aws_apigatewayv2_domain_name" "test": 62: resource "aws_apigatewayv2_domain_name" "test" { --- FAIL: TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication (194.33s) --- PASS: TestAccAWSAPIGatewayV2DomainName_basic (210.10s) --- PASS: TestAccAWSAPIGatewayV2DomainName_Tags (296.94s) --- PASS: TestAccAWSAPIGatewayV2DomainName_UpdateCertificate (430.93s) FAIL FAIL github.com/terraform-providers/terraform-provider-aws/aws 431.633s FAIL GNUmakefile:27: recipe for target 'testacc' failed make: *** [testacc] Error 1 * retry on ResourceConflictException during creation * Generate 'GetDomainNamesPages'. * r/aws_apigatewayv2_domain_name: Use internal lister package for sweeper. Acceptance test output: $ TEST=./aws SWEEP=us-west-2 SWEEPARGS=-sweep-run=aws_apigatewayv2_domain_name make sweep WARNING: This will destroy infrastructure. Use only in development accounts. go test ./aws -v -sweep=us-west-2 -sweep-run=aws_apigatewayv2_domain_name -timeout 60m 2021/03/23 10:24:20 [DEBUG] Running Sweepers for region (us-west-2): 2021/03/23 10:24:20 [DEBUG] Running Sweeper (aws_apigatewayv2_domain_name) in region (us-west-2) 2021/03/23 10:24:20 [INFO] AWS Auth provider used: "EnvProvider" 2021/03/23 10:24:20 [DEBUG] Trying to get account information via sts:GetCallerIdentity 2021/03/23 10:24:21 [DEBUG] Trying to get account information via sts:GetCallerIdentity 2021/03/23 10:24:22 [DEBUG] Deleting API Gateway v2 domain name (testing1.ewbankkit.com) 2021/03/23 10:24:23 Sweeper Tests ran successfully: - aws_apigatewayv2_domain_name ok github.com/terraform-providers/terraform-provider-aws/aws 2.324s * Add enable_execute_command to aws_ecs_service Make tflint happy * r/aws_apigatewayv2_domain_name: Always send domain name configuration on update of mutual TLS configuration. Acceptance test output: $ ACM_CERTIFICATE_ROOT_DOMAIN=ewbankkit.com make testacc TEST=./aws TESTARGS='-run=TestAccAWSAPIGatewayV2DomainName_' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSAPIGatewayV2DomainName_ -timeout 180m === RUN TestAccAWSAPIGatewayV2DomainName_basic === PAUSE TestAccAWSAPIGatewayV2DomainName_basic === RUN TestAccAWSAPIGatewayV2DomainName_disappears === PAUSE TestAccAWSAPIGatewayV2DomainName_disappears === RUN TestAccAWSAPIGatewayV2DomainName_Tags === PAUSE TestAccAWSAPIGatewayV2DomainName_Tags === RUN TestAccAWSAPIGatewayV2DomainName_UpdateCertificate === PAUSE TestAccAWSAPIGatewayV2DomainName_UpdateCertificate === RUN TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication === PAUSE TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication === CONT TestAccAWSAPIGatewayV2DomainName_basic === CONT TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication === CONT TestAccAWSAPIGatewayV2DomainName_UpdateCertificate === CONT TestAccAWSAPIGatewayV2DomainName_Tags === CONT TestAccAWSAPIGatewayV2DomainName_disappears --- PASS: TestAccAWSAPIGatewayV2DomainName_Tags (52.69s) --- PASS: TestAccAWSAPIGatewayV2DomainName_disappears (121.05s) --- PASS: TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication (263.95s) --- PASS: TestAccAWSAPIGatewayV2DomainName_basic (347.90s) --- PASS: TestAccAWSAPIGatewayV2DomainName_UpdateCertificate (469.99s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 470.492s * Add CHANGELOG entry. * tests/resource/aws_vpc_peering_connection: Remove ID-only refresh configuration (#18349) Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18348 Identifier only refresh testing is generally a legacy testing practice before full import testing was the normal convention. Certain functionality of `IDRefreshName` testing, such as alternate providers defined by the test configuration and `ProviderFactories`, is not compatible since there is no method to pass in the original configuration to prevent Terraform CLI errors such as: ``` === CONT TestAccAWSVPCPeeringConnection_region testing_new.go:214: Error running terraform refresh: exit status 1 Error: Provider configuration not present To work with aws_vpc.peer (orphan) its original provider configuration at provider["registry.terraform.io/hashicorp/awsalternate"] is required, but it has been removed. This occurs when a provider configuration is removed while objects created by that provider still exist in the state. Re-add the provider configuration to destroy aws_vpc.peer (orphan), after which you can remove the provider configuration again. --- FAIL: TestAccAWSVPCPeeringConnection_region (24.38s) ``` Import testing accepts a `Config`, which is how it does not have a similar issue. Will submit followup issue to fix the Go documentation in the Terraform Plugin SDK as this testing is not run by default and note this limitation. Will also submit followup issue to remove `IDRefreshIgnore` and `IDRefreshName` from all testing. Output from acceptance testing: ``` --- PASS: TestAccAWSVPCPeeringConnection_peerRegionAutoAccept (13.29s) --- PASS: TestAccAWSVPCPeeringConnection_failedState (14.70s) --- PASS: TestAccAWSVPCPeeringConnection_plan (24.21s) --- PASS: TestAccAWSVPCPeeringConnection_optionsNoAutoAccept (25.87s) --- PASS: TestAccAWSVPCPeeringConnection_basic (27.94s) --- PASS: TestAccAWSVPCPeeringConnection_region (30.92s) --- PASS: TestAccAWSVPCPeeringConnection_options (60.28s) --- PASS: TestAccAWSVPCPeeringConnection_accept (61.32s) --- PASS: TestAccAWSVPCPeeringConnection_tags (62.79s) ``` * Updates documentation for `automatic_failover_enabled` to remove reference to multi-az and add requirement for `number_cache_clusters` * tests/provider: Fix and enable AWS SDK Go pointer conversion linting (C resources) (#18335) Reference: https://github.com/hashicorp/terraform-provider-aws/issues/12992 Previously: ``` aws/resource_aws_cloud9_environment_ec2.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 132: status := *out.Status aws/resource_aws_cloudfront_distribution_test.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 53: distributionID := *distributionSummary.Id aws/resource_aws_cloudfront_origin_request_policy.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 161: originRequestPolicy := *resp.OriginRequestPolicy.OriginRequestPolicyConfig aws/resource_aws_cloudtrail.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 569: item["read_write_type"] = *raw.ReadWriteType -------------------------------------------------------------------------------- 570: item["include_management_events"] = *raw.IncludeManagementEvents -------------------------------------------------------------------------------- 584: item["type"] = *raw.Type -------------------------------------------------------------------------------- severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 262: if d.Id() == *c.Name { aws/resource_aws_cloudwatch_log_destination.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 142: if *destination.DestinationName == name { aws/resource_aws_cloudwatch_log_metric_filter.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 173: if *mf.FilterName == name { aws/resource_aws_cloudwatch_log_resource_policy.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 107: if *resourcePolicy.PolicyName == name { aws/resource_aws_cloudwatch_log_stream.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 152: if *ls.LogStreamName == name { aws/resource_aws_cloudwatch_metric_alarm.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 310: arn := *resp.AlarmArn -------------------------------------------------------------------------------- 581: flatDims[*d.Name] = *d.Value aws/resource_aws_codedeploy_deployment_group.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 1111: l["key"] = *tf.Key -------------------------------------------------------------------------------- 1114: l["value"] = *tf.Value -------------------------------------------------------------------------------- 1117: l["type"] = *tf.Type -------------------------------------------------------------------------------- 1130: l["key"] = *tf.Key -------------------------------------------------------------------------------- 1133: l["value"] = *tf.Value -------------------------------------------------------------------------------- 1136: l["type"] = *tf.Type -------------------------------------------------------------------------------- 1171: item["trigger_name"] = *tc.TriggerName -------------------------------------------------------------------------------- 1172: item["trigger_target_arn"] = *tc.TriggerTargetArn -------------------------------------------------------------------------------- 1187: item["enabled"] = *config.Enabled -------------------------------------------------------------------------------- 1210: item["enabled"] = *config.Enabled -------------------------------------------------------------------------------- 1211: item["ignore_poll_alarm_failure"] = *config.IgnorePollAlarmFailure -------------------------------------------------------------------------------- 1315: item["deployment_option"] = *style.DeploymentOption -------------------------------------------------------------------------------- 1318: item["deployment_type"] = *style.DeploymentType -------------------------------------------------------------------------------- 1355: deploymentReadyOption["action_on_timeout"] = *config.DeploymentReadyOption.ActionOnTimeout -------------------------------------------------------------------------------- 1358: deploymentReadyOption["wait_time_in_minutes"] = *config.DeploymentReadyOption.WaitTimeInMinutes -------------------------------------------------------------------------------- 1369: greenFleetProvisioningOption["action"] = *config.GreenFleetProvisioningOption.Action -------------------------------------------------------------------------------- 1380: blueInstanceTerminationOption["action"] = *config.TerminateBlueInstancesOnDeploymentSuccess.Action -------------------------------------------------------------------------------- 1383: blueInstanceTerminationOption["termination_wait_time_in_minutes"] = *config.TerminateBlueInstancesOnDeploymentSuccess.TerminationWaitTimeInMinutes -------------------------------------------------------------------------------- severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 1110: if tf.Key != nil && *tf.Key != "" { -------------------------------------------------------------------------------- 1113: if tf.Value != nil && *tf.Value != "" { -------------------------------------------------------------------------------- 1116: if tf.Type != nil && *tf.Type != "" { -------------------------------------------------------------------------------- 1129: if tf.Key != nil && *tf.Key != "" { -------------------------------------------------------------------------------- 1132: if tf.Value != nil && *tf.Value != "" { -------------------------------------------------------------------------------- 1135: if tf.Type != nil && *tf.Type != "" { aws/resource_aws_codepipeline.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 464: m[k] = *v aws/resource_aws_config_remediation_configuration.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 123: item["resource_value"] = *value.ResourceValue.Value -------------------------------------------------------------------------------- 126: item["static_value"] = *value.StaticValue.Values[0] ran 15 rules on 2163 files: 40 findings ``` Output from acceptance testing: ``` --- PASS: TestAccAWSCloud9EnvironmentEc2_allFields (286.70s) --- PASS: TestAccAWSCloud9EnvironmentEc2_basic (209.52s) --- PASS: TestAccAWSCloud9EnvironmentEc2_disappears (170.86s) --- PASS: TestAccAWSCloud9EnvironmentEc2_tags (232.19s) --- PASS: TestAccAWSCloudFrontOriginRequestPolicy_basic (19.69s) --- PASS: TestAccAWSCloudFrontOriginRequestPolicy_noneBehavior (22.64s) --- PASS: TestAccAWSCloudFrontOriginRequestPolicy_update (37.49s) --- FAIL: TestAccAWSCloudTrail_serial (656.14s) --- FAIL: TestAccAWSCloudTrail_serial/Trail (656.14s) --- FAIL: TestAccAWSCloudTrail_serial/Trail/basic (48.14s) # Account permissions --- FAIL: TestAccAWSCloudTrail_serial/Trail/enableLogging (46.70s) # Account permissions --- PASS: TestAccAWSCloudTrail_serial/Trail/cloudwatch (73.41s) --- PASS: TestAccAWSCloudTrail_serial/Trail/eventSelector (138.13s) --- PASS: TestAccAWSCloudTrail_serial/Trail/includeGlobalServiceEvents (35.63s) --- PASS: TestAccAWSCloudTrail_serial/Trail/insightSelector (35.46s) --- PASS: TestAccAWSCloudTrail_serial/Trail/isMultiRegion (91.64s) --- PASS: TestAccAWSCloudTrail_serial/Trail/kmsKey (35.12s) --- PASS: TestAccAWSCloudTrail_serial/Trail/logValidation (65.09s) --- PASS: TestAccAWSCloudTrail_serial/Trail/tags (86.69s) --- SKIP: TestAccAWSCloudTrail_serial/Trail/isOrganization (0.13s) --- PASS: TestAccAWSCloudwatchLogDestination_basic (84.11s) --- PASS: TestAccAWSCloudwatchLogDestination_disappears (88.96s) --- PASS: TestAccAWSCloudWatchLogMetricFilter_basic (92.40s) --- PASS: TestAccAWSCloudWatchLogResourcePolicy_basic (32.98s) --- PASS: TestAccAWSCloudWatchLogStream_basic (21.49s) --- PASS: TestAccAWSCloudWatchLogStream_disappears (20.86s) --- PASS: TestAccAWSCloudWatchLogStream_disappears_LogGroup (20.50s) --- PASS: TestAccAWSCloudWatchMetricAlarm_AlarmActions_EC2Automate (252.05s) --- PASS: TestAccAWSCloudWatchMetricAlarm_AlarmActions_SNSTopic (26.06s) --- PASS: TestAccAWSCloudWatchMetricAlarm_AlarmActions_SWFAction (27.65s) --- PASS: TestAccAWSCloudWatchMetricAlarm_basic (23.92s) --- PASS: TestAccAWSCloudWatchMetricAlarm_datapointsToAlarm (17.54s) --- PASS: TestAccAWSCloudWatchMetricAlarm_disappears (18.25s) --- PASS: TestAccAWSCloudWatchMetricAlarm_evaluateLowSampleCountPercentiles (42.33s) --- PASS: TestAccAWSCloudWatchMetricAlarm_expression (96.17s) --- PASS: TestAccAWSCloudWatchMetricAlarm_extendedStatistic (19.08s) --- PASS: TestAccAWSCloudWatchMetricAlarm_missingStatistic (5.29s) --- PASS: TestAccAWSCloudWatchMetricAlarm_tags (62.51s) --- PASS: TestAccAWSCloudWatchMetricAlarm_treatMissingData (42.33s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_alarmConfiguration_create (33.38s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_alarmConfiguration_delete (51.51s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_alarmConfiguration_disable (38.86s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_alarmConfiguration_update (40.28s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_autoRollbackConfiguration_create (43.51s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_autoRollbackConfiguration_delete (61.36s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_autoRollbackConfiguration_disable (42.37s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_autoRollbackConfiguration_update (64.37s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_basic (71.37s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_basic_tagSet (61.98s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_blueGreenDeployment_complete (46.42s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_blueGreenDeploymentConfiguration_create (151.03s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_blueGreenDeploymentConfiguration_delete (48.72s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_blueGreenDeploymentConfiguration_update (45.77s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_blueGreenDeploymentConfiguration_update_with_asg (177.57s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_deploymentStyle_create (31.64s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_deploymentStyle_default (31.74s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_deploymentStyle_delete (45.98s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_deploymentStyle_update (43.92s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_disappears (30.83s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_ECS_BlueGreen (310.19s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_inPlaceDeploymentWithTrafficControl_create (35.95s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_inPlaceDeploymentWithTrafficControl_update (54.46s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_create (32.28s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_delete (44.30s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_targetGroupInfo_create (43.70s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_targetGroupInfo_delete (67.73s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_targetGroupInfo_update (45.46s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_update (64.46s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_onPremiseTag (41.70s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_triggerConfiguration_basic (71.08s) --- PASS: TestAccAWSCodeDeployDeploymentGroup_triggerConfiguration_multiple (73.36s) --- FAIL: TestAccAWSCodePipeline_multiregion_ConvertSingleRegion (83.25s) # https://github.com/hashicorp/terraform-provider-aws/issues/16706 --- PASS: TestAccAWSCodePipeline_basic (72.08s) --- PASS: TestAccAWSCodePipeline_deployWithServiceRole (47.91s) --- PASS: TestAccAWSCodePipeline_disappears (37.13s) --- PASS: TestAccAWSCodePipeline_emptyStageArtifacts (43.65s) --- PASS: TestAccAWSCodePipeline_multiregion_basic (46.08s) --- PASS: TestAccAWSCodePipeline_multiregion_Update (73.72s) --- PASS: TestAccAWSCodePipeline_tags (98.61s) --- PASS: TestAccAWSCodePipeline_WithNamespace (49.41s) --- SKIP: TestAccAWSCodePipeline_WithGitHubv1SourceAction (0.00s) --- PASS: TestAccAWSConfig_serial (3698.82s) --- PASS: TestAccAWSConfig_serial/RemediationConfiguration (364.40s) --- PASS: TestAccAWSConfig_serial/RemediationConfiguration/basic (86.05s) --- PASS: TestAccAWSConfig_serial/RemediationConfiguration/disappears (83.00s) --- PASS: TestAccAWSConfig_serial/RemediationConfiguration/recreates (99.34s) --- PASS: TestAccAWSConfig_serial/RemediationConfiguration/updates (96.01s) ``` * Prevent re-creation when encryption enabled * r/aws_mq_configuration: add missing authentication_strategy When creating an ActiveMQ instance with authentication_strategy=ldap, then the corresponding configuration has to contain the same option as well for the user to be able to include a cachedLDAPAuthorizationMap element in the broker xml configuration. If the option is not provided when creating the configuration, the default strategy "simple" is assumed and AWS automatically removes the cachedLDAPAuthorizationMap element. * Fix terraform test configuration format * Add PR changelog file. * mq_configuration: Update changelog * tests/mq_configuration: Add ErrorCheck * r/mq_configuration: Add RabbitMQ engine type, minor cleanup * tests/r/mq_configuration: Standardized naming * docs/r/mq_configuration: Minor cleanup of docs * Add 'semgrep' target. * tests/r/mq_configuration: Add partition service PreCheck * support lightsail open ports resource * build(deps): bump github.com/bflad/tfproviderlint from 0.23.0 to 0.24.0 in /awsproviderlint (#18368) * build(deps): bump github.com/bflad/tfproviderlint in /awsproviderlint Bumps [github.com/bflad/tfproviderlint](https://github.com/bflad/tfproviderlint) from 0.23.0 to 0.24.0. - [Release notes](https://github.com/bflad/tfproviderlint/releases) - [Changelog](https://github.com/bflad/tfproviderlint/blob/main/CHANGELOG.md) - [Commits](https://github.com/bflad/tfproviderlint/compare/v0.23.0...v0.24.0) Signed-off-by: dependabot[bot] * tests/provider: Disable new failing tfproviderlint reports for now Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18354 Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18377 Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18378 Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18379 Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18380 Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18381 Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Brian Flad * Update CHANGELOG.md for #18368 * remove incorrect deprecation warning for single_header argument * Fixes Terraform formatting * Adds CHANGELOG * Update CHANGELOG for #18384 * r/aws_api_gateway_vpc_link: Persist ID of newly created VPC Link when it fails to reach Available state (#18382) * r/aws_api_gateway_vpc_link: Persist ID of new;y created VPC Link when it fails to reach Available state. Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSAPIGatewayVpcLink_basic' ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAWSAPIGatewayVpcLink_basic -timeout 180m === RUN TestAccAWSAPIGatewayVpcLink_basic === PAUSE TestAccAWSAPIGatewayVpcLink_basic === CONT TestAccAWSAPIGatewayVpcLink_basic --- PASS: TestAccAWSAPIGatewayVpcLink_basic (750.44s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 750.547s * Add CHANGELOG entry. * Update CHANGELOG.md for #18384 * aws_vpc: Correct the ARN account id (#17729) * aws_vpc: Correct the ARN account id * Remove aws_vpc from the document * r/lightsail_instance_public_ports: Add changelog * r/lightsail_instance_public_ports: New resource * docs/lightsail_instance_public_ports: Add docs for new resource * r/lightsail_instance_public_ports: Clean up new resource * tests/r/lightsail_instance_public_ports: Add tests * tests/lightsail_instance_public_ports: Lint * docs/r/lightsail_instance_public_ports: Lint * docs/r/lightsail_instance_public_ports: Lint * docs/r/lightsail_instance_public_ports: Lint * Update CHANGELOG.md for #18361 * Add cidrs attribute to aws_lightsail_instance_public_ports resource * build(deps): Bump github.com/hashicorp/terraform-plugin-sdk/v2 (#18395) Bumps [github.com/hashicorp/terraform-plugin-sdk/v2](https://github.com/hashicorp/terraform-plugin-sdk) from 2.4.4 to 2.5.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-sdk/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/terraform-plugin-sdk/compare/v2.4.4...v2.5.0) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update CHANGELOG.md for #18395 * build(deps): Bump github.com/hashicorp/terraform-plugin-sdk/v2 (#18396) * r/lightsail_instance_public_ports: Alphabetize args * docs/r/lightsail_instance_public_ports: Minor fix * r/lightsail_instance_public_ports: Change CIDRs to set * tests/r/lightsail_instance_public_ports: Nested attr check * r/lightsail_instance_public_ports: Add changelog * docs/r/lightsail_instance_public_ports: Fix docs * tests/r/lightsail_instance_public_ports: Use set testing * r/aws_route: Refactor acceptance tests in preparation for future fixes/enhancements. * Fixes after rebase. * resource/aws_pinpoint_email_channel: Support using SES configuration set and add plan time validations (#18314) Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSPinpointEmailChannel_disappears (19.13s) --- PASS: TestAccAWSPinpointEmailChannel_configurationSet (22.62s) --- PASS: TestAccAWSPinpointEmailChannel_basic (34.66s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSPinpointEmailChannel_disappears (27.30s) --- PASS: TestAccAWSPinpointEmailChannel_configurationSet (33.09s) --- PASS: TestAccAWSPinpointEmailChannel_basic (53.08s) ``` * Update CHANGELOG.md for #18042 * Add missing parameter on test config * resource/aws_pinpoint_event_stream: Update IAM error retry logic to match Contributing Guide Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSPinpointEventStream_disappears (71.12s) --- PASS: TestAccAWSPinpointEventStream_basic (143.79s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSPinpointEventStream_disappears (69.10s) --- PASS: TestAccAWSPinpointEventStream_basic (148.10s) ``` * Add ErrorCheck to test * Update aws/resource_aws_iam_server_certificate.go Co-authored-by: Brian Flad * Add ForceNew to ecs_service service_registries * Create CHANGELOG entry * r/ecs_service: Remove duplicate fields * tests/r/ecs_service: Add ErrorCheck * ecs_service: Update changelog, tests * Update CHANGELOG.md for #18408 * docs/resource/aws_iam_server_certificate: Move tags documentation to arguments Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSIAMServerCertificate_disappears (14.13s) --- PASS: TestAccAWSIAMServerCertificate_name_prefix (15.89s) --- PASS: TestAccAWSIAMServerCertificate_Path (18.27s) --- PASS: TestAccAWSIAMServerCertificate_basic (18.19s) --- PASS: TestAccAWSIAMServerCertificate_file (31.71s) --- PASS: TestAccAWSIAMServerCertificate_tags (40.61s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSIAMServerCertificate_disappears (17.41s) --- PASS: TestAccAWSIAMServerCertificate_name_prefix (20.05s) --- PASS: TestAccAWSIAMServerCertificate_basic (22.42s) --- PASS: TestAccAWSIAMServerCertificate_Path (22.36s) --- PASS: TestAccAWSIAMServerCertificate_file (37.52s) --- PASS: TestAccAWSIAMServerCertificate_tags (51.54s) ``` * Update aws/resource_aws_iam_saml_provider_test.go * r/aws_route: Refactor acceptance tests in preparation for future fixes/enhancements. * r/aws_route: Incorporate relevant changes from #16219. * r/aws_route: Correct capitalization of 'IPv4' and 'IPv6'. Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSRoute_' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSRoute_ -timeout 120m === RUN TestAccAWSRoute_basic === PAUSE TestAccAWSRoute_basic === RUN TestAccAWSRoute_disappears === PAUSE TestAccAWSRoute_disappears === RUN TestAccAWSRoute_disappears_RouteTable === PAUSE TestAccAWSRoute_disappears_RouteTable === RUN TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway === PAUSE TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway === RUN TestAccAWSRoute_IPv6_To_InternetGateway === PAUSE TestAccAWSRoute_IPv6_To_InternetGateway === RUN TestAccAWSRoute_IPv6_To_Instance === PAUSE TestAccAWSRoute_IPv6_To_Instance === RUN TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached === PAUSE TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached === RUN TestAccAWSRoute_IPv6_To_VpcPeeringConnection === PAUSE TestAccAWSRoute_IPv6_To_VpcPeeringConnection === RUN TestAccAWSRoute_IPv6_To_VpnGateway === PAUSE TestAccAWSRoute_IPv6_To_VpnGateway === RUN TestAccAWSRoute_IPv4_To_VpnGateway === PAUSE TestAccAWSRoute_IPv4_To_VpnGateway === RUN TestAccAWSRoute_IPv4_To_Instance === PAUSE TestAccAWSRoute_IPv4_To_Instance === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_Attached === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_Attached === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments === RUN TestAccAWSRoute_IPv4_To_VpcPeeringConnection === PAUSE TestAccAWSRoute_IPv4_To_VpcPeeringConnection === RUN TestAccAWSRoute_IPv4_To_NatGateway === PAUSE TestAccAWSRoute_IPv4_To_NatGateway === RUN TestAccAWSRoute_DoesNotCrashWithVpcEndpoint === PAUSE TestAccAWSRoute_DoesNotCrashWithVpcEndpoint === RUN TestAccAWSRoute_IPv4_To_TransitGateway === PAUSE TestAccAWSRoute_IPv4_To_TransitGateway === RUN TestAccAWSRoute_IPv6_To_TransitGateway === PAUSE TestAccAWSRoute_IPv6_To_TransitGateway === RUN TestAccAWSRoute_IPv4_To_LocalGateway === PAUSE TestAccAWSRoute_IPv4_To_LocalGateway === RUN TestAccAWSRoute_IPv6_To_LocalGateway === PAUSE TestAccAWSRoute_IPv6_To_LocalGateway === RUN TestAccAWSRoute_ConditionalCidrBlock === PAUSE TestAccAWSRoute_ConditionalCidrBlock === RUN TestAccAWSRoute_IPv4_Update_Target === PAUSE TestAccAWSRoute_IPv4_Update_Target === RUN TestAccAWSRoute_IPv6_Update_Target === PAUSE TestAccAWSRoute_IPv6_Update_Target === RUN TestAccAWSRoute_IPv4_To_VpcEndpoint === PAUSE TestAccAWSRoute_IPv4_To_VpcEndpoint === RUN TestAccAWSRoute_LocalRoute === PAUSE TestAccAWSRoute_LocalRoute === CONT TestAccAWSRoute_basic === CONT TestAccAWSRoute_IPv4_To_VpcPeeringConnection --- PASS: TestAccAWSRoute_IPv4_To_VpcPeeringConnection (27.43s) === CONT TestAccAWSRoute_LocalRoute --- PASS: TestAccAWSRoute_basic (36.72s) === CONT TestAccAWSRoute_IPv4_To_VpcEndpoint --- PASS: TestAccAWSRoute_LocalRoute (21.98s) === CONT TestAccAWSRoute_IPv6_Update_Target --- PASS: TestAccAWSRoute_IPv6_Update_Target (226.03s) === CONT TestAccAWSRoute_IPv4_Update_Target --- PASS: TestAccAWSRoute_IPv4_To_VpcEndpoint (273.71s) === CONT TestAccAWSRoute_ConditionalCidrBlock === CONT TestAccAWSRoute_IPv6_To_LocalGateway --- PASS: TestAccAWSRoute_ConditionalCidrBlock (51.91s) === CONT TestAccAWSRoute_IPv6_To_LocalGateway data_source_aws_outposts_outposts_test.go:66: skipping since no Outposts found --- SKIP: TestAccAWSRoute_IPv6_To_LocalGateway (1.28s) === CONT TestAccAWSRoute_IPv4_To_LocalGateway data_source_aws_outposts_outposts_test.go:66: skipping since no Outposts found --- SKIP: TestAccAWSRoute_IPv4_To_LocalGateway (1.10s) === CONT TestAccAWSRoute_IPv6_To_TransitGateway --- PASS: TestAccAWSRoute_IPv6_To_TransitGateway (357.84s) === CONT TestAccAWSRoute_IPv4_To_TransitGateway --- PASS: TestAccAWSRoute_IPv4_Update_Target (626.78s) === CONT TestAccAWSRoute_DoesNotCrashWithVpcEndpoint --- PASS: TestAccAWSRoute_DoesNotCrashWithVpcEndpoint (43.28s) === CONT TestAccAWSRoute_IPv4_To_NatGateway --- PASS: TestAccAWSRoute_IPv4_To_TransitGateway (399.08s) === CONT TestAccAWSRoute_IPv6_To_VpcPeeringConnection --- PASS: TestAccAWSRoute_IPv6_To_VpcPeeringConnection (25.57s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments --- PASS: TestAccAWSRoute_IPv4_To_NatGateway (228.62s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_Attached --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments (190.46s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached (57.67s) === CONT TestAccAWSRoute_IPv4_To_Instance --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_Attached (340.04s) === CONT TestAccAWSRoute_IPv4_To_VpnGateway --- PASS: TestAccAWSRoute_IPv4_To_VpnGateway (35.60s) === CONT TestAccAWSRoute_IPv6_To_VpnGateway --- PASS: TestAccAWSRoute_IPv6_To_VpnGateway (41.86s) === CONT TestAccAWSRoute_IPv6_To_InternetGateway --- PASS: TestAccAWSRoute_IPv6_To_InternetGateway (34.47s) === CONT TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached --- PASS: TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached (58.80s) === CONT TestAccAWSRoute_IPv6_To_Instance --- PASS: TestAccAWSRoute_IPv4_To_Instance (326.97s) === CONT TestAccAWSRoute_disappears_RouteTable --- PASS: TestAccAWSRoute_disappears_RouteTable (33.05s) === CONT TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway --- PASS: TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway (37.46s) === CONT TestAccAWSRoute_disappears --- PASS: TestAccAWSRoute_disappears (31.77s) --- PASS: TestAccAWSRoute_IPv6_To_Instance (327.89s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 2012.898s * r/aws_route: Fix linter S1039: unnecessary use of fmt.Sprintf. * r/aws_route: Add documentation note on use of the 'gateway_id' attribute. * Add CHANGELOG entries. * r/aws_route: Return 'NotFoundError' instead of 'nil' when no route found (#15945). r/aws_route: Implement 'd.IsNewResource()' checksin 'resourceAwsRouteRead' (#16796). Acceptance test output: $ make testacc TEST=./aws TESTARGS='-run=TestAccAWSRoute_basic\|TestAccAWSRoute_disappears' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSRoute_basic\|TestAccAWSRoute_disappears -timeout 120m === RUN TestAccAWSRoute_basic === PAUSE TestAccAWSRoute_basic === RUN TestAccAWSRoute_disappears === PAUSE TestAccAWSRoute_disappears === RUN TestAccAWSRoute_disappears_RouteTable === PAUSE TestAccAWSRoute_disappears_RouteTable === CONT TestAccAWSRoute_basic === CONT TestAccAWSRoute_disappears_RouteTable --- PASS: TestAccAWSRoute_disappears_RouteTable (34.67s) === CONT TestAccAWSRoute_disappears --- PASS: TestAccAWSRoute_basic (36.39s) --- PASS: TestAccAWSRoute_disappears (31.85s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 66.620s * r/aws_route: Change 'finder.RouteTable' to 'finder.RouteTables' to support data source returning multiple route tables. Acceptance test output: $ make testacc TEST=./aws TESTARGS='-run=TestAccAWSRoute_basic\|TestAccAWSRoute_disappears' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSRoute_basic\|TestAccAWSRoute_disappears -timeout 120m === RUN TestAccAWSRoute_basic === PAUSE TestAccAWSRoute_basic === RUN TestAccAWSRoute_disappears === PAUSE TestAccAWSRoute_disappears === RUN TestAccAWSRoute_disappears_RouteTable === PAUSE TestAccAWSRoute_disappears_RouteTable === CONT TestAccAWSRoute_basic === CONT TestAccAWSRoute_disappears_RouteTable --- PASS: TestAccAWSRoute_disappears_RouteTable (33.82s) === CONT TestAccAWSRoute_disappears --- PASS: TestAccAWSRoute_basic (35.39s) --- PASS: TestAccAWSRoute_disappears (31.99s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 65.901s * Revert "r/aws_route: Change 'finder.RouteTable' to 'finder.RouteTables' to support data source returning multiple route tables." This reverts commit 5b93284766f6bea0a044e63ba5bbb5ce8e504424. * r/aws_route: Add 'testAccCheckAWSRouteExists'. Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSRoute_' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSRoute_ -timeout 120m === RUN TestAccAWSRoute_basic === PAUSE TestAccAWSRoute_basic === RUN TestAccAWSRoute_disappears === PAUSE TestAccAWSRoute_disappears === RUN TestAccAWSRoute_disappears_RouteTable === PAUSE TestAccAWSRoute_disappears_RouteTable === RUN TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway === PAUSE TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway === RUN TestAccAWSRoute_IPv6_To_InternetGateway === PAUSE TestAccAWSRoute_IPv6_To_InternetGateway === RUN TestAccAWSRoute_IPv6_To_Instance === PAUSE TestAccAWSRoute_IPv6_To_Instance === RUN TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached === PAUSE TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached === RUN TestAccAWSRoute_IPv6_To_VpcPeeringConnection === PAUSE TestAccAWSRoute_IPv6_To_VpcPeeringConnection === RUN TestAccAWSRoute_IPv6_To_VpnGateway === PAUSE TestAccAWSRoute_IPv6_To_VpnGateway === RUN TestAccAWSRoute_IPv4_To_VpnGateway === PAUSE TestAccAWSRoute_IPv4_To_VpnGateway === RUN TestAccAWSRoute_IPv4_To_Instance === PAUSE TestAccAWSRoute_IPv4_To_Instance === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_Attached === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_Attached === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments === RUN TestAccAWSRoute_IPv4_To_VpcPeeringConnection === PAUSE TestAccAWSRoute_IPv4_To_VpcPeeringConnection === RUN TestAccAWSRoute_IPv4_To_NatGateway === PAUSE TestAccAWSRoute_IPv4_To_NatGateway === RUN TestAccAWSRoute_DoesNotCrashWithVpcEndpoint === PAUSE TestAccAWSRoute_DoesNotCrashWithVpcEndpoint === RUN TestAccAWSRoute_IPv4_To_TransitGateway === PAUSE TestAccAWSRoute_IPv4_To_TransitGateway === RUN TestAccAWSRoute_IPv6_To_TransitGateway === PAUSE TestAccAWSRoute_IPv6_To_TransitGateway === RUN TestAccAWSRoute_IPv4_To_LocalGateway === PAUSE TestAccAWSRoute_IPv4_To_LocalGateway === RUN TestAccAWSRoute_IPv6_To_LocalGateway === PAUSE TestAccAWSRoute_IPv6_To_LocalGateway === RUN TestAccAWSRoute_ConditionalCidrBlock === PAUSE TestAccAWSRoute_ConditionalCidrBlock === RUN TestAccAWSRoute_IPv4_Update_Target === PAUSE TestAccAWSRoute_IPv4_Update_Target === RUN TestAccAWSRoute_IPv6_Update_Target === PAUSE TestAccAWSRoute_IPv6_Update_Target === RUN TestAccAWSRoute_IPv4_To_VpcEndpoint === PAUSE TestAccAWSRoute_IPv4_To_VpcEndpoint === RUN TestAccAWSRoute_LocalRoute === PAUSE TestAccAWSRoute_LocalRoute === CONT TestAccAWSRoute_basic === CONT TestAccAWSRoute_IPv4_To_VpcPeeringConnection --- PASS: TestAccAWSRoute_IPv4_To_VpcPeeringConnection (27.59s) === CONT TestAccAWSRoute_LocalRoute --- PASS: TestAccAWSRoute_basic (36.97s) === CONT TestAccAWSRoute_IPv4_To_VpcEndpoint --- PASS: TestAccAWSRoute_LocalRoute (22.34s) === CONT TestAccAWSRoute_IPv6_Update_Target === CONT TestAccAWSRoute_IPv4_To_VpcEndpoint resource_aws_route_test.go:1305: Step 1/2 error: Error running apply: 2021/01/24 16:28:27 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.12.0 Error: error waiting for VPC Endpoint (vpce-0467b8bc3339b49d3) to become available: VPC Endpoint is in a failed state --- FAIL: TestAccAWSRoute_IPv4_To_VpcEndpoint (117.58s) === CONT TestAccAWSRoute_IPv4_Update_Target --- PASS: TestAccAWSRoute_IPv6_Update_Target (240.69s) === CONT TestAccAWSRoute_ConditionalCidrBlock === CONT TestAccAWSRoute_IPv4_Update_Target resource_aws_route_test.go:961: Step 1/9 error: Error running apply: 2021/01/24 16:30:26 [DEBUG] Using modified User-Agent: Terraform/0.12.26 HashiCorp-terraform-exec/0.12.0 Error: error waiting for VPC Endpoint (vpce-00b5c230eaa0bb041) to become available: VPC Endpoint is in a failed state --- PASS: TestAccAWSRoute_ConditionalCidrBlock (53.83s) === CONT TestAccAWSRoute_IPv6_To_LocalGateway data_source_aws_outposts_outposts_test.go:66: skipping since no Outposts found --- SKIP: TestAccAWSRoute_IPv6_To_LocalGateway (1.20s) === CONT TestAccAWSRoute_IPv4_To_LocalGateway data_source_aws_outposts_outposts_test.go:66: skipping since no Outposts found --- SKIP: TestAccAWSRoute_IPv4_To_LocalGateway (1.09s) === CONT TestAccAWSRoute_IPv6_To_TransitGateway --- FAIL: TestAccAWSRoute_IPv4_Update_Target (293.81s) === CONT TestAccAWSRoute_IPv4_To_TransitGateway --- PASS: TestAccAWSRoute_IPv6_To_TransitGateway (398.85s) === CONT TestAccAWSRoute_DoesNotCrashWithVpcEndpoint --- PASS: TestAccAWSRoute_DoesNotCrashWithVpcEndpoint (43.25s) === CONT TestAccAWSRoute_IPv4_To_NatGateway --- PASS: TestAccAWSRoute_IPv4_To_TransitGateway (357.85s) === CONT TestAccAWSRoute_IPv6_To_VpcPeeringConnection --- PASS: TestAccAWSRoute_IPv6_To_VpcPeeringConnection (25.91s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments --- PASS: TestAccAWSRoute_IPv4_To_NatGateway (198.68s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_Attached --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments (188.15s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached (58.13s) === CONT TestAccAWSRoute_IPv4_To_Instance --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_Attached (350.41s) === CONT TestAccAWSRoute_IPv4_To_VpnGateway --- PASS: TestAccAWSRoute_IPv4_To_VpnGateway (55.38s) === CONT TestAccAWSRoute_IPv6_To_VpnGateway --- PASS: TestAccAWSRoute_IPv4_To_Instance (326.27s) === CONT TestAccAWSRoute_IPv6_To_InternetGateway --- PASS: TestAccAWSRoute_IPv6_To_VpnGateway (41.21s) === CONT TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached --- PASS: TestAccAWSRoute_IPv6_To_InternetGateway (35.53s) === CONT TestAccAWSRoute_IPv6_To_Instance --- PASS: TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached (58.52s) === CONT TestAccAWSRoute_disappears_RouteTable --- PASS: TestAccAWSRoute_disappears_RouteTable (33.04s) === CONT TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway --- PASS: TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway (37.15s) === CONT TestAccAWSRoute_disappears --- PASS: TestAccAWSRoute_disappears (32.57s) --- PASS: TestAccAWSRoute_IPv6_To_Instance (349.57s) FAIL FAIL github.com/terraform-providers/terraform-provider-aws/aws 1789.890s FAIL GNUmakefile:27: recipe for target 'testacc' failed make: *** [testacc] Error 1 Failures are unrelated to this change. * Minor tweak to 'finder.RouteTable'. * Remove 'tflint' check as aws_route targets are now validated by the resource itself. * docs/resource/aws_iam_saml_provider: Move tags to arguments section * tests/resource/aws_iam_server_certificate: Add missing ErrorCheck (#18413) Previously: ``` aws/resource_aws_iam_server_certificate_test.go:154:36: XAT001: missing ErrorCheck 153 154 resource.ParallelTest(t, resource.TestCase{ 155 PreCheck: func() { testAccPreCheck(t) }, ``` Output from acceptance testing: ``` --- PASS: TestAccAWSIAMServerCertificate_name_prefix (15.33s) ``` * Update CHANGELOG.md for #18413 * r/aws_route: Add 'ErrorCheck' to new acceptance tests. Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSRoute_' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSRoute_ -timeout 180m === RUN TestAccAWSRoute_basic === PAUSE TestAccAWSRoute_basic === RUN TestAccAWSRoute_disappears === PAUSE TestAccAWSRoute_disappears === RUN TestAccAWSRoute_disappears_RouteTable === PAUSE TestAccAWSRoute_disappears_RouteTable === RUN TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway === PAUSE TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway === RUN TestAccAWSRoute_IPv6_To_InternetGateway === PAUSE TestAccAWSRoute_IPv6_To_InternetGateway === RUN TestAccAWSRoute_IPv6_To_Instance === PAUSE TestAccAWSRoute_IPv6_To_Instance === RUN TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached === PAUSE TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached === RUN TestAccAWSRoute_IPv6_To_VpcPeeringConnection === PAUSE TestAccAWSRoute_IPv6_To_VpcPeeringConnection === RUN TestAccAWSRoute_IPv6_To_VpnGateway === PAUSE TestAccAWSRoute_IPv6_To_VpnGateway === RUN TestAccAWSRoute_IPv4_To_VpnGateway === PAUSE TestAccAWSRoute_IPv4_To_VpnGateway === RUN TestAccAWSRoute_IPv4_To_Instance === PAUSE TestAccAWSRoute_IPv4_To_Instance === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_Attached === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_Attached === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments === RUN TestAccAWSRoute_IPv4_To_VpcPeeringConnection === PAUSE TestAccAWSRoute_IPv4_To_VpcPeeringConnection === RUN TestAccAWSRoute_IPv4_To_NatGateway === PAUSE TestAccAWSRoute_IPv4_To_NatGateway === RUN TestAccAWSRoute_DoesNotCrashWithVpcEndpoint === PAUSE TestAccAWSRoute_DoesNotCrashWithVpcEndpoint === RUN TestAccAWSRoute_IPv4_To_TransitGateway === PAUSE TestAccAWSRoute_IPv4_To_TransitGateway === RUN TestAccAWSRoute_IPv6_To_TransitGateway === PAUSE TestAccAWSRoute_IPv6_To_TransitGateway === RUN TestAccAWSRoute_IPv4_To_LocalGateway === PAUSE TestAccAWSRoute_IPv4_To_LocalGateway === RUN TestAccAWSRoute_IPv6_To_LocalGateway === PAUSE TestAccAWSRoute_IPv6_To_LocalGateway === RUN TestAccAWSRoute_ConditionalCidrBlock === PAUSE TestAccAWSRoute_ConditionalCidrBlock === RUN TestAccAWSRoute_IPv4_Update_Target === PAUSE TestAccAWSRoute_IPv4_Update_Target === RUN TestAccAWSRoute_IPv6_Update_Target === PAUSE TestAccAWSRoute_IPv6_Update_Target === RUN TestAccAWSRoute_IPv4_To_VpcEndpoint === PAUSE TestAccAWSRoute_IPv4_To_VpcEndpoint === RUN TestAccAWSRoute_LocalRoute === PAUSE TestAccAWSRoute_LocalRoute === CONT TestAccAWSRoute_basic === CONT TestAccAWSRoute_IPv4_To_VpcPeeringConnection --- PASS: TestAccAWSRoute_IPv4_To_VpcPeeringConnection (28.45s) === CONT TestAccAWSRoute_LocalRoute --- PASS: TestAccAWSRoute_basic (38.00s) === CONT TestAccAWSRoute_IPv4_To_VpcEndpoint --- PASS: TestAccAWSRoute_LocalRoute (22.59s) === CONT TestAccAWSRoute_IPv6_Update_Target --- PASS: TestAccAWSRoute_IPv6_Update_Target (232.50s) === CONT TestAccAWSRoute_IPv4_Update_Target --- PASS: TestAccAWSRoute_IPv4_To_VpcEndpoint (338.09s) === CONT TestAccAWSRoute_ConditionalCidrBlock --- PASS: TestAccAWSRoute_ConditionalCidrBlock (53.66s) === CONT TestAccAWSRoute_IPv6_To_LocalGateway data_source_aws_outposts_outposts_test.go:67: skipping since no Outposts found --- SKIP: TestAccAWSRoute_IPv6_To_LocalGateway (0.67s) === CONT TestAccAWSRoute_IPv4_To_LocalGateway data_source_aws_outposts_outposts_test.go:67: skipping since no Outposts found --- SKIP: TestAccAWSRoute_IPv4_To_LocalGateway (0.53s) === CONT TestAccAWSRoute_IPv6_To_TransitGateway --- PASS: TestAccAWSRoute_IPv6_To_TransitGateway (379.86s) === CONT TestAccAWSRoute_IPv4_To_TransitGateway --- PASS: TestAccAWSRoute_IPv4_Update_Target (649.40s) === CONT TestAccAWSRoute_DoesNotCrashWithVpcEndpoint --- PASS: TestAccAWSRoute_DoesNotCrashWithVpcEndpoint (44.09s) === CONT TestAccAWSRoute_IPv4_To_NatGateway --- PASS: TestAccAWSRoute_IPv4_To_NatGateway (188.51s) === CONT TestAccAWSRoute_IPv6_To_VpcPeeringConnection --- PASS: TestAccAWSRoute_IPv4_To_TransitGateway (368.92s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments --- PASS: TestAccAWSRoute_IPv6_To_VpcPeeringConnection (26.92s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_Attached --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_Attached (109.80s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments (155.70s) === CONT TestAccAWSRoute_IPv4_To_Instance --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached (58.67s) === CONT TestAccAWSRoute_IPv4_To_VpnGateway --- PASS: TestAccAWSRoute_IPv4_To_VpnGateway (45.64s) === CONT TestAccAWSRoute_IPv6_To_VpnGateway --- PASS: TestAccAWSRoute_IPv6_To_VpnGateway (60.67s) === CONT TestAccAWSRoute_IPv6_To_InternetGateway --- PASS: TestAccAWSRoute_IPv6_To_InternetGateway (35.74s) === CONT TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached --- PASS: TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached (59.67s) === CONT TestAccAWSRoute_IPv6_To_Instance --- PASS: TestAccAWSRoute_IPv6_To_Instance (76.28s) === CONT TestAccAWSRoute_disappears_RouteTable --- PASS: TestAccAWSRoute_IPv4_To_Instance (306.09s) === CONT TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway --- PASS: TestAccAWSRoute_disappears_RouteTable (34.85s) === CONT TestAccAWSRoute_disappears --- PASS: TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway (40.15s) --- PASS: TestAccAWSRoute_disappears (33.21s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 1707.091s * resource/aws_iam_oidc_provider: Add tagging support + validations + sweeper (#17964) Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSIAMOpenIDConnectProvider_disappears (10.03s) --- PASS: TestAccAWSIAMOpenIDConnectProvider_basic (20.50s) --- PASS: TestAccAWSIAMOpenIDConnectProvider_tags (32.26s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSIAMOpenIDConnectProvider_disappears (15.58s) --- PASS: TestAccAWSIAMOpenIDConnectProvider_basic (36.70s) --- PASS: TestAccAWSIAMOpenIDConnectProvider_tags (47.27s) ``` * r/aws_lb: Add service ErrorCheck * tests/r/route: Use ELB ErrorCheck * resource/aws_iam_instance_profile: Add tagging support + sweeper (#17962) Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSIAMInstanceProfile_withoutRole (24.71s) --- PASS: TestAccAWSIAMInstanceProfile_disappears_role (25.87s) --- PASS: TestAccAWSIAMInstanceProfile_disappears (26.09s) --- PASS: TestAccAWSIAMInstanceProfile_namePrefix (28.30s) --- PASS: TestAccAWSIAMInstanceProfile_basic (31.35s) --- PASS: TestAccAWSIAMInstanceProfile_tags (44.67s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSIAMInstanceProfile_withoutRole (32.70s) --- PASS: TestAccAWSIAMInstanceProfile_disappears_role (34.17s) --- PASS: TestAccAWSIAMInstanceProfile_disappears (34.40s) --- PASS: TestAccAWSIAMInstanceProfile_basic (39.09s) --- PASS: TestAccAWSIAMInstanceProfile_namePrefix (41.02s) --- PASS: TestAccAWSIAMInstanceProfile_tags (69.02s) ``` * resource/aws_ami_from_instance: Tag on create (#17968) Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSAMIFromInstance_disappears (259.64s) --- PASS: TestAccAWSAMIFromInstance_basic (276.96s) --- PASS: TestAccAWSAMIFromInstance_tags (309.87s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSAMIFromInstance_disappears (289.51s) --- PASS: TestAccAWSAMIFromInstance_basic (307.13s) --- PASS: TestAccAWSAMIFromInstance_tags (356.92s) ``` * Add support for deployment_circuit_breaker block * Add a test for deployment_circuit_breaker block * Add document for deployment_circuit_breaker block * r/ecs_service: Add ErrorCheck * r/ecs_service: Error wrapping * r/ecs_service: Fix Errorfs * r/ecs_service: Order arguments * r/ecs_service: Cleanup resource * resource/aws_vpc: Handle read-after-create eventual consistency (#18391) * resource/aws_vpc: Handle read-after-create eventual consistency Reference: https://github.com/hashicorp/terraform-provider-aws/issues/16796 Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSVpc_AssignGeneratedIpv6CidrBlock (82.88s) --- PASS: TestAccAWSVpc_basic (41.94s) --- PASS: TestAccAWSVpc_bothDnsOptionsSet (50.15s) --- PASS: TestAccAWSVpc_classiclinkDnsSupportOptionSet (42.24s) --- PASS: TestAccAWSVpc_classiclinkOptionSet (42.26s) --- PASS: TestAccAWSVpc_coreMismatchedDiffs (29.27s) --- PASS: TestAccAWSVpc_defaultAndIgnoreTags (62.73s) --- PASS: TestAccAWSVpc_defaultTags_providerAndResource_duplicateTag (4.83s) --- PASS: TestAccAWSVpc_defaultTags_providerAndResource_nonOverlappingTag (70.21s) --- PASS: TestAccAWSVpc_defaultTags_providerAndResource_overlappingTag (69.97s) --- PASS: TestAccAWSVpc_defaultTags_providerOnly (65.84s) --- PASS: TestAccAWSVpc_defaultTags_updateToProviderOnly (55.23s) --- PASS: TestAccAWSVpc_defaultTags_updateToResourceOnly (50.23s) --- PASS: TestAccAWSVpc_DisabledDnsSupport (49.90s) --- PASS: TestAccAWSVpc_disappears (22.42s) --- PASS: TestAccAWSVpc_ignoreTags (64.60s) --- PASS: TestAccAWSVpc_tags (82.89s) --- PASS: TestAccAWSVpc_Tenancy (84.83s) --- PASS: TestAccAWSVpc_update (67.73s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSVpc_AssignGeneratedIpv6CidrBlock (85.77s) --- PASS: TestAccAWSVpc_basic (36.99s) --- PASS: TestAccAWSVpc_bothDnsOptionsSet (48.65s) --- PASS: TestAccAWSVpc_coreMismatchedDiffs (32.11s) --- PASS: TestAccAWSVpc_defaultAndIgnoreTags (63.25s) --- PASS: TestAccAWSVpc_defaultTags_providerAndResource_duplicateTag (4.70s) --- PASS: TestAccAWSVpc_defaultTags_providerAndResource_nonOverlappingTag (59.36s) --- PASS: TestAccAWSVpc_defaultTags_providerAndResource_overlappingTag (59.09s) --- PASS: TestAccAWSVpc_defaultTags_providerOnly (60.21s) --- PASS: TestAccAWSVpc_defaultTags_updateToProviderOnly (46.79s) --- PASS: TestAccAWSVpc_defaultTags_updateToResourceOnly (48.55s) --- PASS: TestAccAWSVpc_DisabledDnsSupport (47.71s) --- PASS: TestAccAWSVpc_disappears (23.64s) --- PASS: TestAccAWSVpc_ignoreTags (62.21s) --- PASS: TestAccAWSVpc_tags (82.23s) --- PASS: TestAccAWSVpc_Tenancy (83.42s) --- PASS: TestAccAWSVpc_update (66.22s) --- SKIP: TestAccAWSVpc_classiclinkDnsSupportOptionSet (15.15s) --- SKIP: TestAccAWSVpc_classiclinkOptionSet (15.15s) ``` * Update CHANGELOG for #18391 * resource/aws_subnet: Handle read-after-create eventual consistency (#18392) * resource/aws_subnet: Handle read-after-create eventual consistency Reference: https://github.com/hashicorp/terraform-provider-aws/issues/12829 Reference: https://github.com/hashicorp/terraform-provider-aws/issues/16796 Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSSubnet_availabilityZoneId (53.74s) --- PASS: TestAccAWSSubnet_basic (52.50s) --- PASS: TestAccAWSSubnet_defaultAndIgnoreTags (80.26s) --- PASS: TestAccAWSSubnet_defaultTags_providerAndResource_duplicateTag (6.45s) --- PASS: TestAccAWSSubnet_defaultTags_providerAndResource_nonOverlappingTag (84.84s) --- PASS: TestAccAWSSubnet_defaultTags_providerAndResource_overlappingTag (86.61s) --- PASS: TestAccAWSSubnet_defaultTags_providerOnly (87.99s) --- PASS: TestAccAWSSubnet_defaultTags_updateToProviderOnly (69.48s) --- PASS: TestAccAWSSubnet_defaultTags_updateToResourceOnly (72.12s) --- PASS: TestAccAWSSubnet_disappears (41.08s) --- PASS: TestAccAWSSubnet_enableIpv6 (109.36s) --- PASS: TestAccAWSSubnet_ignoreTags (81.13s) --- PASS: TestAccAWSSubnet_ipv6 (118.69s) --- PASS: TestAccAWSSubnet_MapPublicIpOnLaunch (118.55s) --- PASS: TestAccAWSSubnet_tags (106.25s) --- SKIP: TestAccAWSSubnet_CustomerOwnedIpv4Pool (1.44s) --- SKIP: TestAccAWSSubnet_MapCustomerOwnedIpOnLaunch (1.40s) --- SKIP: TestAccAWSSubnet_outpost (1.70s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSSubnet_availabilityZoneId (55.41s) --- PASS: TestAccAWSSubnet_basic (55.46s) --- PASS: TestAccAWSSubnet_defaultAndIgnoreTags (85.95s) --- PASS: TestAccAWSSubnet_defaultTags_providerAndResource_duplicateTag (6.64s) --- PASS: TestAccAWSSubnet_defaultTags_providerAndResource_nonOverlappingTag (82.23s) --- PASS: TestAccAWSSubnet_defaultTags_providerAndResource_overlappingTag (84.95s) --- PASS: TestAccAWSSubnet_defaultTags_providerOnly (86.26s) --- PASS: TestAccAWSSubnet_defaultTags_updateToProviderOnly (69.05s) --- PASS: TestAccAWSSubnet_defaultTags_updateToResourceOnly (73.74s) --- PASS: TestAccAWSSubnet_disappears (42.78s) --- PASS: TestAccAWSSubnet_enableIpv6 (117.40s) --- PASS: TestAccAWSSubnet_ignoreTags (83.74s) --- PASS: TestAccAWSSubnet_ipv6 (126.25s) --- PASS: TestAccAWSSubnet_MapPublicIpOnLaunch (124.27s) --- PASS: TestAccAWSSubnet_tags (115.31s) --- SKIP: TestAccAWSSubnet_CustomerOwnedIpv4Pool (6.95s) --- SKIP: TestAccAWSSubnet_MapCustomerOwnedIpOnLaunch (2.60s) --- SKIP: TestAccAWSSubnet_outpost (2.14s) ``` * Update CHANGELOG for #18392 * Update CHANGELOG.md for #18392 * r/aws_route: Refactor acceptance tests in preparation for future fixes/enhancements. * move time-boxed retry logic to AWS SDK GO service client retry handling * r/aws_route: AWS Wavelength support. Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSRoute_' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSRoute_ -timeout 120m === RUN TestAccAWSRoute_basic === PAUSE TestAccAWSRoute_basic === RUN TestAccAWSRoute_disappears === PAUSE TestAccAWSRoute_disappears === RUN TestAccAWSRoute_disappears_RouteTable === PAUSE TestAccAWSRoute_disappears_RouteTable === RUN TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway === PAUSE TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway === RUN TestAccAWSRoute_IPv6_To_InternetGateway === PAUSE TestAccAWSRoute_IPv6_To_InternetGateway === RUN TestAccAWSRoute_IPv6_To_Instance === PAUSE TestAccAWSRoute_IPv6_To_Instance === RUN TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached === PAUSE TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached === RUN TestAccAWSRoute_IPv6_To_VpcPeeringConnection === PAUSE TestAccAWSRoute_IPv6_To_VpcPeeringConnection === RUN TestAccAWSRoute_IPv6_To_VpnGateway === PAUSE TestAccAWSRoute_IPv6_To_VpnGateway === RUN TestAccAWSRoute_IPv4_To_VpnGateway === PAUSE TestAccAWSRoute_IPv4_To_VpnGateway === RUN TestAccAWSRoute_IPv4_To_Instance === PAUSE TestAccAWSRoute_IPv4_To_Instance === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_Attached === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_Attached === RUN TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments === PAUSE TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments === RUN TestAccAWSRoute_IPv4_To_VpcPeeringConnection === PAUSE TestAccAWSRoute_IPv4_To_VpcPeeringConnection === RUN TestAccAWSRoute_IPv4_To_NatGateway === PAUSE TestAccAWSRoute_IPv4_To_NatGateway === RUN TestAccAWSRoute_DoesNotCrashWithVpcEndpoint === PAUSE TestAccAWSRoute_DoesNotCrashWithVpcEndpoint === RUN TestAccAWSRoute_IPv4_To_TransitGateway === PAUSE TestAccAWSRoute_IPv4_To_TransitGateway === RUN TestAccAWSRoute_IPv6_To_TransitGateway === PAUSE TestAccAWSRoute_IPv6_To_TransitGateway === RUN TestAccAWSRoute_IPv4_To_CarrierGateway === PAUSE TestAccAWSRoute_IPv4_To_CarrierGateway === RUN TestAccAWSRoute_IPv4_To_LocalGateway === PAUSE TestAccAWSRoute_IPv4_To_LocalGateway === RUN TestAccAWSRoute_IPv6_To_LocalGateway === PAUSE TestAccAWSRoute_IPv6_To_LocalGateway === RUN TestAccAWSRoute_ConditionalCidrBlock === PAUSE TestAccAWSRoute_ConditionalCidrBlock === RUN TestAccAWSRoute_IPv4_Update_Target === PAUSE TestAccAWSRoute_IPv4_Update_Target === RUN TestAccAWSRoute_IPv6_Update_Target === PAUSE TestAccAWSRoute_IPv6_Update_Target === RUN TestAccAWSRoute_IPv4_To_VpcEndpoint === PAUSE TestAccAWSRoute_IPv4_To_VpcEndpoint === RUN TestAccAWSRoute_LocalRoute === PAUSE TestAccAWSRoute_LocalRoute === CONT TestAccAWSRoute_basic === CONT TestAccAWSRoute_IPv4_To_VpcPeeringConnection --- PASS: TestAccAWSRoute_IPv4_To_VpcPeeringConnection (27.86s) === CONT TestAccAWSRoute_LocalRoute --- PASS: TestAccAWSRoute_basic (37.05s) === CONT TestAccAWSRoute_IPv4_To_VpcEndpoint --- PASS: TestAccAWSRoute_LocalRoute (22.22s) === CONT TestAccAWSRoute_IPv6_Update_Target --- PASS: TestAccAWSRoute_IPv6_Update_Target (217.77s) === CONT TestAccAWSRoute_IPv4_Update_Target --- PASS: TestAccAWSRoute_IPv4_To_VpcEndpoint (314.58s) === CONT TestAccAWSRoute_ConditionalCidrBlock --- PASS: TestAccAWSRoute_ConditionalCidrBlock (54.25s) === CONT TestAccAWSRoute_IPv6_To_LocalGateway data_source_aws_outposts_outposts_test.go:66: skipping since no Outposts found --- SKIP: TestAccAWSRoute_IPv6_To_LocalGateway (1.28s) === CONT TestAccAWSRoute_IPv4_To_LocalGateway data_source_aws_outposts_outposts_test.go:66: skipping since no Outposts found --- SKIP: TestAccAWSRoute_IPv4_To_LocalGateway (1.16s) === CONT TestAccAWSRoute_IPv4_To_CarrierGateway --- PASS: TestAccAWSRoute_IPv4_To_CarrierGateway (25.48s) === CONT TestAccAWSRoute_IPv6_To_TransitGateway --- PASS: TestAccAWSRoute_IPv6_To_TransitGateway (378.71s) === CONT TestAccAWSRoute_IPv4_To_TransitGateway --- PASS: TestAccAWSRoute_IPv4_Update_Target (682.34s) === CONT TestAccAWSRoute_DoesNotCrashWithVpcEndpoint --- PASS: TestAccAWSRoute_DoesNotCrashWithVpcEndpoint (42.49s) === CONT TestAccAWSRoute_IPv4_To_NatGateway --- PASS: TestAccAWSRoute_IPv4_To_NatGateway (187.94s) === CONT TestAccAWSRoute_IPv6_To_VpcPeeringConnection --- PASS: TestAccAWSRoute_IPv4_To_TransitGateway (378.19s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments --- PASS: TestAccAWSRoute_IPv6_To_VpcPeeringConnection (26.27s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_Attached --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments (173.10s) === CONT TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached (58.15s) === CONT TestAccAWSRoute_IPv4_To_Instance --- PASS: TestAccAWSRoute_IPv4_To_NetworkInterface_Attached (330.77s) === CONT TestAccAWSRoute_IPv4_To_VpnGateway --- PASS: TestAccAWSRoute_IPv4_To_VpnGateway (38.73s) === CONT TestAccAWSRoute_IPv6_To_VpnGateway --- PASS: TestAccAWSRoute_IPv6_To_VpnGateway (37.37s) === CONT TestAccAWSRoute_IPv6_To_InternetGateway --- PASS: TestAccAWSRoute_IPv6_To_InternetGateway (34.74s) === CONT TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached --- PASS: TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached (58.78s) === CONT TestAccAWSRoute_IPv6_To_Instance --- PASS: TestAccAWSRoute_IPv4_To_Instance (310.07s) === CONT TestAccAWSRoute_disappears_RouteTable --- PASS: TestAccAWSRoute_disappears_RouteTable (34.49s) === CONT TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway --- PASS: TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway (37.65s) === CONT TestAccAWSRoute_disappears --- PASS: TestAccAWSRoute_disappears (32.07s) --- PASS: TestAccAWSRoute_IPv6_To_Instance (328.50s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 2035.886s * Add CHANGELOG entry. * Update CHANGELOG * service/storagegateway: Support Cached and VTL gateway upload buffers (#18313) * service/storagegateway: Support Cached and VTL gateway upload buffers Reference: https://github.com/hashicorp/terraform-provider-aws/issues/17809 The referenced issue contains the context, but the gist of this issue is that the Storage Gateway API canonicalizes the Cached and VTL disk identifiers only after first cache or upload buffer use, which means that this resource must accept the path first, then perform its own lookup after creation. This also fixes the `aws_storagegateway_local_disk` data source, which was missing `Computed` on the `disk_node` and `disk_path` attributes, which prevented it for being used to lookup one for the value of the other. Previously: ``` === CONT TestAccAWSStorageGatewayUploadBuffer_DiskPath resource_aws_storagegateway_upload_buffer_test.go:107: Step 1/2 error: Error running apply: exit status 1 Error: error reading Storage Gateway Upload Buffer (arn:aws:storagegateway:us-west-2:187416307283:gateway/sgw-D0A941B9:/dev/nvme1n1): not found on terraform_plugin_test.tf line 129, in resource "aws_storagegateway_upload_buffer" "test": 129: resource "aws_storagegateway_upload_buffer" "test" { --- FAIL: TestAccAWSStorageGatewayUploadBuffer_DiskPath (418.35s) ``` Output from acceptance testing: ``` --- PASS: TestAccAWSStorageGatewayLocalDiskDataSource_DiskNode (288.52s) --- PASS: TestAccAWSStorageGatewayLocalDiskDataSource_DiskPath (300.60s) --- PASS: TestAccAWSStorageGatewayUploadBuffer_basic (418.26s) --- PASS: TestAccAWSStorageGatewayUploadBuffer_DiskPath (444.33s) ``` * Update CHANGELOG for #18313 * Update CHANGELOG.md for #18313 * service/ec2: Handle read-after-write eventual consistency issues in Network ACL resources (#18388) * service/ec2: Handle read-after-write eventual consistency issues in Network ACL resources Reference: https://github.com/hashicorp/terraform-provider-aws/issues/16796 Reference: https://github.com/hashicorp/terraform-provider-aws/blob/main/docs/contributing/retries-and-waiters.md#resource-lifecycle-retries Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSNetworkAcl_basic (55.36s) --- PASS: TestAccAWSNetworkAcl_CaseSensitivityNoChanges (49.96s) --- PASS: TestAccAWSNetworkAcl_disappears (32.88s) --- PASS: TestAccAWSNetworkAcl_Egress_ConfigMode (86.30s) --- PASS: TestAccAWSNetworkAcl_EgressAndIngressRules (43.19s) --- PASS: TestAccAWSNetworkAcl_espProtocol (44.05s) --- PASS: TestAccAWSNetworkAcl_Ingress_ConfigMode (83.59s) --- PASS: TestAccAWSNetworkAcl_ipv6ICMPRules (40.67s) --- PASS: TestAccAWSNetworkAcl_ipv6Rules (64.78s) --- PASS: TestAccAWSNetworkAcl_ipv6VpcRules (52.74s) --- PASS: TestAccAWSNetworkAcl_OnlyEgressRules (43.49s) --- PASS: TestAccAWSNetworkAcl_OnlyIngressRules_basic (50.78s) --- PASS: TestAccAWSNetworkAcl_OnlyIngressRules_update (72.14s) --- PASS: TestAccAWSNetworkAcl_SubnetChange (74.65s) --- PASS: TestAccAWSNetworkAcl_Subnets (87.92s) --- PASS: TestAccAWSNetworkAcl_SubnetsDelete (81.74s) --- PASS: TestAccAWSNetworkAcl_tags (74.60s) --- PASS: TestAccAWSNetworkAclRule_allProtocol (69.48s) --- PASS: TestAccAWSNetworkAclRule_basic (54.04s) --- PASS: TestAccAWSNetworkAclRule_disappears (30.99s) --- PASS: TestAccAWSNetworkAclRule_disappears_IngressEgressSameNumber (41.45s) --- PASS: TestAccAWSNetworkAclRule_disappears_NetworkAcl (40.04s) --- PASS: TestAccAWSNetworkAclRule_ipv6 (45.12s) --- PASS: TestAccAWSNetworkAclRule_ipv6ICMP (47.00s) --- PASS: TestAccAWSNetworkAclRule_ipv6VpcAssignGeneratedIpv6CidrBlockUpdate (72.25s) --- PASS: TestAccAWSNetworkAclRule_tcpProtocol (61.69s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSNetworkAcl_basic (58.57s) --- PASS: TestAccAWSNetworkAcl_CaseSensitivityNoChanges (94.47s) --- PASS: TestAccAWSNetworkAcl_disappears (60.54s) --- PASS: TestAccAWSNetworkAcl_Egress_ConfigMode (99.32s) --- PASS: TestAccAWSNetworkAcl_EgressAndIngressRules (74.30s) --- PASS: TestAccAWSNetworkAcl_espProtocol (63.01s) --- PASS: TestAccAWSNetworkAcl_Ingress_ConfigMode (129.73s) --- PASS: TestAccAWSNetworkAcl_ipv6ICMPRules (64.84s) --- PASS: TestAccAWSNetworkAcl_ipv6Rules (95.18s) --- PASS: TestAccAWSNetworkAcl_ipv6VpcRules (61.43s) --- PASS: TestAccAWSNetworkAcl_OnlyEgressRules (86.34s) --- PASS: TestAccAWSNetworkAcl_OnlyIngressRules_basic (87.57s) --- PASS: TestAccAWSNetworkAcl_OnlyIngressRules_update (129.92s) --- PASS: TestAccAWSNetworkAcl_SubnetChange (144.88s) --- PASS: TestAccAWSNetworkAcl_Subnets (144.73s) --- PASS: TestAccAWSNetworkAcl_SubnetsDelete (120.00s) --- PASS: TestAccAWSNetworkAcl_tags (122.44s) --- PASS: TestAccAWSNetworkAclRule_allProtocol (72.14s) --- PASS: TestAccAWSNetworkAclRule_basic (95.37s) --- PASS: TestAccAWSNetworkAclRule_disappears (61.95s) --- PASS: TestAccAWSNetworkAclRule_disappears_IngressEgressSameNumber (56.73s) --- PASS: TestAccAWSNetworkAclRule_disappears_NetworkAcl (65.84s) --- PASS: TestAccAWSNetworkAclRule_ipv6 (89.03s) --- PASS: TestAccAWSNetworkAclRule_ipv6ICMP (81.90s) --- PASS: TestAccAWSNetworkAclRule_ipv6VpcAssignGeneratedIpv6CidrBlockUpdate (123.78s) --- PASS: TestAccAWSNetworkAclRule_missingParam (27.16s) --- PASS: TestAccAWSNetworkAclRule_tcpProtocol (88.83s) ``` * Update CHANGELOG for #18388 * Update CHANGELOG.md for #18388 * tests/provider: Add missing ErrorCheck Previously: ``` Error: /home/runner/work/terraform-provider-aws/terraform-provider-aws/aws/resource_aws_config_configuration_aggregator_test.go:209:36: XAT001: missing ErrorCheck 208 209 resource.ParallelTest(t, resource.TestCase{ 210 PreCheck: func() { testAccPreCheck(t) }, Error: /home/runner/work/terraform-provider-aws/terraform-provider-aws/aws/resource_aws_ecr_repository_policy_test.go:84:36: XAT001: missing ErrorCheck 83 84 resource.ParallelTest(t, resource.TestCase{ 85 PreCheck: func() { testAccPreCheck(t) }, Error: /home/runner/work/terraform-provider-aws/terraform-provider-aws/aws/resource_aws_ecr_repository_policy_test.go:105:36: XAT001: missing ErrorCheck 104 105 resource.ParallelTest(t, resource.TestCase{ 106 PreCheck: func() { testAccPreCheck(t) }, Error: /home/runner/work/terraform-provider-aws/terraform-provider-aws/aws/resource_aws_sns_topic_subscription_test.go:444:36: XAT001: missing ErrorCheck 443 444 resource.ParallelTest(t, resource.TestCase{ 445 PreCheck: func() { testAccPreCheck(t) }, Error: /home/runner/work/terraform-provider-aws/terraform-provider-aws/aws/resource_aws_sns_topic_subscription_test.go:466:36: XAT001: missing ErrorCheck 465 466 resource.ParallelTest(t, resource.TestCase{ 467 PreCheck: func() { testAccPreCheck(t) }, make: *** [GNUmakefile:92: awsproviderlint] Error 3 ``` * v3.34.0 * Update CHANGELOG after release * r/ecs_service: Move to consts * provider: Migrate to iamwaiter.PropagationTimeout constant and begin enabling go-mnd linter (#17811) Reference: https://github.com/hashicorp/terraform-provider-aws/issues/13199 Reference: https://github.com/hashicorp/terraform-provider-aws/issues/16752 Reference: https://github.com/hashicorp/terraform-provider-aws/issues/16753 IAM eventual consistency handling has long been the source of needing retries in resource logic. Due to the lack of a consistent implementation (e.g. static constant) for how long to retry for these types of errors, there have been varying retry durations. The `iamwaiter.PropagationTimeout` constant was introduced for this purpose. This change begins by introducing the `go-mnd` linter to enforce the usage of constants in function arguments. Example reports below. The rest of the changes are the minimum required to ensure `iamwaiter.PropagationTimeout` with its 2 minute duration is applied. You will note that this is fixing the duration in some cases to slightly increase it to the standard value. Any higher durations are ignored to reduce changes for now. As such, this can be reviewed by validating that a lower duration was not introduced and skipping acceptance testing since no logic changes should be introduced. One caveat to `go-mnd` is that it currently ignores `1` as a magic number, which is possible in usage such as `1*time.Minute`, and that ignored number cannot be overriden. An upstream issue will be created to ask the `ignore-number` configuration to overwrite instead of append. Example previous report: ``` aws/resource_aws_api_gateway_account.go:99:23: mnd: Magic number: 2, in detected (gomnd) err = resource.Retry(2*time.Minute, func() *resource.RetryError { ^ ``` * tests/provider: Fix and enable AWS SDK Go pointer conversion linting (T-W resources) (#18353) Reference: https://github.com/hashicorp/terraform-provider-aws/issues/12992 Previously: ``` aws/resource_aws_transfer_ssh_key.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 101: body = *s.SshPublicKeyBody -------------------------------------------------------------------------------- severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 100: if sshKeyID == *s.SshPublicKeyId { aws/resource_aws_volume_attachment.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 179: if a.InstanceId != nil && *a.InstanceId == instanceID { -------------------------------------------------------------------------------- 215: if len(vols.Volumes) == 0 || *vols.Volumes[0].State == ec2.VolumeStateAvailable { aws/resource_aws_vpc.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 339: classiclink_enabled = *v.ClassicLinkEnabled -------------------------------------------------------------------------------- 364: classiclinkdns_enabled = *v.ClassicLinkDnsSupported -------------------------------------------------------------------------------- severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 337: if *v.VpcId == vpcid { -------------------------------------------------------------------------------- 362: if *v.VpcId == vpcid { aws/resource_aws_vpc_peering_connection.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 146: if (client.accountid == *pc.AccepterVpcInfo.OwnerId) && (client.accountid != *pc.RequesterVpcInfo.OwnerId) { -------------------------------------------------------------------------------- 146: if (client.accountid == *pc.AccepterVpcInfo.OwnerId) && (client.accountid != *pc.RequesterVpcInfo.OwnerId) { aws/resource_aws_vpn_connection_route.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 158: if *r.DestinationCidrBlock == cidrBlock && *r.State != "deleted" { -------------------------------------------------------------------------------- 158: if *r.DestinationCidrBlock == cidrBlock && *r.State != "deleted" { aws/resource_aws_vpn_gateway_route_propagation.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-conditional: Prefer AWS Go SDK pointer conversion functions for dereferencing during conditionals, e.g. aws.StringValue() 90: if *vgw.GatewayId == gwID { aws/resource_aws_waf_sql_injection_match_set.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 179: m["text_transformation"] = *t.TextTransformation aws/resource_aws_wafregional_rule.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 228: m["negated"] = *p.Negated -------------------------------------------------------------------------------- 229: m["type"] = *p.Type -------------------------------------------------------------------------------- 230: m["data_id"] = *p.DataId aws/resource_aws_workspaces_ip_group.go severity:warning rule:prefer-aws-go-sdk-pointer-conversion-assignment: Prefer AWS Go SDK pointer conversion functions for dereferencing during assignment, e.g. aws.StringValue() 219: r["description"] = *rule.RuleDesc ran 15 rules on 2163 files: 18 findings ``` Output from acceptance testing: ``` --- PASS: TestAccAWSTransferSshKey_basic (172.65s) --- PASS: TestAccAWSVolumeAttachment_attachStopped (379.45s) --- PASS: TestAccAWSVolumeAttachment_basic (137.33s) --- PASS: TestAccAWSVolumeAttachment_disappears (127.64s) --- PASS: TestAccAWSVolumeAttachment_skipDestroy (106.70s) --- PASS: TestAccAWSVolumeAttachment_update (117.94s) --- PASS: TestAccAWSVpc_AssignGeneratedIpv6CidrBlock (96.85s) --- PASS: TestAccAWSVpc_basic (35.87s) --- PASS: TestAccAWSVpc_bothDnsOptionsSet (45.41s) --- PASS: TestAccAWSVpc_classiclinkDnsSupportOptionSet (39.09s) --- PASS: TestAccAWSVpc_classiclinkOptionSet (38.76s) --- PASS: TestAccAWSVpc_coreMismatchedDiffs (30.39s) --- PASS: TestAccAWSVpc_defaultAndIgnoreTags (69.04s) --- PASS: TestAccAWSVpc_defaultTags_providerAndResource_duplicateTag (5.12s) --- PASS: TestAccAWSVpc_defaultTags_providerAndResource_nonOverlappingTag (74.60s) --- PASS: TestAccAWSVpc_defaultTags_providerAndResource_overlappingTag (77.40s) --- PASS: TestAccAWSVpc_defaultTags_providerOnly (74.67s) --- PASS: TestAccAWSVpc_defaultTags_updateToProviderOnly (53.56s) --- PASS: TestAccAWSVpc_defaultTags_updateToResourceOnly (54.07s) --- PASS: TestAccAWSVpc_DisabledDnsSupport (44.39s) --- PASS: TestAccAWSVpc_disappears (21.95s) --- PASS: TestAccAWSVpc_ignoreTags (69.04s) --- PASS: TestAccAWSVpc_tags (79.06s) --- PASS: TestAccAWSVpc_Tenancy (77.06s) --- PASS: TestAccAWSVpc_update (58.54s) --- FAIL: TestAccAWSVPCPeeringConnection_region (39.86s) # https://github.com/hashicorp/terraform-provider-aws/issues/18348 --- PASS: TestAccAWSVPCPeeringConnection_accept (81.01s) --- PASS: TestAccAWSVPCPeeringConnection_basic (43.58s) --- PASS: TestAccAWSVPCPeeringConnection_failedState (18.09s) --- PASS: TestAccAWSVPCPeeringConnection_options (78.71s) --- PASS: TestAccAWSVPCPeeringConnection_optionsNoAutoAccept (30.00s) --- PASS: TestAccAWSVPCPeeringConnection_peerRegionAutoAccept (16.39s) --- PASS: TestAccAWSVPCPeeringConnection_plan (31.03s) --- PASS: TestAccAWSVPCPeeringConnection_tags (85.86s) --- PASS: TestAccAWSVpnConnectionRoute_basic (457.75s) --- PASS: TestAccAWSVPNGatewayRoutePropagation_basic (55.88s) --- PASS: TestAccAWSWafRegionalRule_basic (61.65s) --- PASS: TestAccAWSWafRegionalRule_changeNameForceNew (107.77s) --- PASS: TestAccAWSWafRegionalRule_changePredicates (103.24s) --- PASS: TestAccAWSWafRegionalRule_disappears (64.90s) --- PASS: TestAccAWSWafRegionalRule_noPredicates (44.78s) --- PASS: TestAccAWSWafRegionalRule_tags (97.70s) --- PASS: TestAccAWSWafSqlInjectionMatchSet_basic (21.90s) --- PASS: TestAccAWSWafSqlInjectionMatchSet_changeNameForceNew (38.62s) --- PASS: TestAccAWSWafSqlInjectionMatchSet_changeTuples (35.26s) --- PASS: TestAccAWSWafSqlInjectionMatchSet_disappears (16.76s) --- PASS: TestAccAWSWafSqlInjectionMatchSet_noTuples (20.81s) --- FAIL: TestAccAwsWorkspacesIpGroup_MultipleDirectories (612.05s) # https://github.com/hashicorp/terraform-provider-aws/issues/18352 --- PASS: TestAccAwsWorkspacesIpGroup_basic (44.84s) --- PASS: TestAccAwsWorkspacesIpGroup_disappears (24.70s) --- PASS: TestAccAwsWorkspacesIpGroup_tags (69.57s) ``` * r/aws_route_table: AWS Wavelength support. Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSRouteTable_' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSRouteTable_ -timeout 120m === RUN TestAccAWSRouteTable_basic === PAUSE TestAccAWSRouteTable_basic === RUN TestAccAWSRouteTable_disappears === PAUSE TestAccAWSRouteTable_disappears === RUN TestAccAWSRouteTable_disappears_SubnetAssociation === PAUSE TestAccAWSRouteTable_disappears_SubnetAssociation === RUN TestAccAWSRouteTable_IPv4_To_InternetGateway === PAUSE TestAccAWSRouteTable_IPv4_To_InternetGateway === RUN TestAccAWSRouteTable_IPv4_To_Instance === PAUSE TestAccAWSRouteTable_IPv4_To_Instance === RUN TestAccAWSRouteTable_IPv6_To_EgressOnlyInternetGateway === PAUSE TestAccAWSRouteTable_IPv6_To_EgressOnlyInternetGateway === RUN TestAccAWSRouteTable_tags === PAUSE TestAccAWSRouteTable_tags === RUN TestAccAWSRouteTable_RequireRouteDestination === PAUSE TestAccAWSRouteTable_RequireRouteDestination === RUN TestAccAWSRouteTable_RequireRouteTarget === PAUSE TestAccAWSRouteTable_RequireRouteTarget === RUN TestAccAWSRouteTable_Route_ConfigMode === PAUSE TestAccAWSRouteTable_Route_ConfigMode === RUN TestAccAWSRouteTable_IPv4_To_TransitGateway === PAUSE TestAccAWSRouteTable_IPv4_To_TransitGateway === RUN TestAccAWSRouteTable_IPv4_To_VpcEndpoint === PAUSE TestAccAWSRouteTable_IPv4_To_VpcEndpoint === RUN TestAccAWSRouteTable_IPv4_To_CarrierGateway === PAUSE TestAccAWSRouteTable_IPv4_To_CarrierGateway === RUN TestAccAWSRouteTable_IPv4_To_LocalGateway === PAUSE TestAccAWSRouteTable_IPv4_To_LocalGateway === RUN TestAccAWSRouteTable_IPv4_To_VpcPeeringConnection === PAUSE TestAccAWSRouteTable_IPv4_To_VpcPeeringConnection === RUN TestAccAWSRouteTable_vgwRoutePropagation === PAUSE TestAccAWSRouteTable_vgwRoutePropagation === RUN TestAccAWSRouteTable_ConditionalCidrBlock === PAUSE TestAccAWSRouteTable_ConditionalCidrBlock === RUN TestAccAWSRouteTable_IPv4_To_NatGateway === PAUSE TestAccAWSRouteTable_IPv4_To_NatGateway === RUN TestAccAWSRouteTable_IPv6_To_NetworkInterface_Unattached === PAUSE TestAccAWSRouteTable_IPv6_To_NetworkInterface_Unattached === RUN TestAccAWSRouteTable_VpcMultipleCidrs === PAUSE TestAccAWSRouteTable_VpcMultipleCidrs === RUN TestAccAWSRouteTable_VpcClassicLink === PAUSE TestAccAWSRouteTable_VpcClassicLink === RUN TestAccAWSRouteTable_GatewayVpcEndpoint === PAUSE TestAccAWSRouteTable_GatewayVpcEndpoint === RUN TestAccAWSRouteTable_MultipleRoutes === PAUSE TestAccAWSRouteTable_MultipleRoutes === CONT TestAccAWSRouteTable_basic === CONT TestAccAWSRouteTable_IPv4_To_CarrierGateway --- PASS: TestAccAWSRouteTable_basic (22.53s) === CONT TestAccAWSRouteTable_MultipleRoutes --- PASS: TestAccAWSRouteTable_IPv4_To_CarrierGateway (27.08s) === CONT TestAccAWSRouteTable_GatewayVpcEndpoint --- PASS: TestAccAWSRouteTable_GatewayVpcEndpoint (38.31s) === CONT TestAccAWSRouteTable_VpcClassicLink --- PASS: TestAccAWSRouteTable_VpcClassicLink (22.43s) === CONT TestAccAWSRouteTable_VpcMultipleCidrs --- PASS: TestAccAWSRouteTable_VpcMultipleCidrs (44.06s) === CONT TestAccAWSRouteTable_IPv6_To_NetworkInterface_Unattached --- PASS: TestAccAWSRouteTable_MultipleRoutes (167.25s) === CONT TestAccAWSRouteTable_IPv4_To_NatGateway --- PASS: TestAccAWSRouteTable_IPv6_To_NetworkInterface_Unattached (64.25s) === CONT TestAccAWSRouteTable_ConditionalCidrBlock --- PASS: TestAccAWSRouteTable_ConditionalCidrBlock (52.89s) === CONT TestAccAWSRouteTable_vgwRoutePropagation --- PASS: TestAccAWSRouteTable_vgwRoutePropagation (65.65s) === CONT TestAccAWSRouteTable_IPv4_To_VpcPeeringConnection --- PASS: TestAccAWSRouteTable_IPv4_To_VpcPeeringConnection (26.92s) === CONT TestAccAWSRouteTable_IPv4_To_LocalGateway data_source_aws_outposts_outposts_test.go:66: skipping since no Outposts found --- SKIP: TestAccAWSRouteTable_IPv4_To_LocalGateway (1.76s) === CONT TestAccAWSRouteTable_tags --- PASS: TestAccAWSRouteTable_IPv4_To_NatGateway (216.05s) === CONT TestAccAWSRouteTable_IPv4_To_VpcEndpoint --- PASS: TestAccAWSRouteTable_tags (69.02s) === CONT TestAccAWSRouteTable_IPv4_To_TransitGateway --- PASS: TestAccAWSRouteTable_IPv4_To_VpcEndpoint (297.37s) === CONT TestAccAWSRouteTable_Route_ConfigMode --- PASS: TestAccAWSRouteTable_Route_ConfigMode (70.12s) === CONT TestAccAWSRouteTable_RequireRouteTarget --- PASS: TestAccAWSRouteTable_RequireRouteTarget (11.79s) === CONT TestAccAWSRouteTable_RequireRouteDestination === CONT TestAccAWSRouteTable_IPv4_To_InternetGateway --- PASS: TestAccAWSRouteTable_IPv4_To_TransitGateway (411.37s) --- PASS: TestAccAWSRouteTable_IPv4_To_InternetGateway (64.50s) === CONT TestAccAWSRouteTable_IPv6_To_EgressOnlyInternetGateway --- PASS: TestAccAWSRouteTable_IPv6_To_EgressOnlyInternetGateway (47.10s) === CONT TestAccAWSRouteTable_IPv4_To_Instance --- PASS: TestAccAWSRouteTable_RequireRouteDestination (314.49s) === CONT TestAccAWSRouteTable_disappears_SubnetAssociation --- PASS: TestAccAWSRouteTable_disappears_SubnetAssociation (24.60s) === CONT TestAccAWSRouteTable_disappears --- PASS: TestAccAWSRouteTable_disappears (19.61s) --- PASS: TestAccAWSRouteTable_IPv4_To_Instance (324.26s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 1259.709s * r/aws_default_route_table: AWS Wavelength support. * Revert "r/aws_default_route_table: AWS Wavelength support." This reverts commit a32cff5e705ae5c7f841c1743d8f7f84500d0294. * r/aws_default_route_table: Add 'arn' attribute. Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSDefaultRouteTable_ -timeout 120m === RUN TestAccAWSDefaultRouteTable_basic === PAUSE TestAccAWSDefaultRouteTable_basic === RUN TestAccAWSDefaultRouteTable_disappears_Vpc === PAUSE TestAccAWSDefaultRouteTable_disappears_Vpc === RUN TestAccAWSDefaultRouteTable_Route_ConfigMode === PAUSE TestAccAWSDefaultRouteTable_Route_ConfigMode === RUN TestAccAWSDefaultRouteTable_swap === PAUSE TestAccAWSDefaultRouteTable_swap === RUN TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway === PAUSE TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway === RUN TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint === PAUSE TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint === RUN TestAccAWSDefaultRouteTable_VpcEndpointAssociation === PAUSE TestAccAWSDefaultRouteTable_VpcEndpointAssociation === RUN TestAccAWSDefaultRouteTable_tags === PAUSE TestAccAWSDefaultRouteTable_tags === RUN TestAccAWSDefaultRouteTable_ConditionalCidrBlock === PAUSE TestAccAWSDefaultRouteTable_ConditionalCidrBlock === CONT TestAccAWSDefaultRouteTable_basic === CONT TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint --- PASS: TestAccAWSDefaultRouteTable_basic (29.97s) === CONT TestAccAWSDefaultRouteTable_ConditionalCidrBlock --- PASS: TestAccAWSDefaultRouteTable_ConditionalCidrBlock (54.15s) === CONT TestAccAWSDefaultRouteTable_tags --- PASS: TestAccAWSDefaultRouteTable_tags (52.24s) === CONT TestAccAWSDefaultRouteTable_VpcEndpointAssociation --- PASS: TestAccAWSDefaultRouteTable_VpcEndpointAssociation (44.51s) === CONT TestAccAWSDefaultRouteTable_swap --- PASS: TestAccAWSDefaultRouteTable_swap (91.07s) === CONT TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway === CONT TestAccAWSDefaultRouteTable_Route_ConfigMode --- PASS: TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint (323.68s) --- PASS: TestAccAWSDefaultRouteTable_Route_ConfigMode (84.01s) === CONT TestAccAWSDefaultRouteTable_disappears_Vpc --- PASS: TestAccAWSDefaultRouteTable_disappears_Vpc (14.13s) --- PASS: TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway (400.11s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 672.134s * r/aws_route_table: Better documentation of attribute-as-blocks mode for 'route' attribute. * r/aws_default_route_table: Better documentation of attribute-as-blocks mode for 'route' attribute. * Add CHANGELOG entry. * Use 'ec2.ServiceName'. * r/aws_default_route_table: AWS Wavelength support. * Revert "r/aws_default_route_table: AWS Wavelength support." This reverts commit a32cff5e705ae5c7f841c1743d8f7f84500d0294. * r/aws_default_route_table: Add 'arn' attribute. Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSDefaultRouteTable_' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSDefaultRouteTable_ -timeout 120m === RUN TestAccAWSDefaultRouteTable_basic === PAUSE TestAccAWSDefaultRouteTable_basic === RUN TestAccAWSDefaultRouteTable_disappears_Vpc === PAUSE TestAccAWSDefaultRouteTable_disappears_Vpc === RUN TestAccAWSDefaultRouteTable_Route_ConfigMode === PAUSE TestAccAWSDefaultRouteTable_Route_ConfigMode === RUN TestAccAWSDefaultRouteTable_swap === PAUSE TestAccAWSDefaultRouteTable_swap === RUN TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway === PAUSE TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway === RUN TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint === PAUSE TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint === RUN TestAccAWSDefaultRouteTable_VpcEndpointAssociation === PAUSE TestAccAWSDefaultRouteTable_VpcEndpointAssociation === RUN TestAccAWSDefaultRouteTable_tags === PAUSE TestAccAWSDefaultRouteTable_tags === RUN TestAccAWSDefaultRouteTable_ConditionalCidrBlock === PAUSE TestAccAWSDefaultRouteTable_ConditionalCidrBlock === CONT TestAccAWSDefaultRouteTable_basic === CONT TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint --- PASS: TestAccAWSDefaultRouteTable_basic (29.97s) === CONT TestAccAWSDefaultRouteTable_ConditionalCidrBlock --- PASS: TestAccAWSDefaultRouteTable_ConditionalCidrBlock (54.15s) === CONT TestAccAWSDefaultRouteTable_tags --- PASS: TestAccAWSDefaultRouteTable_tags (52.24s) === CONT TestAccAWSDefaultRouteTable_VpcEndpointAssociation --- PASS: TestAccAWSDefaultRouteTable_VpcEndpointAssociation (44.51s) === CONT TestAccAWSDefaultRouteTable_swap --- PASS: TestAccAWSDefaultRouteTable_swap (91.07s) === CONT TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway === CONT TestAccAWSDefaultRouteTable_Route_ConfigMode --- PASS: TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint (323.68s) --- PASS: TestAccAWSDefaultRouteTable_Route_ConfigMode (84.01s) === CONT TestAccAWSDefaultRouteTable_disappears_Vpc --- PASS: TestAccAWSDefaultRouteTable_disappears_Vpc (14.13s) --- PASS: TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway (400.11s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 672.134s * r/aws_default_route_table: Better documentation of attribute-as-blocks mode for 'route' attribute. * r/aws_route_table: Add 'ErrorCheck' to new acceptance tests. Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSRouteTable_' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSRouteTable_ -timeout 180m === RUN TestAccAWSRouteTable_basic === PAUSE TestAccAWSRouteTable_basic === RUN TestAccAWSRouteTable_disappears === PAUSE TestAccAWSRouteTable_disappears === RUN TestAccAWSRouteTable_disappears_SubnetAssociation === PAUSE TestAccAWSRouteTable_disappears_SubnetAssociation === RUN TestAccAWSRouteTable_IPv4_To_InternetGateway === PAUSE TestAccAWSRouteTable_IPv4_To_InternetGateway === RUN TestAccAWSRouteTable_IPv4_To_Instance === PAUSE TestAccAWSRouteTable_IPv4_To_Instance === RUN TestAccAWSRouteTable_IPv6_To_EgressOnlyInternetGateway === PAUSE TestAccAWSRouteTable_IPv6_To_EgressOnlyInternetGateway === RUN TestAccAWSRouteTable_tags === PAUSE TestAccAWSRouteTable_tags === RUN TestAccAWSRouteTable_RequireRouteDestination === PAUSE TestAccAWSRouteTable_RequireRouteDestination === RUN TestAccAWSRouteTable_RequireRouteTarget === PAUSE TestAccAWSRouteTable_RequireRouteTarget === RUN TestAccAWSRouteTable_Route_ConfigMode === PAUSE TestAccAWSRouteTable_Route_ConfigMode === RUN TestAccAWSRouteTable_IPv4_To_TransitGateway === PAUSE TestAccAWSRouteTable_IPv4_To_TransitGateway === RUN TestAccAWSRouteTable_IPv4_To_VpcEndpoint === PAUSE TestAccAWSRouteTable_IPv4_To_VpcEndpoint === RUN TestAccAWSRouteTable_IPv4_To_CarrierGateway === PAUSE TestAccAWSRouteTable_IPv4_To_CarrierGateway === RUN TestAccAWSRouteTable_IPv4_To_LocalGateway === PAUSE TestAccAWSRouteTable_IPv4_To_LocalGateway === RUN TestAccAWSRouteTable_IPv4_To_VpcPeeringConnection === PAUSE TestAccAWSRouteTable_IPv4_To_VpcPeeringConnection === RUN TestAccAWSRouteTable_vgwRoutePropagation === PAUSE TestAccAWSRouteTable_vgwRoutePropagation === RUN TestAccAWSRouteTable_ConditionalCidrBlock === PAUSE TestAccAWSRouteTable_ConditionalCidrBlock === RUN TestAccAWSRouteTable_IPv4_To_NatGateway === PAUSE TestAccAWSRouteTable_IPv4_To_NatGateway === RUN TestAccAWSRouteTable_IPv6_To_NetworkInterface_Unattached === PAUSE TestAccAWSRouteTable_IPv6_To_NetworkInterface_Unattached === RUN TestAccAWSRouteTable_VpcMultipleCidrs === PAUSE TestAccAWSRouteTable_VpcMultipleCidrs === RUN TestAccAWSRouteTable_VpcClassicLink === PAUSE TestAccAWSRouteTable_VpcClassicLink === RUN TestAccAWSRouteTable_GatewayVpcEndpoint === PAUSE TestAccAWSRouteTable_GatewayVpcEndpoint === RUN TestAccAWSRouteTable_MultipleRoutes === PAUSE TestAccAWSRouteTable_MultipleRoutes === CONT TestAccAWSRouteTable_basic === CONT TestAccAWSRouteTable_IPv4_To_CarrierGateway --- PASS: TestAccAWSRouteTable_basic (23.03s) === CONT TestAccAWSRouteTable_MultipleRoutes --- PASS: TestAccAWSRouteTable_IPv4_To_CarrierGateway (27.07s) === CONT TestAccAWSRouteTable_GatewayVpcEndpoint --- PASS: TestAccAWSRouteTable_GatewayVpcEndpoint (38.36s) === CONT TestAccAWSRouteTable_VpcClassicLink --- PASS: TestAccAWSRouteTable_VpcClassicLink (23.18s) === CONT TestAccAWSRouteTable_VpcMultipleCidrs --- PASS: TestAccAWSRouteTable_VpcMultipleCidrs (44.45s) === CONT TestAccAWSRouteTable_IPv6_To_NetworkInterface_Unattached --- PASS: TestAccAWSRouteTable_IPv6_To_NetworkInterface_Unattached (64.43s) === CONT TestAccAWSRouteTable_IPv4_To_NatGateway --- PASS: TestAccAWSRouteTable_MultipleRoutes (174.60s) === CONT TestAccAWSRouteTable_ConditionalCidrBlock --- PASS: TestAccAWSRouteTable_ConditionalCidrBlock (54.34s) === CONT TestAccAWSRouteTable_vgwRoutePropagation --- PASS: TestAccAWSRouteTable_vgwRoutePropagation (78.89s) === CONT TestAccAWSRouteTable_IPv4_To_VpcPeeringConnection --- PASS: TestAccAWSRouteTable_IPv4_To_VpcPeeringConnection (26.74s) === CONT TestAccAWSRouteTable_IPv4_To_LocalGateway data_source_aws_outposts_outposts_test.go:67: skipping since no Outposts found === CONT TestAccAWSRouteTable_tags --- SKIP: TestAccAWSRouteTable_IPv4_To_LocalGateway (0.60s) --- PASS: TestAccAWSRouteTable_tags (68.15s) === CONT TestAccAWSRouteTable_IPv4_To_VpcEndpoint --- PASS: TestAccAWSRouteTable_IPv4_To_NatGateway (237.14s) === CONT TestAccAWSRouteTable_IPv4_To_TransitGateway --- PASS: TestAccAWSRouteTable_IPv4_To_VpcEndpoint (287.82s) === CONT TestAccAWSRouteTable_Route_ConfigMode --- PASS: TestAccAWSRouteTable_Route_ConfigMode (70.96s) === CONT TestAccAWSRouteTable_RequireRouteTarget --- PASS: TestAccAWSRouteTable_RequireRouteTarget (12.27s) === CONT TestAccAWSRouteTable_RequireRouteDestination --- PASS: TestAccAWSRouteTable_IPv4_To_TransitGateway (402.33s) === CONT TestAccAWSRouteTable_IPv4_To_InternetGateway --- PASS: TestAccAWSRouteTable_IPv4_To_InternetGateway (63.20s) === CONT TestAccAWSRouteTable_IPv6_To_EgressOnlyInternetGateway === CONT TestAccAWSRouteTable_IPv4_To_Instance --- PASS: TestAccAWSRouteTable_IPv6_To_EgressOnlyInternetGateway (47.99s) --- PASS: TestAccAWSRouteTable_IPv4_To_Instance (123.37s) === CONT TestAccAWSRouteTable_disappears_SubnetAssociation --- PASS: TestAccAWSRouteTable_disappears_SubnetAssociation (25.30s) === CONT TestAccAWSRouteTable_disappears --- PASS: TestAccAWSRouteTable_disappears (20.39s) --- PASS: TestAccAWSRouteTable_RequireRouteDestination (324.41s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 1121.930s * Nudge GitHub Actions. * Fix tfproviderdocs errors: Error checking Terraform Provider documentation: 2 errors occurred: * website/docs/r/default_route_table.html.markdown: error checking file contents: example section code block language (hcl) should be: ```terraform * website/docs/r/route_table.html.markdown: error checking file contents: example section code block language (hcl) should be: ```terraform * tests/provider: Bootstrap d.IsNewResource() semgrep rule and fix some A resources to start (#18346) * tests/provider: Bootstrap d.IsNewResource() semgrep rule and fix some A resources to start Reference: https://github.com/hashicorp/terraform-provider-aws/issues/16796 During resource creation, Terraform CLI expects either a properly applied state for the new resource or an error. To signal proper resource existence, the Terraform Plugin SDK uses an underlying resource identifier (set via `d.SetId(/* some value */)`). If for some reason the resource creation is returned without an error, but also without the resource identifier being set, Terraform CLI will return an error such as: ``` Error: Provider produced inconsistent result after apply When applying changes to aws_sns_topic_subscription.sqs, provider "registry.terraform.io/hashicorp/aws" produced an unexpected new value: Root resource was present, but now absent. This is a bug in the provider, which should be reported in the provider's own issue tracker. ``` A typical pattern in resource implementations in the `Create`/`CreateContext` function is to `return` the `Read`/`ReadContext` function at the end to fill in the Terraform State for all attributes. Another typical pattern in resource implementations in the `Read`/`ReadContext` function is to remove the resource from the Terraform State if the remote system returns an error or status that indicates the remote resource no longer exists by explicitly calling `d.SetId("")` and returning no error. If the remote system is not strongly read-after-write consistent (eventually consistent), this means the resource creation can return no error and also return no resource state. To prevent this type of Terraform CLI error, the resource implementation should also check against `d.IsNewResource()` before removing from the Terraform State and returning no error. If that check is `true`, then remote operation error (or one synthesized from the non-existent status) should be returned instead. While adding this check will not fix the resource implementation to handle the eventually consistent nature of the remote system, the error being returned will be less opaque for operators and code maintainers to troubleshoot. Previously: ``` aws/resource_aws_accessanalyzer_analyzer.go severity:warning rule:helper-schema-ResourceData-SetId-empty-without-IsNewResource-check: Calling `d.SetId("")` should ensure `!d.IsNewResource()` is checked first 115: d.SetId("") 116: return nil aws/resource_aws_acm_certificate_validation.go severity:warning rule:helper-schema-ResourceData-SetId-empty-without-IsNewResource-check: Calling `d.SetId("")` should ensure `!d.IsNewResource()` is checked first 181: d.SetId("") 182: return nil aws/resource_aws_acmpca_certificate.go severity:warning rule:helper-schema-ResourceData-SetId-empty-without-IsNewResource-check: Calling `d.SetId("")` should ensure `!d.IsNewResource()` is checked first 175: d.SetId("") 176: return nil aws/resource_aws_acmpca_certificate_authority.go severity:warning rule:helper-schema-ResourceData-SetId-empty-without-IsNewResource-check: Calling `d.SetId("")` should ensure `!d.IsNewResource()` is checked first 329: d.SetId("") 330: return nil -------------------------------------------------------------------------------- 339: d.SetId("") 340: return nil -------------------------------------------------------------------------------- 371: d.SetId("") 372: return nil -------------------------------------------------------------------------------- 398: d.SetId("") 399: return nil aws/resource_aws_ami.go severity:warning rule:helper-schema-ResourceData-SetId-empty-without-IsNewResource-check: Calling `d.SetId("")` should ensure `!d.IsNewResource()` is checked first 344: d.SetId("") 345: return nil -------------------------------------------------------------------------------- 361: d.SetId("") 362: return nil -------------------------------------------------------------------------------- 383: d.SetId("") 384: return nil aws/resource_aws_ami_launch_permission.go severity:warning rule:helper-schema-ResourceData-SetId-empty-without-IsNewResource-check: Calling `d.SetId("")` should ensure `!d.IsNewResource()` is checked first 81: d.SetId("") 82: return nil ``` Output from acceptance testing: ``` --- FAIL: TestAccAWSAcmCertificateValidation_validationRecordFqdnsWildcardAndRoot (4.02s) # alternate testing account issue --- FAIL: TestAccAWSAcmCertificateValidation_validationRecordFqdnsWildcard (4.11s) # alternate testing account issue --- PASS: TestAccAWSAcmCertificateValidation_basic (92.89s) --- PASS: TestAccAWSAcmCertificateValidation_timeout (25.70s) --- PASS: TestAccAWSAcmCertificateValidation_validationRecordFqdns (101.67s) --- PASS: TestAccAWSAcmCertificateValidation_validationRecordFqdnsEmail (20.07s) --- PASS: TestAccAWSAcmCertificateValidation_validationRecordFqdnsRoot (92.99s) --- PASS: TestAccAWSAcmCertificateValidation_validationRecordFqdnsRootAndWildcard (63.68s) --- PASS: TestAccAWSAcmCertificateValidation_validationRecordFqdnsSan (88.87s) --- PASS: TestAccAwsAcmpcaCertificate_EndEntityCertificate (35.64s) --- PASS: TestAccAwsAcmpcaCertificate_RootCertificate (28.20s) --- PASS: TestAccAwsAcmpcaCertificate_SubordinateCertificate (38.12s) --- PASS: TestAccAwsAcmpcaCertificate_Validity_Absolute (34.39s) --- PASS: TestAccAwsAcmpcaCertificate_Validity_EndDate (35.95s) --- PASS: TestAccAwsAcmpcaCertificateAuthority_basic (22.75s) --- PASS: TestAccAwsAcmpcaCertificateAuthority_DeleteFromActiveState (24.35s) --- PASS: TestAccAwsAcmpcaCertificateAuthority_disappears (14.37s) --- PASS: TestAccAwsAcmpcaCertificateAuthority_Enabled (53.63s) --- PASS: TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfiguration_CustomCname (120.00s) --- PASS: TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfiguration_Enabled (95.90s) --- PASS: TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfiguration_ExpirationInDays (74.81s) --- PASS: TestAccAwsAcmpcaCertificateAuthority_Tags (62.46s) --- PASS: TestAccAWSAMI_basic (63.47s) --- PASS: TestAccAWSAMI_description (76.70s) --- PASS: TestAccAWSAMI_disappears (60.26s) --- PASS: TestAccAWSAMI_EphemeralBlockDevices (63.85s) --- PASS: TestAccAWSAMI_Gp3BlockDevice (46.78s) --- PASS: TestAccAWSAMI_tags (89.70s) --- PASS: TestAccAWSAMILaunchPermission_basic (337.22s) --- PASS: TestAccAWSAMILaunchPermission_Disappears_AMI (354.06s) --- PASS: TestAccAWSAMILaunchPermission_Disappears_LaunchPermission (336.05s) --- PASS: TestAccAWSAMILaunchPermission_Disappears_LaunchPermission_Public (334.96s) ``` * tests/provider: Simplify semgrep helper-schema-ResourceData-SetId-empty-without-IsNewResource-check exclude paths * tests/r/default_route_table: All elasticloadbalancing ErrorCheck * resource/aws_synthetics_canary: Handle asynchronous IAM eventual consistency error on creation (#18404) * resource/aws_synthetics_canary: Handle asynchronous IAM eventual consistency error on creation Reference: https://github.com/hashicorp/terraform-provider-aws/issues/18101 Previously: ``` === CONT TestAccAWSSyntheticsCanary_basic resource_aws_synthetics_canary_test.go:82: Step 1/3 error: Error running apply: exit status 1 Error: error waiting for Synthetics Canary (tf-acc-test-s9t49btk) creation: : The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 8e3169db-124d-4c5a-ac0e-d9f382cf737f; Proxy: null) on terraform_plugin_test.tf line 92, in resource "aws_synthetics_canary" "test": 92: resource "aws_synthetics_canary" "test" { --- FAIL: TestAccAWSSyntheticsCanary_basic (16.37s) === CONT TestAccAWSSyntheticsCanary_runtimeVersion resource_aws_synthetics_canary_test.go:156: Step 1/3 error: Error running apply: exit status 1 Error: error waiting for Synthetics Canary (tf-acc-test-nenvizbg) creation: : The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: ffcb7edb-c77e-43f2-8a0a-1183e92f0f8c; Proxy: null) on terraform_plugin_test.tf line 92, in resource "aws_synthetics_canary" "test": 92: resource "aws_synthetics_canary" "test" { --- FAIL: TestAccAWSSyntheticsCanary_runtimeVersion (16.85s) === CONT TestAccAWSSyntheticsCanary_startCanary_codeChanges resource_aws_synthetics_canary_test.go:239: Step 1/3 error: Error running apply: exit status 1 Error: error waiting for Synthetics Canary (tf-acc-test-7c9erovn) creation: : The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 1c4bacd4-3134-4df3-8e82-2538e155b524; Proxy: null) on terraform_plugin_test.tf line 92, in resource "aws_synthetics_canary" "test": 92: resource "aws_synthetics_canary" "test" { --- FAIL: TestAccAWSSyntheticsCanary_startCanary_codeChanges (16.92s) === CONT TestAccAWSSyntheticsCanary_startCanary resource_aws_synthetics_canary_test.go:190: Step 1/4 error: Error running apply: exit status 1 Error: error waiting for Synthetics Canary (tf-acc-test-gzn0ksyz) creation: : The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: afa63236-ac58-4cec-9c93-67192216f734; Proxy: null) on terraform_plugin_test.tf line 92, in resource "aws_synthetics_canary" "test": 92: resource "aws_synthetics_canary" "test" { --- FAIL: TestAccAWSSyntheticsCanary_startCanary (17.91s) === CONT TestAccAWSSyntheticsCanary_s3 resource_aws_synthetics_canary_test.go:281: Step 1/2 error: Error running apply: exit status 1 Error: error waiting for Synthetics Canary (tf-acc-test-rhjz4908) creation: : The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: ea96e8db-b243-499e-b6e9-54e5d30c7604; Proxy: null) on terraform_plugin_test.tf line 92, in resource "aws_synthetics_canary" "test": 92: resource "aws_synthetics_canary" "test" { --- FAIL: TestAccAWSSyntheticsCanary_s3 (16.68s) === CONT TestAccAWSSyntheticsCanary_runConfig resource_aws_synthetics_canary_test.go:326: Step 1/4 error: Error running apply: exit status 1 Error: error waiting for Synthetics Canary (tf-acc-test-qy4r4rep) creation: : The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: aee1cc0e-6f2d-4f8d-8720-91aa25333dcc; Proxy: null) on terraform_plugin_test.tf line 92, in resource "aws_synthetics_canary" "test": 92: resource "aws_synthetics_canary" "test" { --- FAIL: TestAccAWSSyntheticsCanary_runConfig (15.30s) === CONT TestAccAWSSyntheticsCanary_runConfigTracing resource_aws_synthetics_canary_test.go:373: Step 1/4 error: Error running apply: exit status 1 Error: error waiting for Synthetics Canary (tf-acc-test-44kmj0af) creation: : The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 653d7e28-e3a6-4d5d-8da0-818cb7debb9a; Proxy: null) on terraform_plugin_test.tf line 92, in resource "aws_synthetics_canary" "test": 92: resource "aws_synthetics_canary" "test" { --- FAIL: TestAccAWSSyntheticsCanary_runConfigTracing (14.80s) === CONT TestAccAWSSyntheticsCanary_vpc resource_aws_synthetics_canary_test.go:416: Step 1/4 error: Error running apply: exit status 1 Error: error waiting for Synthetics Canary (tf-acc-test-278kyhh1) creation: : The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 9e377590-2ea9-42db-8340-f181964fd388; Proxy: null) on terraform_plugin_test.tf line 150, in resource "aws_synthetics_canary" "test": 150: resource "aws_synthetics_canary" "test" { --- FAIL: TestAccAWSSyntheticsCanary_vpc (15.25s) === CONT TestAccAWSSyntheticsCanary_tags resource_aws_synthetics_canary_test.go:466: Step 1/4 error: Error running apply: exit status 1 Error: error waiting for Synthetics Canary (tf-acc-test-8thffpcs) creation: : The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 60d2ea31-fdcb-4c4e-85ec-eecda075d58c; Proxy: null) on terraform_plugin_test.tf line 92, in resource "aws_synthetics_canary" "test": 92: resource "aws_synthetics_canary" "test" { --- FAIL: TestAccAWSSyntheticsCanary_tags (15.32s) === CONT TestAccAWSSyntheticsCanary_disappears resource_aws_synthetics_canary_test.go:513: Step 1/1 error: Error running apply: exit status 1 Error: error waiting for Synthetics Canary (tf-acc-test-yelzrxeu) creation: : The role defined for the function cannot be assumed by Lambda. (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 398f9321-06ea-4019-ba08-37594ec32f04; Proxy: null) on terraform_plugin_test.tf line 92, in resource "aws_synthetics_canary" "test": 92: resource "aws_synthetics_canary" "test" { --- FAIL: TestAccAWSSyntheticsCanary_disappears (15.34s) ``` Output from acceptance testing: ``` --- PASS: TestAccAWSSyntheticsCanary_basic (105.78s) --- PASS: TestAccAWSSyntheticsCanary_disappears (59.55s) --- PASS: TestAccAWSSyntheticsCanary_runConfig (114.95s) --- PASS: TestAccAWSSyntheticsCanary_runConfigTracing (94.08s) --- PASS: TestAccAWSSyntheticsCanary_runtimeVersion (89.12s) --- PASS: TestAccAWSSyntheticsCanary_s3 (72.90s) --- PASS: TestAccAWSSyntheticsCanary_startCanary (124.81s) --- PASS: TestAccAWSSyntheticsCanary_startCanary_codeChanges (111.66s) --- PASS: TestAccAWSSyntheticsCanary_tags (115.10s) --- PASS: TestAccAWSSyntheticsCanary_vpc (678.91s) ``` * Update CHANGELOG for #18404 * Update CHANGELOG.md for #18404 * service/iam: Policy tagging support and add policy_id attribute (#18276) Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSDataSourceIAMPolicy_basic (20.45s) --- PASS: TestAccAWSIAMPolicy_basic (22.11s) --- PASS: TestAccAWSIAMPolicy_description (21.92s) --- PASS: TestAccAWSIAMPolicy_disappears (18.51s) --- PASS: TestAccAWSIAMPolicy_namePrefix (22.36s) --- PASS: TestAccAWSIAMPolicy_path (22.27s) --- PASS: TestAccAWSIAMPolicy_policy (29.66s) --- PASS: TestAccAWSIAMPolicy_tags (36.52s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSDataSourceIAMPolicy_basic (25.35s) --- PASS: TestAccAWSIAMPolicy_basic (27.37s) --- PASS: TestAccAWSIAMPolicy_description (27.37s) --- PASS: TestAccAWSIAMPolicy_disappears (21.46s) --- PASS: TestAccAWSIAMPolicy_namePrefix (27.86s) --- PASS: TestAccAWSIAMPolicy_path (27.19s) --- PASS: TestAccAWSIAMPolicy_policy (41.21s) --- PASS: TestAccAWSIAMPolicy_tags (53.53s) ``` * resource/aws_ssm_parameter: Tag on create + validations (#17830) Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSSSMParameter_disappears (35.77s) --- PASS: TestAccAWSSSMParameter_fullPath (51.23s) --- PASS: TestAccAWSSSMParameter_basic (51.86s) --- PASS: TestAccAWSSSMParameter_secure (52.09s) --- PASS: TestAccAWSSSMParameter_DataType_AwsEc2Image (58.46s) --- PASS: TestAccAWSSSMParameter_secure_with_key (60.49s) --- PASS: TestAccAWSSSMParameter_overwrite (77.69s) --- PASS: TestAccAWSSSMParameter_changeNameForcesNew (82.64s) --- PASS: TestAccAWSSSMParameter_updateDescription (82.84s) --- PASS: TestAccAWSSSMParameter_updateType (83.08s) --- PASS: TestAccAWSSSMParameter_secure_keyUpdate (85.13s) --- PASS: TestAccAWSSSMParameter_Tier_IntelligentTieringToStandard (93.66s) --- PASS: TestAccAWSSSMParameter_tags (94.47s) --- PASS: TestAccAWSSSMParameter_Tier (96.68s) --- PASS: TestAccAWSSSMParameter_Tier_IntelligentTieringToAdvanced (98.75s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSSSMParameter_disappears (40.39s) --- PASS: TestAccAWSSSMParameter_fullPath (59.78s) --- PASS: TestAccAWSSSMParameter_secure (59.78s) --- PASS: TestAccAWSSSMParameter_DataType_AwsEc2Image (59.81s) --- PASS: TestAccAWSSSMParameter_secure_with_key (59.87s) --- PASS: TestAccAWSSSMParameter_basic (59.88s) --- PASS: TestAccAWSSSMParameter_changeNameForcesNew (77.00s) --- PASS: TestAccAWSSSMParameter_updateDescription (83.65s) --- PASS: TestAccAWSSSMParameter_overwrite (84.29s) --- PASS: TestAccAWSSSMParameter_updateType (84.34s) --- PASS: TestAccAWSSSMParameter_secure_keyUpdate (85.81s) --- PASS: TestAccAWSSSMParameter_Tier_IntelligentTieringToStandard (97.59s) --- PASS: TestAccAWSSSMParameter_tags (100.37s) --- PASS: TestAccAWSSSMParameter_Tier (100.40s) --- PASS: TestAccAWSSSMParameter_Tier_IntelligentTieringToAdvanced (103.42s) ``` * build(deps): Bump github.com/aws/aws-sdk-go from 1.38.0 to 1.38.6 (#18424) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.38.0 to 1.38.6. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-go/compare/v1.38.0...v1.38.6) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Update CHANGELOG.md for #18424 * build(deps): Bump github.com/aws/aws-sdk-go in /awsproviderlint (#18422) * build(deps): Bump github.com/bflad/tfproviderlint in /awsproviderlint (#18434) * build(deps): bump github/issue-labeler from v2.2 to v2.3 (#18322) Bumps [github/issue-labeler](https://github.com/github/issue-labeler) from v2.2 to v2.3. - [Release notes](https://github.com/github/issue-labeler/releases) - [Commits](https://github.com/github/issue-labeler/compare/v2.2...a326d12b9b64d4395a18e50f648214c609501643) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * resource/aws_efs_file_system: Add attributes and refactor to use waiter package (#17969) Output from acceptance testing in AWS Commercial: ``` --- PASS: TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption (15.26s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy (29.48s) --- PASS: TestAccAWSEFSFileSystem_disappears (37.95s) --- PASS: TestAccAWSEFSFileSystem_kmsKey (54.93s) --- PASS: TestAccAWSEFSFileSystem_ThroughputMode (65.88s) --- PASS: TestAccAWSEFSFileSystem_basic (83.23s) --- PASS: TestAccAWSEFSFileSystem_pagedTags (85.76s) --- PASS: TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps (94.41s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy_removal (96.71s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy_update (107.04s) --- PASS: TestAccAWSEFSFileSystem_tags (142.76s) ``` Output from acceptance testing in AWS GovCloud (US): ``` --- PASS: TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption (19.51s) --- PASS: TestAccAWSEFSFileSystem_pagedTags (58.12s) --- PASS: TestAccAWSEFSFileSystem_kmsKey (64.15s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy (67.15s) --- PASS: TestAccAWSEFSFileSystem_disappears (85.41s) --- PASS: TestAccAWSEFSFileSystem_basic (95.51s) --- PASS: TestAccAWSEFSFileSystem_ThroughputMode (101.41s) --- PASS: TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps (103.19s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy_update (105.87s) --- PASS: TestAccAWSEFSFileSystem_tags (149.67s) --- PASS: TestAccAWSEFSFileSystem_lifecyclePolicy_removal (151.51s) ``` * Update CHANGELOG.md for #18341 * r/ecs_service: Rework status, waiter * r/ecs_service: Rework retries, waiters * tests/r/ecs_service: Use proper disappears test * tests/r/ecs_service: Use standard resource naming * d/aws_route: AWS Wavelength support. Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSRouteDataSource_' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSRouteDataSource_ -timeout 120m === RUN TestAccAWSRouteDataSource_basic === PAUSE TestAccAWSRouteDataSource_basic === RUN TestAccAWSRouteDataSource_TransitGatewayID === PAUSE TestAccAWSRouteDataSource_TransitGatewayID === RUN TestAccAWSRouteDataSource_IPv6DestinationCidr === PAUSE TestAccAWSRouteDataSource_IPv6DestinationCidr === RUN TestAccAWSRouteDataSource_LocalGatewayID === PAUSE TestAccAWSRouteDataSource_LocalGatewayID === CONT TestAccAWSRouteDataSource_basic === CONT TestAccAWSRouteDataSource_LocalGatewayID data_source_aws_outposts_outposts_test.go:66: skipping since no Outposts found --- SKIP: TestAccAWSRouteDataSource_LocalGatewayID (2.00s) === CONT TestAccAWSRouteDataSource_IPv6DestinationCidr --- PASS: TestAccAWSRouteDataSource_IPv6DestinationCidr (24.28s) === CONT TestAccAWSRouteDataSource_TransitGatewayID --- PASS: TestAccAWSRouteDataSource_basic (328.90s) --- PASS: TestAccAWSRouteDataSource_TransitGatewayID (305.22s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 331.596s * d/aws_route: Add 'TestAccAWSRouteDataSource_CarrierGatewayID'. Acceptance test output: $ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSRouteDataSource_CarrierGatewayID' ACCTEST_PARALLELISM=2 ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./aws -v -count 1 -parallel 2 -run=TestAccAWSRouteDataSource_CarrierGatewayID -timeout 120m === RUN TestAccAWSRouteDataSource_CarrierGatewayID === PAUSE TestAccAWSRouteDataSource_CarrierGatewayID === CONT TestAccAWSRouteDataSource_CarrierGatewayID --- PASS: TestAccAWSRouteDataSource_CarrierGatewayID (25.26s) PASS ok github.com/terraform-providers/terraform-provider-aws/aws 25.394s * Add CHANGELOG entry. * Add 'ErrorCheck' for new acceptance tests. * ds/route: Minor cleanup * r/ecs_service: Remove unused wait func * tests/r/ecs_service: Adjust for standard variables, names * r/ecs_service: Add retry for dependencyviolation * r/security_group: Increase delete timeout and ensure dependencyviolation caught * docs/r/security_group: Increase delete timeout * docs/r/ecs_service: Minor doc cleanup * r/ecs_service: Add changelog Co-authored-by: Dirk Avery <31492422+YakDriver@users.noreply.github.com> Co-authored-by: Brian Flad Co-authored-by: Dirk Avery Co-authored-by: Kit Ewbank Co-authored-by: Angie Pinilla Co-authored-by: Dmitry Shevchuk Co-authored-by: Graham Davison Co-authored-by: Andreas Granig Co-authored-by: Alexey Mikhailov Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: changelogbot Co-authored-by: Shuhei Kitagawa Co-authored-by: Kurt McAlpine Co-authored-by: Ilia Lazebnik Co-authored-by: Bill Rich Co-authored-by: Adam Tyler Co-authored-by: tf-release-bot --- .changelog/11967.txt | 3 + .changelog/14101.txt | 7 + .changelog/14193.txt | 3 + .changelog/14247.txt | 3 + .changelog/14319.txt | 7 + .changelog/14905.txt | 3 + .changelog/15213.txt | 7 + .changelog/16815.txt | 11 + .changelog/16930.txt | 7 + .changelog/16936.txt | 7 + .changelog/16961.txt | 3 + .changelog/16963.txt | 3 + .changelog/16979.txt | 11 + .changelog/17149.txt | 7 + .changelog/17387.txt | 3 + .changelog/17465.txt | 3 + .changelog/17589.txt | 3 + .changelog/17596.txt | 3 + .changelog/17641.txt | 7 + .changelog/17830.txt | 7 + .changelog/17876.txt | 3 + .changelog/17909.txt | 3 + .changelog/17958.txt | 3 + .changelog/17962.txt | 3 + .changelog/17964.txt | 7 + .changelog/17965.txt | 7 + .changelog/17967.txt | 7 + .changelog/17968.txt | 3 + .changelog/17969.txt | 3 + .changelog/17974.txt | 15 + .changelog/17985.txt | 3 + .changelog/18042.txt | 3 + .changelog/18070.txt | 3 + .changelog/18076.txt | 3 + .changelog/18129.txt | 3 + .changelog/18203.txt | 3 + .changelog/18276.txt | 11 + .changelog/18281.txt | 3 + .changelog/18305.txt | 7 + .changelog/18313.txt | 11 + .changelog/18314.txt | 7 + .changelog/18341.txt | 3 + .changelog/18351.txt | 3 + .changelog/18361.txt | 3 + .changelog/18382.txt | 3 + .changelog/18384.txt | 4 + .changelog/18388.txt | 7 + .changelog/18391.txt | 3 + .changelog/18392.txt | 3 + .changelog/18404.txt | 3 + .changelog/8611.txt | 3 + .github/workflows/firewatch.yml | 2 +- .github/workflows/issues.yml | 4 +- .github/workflows/terraform_provider.yml | 35 +- .golangci.yml | 127 + .hashibot.hcl | 8 + .semgrep.yml | 114 +- CHANGELOG.md | 105 + GNUmakefile | 12 +- aws/config.go | 22 +- aws/core_acceptance_test.go | 1 + aws/data_source_aws_acm_certificate_test.go | 20 +- ...e_aws_acmpca_certificate_authority_test.go | 6 +- ...data_source_aws_acmpca_certificate_test.go | 6 +- aws/data_source_aws_ami_ids_test.go | 11 +- aws/data_source_aws_ami_test.go | 26 +- ...ata_source_aws_api_gateway_api_key_test.go | 6 +- ...source_aws_api_gateway_domain_name_test.go | 2 + ...ta_source_aws_api_gateway_resource_test.go | 6 +- ...ta_source_aws_api_gateway_rest_api_test.go | 11 +- ...ta_source_aws_api_gateway_vpc_link_test.go | 6 +- aws/data_source_aws_apigatewayv2_api_test.go | 3 + aws/data_source_aws_apigatewayv2_apis_test.go | 4 + aws/data_source_aws_arn_test.go | 5 +- aws/data_source_aws_autoscaling_group_test.go | 11 +- ...data_source_aws_autoscaling_groups_test.go | 6 +- aws/data_source_aws_availability_zone_test.go | 30 +- ...data_source_aws_availability_zones_test.go | 30 +- aws/data_source_aws_backup_plan_test.go | 6 +- aws/data_source_aws_backup_selection_test.go | 6 +- aws/data_source_aws_backup_vault_test.go | 6 +- ...urce_aws_batch_compute_environment_test.go | 6 +- aws/data_source_aws_batch_job_queue_test.go | 6 +- ...source_aws_billing_service_account_test.go | 5 +- aws/data_source_aws_caller_identity_test.go | 6 +- aws/data_source_aws_canonical_user_id_test.go | 6 +- ...a_source_aws_cloudformation_export_test.go | 11 +- ...ta_source_aws_cloudformation_stack_test.go | 11 +- ...source_aws_cloudfront_cache_policy_test.go | 1 + ...source_aws_cloudfront_distribution_test.go | 19 +- ...s_cloudfront_origin_request_policy_test.go | 2 + aws/data_source_aws_cloudhsm2_cluster_test.go | 6 +- ...a_source_aws_cloudtrail_service_account.go | 2 +- ...rce_aws_cloudtrail_service_account_test.go | 10 +- ...ta_source_aws_cloudwatch_log_group_test.go | 21 +- ...s_codeartifact_authorization_token_test.go | 15 +- ...s_codeartifact_repository_endpoint_test.go | 10 +- ...a_source_aws_codecommit_repository_test.go | 6 +- ...urce_aws_codestarconnections_connection.go | 70 + ...aws_codestarconnections_connection_test.go | 86 + ...data_source_aws_cognito_user_pools_test.go | 6 +- ...a_source_aws_cur_report_definition_test.go | 3 + aws/data_source_aws_customer_gateway_test.go | 11 +- ...ata_source_aws_db_cluster_snapshot_test.go | 16 +- ...ata_source_aws_db_event_categories_test.go | 11 +- aws/data_source_aws_db_instance_test.go | 7 +- aws/data_source_aws_db_snapshot_test.go | 6 +- aws/data_source_aws_db_subnet_group_test.go | 3 + ...ce_aws_directory_service_directory_test.go | 18 +- ...ta_source_aws_docdb_engine_version_test.go | 3 + ...ce_aws_docdb_orderable_db_instance_test.go | 2 + aws/data_source_aws_dx_gateway_test.go | 6 +- aws/data_source_aws_dynamodb_table_test.go | 6 +- ...ata_source_aws_ebs_default_kms_key_test.go | 5 +- ...urce_aws_ebs_encryption_by_default_test.go | 5 +- aws/data_source_aws_ebs_snapshot_ids_test.go | 16 +- aws/data_source_aws_ebs_snapshot_test.go | 16 +- aws/data_source_aws_ebs_volume_test.go | 11 +- aws/data_source_aws_ebs_volumes_test.go | 2 + aws/data_source_aws_ec2_coip_pool_test.go | 11 +- aws/data_source_aws_ec2_coip_pools_test.go | 11 +- ...rce_aws_ec2_instance_type_offering_test.go | 3 + ...ce_aws_ec2_instance_type_offerings_test.go | 2 + aws/data_source_aws_ec2_instance_type_test.go | 21 +- ..._aws_ec2_local_gateway_route_table_test.go | 21 +- ...aws_ec2_local_gateway_route_tables_test.go | 11 +- aws/data_source_aws_ec2_local_gateway_test.go | 6 +- ...al_gateway_virtual_interface_group_test.go | 16 +- ...l_gateway_virtual_interface_groups_test.go | 16 +- ...c2_local_gateway_virtual_interface_test.go | 16 +- ...data_source_aws_ec2_local_gateways_test.go | 6 +- ...source_aws_ec2_managed_prefix_list_test.go | 15 +- aws/data_source_aws_ec2_spot_price_test.go | 2 + ...nsit_gateway_dx_gateway_attachment_test.go | 3 + ...transit_gateway_peering_attachment_test.go | 10 + ...ws_ec2_transit_gateway_route_table_test.go | 3 + ...ce_aws_ec2_transit_gateway_route_tables.go | 86 + ...s_ec2_transit_gateway_route_tables_test.go | 73 + ...ata_source_aws_ec2_transit_gateway_test.go | 3 + ...ec2_transit_gateway_vpc_attachment_test.go | 3 + ...ec2_transit_gateway_vpn_attachment_test.go | 3 + ...source_aws_ecr_authorization_token_test.go | 6 +- aws/data_source_aws_ecr_image_test.go | 6 +- aws/data_source_aws_ecr_repository_test.go | 16 +- aws/data_source_aws_ecs_cluster_test.go | 73 +- ...ource_aws_ecs_container_definition_test.go | 6 +- aws/data_source_aws_ecs_service_test.go | 19 +- ...ata_source_aws_ecs_task_definition_test.go | 6 +- aws/data_source_aws_efs_access_point_test.go | 2 + aws/data_source_aws_efs_access_points_test.go | 2 + aws/data_source_aws_efs_file_system_test.go | 16 +- aws/data_source_aws_efs_mount_target_test.go | 6 +- aws/data_source_aws_eip_test.go | 43 +- aws/data_source_aws_eks_cluster_auth_test.go | 6 +- aws/data_source_aws_eks_cluster_test.go | 2 + ..._aws_elastic_beanstalk_application_test.go | 2 + ...ource_aws_elastic_beanstalk_hosted_zone.go | 2 +- ..._aws_elastic_beanstalk_hosted_zone_test.go | 11 +- ...s_elastic_beanstalk_solution_stack_test.go | 6 +- ...ata_source_aws_elasticache_cluster_test.go | 6 +- ..._aws_elasticache_replication_group_test.go | 21 +- ...ta_source_aws_elasticsearch_domain_test.go | 11 +- aws/data_source_aws_elb_hosted_zone_id.go | 2 +- ...data_source_aws_elb_hosted_zone_id_test.go | 6 +- aws/data_source_aws_elb_service_account.go | 2 +- ...ata_source_aws_elb_service_account_test.go | 11 +- aws/data_source_aws_elb_test.go | 6 +- aws/data_source_aws_glue_script_test.go | 11 +- ...data_source_aws_guardduty_detector_test.go | 7 +- aws/data_source_aws_iam_group_test.go | 11 +- ...ta_source_aws_iam_instance_profile_test.go | 6 +- aws/data_source_aws_iam_policy.go | 5 + ...ata_source_aws_iam_policy_document_test.go | 71 +- aws/data_source_aws_iam_policy_test.go | 25 +- aws/data_source_aws_iam_role_test.go | 11 +- ..._source_aws_iam_server_certificate_test.go | 3 + aws/data_source_aws_iam_user_test.go | 11 +- ...ata_source_aws_identitystore_group_test.go | 4 + ...data_source_aws_identitystore_user_test.go | 4 + ..._source_aws_imagebuilder_component_test.go | 2 + ...builder_distribution_configuration_test.go | 2 + ...ce_aws_imagebuilder_image_pipeline_test.go | 2 + ...urce_aws_imagebuilder_image_recipe_test.go | 2 + ...data_source_aws_imagebuilder_image_test.go | 2 + ...ilder_infrastructure_configuration_test.go | 2 + ...ource_aws_inspector_rules_packages_test.go | 6 +- aws/data_source_aws_instance_test.go | 121 +- aws/data_source_aws_instances_test.go | 16 +- aws/data_source_aws_internet_gateway.go | 2 +- aws/data_source_aws_internet_gateway_test.go | 6 +- aws/data_source_aws_iot_endpoint_test.go | 26 +- aws/data_source_aws_ip_ranges_test.go | 10 +- ...data_source_aws_kinesis_stream_consumer.go | 107 + ...source_aws_kinesis_stream_consumer_test.go | 144 + aws/data_source_aws_kinesis_stream_test.go | 1 + aws/data_source_aws_kms_alias_test.go | 11 +- aws/data_source_aws_kms_ciphertext_test.go | 16 +- aws/data_source_aws_kms_key_test.go | 6 +- aws/data_source_aws_kms_secret_test.go | 6 +- aws/data_source_aws_kms_secrets_test.go | 10 +- ...s_lakeformation_data_lake_settings_test.go | 1 + ...urce_aws_lakeformation_permissions_test.go | 5 + ..._source_aws_lakeformation_resource_test.go | 1 + aws/data_source_aws_lambda_alias_test.go | 6 +- ...rce_aws_lambda_code_signing_config_test.go | 16 +- aws/data_source_aws_lambda_function_test.go | 41 +- aws/data_source_aws_lambda_invocation_test.go | 16 +- ...ta_source_aws_lambda_layer_version_test.go | 16 +- ...ta_source_aws_launch_configuration_test.go | 17 +- aws/data_source_aws_launch_template_test.go | 11 + aws/data_source_aws_lb_listener_test.go | 21 +- aws/data_source_aws_lb_target_group_test.go | 11 +- aws/data_source_aws_lb_test.go | 16 +- aws/data_source_aws_lex_bot_alias_test.go | 5 +- aws/data_source_aws_lex_bot_test.go | 10 +- aws/data_source_aws_lex_intent_test.go | 10 +- aws/data_source_aws_lex_slot_type_test.go | 10 +- aws/data_source_aws_mq_broker_test.go | 5 +- aws/data_source_aws_msk_cluster_test.go | 2 + aws/data_source_aws_msk_configuration_test.go | 2 + aws/data_source_aws_nat_gateway_test.go | 6 +- ..._source_aws_neptune_engine_version_test.go | 3 + ..._aws_neptune_orderable_db_instance_test.go | 2 + aws/data_source_aws_network_acls_test.go | 5 + aws/data_source_aws_network_interface_test.go | 21 +- ...data_source_aws_network_interfaces_test.go | 3 + ...rce_aws_organizations_organization_test.go | 4 +- ...organizations_organizational_units_test.go | 4 +- ...aws_outposts_outpost_instance_type_test.go | 3 + ...ws_outposts_outpost_instance_types_test.go | 2 + aws/data_source_aws_outposts_outpost_test.go | 4 + aws/data_source_aws_outposts_outposts_test.go | 1 + aws/data_source_aws_outposts_site_test.go | 3 + aws/data_source_aws_outposts_sites_test.go | 1 + aws/data_source_aws_partition_test.go | 5 +- aws/data_source_aws_prefix_list_test.go | 15 +- aws/data_source_aws_pricing_product_test.go | 3 + aws/data_source_aws_qldb_ledger_test.go | 5 +- ...data_source_aws_ram_resource_share_test.go | 11 +- aws/data_source_aws_rds_certificate_test.go | 2 + aws/data_source_aws_rds_cluster_test.go | 6 +- ...data_source_aws_rds_engine_version_test.go | 4 + ...urce_aws_rds_orderable_db_instance_test.go | 11 + aws/data_source_aws_redshift_cluster_test.go | 16 +- ...rce_aws_redshift_orderable_cluster_test.go | 4 + ...ata_source_aws_redshift_service_account.go | 2 +- ...ource_aws_redshift_service_account_test.go | 11 +- aws/data_source_aws_region_test.go | 20 +- aws/data_source_aws_regions_test.go | 16 +- aws/data_source_aws_route.go | 181 +- ..._source_aws_route53_delegation_set_test.go | 3 +- ...urce_aws_route53_resolver_endpoint_test.go | 5 +- ...a_source_aws_route53_resolver_rule_test.go | 13 +- ..._source_aws_route53_resolver_rules_test.go | 5 +- aws/data_source_aws_route53_zone_test.go | 14 +- aws/data_source_aws_route_table_test.go | 11 +- aws/data_source_aws_route_tables_test.go | 2 + aws/data_source_aws_route_test.go | 74 +- aws/data_source_aws_s3_bucket_object_test.go | 14 +- aws/data_source_aws_s3_bucket_objects_test.go | 9 + aws/data_source_aws_s3_bucket_test.go | 11 +- ...e_aws_sagemaker_prebuilt_ecr_image_test.go | 11 +- ...aws_secretsmanager_secret_rotation_test.go | 6 +- ...a_source_aws_secretsmanager_secret_test.go | 21 +- ..._aws_secretsmanager_secret_version_test.go | 16 +- aws/data_source_aws_security_group_test.go | 6 +- aws/data_source_aws_security_groups_test.go | 11 +- ...sapplicationrepository_application_test.go | 12 +- ...ce_aws_servicequotas_service_quota_test.go | 10 +- ...a_source_aws_servicequotas_service_test.go | 5 +- aws/data_source_aws_sfn_activity_test.go | 6 +- aws/data_source_aws_sfn_state_machine_test.go | 6 +- ...data_source_aws_signer_signing_job_test.go | 6 +- ..._source_aws_signer_signing_profile_test.go | 6 +- aws/data_source_aws_sns_test.go | 6 +- aws/data_source_aws_sqs_queue_test.go | 11 +- aws/data_source_aws_ssm_document_test.go | 6 +- aws/data_source_aws_ssm_parameter_test.go | 15 +- ...data_source_aws_ssm_patch_baseline_test.go | 7 +- ...data_source_aws_ssoadmin_instances_test.go | 5 +- ...source_aws_ssoadmin_permission_set_test.go | 16 +- ...ta_source_aws_storagegateway_local_disk.go | 2 + ...urce_aws_storagegateway_local_disk_test.go | 11 +- aws/data_source_aws_subnet_ids_test.go | 3 + aws/data_source_aws_subnet_test.go | 12 +- aws/data_source_aws_transfer_server_test.go | 16 +- aws/data_source_aws_vpc.go | 2 +- aws/data_source_aws_vpc_dhcp_options.go | 2 +- aws/data_source_aws_vpc_dhcp_options_test.go | 11 +- aws/data_source_aws_vpc_endpoint.go | 2 +- aws/data_source_aws_vpc_endpoint_service.go | 38 +- ...ta_source_aws_vpc_endpoint_service_test.go | 36 +- aws/data_source_aws_vpc_endpoint_test.go | 31 +- ..._source_aws_vpc_peering_connection_test.go | 26 +- ...source_aws_vpc_peering_connections_test.go | 6 +- aws/data_source_aws_vpc_test.go | 12 +- aws/data_source_aws_vpcs_test.go | 16 +- aws/data_source_aws_vpn_gateway_test.go | 11 +- aws/data_source_aws_waf_ipset_test.go | 5 +- ...ata_source_aws_waf_rate_based_rule_test.go | 5 +- aws/data_source_aws_waf_rule_test.go | 5 +- aws/data_source_aws_waf_web_acl_test.go | 5 +- aws/data_source_aws_wafregional_ipset_test.go | 5 +- ...ce_aws_wafregional_rate_based_rule_test.go | 5 +- aws/data_source_aws_wafregional_rule_test.go | 5 +- ...ata_source_aws_wafregional_web_acl_test.go | 5 +- aws/data_source_aws_wafv2_ip_set_test.go | 6 +- ...source_aws_wafv2_regex_pattern_set_test.go | 6 +- aws/data_source_aws_wafv2_rule_group_test.go | 6 +- aws/data_source_aws_wafv2_web_acl_test.go | 6 +- aws/data_source_aws_workspaces_bundle_test.go | 19 +- ...ta_source_aws_workspaces_directory_test.go | 4 +- aws/data_source_aws_workspaces_image_test.go | 3 +- ...ta_source_aws_workspaces_workspace_test.go | 16 +- aws/hosted_zones.go | 2 +- aws/internal/keyvaluetags/iam_tags.go | 175 + aws/internal/keyvaluetags/key_value_tags.go | 56 + .../keyvaluetags/key_value_tags_test.go | 377 ++ aws/internal/net/cidr.go | 23 + aws/internal/net/cidr_test.go | 26 + .../service/apigatewayv2/finder/finder.go | 33 + .../service/apigatewayv2/lister/list.go | 2 +- .../apigatewayv2/lister/list_pages_gen.go | 23 +- .../service/apigatewayv2/waiter/status.go | 23 + .../service/apigatewayv2/waiter/waiter.go | 17 + .../codestarconnections/finder/finder.go | 22 + aws/internal/service/ec2/errors.go | 8 +- aws/internal/service/ec2/finder/finder.go | 190 + aws/internal/service/ec2/id.go | 5 + aws/internal/service/ec2/waiter/waiter.go | 7 + aws/internal/service/ecs/waiter/status.go | 37 + aws/internal/service/ecs/waiter/waiter.go | 69 + aws/internal/service/efs/waiter/status.go | 23 + aws/internal/service/efs/waiter/waiter.go | 50 +- aws/internal/service/kinesis/finder/finder.go | 25 + aws/internal/service/kinesis/waiter/status.go | 30 + aws/internal/service/kinesis/waiter/waiter.go | 49 + .../service/sagemaker/waiter/waiter.go | 2 +- aws/internal/service/sns/finder/finder.go | 26 + aws/internal/service/sns/waiter/status.go | 11 +- aws/internal/service/sns/waiter/waiter.go | 18 + aws/internal/service/ssm/finder/finder.go | 29 + .../service/storagegateway/finder/finder.go | 48 + aws/provider.go | 38 + aws/provider_test.go | 490 +- aws/resource_aws_accessanalyzer_analyzer.go | 3 +- ...source_aws_accessanalyzer_analyzer_test.go | 4 + aws/resource_aws_acm_certificate_test.go | 17 + ...resource_aws_acm_certificate_validation.go | 28 +- ...rce_aws_acm_certificate_validation_test.go | 10 + aws/resource_aws_acmpca_certificate.go | 18 +- ...source_aws_acmpca_certificate_authority.go | 50 +- ..._certificate_authority_certificate_test.go | 3 + ...e_aws_acmpca_certificate_authority_test.go | 8 + aws/resource_aws_acmpca_certificate_test.go | 5 + aws/resource_aws_alb_target_group_test.go | 15 + aws/resource_aws_ami.go | 132 +- aws/resource_aws_ami_copy.go | 84 +- aws/resource_aws_ami_copy_test.go | 4 + aws/resource_aws_ami_from_instance.go | 82 +- aws/resource_aws_ami_from_instance_test.go | 26 + aws/resource_aws_ami_launch_permission.go | 4 + ...resource_aws_ami_launch_permission_test.go | 4 + aws/resource_aws_ami_test.go | 11 + aws/resource_aws_api_gateway_account.go | 4 +- aws/resource_aws_api_gateway_account_test.go | 1 + aws/resource_aws_api_gateway_api_key_test.go | 6 + ...esource_aws_api_gateway_authorizer_test.go | 8 + ...ource_aws_api_gateway_base_path_mapping.go | 2 +- ..._aws_api_gateway_base_path_mapping_test.go | 4 + ...aws_api_gateway_client_certificate_test.go | 3 + ...esource_aws_api_gateway_deployment_test.go | 8 + ...urce_aws_api_gateway_documentation_part.go | 25 +- ...aws_api_gateway_documentation_part_test.go | 4 + ..._api_gateway_documentation_version_test.go | 3 + ...source_aws_api_gateway_domain_name_test.go | 8 + ...e_aws_api_gateway_gateway_response_test.go | 2 + aws/resource_aws_api_gateway_integration.go | 108 +- ...s_api_gateway_integration_response_test.go | 2 + ...source_aws_api_gateway_integration_test.go | 6 + ...ce_aws_api_gateway_method_response_test.go | 2 + ...ce_aws_api_gateway_method_settings_test.go | 15 + aws/resource_aws_api_gateway_method_test.go | 6 + aws/resource_aws_api_gateway_model_test.go | 2 + ..._aws_api_gateway_request_validator_test.go | 2 + aws/resource_aws_api_gateway_resource_test.go | 3 + ...ce_aws_api_gateway_rest_api_policy_test.go | 3 + aws/resource_aws_api_gateway_rest_api_test.go | 29 + aws/resource_aws_api_gateway_stage.go | 6 +- aws/resource_aws_api_gateway_stage_test.go | 5 + ...rce_aws_api_gateway_usage_plan_key_test.go | 3 + ...esource_aws_api_gateway_usage_plan_test.go | 10 + aws/resource_aws_api_gateway_vpc_link.go | 3 +- aws/resource_aws_api_gateway_vpc_link_test.go | 3 + ...ource_aws_apigatewayv2_api_mapping_test.go | 4 + aws/resource_aws_apigatewayv2_api_test.go | 12 + ...source_aws_apigatewayv2_authorizer_test.go | 6 + ...source_aws_apigatewayv2_deployment_test.go | 3 + aws/resource_aws_apigatewayv2_domain_name.go | 127 +- ...ource_aws_apigatewayv2_domain_name_test.go | 111 +- ..._apigatewayv2_integration_response_test.go | 3 + ...ource_aws_apigatewayv2_integration_test.go | 10 + aws/resource_aws_apigatewayv2_model_test.go | 3 + ...ce_aws_apigatewayv2_route_response_test.go | 3 + aws/resource_aws_apigatewayv2_route_test.go | 8 + aws/resource_aws_apigatewayv2_stage_test.go | 15 + ...resource_aws_apigatewayv2_vpc_link_test.go | 3 + ...source_aws_app_cookie_stickiness_policy.go | 6 +- ...e_aws_app_cookie_stickiness_policy_test.go | 3 + aws/resource_aws_appautoscaling_policy.go | 91 +- ...resource_aws_appautoscaling_policy_test.go | 9 + ...ws_appautoscaling_scheduled_action_test.go | 13 + aws/resource_aws_appautoscaling_target.go | 9 +- ...resource_aws_appautoscaling_target_test.go | 6 + ...resource_aws_appmesh_gateway_route_test.go | 6 + aws/resource_aws_appmesh_mesh_test.go | 3 + aws/resource_aws_appmesh_route_test.go | 13 + ...source_aws_appmesh_virtual_gateway_test.go | 8 + aws/resource_aws_appmesh_virtual_node_test.go | 13 + ...esource_aws_appmesh_virtual_router_test.go | 2 + ...source_aws_appmesh_virtual_service_test.go | 3 + aws/resource_aws_appsync_api_key_test.go | 3 + aws/resource_aws_appsync_datasource_test.go | 12 + aws/resource_aws_appsync_function_test.go | 4 + aws/resource_aws_appsync_graphql_api_test.go | 25 + aws/resource_aws_appsync_resolver.go | 2 +- aws/resource_aws_appsync_resolver_test.go | 8 + aws/resource_aws_athena_database.go | 22 +- aws/resource_aws_athena_database_test.go | 6 + aws/resource_aws_athena_named_query_test.go | 2 + aws/resource_aws_athena_workgroup_test.go | 13 + aws/resource_aws_autoscaling_attachment.go | 4 +- ...esource_aws_autoscaling_attachment_test.go | 2 + aws/resource_aws_autoscaling_group.go | 23 +- aws/resource_aws_autoscaling_group_test.go | 41 + ...resource_aws_autoscaling_lifecycle_hook.go | 6 +- ...rce_aws_autoscaling_lifecycle_hook_test.go | 2 + aws/resource_aws_autoscaling_notification.go | 10 +- ...ource_aws_autoscaling_notification_test.go | 3 + aws/resource_aws_autoscaling_policy.go | 26 +- aws/resource_aws_autoscaling_policy_test.go | 6 + aws/resource_aws_autoscaling_schedule.go | 2 +- aws/resource_aws_autoscaling_schedule_test.go | 5 + ..._aws_autoscalingplans_scaling_plan_test.go | 4 + ...esource_aws_backup_global_settings_test.go | 1 + aws/resource_aws_backup_plan_test.go | 11 + ...esource_aws_backup_region_settings_test.go | 1 + aws/resource_aws_backup_selection.go | 4 +- aws/resource_aws_backup_selection_test.go | 6 + ...rce_aws_backup_vault_notifications_test.go | 2 + aws/resource_aws_backup_vault_policy_test.go | 2 + aws/resource_aws_backup_vault_test.go | 4 + ...urce_aws_batch_compute_environment_test.go | 19 + aws/resource_aws_batch_job_definition.go | 2 +- aws/resource_aws_batch_job_definition_test.go | 4 + aws/resource_aws_batch_job_queue.go | 2 +- aws/resource_aws_batch_job_queue_test.go | 6 + aws/resource_aws_budgets_budget_test.go | 30 +- aws/resource_aws_cloud9_environment_ec2.go | 11 +- ...esource_aws_cloud9_environment_ec2_test.go | 4 + ..._cloudformation_stack_set_instance_test.go | 5 + ...ource_aws_cloudformation_stack_set_test.go | 12 + aws/resource_aws_cloudformation_stack_test.go | 14 + ...source_aws_cloudfront_cache_policy_test.go | 3 + aws/resource_aws_cloudfront_distribution.go | 2 - ...source_aws_cloudfront_distribution_test.go | 271 +- ..._cloudfront_origin_access_identity_test.go | 3 + ...ce_aws_cloudfront_origin_request_policy.go | 10 +- ...s_cloudfront_origin_request_policy_test.go | 3 + ...resource_aws_cloudfront_public_key_test.go | 4 + ...aws_cloudfront_realtime_log_config_test.go | 3 + aws/resource_aws_cloudhsm2_cluster_test.go | 2 + aws/resource_aws_cloudhsm2_hsm_test.go | 2 + aws/resource_aws_cloudtrail.go | 14 +- aws/resource_aws_cloudtrail_test.go | 11 + ...rce_aws_cloudwatch_composite_alarm_test.go | 9 + aws/resource_aws_cloudwatch_dashboard_test.go | 3 + ...ource_aws_cloudwatch_event_archive_test.go | 5 + aws/resource_aws_cloudwatch_event_bus_test.go | 5 + ...ce_aws_cloudwatch_event_permission_test.go | 7 + ...resource_aws_cloudwatch_event_rule_test.go | 11 + ...source_aws_cloudwatch_event_target_test.go | 15 + ...resource_aws_cloudwatch_log_destination.go | 2 +- ..._cloudwatch_log_destination_policy_test.go | 1 + ...rce_aws_cloudwatch_log_destination_test.go | 2 + aws/resource_aws_cloudwatch_log_group_test.go | 9 + ...source_aws_cloudwatch_log_metric_filter.go | 2 +- ...e_aws_cloudwatch_log_metric_filter_test.go | 1 + ...urce_aws_cloudwatch_log_resource_policy.go | 2 +- ...aws_cloudwatch_log_resource_policy_test.go | 1 + aws/resource_aws_cloudwatch_log_stream.go | 2 +- ...resource_aws_cloudwatch_log_stream_test.go | 3 + ...cloudwatch_log_subscription_filter_test.go | 7 + aws/resource_aws_cloudwatch_metric_alarm.go | 4 +- ...source_aws_cloudwatch_metric_alarm_test.go | 12 + ...artifact_domain_permissions_policy_test.go | 4 + aws/resource_aws_codeartifact_domain_test.go | 4 + ...fact_repository_permissions_policy_test.go | 4 + ...source_aws_codeartifact_repository_test.go | 8 + aws/resource_aws_codebuild_project.go | 21 +- aws/resource_aws_codebuild_project_test.go | 118 +- ...esource_aws_codebuild_report_group_test.go | 5 + ...ce_aws_codebuild_source_credential_test.go | 2 + aws/resource_aws_codebuild_webhook_test.go | 5 + ...resource_aws_codecommit_repository_test.go | 5 + aws/resource_aws_codecommit_trigger_test.go | 1 + aws/resource_aws_codedeploy_app_test.go | 5 + ...e_aws_codedeploy_deployment_config_test.go | 5 + ...esource_aws_codedeploy_deployment_group.go | 62 +- ...ce_aws_codedeploy_deployment_group_test.go | 32 + aws/resource_aws_codepipeline.go | 25 +- aws/resource_aws_codepipeline_test.go | 10 + aws/resource_aws_codepipeline_webhook_test.go | 5 + ...urce_aws_codestarconnections_connection.go | 17 +- ...aws_codestarconnections_connection_test.go | 3 + ...tarnotifications_notification_rule_test.go | 5 + ...ito_identity_pool_roles_attachment_test.go | 6 + ...resource_aws_cognito_identity_pool_test.go | 7 + ...urce_aws_cognito_identity_provider_test.go | 1 + ...source_aws_cognito_resource_server_test.go | 2 + aws/resource_aws_cognito_user_group_test.go | 3 + aws/resource_aws_cognito_user_pool.go | 9 +- ...ource_aws_cognito_user_pool_client_test.go | 11 + ...ource_aws_cognito_user_pool_domain_test.go | 3 + aws/resource_aws_cognito_user_pool_test.go | 27 + ...cognito_user_pool_ui_customization_test.go | 10 + ...aws_config_aggregate_authorization_test.go | 2 + aws/resource_aws_config_config_rule.go | 3 +- aws/resource_aws_config_config_rule_test.go | 9 + ...rce_aws_config_configuration_aggregator.go | 44 +- ...ws_config_configuration_aggregator_test.go | 134 +- ...nfig_configuration_recorder_status_test.go | 3 + ..._aws_config_configuration_recorder_test.go | 3 + ...source_aws_config_conformance_pack_test.go | 11 + aws/resource_aws_config_delivery_channel.go | 3 +- ...source_aws_config_delivery_channel_test.go | 3 + ...ws_config_organization_custom_rule_test.go | 13 + ...s_config_organization_managed_rule_test.go | 12 + ...ce_aws_config_remediation_configuration.go | 8 +- ...s_config_remediation_configuration_test.go | 4 + aws/resource_aws_cur_report_definition.go | 2 +- ...resource_aws_cur_report_definition_test.go | 6 + aws/resource_aws_customer_gateway_test.go | 6 + ...resource_aws_datapipeline_pipeline_test.go | 4 + aws/resource_aws_datasync_agent_test.go | 4 + ...resource_aws_datasync_location_efs_test.go | 4 + ...c_location_fsx_windows_file_system_test.go | 4 + ...resource_aws_datasync_location_nfs_test.go | 5 + aws/resource_aws_datasync_location_s3.go | 4 +- aws/resource_aws_datasync_location_s3_test.go | 3 + ...resource_aws_datasync_location_smb_test.go | 3 + aws/resource_aws_datasync_task_test.go | 12 + aws/resource_aws_dax_cluster.go | 3 +- aws/resource_aws_dax_cluster_test.go | 4 + aws/resource_aws_dax_parameter_group_test.go | 1 + aws/resource_aws_dax_subnet_group_test.go | 1 + aws/resource_aws_db_cluster_snapshot_test.go | 2 + ...resource_aws_db_event_subscription_test.go | 5 + aws/resource_aws_db_instance.go | 5 +- ...e_aws_db_instance_role_association_test.go | 2 + aws/resource_aws_db_instance_test.go | 95 +- aws/resource_aws_db_option_group.go | 3 +- aws/resource_aws_db_option_group_test.go | 14 + aws/resource_aws_db_parameter_group.go | 8 +- aws/resource_aws_db_parameter_group_test.go | 83 +- ..._aws_db_proxy_default_target_group_test.go | 8 + aws/resource_aws_db_proxy_target_test.go | 3 + aws/resource_aws_db_proxy_test.go | 12 + aws/resource_aws_db_security_group_test.go | 1 + aws/resource_aws_db_snapshot_test.go | 3 + aws/resource_aws_db_subnet_group_test.go | 5 + aws/resource_aws_default_network_acl_test.go | 6 + aws/resource_aws_default_route_table.go | 5 + aws/resource_aws_default_route_table_test.go | 14 + ...esource_aws_default_security_group_test.go | 4 + aws/resource_aws_default_subnet_test.go | 2 + ...ource_aws_default_vpc_dhcp_options_test.go | 1 + aws/resource_aws_default_vpc_test.go | 1 + aws/resource_aws_devicefarm_project_test.go | 2 + ...tory_service_conditional_forwarder_test.go | 1 + ...ce_aws_directory_service_directory_test.go | 7 + ...directory_service_log_subscription_test.go | 1 + aws/resource_aws_dlm_lifecycle_policy_test.go | 3 + aws/resource_aws_dms_certificate.go | 71 +- aws/resource_aws_dms_certificate_test.go | 146 +- aws/resource_aws_dms_endpoint_test.go | 15 + ...esource_aws_dms_event_subscription_test.go | 5 + ...ource_aws_dms_replication_instance_test.go | 13 + ...e_aws_dms_replication_subnet_group_test.go | 1 + aws/resource_aws_dms_replication_task_test.go | 1 + aws/resource_aws_docdb_cluster.go | 5 +- aws/resource_aws_docdb_cluster_instance.go | 5 +- ...esource_aws_docdb_cluster_instance_test.go | 6 + ..._aws_docdb_cluster_parameter_group_test.go | 7 + ...esource_aws_docdb_cluster_snapshot_test.go | 1 + aws/resource_aws_docdb_cluster_test.go | 12 + aws/resource_aws_docdb_subnet_group_test.go | 5 + aws/resource_aws_dx_bgp_peer_test.go | 1 + ...urce_aws_dx_connection_association_test.go | 2 + aws/resource_aws_dx_connection_test.go | 2 + ...ws_dx_gateway_association_proposal_test.go | 4 + ...esource_aws_dx_gateway_association_test.go | 9 + aws/resource_aws_dx_gateway_test.go | 2 + ...x_hosted_private_virtual_interface_test.go | 2 + ...dx_hosted_public_virtual_interface_test.go | 2 + ...x_hosted_transit_virtual_interface_test.go | 2 + aws/resource_aws_dx_lag_test.go | 2 + ...e_aws_dx_private_virtual_interface_test.go | 3 + ...ce_aws_dx_public_virtual_interface_test.go | 2 + ...e_aws_dx_transit_virtual_interface_test.go | 2 + ...resource_aws_dynamodb_global_table_test.go | 2 + aws/resource_aws_dynamodb_table_item_test.go | 5 + aws/resource_aws_dynamodb_table_test.go | 25 + aws/resource_aws_ebs_default_kms_key_test.go | 1 + ...urce_aws_ebs_encryption_by_default_test.go | 1 + aws/resource_aws_ebs_snapshot_copy_test.go | 6 + aws/resource_aws_ebs_snapshot_test.go | 5 + ...ce_aws_ec2_availability_zone_group_test.go | 1 + ...ource_aws_ec2_capacity_reservation_test.go | 11 + aws/resource_aws_ec2_carrier_gateway.go | 2 +- aws/resource_aws_ec2_carrier_gateway_test.go | 3 + ..._ec2_client_vpn_authorization_rule_test.go | 4 + ...source_aws_ec2_client_vpn_endpoint_test.go | 16 +- ...ec2_client_vpn_network_association_test.go | 94 + aws/resource_aws_ec2_client_vpn_route_test.go | 3 + aws/resource_aws_ec2_fleet_test.go | 28 + ...ateway_route_table_vpc_association_test.go | 3 + ...source_aws_ec2_local_gateway_route_test.go | 3 + ...source_aws_ec2_managed_prefix_list_test.go | 6 + aws/resource_aws_ec2_tag_test.go | 4 + ...aws_ec2_traffic_mirror_filter_rule_test.go | 2 + ...urce_aws_ec2_traffic_mirror_filter_test.go | 3 + ...resource_aws_ec2_traffic_mirror_session.go | 8 +- ...rce_aws_ec2_traffic_mirror_session_test.go | 4 + aws/resource_aws_ec2_traffic_mirror_target.go | 12 +- ...urce_aws_ec2_traffic_mirror_target_test.go | 5 + ...ateway_peering_attachment_accepter_test.go | 3 + ...transit_gateway_peering_attachment_test.go | 4 + ...nsit_gateway_prefix_list_reference_test.go | 5 + ...it_gateway_route_table_association_test.go | 1 + ...it_gateway_route_table_propagation_test.go | 1 + ...ws_ec2_transit_gateway_route_table_test.go | 4 + ...urce_aws_ec2_transit_gateway_route_test.go | 5 + aws/resource_aws_ec2_transit_gateway_test.go | 11 + ...it_gateway_vpc_attachment_accepter_test.go | 3 + ...ec2_transit_gateway_vpc_attachment_test.go | 11 + aws/resource_aws_ecr_lifecycle_policy_test.go | 1 + aws/resource_aws_ecr_repository_policy.go | 102 +- ...resource_aws_ecr_repository_policy_test.go | 145 +- aws/resource_aws_ecr_repository_test.go | 6 + aws/resource_aws_ecrpublic_repository_test.go | 9 + ...resource_aws_ecs_capacity_provider_test.go | 5 + aws/resource_aws_ecs_cluster_test.go | 8 + aws/resource_aws_ecs_service.go | 475 +- aws/resource_aws_ecs_service_test.go | 1723 +++--- aws/resource_aws_ecs_task_definition_test.go | 25 + aws/resource_aws_efs_access_point_test.go | 7 + aws/resource_aws_efs_file_system.go | 212 +- ...esource_aws_efs_file_system_policy_test.go | 2 + aws/resource_aws_efs_file_system_test.go | 59 +- aws/resource_aws_efs_mount_target_test.go | 4 + ...e_aws_egress_only_internet_gateway_test.go | 2 + aws/resource_aws_eip_association_test.go | 6 + aws/resource_aws_eip_test.go | 16 + aws/resource_aws_eks_cluster.go | 3 +- aws/resource_aws_eks_cluster_test.go | 10 + aws/resource_aws_eks_fargate_profile_test.go | 5 + aws/resource_aws_eks_node_group_test.go | 20 + ..._aws_elastic_beanstalk_application_test.go | 4 + ...stic_beanstalk_application_version_test.go | 3 + ...c_beanstalk_configuration_template_test.go | 3 + ..._aws_elastic_beanstalk_environment_test.go | 15 +- ...ce_aws_elastic_transcoder_pipeline_test.go | 6 + ...urce_aws_elastic_transcoder_preset_test.go | 6 + aws/resource_aws_elasticache_cluster_test.go | 58 +- ...asticache_global_replication_group_test.go | 5 + ...ce_aws_elasticache_parameter_group_test.go | 9 + ...ource_aws_elasticache_replication_group.go | 4 +- ..._aws_elasticache_replication_group_test.go | 153 +- ...rce_aws_elasticache_security_group_test.go | 1 + ...ource_aws_elasticache_subnet_group_test.go | 2 + aws/resource_aws_elasticsearch_domain.go | 3 +- ...ce_aws_elasticsearch_domain_policy_test.go | 1 + aws/resource_aws_elasticsearch_domain_test.go | 34 +- aws/resource_aws_elb_attachment_test.go | 2 + aws/resource_aws_elb_test.go | 21 + aws/resource_aws_emr_cluster.go | 3 +- aws/resource_aws_emr_cluster_test.go | 31 + aws/resource_aws_emr_instance_fleet_test.go | 5 + aws/resource_aws_emr_instance_group_test.go | 7 + ...rce_aws_emr_security_configuration_test.go | 1 + aws/resource_aws_flow_log_test.go | 9 + aws/resource_aws_fms_admin_account.go | 2 +- aws/resource_aws_fms_admin_account_test.go | 1 + aws/resource_aws_fms_policy_test.go | 5 + ...esource_aws_fsx_lustre_file_system_test.go | 18 + ...source_aws_fsx_windows_file_system_test.go | 16 + aws/resource_aws_gamelift_alias_test.go | 4 + aws/resource_aws_gamelift_build_test.go | 3 + aws/resource_aws_gamelift_fleet_test.go | 4 + ...ce_aws_gamelift_game_session_queue_test.go | 3 + aws/resource_aws_glacier_vault_lock_test.go | 2 + aws/resource_aws_glacier_vault_test.go | 5 + ...ource_aws_globalaccelerator_accelerator.go | 2 +- ..._aws_globalaccelerator_accelerator_test.go | 9 +- ...s_globalaccelerator_endpoint_group_test.go | 8 + ...resource_aws_globalaccelerator_listener.go | 28 +- ...rce_aws_globalaccelerator_listener_test.go | 4 + ...resource_aws_glue_catalog_database_test.go | 2 + aws/resource_aws_glue_catalog_table_test.go | 15 + aws/resource_aws_glue_classifier_test.go | 8 + aws/resource_aws_glue_connection_test.go | 7 + aws/resource_aws_glue_crawler_test.go | 30 + ...e_data_catalog_encryption_settings_test.go | 1 + aws/resource_aws_glue_dev_endpoint_test.go | 14 + aws/resource_aws_glue_job_test.go | 16 + aws/resource_aws_glue_ml_transform_test.go | 10 + aws/resource_aws_glue_partition_test.go | 5 + aws/resource_aws_glue_registry_test.go | 4 + aws/resource_aws_glue_resource_policy_test.go | 3 + aws/resource_aws_glue_schema_test.go | 7 + ...ce_aws_glue_security_configuration_test.go | 5 + aws/resource_aws_glue_trigger_test.go | 12 + ...rce_aws_glue_user_defined_function_test.go | 3 + aws/resource_aws_glue_workflow_test.go | 6 + aws/resource_aws_guardduty_detector_test.go | 2 + aws/resource_aws_guardduty_filter_test.go | 4 + ...urce_aws_guardduty_invite_accepter_test.go | 1 + aws/resource_aws_guardduty_ipset_test.go | 2 + aws/resource_aws_guardduty_member_test.go | 4 + ...ardduty_organization_admin_account_test.go | 1 + ...ardduty_organization_configuration_test.go | 4 +- ...s_guardduty_publishing_destination_test.go | 2 + ...ource_aws_guardduty_threatintelset_test.go | 2 + aws/resource_aws_iam_access_key_test.go | 3 + aws/resource_aws_iam_account_alias_test.go | 2 + ...ce_aws_iam_account_password_policy_test.go | 1 + aws/resource_aws_iam_group_membership_test.go | 2 + ...ce_aws_iam_group_policy_attachment_test.go | 3 + aws/resource_aws_iam_group_policy_test.go | 4 + aws/resource_aws_iam_group_test.go | 2 + aws/resource_aws_iam_instance_profile.go | 26 +- aws/resource_aws_iam_instance_profile_test.go | 157 +- ...esource_aws_iam_openid_connect_provider.go | 43 +- ...ce_aws_iam_openid_connect_provider_test.go | 169 +- aws/resource_aws_iam_policy.go | 115 +- ...resource_aws_iam_policy_attachment_test.go | 5 + aws/resource_aws_iam_policy_test.go | 123 +- aws/resource_aws_iam_role.go | 2 +- ...rce_aws_iam_role_policy_attachment_test.go | 4 + aws/resource_aws_iam_role_policy_test.go | 6 + aws/resource_aws_iam_role_test.go | 21 + aws/resource_aws_iam_saml_provider.go | 43 +- aws/resource_aws_iam_saml_provider_test.go | 74 + aws/resource_aws_iam_server_certificate.go | 60 +- ...esource_aws_iam_server_certificate_test.go | 175 +- ...source_aws_iam_service_linked_role_test.go | 20 +- aws/resource_aws_iam_user.go | 4 +- ...urce_aws_iam_user_group_membership_test.go | 1 + aws/resource_aws_iam_user_login_profile.go | 4 +- ...esource_aws_iam_user_login_profile_test.go | 5 + ...rce_aws_iam_user_policy_attachment_test.go | 3 + aws/resource_aws_iam_user_policy_test.go | 5 + aws/resource_aws_iam_user_ssh_key_test.go | 2 + aws/resource_aws_iam_user_test.go | 11 + ...esource_aws_imagebuilder_component_test.go | 9 + ...builder_distribution_configuration_test.go | 13 + ...ce_aws_imagebuilder_image_pipeline_test.go | 13 + ...urce_aws_imagebuilder_image_recipe_test.go | 17 + aws/resource_aws_imagebuilder_image_test.go | 7 + ...ilder_infrastructure_configuration_test.go | 14 + ...ce_aws_inspector_assessment_target_test.go | 4 + ..._aws_inspector_assessment_template_test.go | 3 + ...ource_aws_inspector_resource_group_test.go | 1 + aws/resource_aws_instance.go | 7 +- aws/resource_aws_instance_test.go | 91 + aws/resource_aws_internet_gateway.go | 2 +- aws/resource_aws_internet_gateway_test.go | 4 + aws/resource_aws_iot_certificate_test.go | 2 + ...resource_aws_iot_policy_attachment_test.go | 1 + aws/resource_aws_iot_policy_test.go | 2 + aws/resource_aws_iot_role_alias_test.go | 1 + ...aws_iot_thing_principal_attachment_test.go | 1 + aws/resource_aws_iot_thing_test.go | 2 + aws/resource_aws_iot_thing_type_test.go | 2 + aws/resource_aws_iot_topic_rule_test.go | 20 + aws/resource_aws_key_pair_test.go | 5 + ..._aws_kinesis_analytics_application_test.go | 20 + ...s_kinesis_firehose_delivery_stream_test.go | 32 + aws/resource_aws_kinesis_stream_consumer.go | 138 + ...source_aws_kinesis_stream_consumer_test.go | 207 + aws/resource_aws_kinesis_stream_test.go | 30 +- aws/resource_aws_kinesis_video_stream_test.go | 4 + ...aws_kinesisanalyticsv2_application_test.go | 25 + aws/resource_aws_kms_alias_test.go | 6 + aws/resource_aws_kms_ciphertext_test.go | 4 + aws/resource_aws_kms_external_key_test.go | 9 + aws/resource_aws_kms_grant_test.go | 7 + aws/resource_aws_kms_key_test.go | 8 + ...ce_aws_lakeformation_data_lake_settings.go | 4 +- ...s_lakeformation_data_lake_settings_test.go | 3 + aws/resource_aws_lakeformation_permissions.go | 139 +- ...urce_aws_lakeformation_permissions_test.go | 101 + ...esource_aws_lakeformation_resource_test.go | 5 + aws/resource_aws_lakeformation_test.go | 19 +- aws/resource_aws_lambda_alias_test.go | 4 + ...rce_aws_lambda_code_signing_config_test.go | 3 + ...ce_aws_lambda_event_source_mapping_test.go | 16 + ...ambda_function_event_invoke_config_test.go | 14 + aws/resource_aws_lambda_function_test.go | 36 + aws/resource_aws_lambda_layer_version_test.go | 6 + aws/resource_aws_lambda_permission_test.go | 11 + ...bda_provisioned_concurrency_config_test.go | 5 + aws/resource_aws_launch_configuration.go | 5 +- aws/resource_aws_launch_configuration_test.go | 15 + aws/resource_aws_launch_template_test.go | 33 + ...ce_aws_lb_cookie_stickiness_policy_test.go | 3 + ...source_aws_lb_listener_certificate_test.go | 4 + aws/resource_aws_lb_listener_rule_test.go | 24 + aws/resource_aws_lb_listener_test.go | 11 + ...urce_aws_lb_ssl_negotiation_policy_test.go | 2 + ...rce_aws_lb_target_group_attachment_test.go | 6 + aws/resource_aws_lb_target_group_test.go | 31 + aws/resource_aws_lb_test.go | 34 + aws/resource_aws_lex_bot_alias_test.go | 7 + aws/resource_aws_lex_bot_test.go | 13 + aws/resource_aws_lex_intent_test.go | 12 + aws/resource_aws_lex_slot_type_test.go | 7 + ...rce_aws_licensemanager_association_test.go | 1 + ...censemanager_license_configuration_test.go | 2 + aws/resource_aws_lightsail_domain_test.go | 2 + ...rce_aws_lightsail_instance_public_ports.go | 231 + ...ws_lightsail_instance_public_ports_test.go | 261 + aws/resource_aws_lightsail_instance_test.go | 4 + aws/resource_aws_lightsail_key_pair_test.go | 4 + ...aws_lightsail_static_ip_attachment_test.go | 2 + aws/resource_aws_lightsail_static_ip_test.go | 2 + ...oad_balancer_backend_server_policy_test.go | 1 + ..._aws_load_balancer_listener_policy_test.go | 1 + aws/resource_aws_load_balancer_policy_test.go | 3 + ...s_macie_member_account_association_test.go | 6 +- ...ce_aws_macie_s3_bucket_association_test.go | 2 + ...e_aws_main_route_table_association_test.go | 2 + aws/resource_aws_media_convert_queue_test.go | 6 + ...resource_aws_media_package_channel_test.go | 3 + ...e_aws_media_store_container_policy_test.go | 1 + ...resource_aws_media_store_container_test.go | 2 + aws/resource_aws_mq_broker_test.go | 15 + aws/resource_aws_mq_configuration.go | 22 +- aws/resource_aws_mq_configuration_test.go | 153 +- aws/resource_aws_msk_cluster_test.go | 22 +- aws/resource_aws_msk_configuration_test.go | 5 + ...e_aws_msk_scram_secret_association_test.go | 4 + aws/resource_aws_nat_gateway_test.go | 2 + aws/resource_aws_neptune_cluster.go | 3 +- aws/resource_aws_neptune_cluster_instance.go | 5 +- ...ource_aws_neptune_cluster_instance_test.go | 6 + ...ws_neptune_cluster_parameter_group_test.go | 7 + ...ource_aws_neptune_cluster_snapshot_test.go | 1 + aws/resource_aws_neptune_cluster_test.go | 11 + ...rce_aws_neptune_event_subscription_test.go | 4 + ...source_aws_neptune_parameter_group_test.go | 4 + aws/resource_aws_neptune_subnet_group_test.go | 4 + aws/resource_aws_network_acl.go | 118 +- aws/resource_aws_network_acl_rule.go | 149 +- aws/resource_aws_network_acl_rule_test.go | 12 +- aws/resource_aws_network_acl_test.go | 17 + ...e_aws_network_interface_attachment_test.go | 1 + ...ws_network_interface_sg_attachment_test.go | 5 + aws/resource_aws_network_interface_test.go | 11 + ...ws_networkfirewall_firewall_policy_test.go | 13 + ...ource_aws_networkfirewall_firewall_test.go | 7 + ...workfirewall_logging_configuration_test.go | 13 + ...ws_networkfirewall_resource_policy_test.go | 5 + ...rce_aws_networkfirewall_rule_group_test.go | 14 + aws/resource_aws_opsworks_application_test.go | 1 + ...resource_aws_opsworks_custom_layer_test.go | 3 + ...esource_aws_opsworks_ganglia_layer_test.go | 2 + ...esource_aws_opsworks_haproxy_layer_test.go | 2 + aws/resource_aws_opsworks_instance_test.go | 2 + ...source_aws_opsworks_java_app_layer_test.go | 2 + ...ource_aws_opsworks_memcached_layer_test.go | 2 + aws/resource_aws_opsworks_mysql_layer_test.go | 2 + ...urce_aws_opsworks_nodejs_app_layer_test.go | 2 + aws/resource_aws_opsworks_permission.go | 4 +- aws/resource_aws_opsworks_permission_test.go | 2 + ...esource_aws_opsworks_php_app_layer_test.go | 2 + ...ource_aws_opsworks_rails_app_layer_test.go | 2 + ...ource_aws_opsworks_rds_db_instance_test.go | 1 + aws/resource_aws_opsworks_stack_test.go | 6 + ...urce_aws_opsworks_static_web_layer_test.go | 2 + ...resource_aws_opsworks_user_profile_test.go | 1 + ...resource_aws_organizations_account_test.go | 3 + ...rce_aws_organizations_organization_test.go | 6 + ..._organizations_organizational_unit_test.go | 2 + ...ws_organizations_policy_attachment_test.go | 3 + aws/resource_aws_organizations_policy_test.go | 10 + aws/resource_aws_pinpoint_adm_channel_test.go | 1 + ...resource_aws_pinpoint_apns_channel_test.go | 2 + ..._aws_pinpoint_apns_sandbox_channel_test.go | 2 + ...rce_aws_pinpoint_apns_voip_channel_test.go | 2 + ...pinpoint_apns_voip_sandbox_channel_test.go | 2 + aws/resource_aws_pinpoint_app_test.go | 5 + ...esource_aws_pinpoint_baidu_channel_test.go | 1 + aws/resource_aws_pinpoint_email_channel.go | 40 +- ...esource_aws_pinpoint_email_channel_test.go | 138 +- aws/resource_aws_pinpoint_event_stream.go | 55 +- ...resource_aws_pinpoint_event_stream_test.go | 67 +- aws/resource_aws_pinpoint_gcm_channel_test.go | 1 + aws/resource_aws_pinpoint_sms_channel.go | 33 +- aws/resource_aws_pinpoint_sms_channel_test.go | 34 +- aws/resource_aws_placement_group_test.go | 3 + aws/resource_aws_prometheus_workspace_test.go | 2 + ...resource_aws_proxy_protocol_policy_test.go | 1 + aws/resource_aws_qldb_ledger_test.go | 2 + aws/resource_aws_quicksight_group_test.go | 3 + aws/resource_aws_quicksight_user_test.go | 3 + ...urce_aws_ram_principal_association_test.go | 2 + ...ource_aws_ram_resource_association_test.go | 2 + ...ce_aws_ram_resource_share_accepter_test.go | 1 + aws/resource_aws_ram_resource_share_test.go | 4 + aws/resource_aws_rds_cluster.go | 5 +- aws/resource_aws_rds_cluster_endpoint_test.go | 3 + aws/resource_aws_rds_cluster_instance.go | 5 +- aws/resource_aws_rds_cluster_instance_test.go | 23 + ...ce_aws_rds_cluster_parameter_group_test.go | 9 + aws/resource_aws_rds_cluster_test.go | 56 + aws/resource_aws_rds_global_cluster_test.go | 11 + aws/resource_aws_redshift_cluster_test.go | 15 + ...ce_aws_redshift_event_subscription_test.go | 5 + ...ource_aws_redshift_parameter_group_test.go | 4 + ...source_aws_redshift_security_group_test.go | 5 + ...e_aws_redshift_snapshot_copy_grant_test.go | 3 + ...hift_snapshot_schedule_association_test.go | 1 + ...rce_aws_redshift_snapshot_schedule_test.go | 6 + ...resource_aws_redshift_subnet_group_test.go | 5 + aws/resource_aws_resourcegroups_group_test.go | 2 + aws/resource_aws_route.go | 680 +-- ...esource_aws_route53_delegation_set_test.go | 4 +- aws/resource_aws_route53_health_check_test.go | 22 +- ...rce_aws_route53_hosted_zone_dnssec_test.go | 6 +- ...source_aws_route53_key_signing_key_test.go | 6 +- aws/resource_aws_route53_query_log_test.go | 2 +- aws/resource_aws_route53_record_test.go | 71 +- ...aws_route53_resolver_dnssec_config_test.go | 4 +- ...urce_aws_route53_resolver_endpoint_test.go | 4 +- ...olver_query_log_config_association_test.go | 4 +- ..._route53_resolver_query_log_config_test.go | 6 +- ..._route53_resolver_rule_association_test.go | 2 +- ...resource_aws_route53_resolver_rule_test.go | 14 +- ...te53_vpc_association_authorization_test.go | 4 +- ...ource_aws_route53_zone_association_test.go | 13 +- aws/resource_aws_route53_zone_test.go | 22 +- aws/resource_aws_route_table.go | 52 +- ...source_aws_route_table_association_test.go | 8 + aws/resource_aws_route_table_test.go | 116 +- aws/resource_aws_route_test.go | 2983 +++++++--- aws/resource_aws_s3_access_point_test.go | 7 + ...aws_s3_account_public_access_block_test.go | 7 + ..._s3_bucket_analytics_configuration_test.go | 13 + aws/resource_aws_s3_bucket_inventory_test.go | 3 + aws/resource_aws_s3_bucket_metric_test.go | 7 + ...esource_aws_s3_bucket_notification_test.go | 6 + aws/resource_aws_s3_bucket_object_test.go | 28 + ...e_aws_s3_bucket_ownership_controls_test.go | 4 + aws/resource_aws_s3_bucket_policy_test.go | 2 + ..._aws_s3_bucket_public_access_block_test.go | 7 + aws/resource_aws_s3_bucket_test.go | 47 +- aws/resource_aws_s3_object_copy_test.go | 1 + ...rol_bucket_lifecycle_configuration_test.go | 10 + ...source_aws_s3control_bucket_policy_test.go | 3 + aws/resource_aws_s3control_bucket_test.go | 3 + aws/resource_aws_s3outposts_endpoint_test.go | 3 + ...rce_aws_sagemaker_app_image_config_test.go | 4 + aws/resource_aws_sagemaker_app_test.go | 4 + ...urce_aws_sagemaker_code_repository_test.go | 4 + aws/resource_aws_sagemaker_domain_test.go | 11 + ...s_sagemaker_endpoint_configuration_test.go | 7 + aws/resource_aws_sagemaker_endpoint_test.go | 3 + ...source_aws_sagemaker_feature_group_test.go | 9 + aws/resource_aws_sagemaker_image_test.go | 5 + ...source_aws_sagemaker_image_version_test.go | 3 + ..._aws_sagemaker_model_package_group_test.go | 4 + aws/resource_aws_sagemaker_model_test.go | 11 + ...k_instance_lifecycle_configuration_test.go | 2 + ...ce_aws_sagemaker_notebook_instance_test.go | 12 + ...esource_aws_sagemaker_user_profile_test.go | 7 + ...e_aws_secretsmanager_secret_policy_test.go | 3 + ...aws_secretsmanager_secret_rotation_test.go | 1 + ...resource_aws_secretsmanager_secret_test.go | 9 + ..._aws_secretsmanager_secret_version_test.go | 3 + aws/resource_aws_security_group.go | 19 +- aws/resource_aws_security_group_rule_test.go | 24 + aws/resource_aws_security_group_test.go | 42 + aws/resource_aws_securityhub_account_test.go | 1 + ...urce_aws_securityhub_action_target_test.go | 4 + ...ce_aws_securityhub_invite_accepter_test.go | 1 + aws/resource_aws_securityhub_member_test.go | 2 + ...rityhub_organization_admin_account_test.go | 71 + ...s_securityhub_product_subscription_test.go | 1 + ...securityhub_standards_subscription_test.go | 1 + aws/resource_aws_securityhub_test.go | 5 +- ...ionrepository_cloudformation_stack_test.go | 6 + ...s_service_discovery_http_namespace_test.go | 4 + ...ce_discovery_private_dns_namespace_test.go | 5 + ...ice_discovery_public_dns_namespace_test.go | 4 + ...urce_aws_service_discovery_service_test.go | 5 + ...ource_aws_servicecatalog_portfolio_test.go | 3 + ...ce_aws_servicequotas_service_quota_test.go | 3 + ...ce_aws_ses_active_receipt_rule_set_test.go | 2 + ...resource_aws_ses_configuration_set_test.go | 6 + aws/resource_aws_ses_domain_dkim_test.go | 1 + aws/resource_aws_ses_domain_identity_test.go | 3 + ...s_ses_domain_identity_verification_test.go | 3 + aws/resource_aws_ses_domain_mail_from_test.go | 4 + aws/resource_aws_ses_email_identity_test.go | 2 + ...resource_aws_ses_event_destination_test.go | 2 + ...ws_ses_identity_notification_topic_test.go | 1 + aws/resource_aws_ses_identity_policy_test.go | 3 + aws/resource_aws_ses_receipt_filter_test.go | 2 + aws/resource_aws_ses_receipt_rule_set_test.go | 2 + aws/resource_aws_ses_receipt_rule_test.go | 5 + aws/resource_aws_ses_template_test.go | 3 + aws/resource_aws_sfn_activity_test.go | 2 + aws/resource_aws_sfn_state_machine_test.go | 6 + aws/resource_aws_shield_protection_test.go | 7 +- aws/resource_aws_signer_signing_job_test.go | 1 + ..._signer_signing_profile_permission_test.go | 4 + ...esource_aws_signer_signing_profile_test.go | 5 + aws/resource_aws_simpledb_domain_test.go | 1 + ..._snapshot_create_volume_permission_test.go | 3 + aws/resource_aws_sns_platform_application.go | 4 +- ...ource_aws_sns_platform_application_test.go | 4 + aws/resource_aws_sns_sms_preferences_test.go | 4 + aws/resource_aws_sns_topic_policy_test.go | 2 + aws/resource_aws_sns_topic_subscription.go | 39 +- ...esource_aws_sns_topic_subscription_test.go | 192 +- aws/resource_aws_sns_topic_test.go | 10 + ...rce_aws_spot_datafeed_subscription_test.go | 2 + aws/resource_aws_spot_fleet_request_test.go | 37 + aws/resource_aws_spot_instance_request.go | 3 +- ...resource_aws_spot_instance_request_test.go | 13 + aws/resource_aws_sqs_queue_policy_test.go | 4 + aws/resource_aws_sqs_queue_test.go | 14 + aws/resource_aws_ssm_activation_test.go | 4 + aws/resource_aws_ssm_association_test.go | 13 + aws/resource_aws_ssm_document_test.go | 17 + ..._aws_ssm_maintenance_window_target_test.go | 7 + ...ce_aws_ssm_maintenance_window_task_test.go | 11 + ...esource_aws_ssm_maintenance_window_test.go | 13 + aws/resource_aws_ssm_parameter.go | 69 +- aws/resource_aws_ssm_parameter_test.go | 154 +- aws/resource_aws_ssm_patch_baseline_test.go | 8 + aws/resource_aws_ssm_patch_group.go | 91 +- aws/resource_aws_ssm_patch_group_migrate.go | 35 + ...source_aws_ssm_patch_group_migrate_test.go | 37 + aws/resource_aws_ssm_patch_group_test.go | 165 +- ...esource_aws_ssm_resource_data_sync_test.go | 3 + ...ce_aws_ssoadmin_account_assignment_test.go | 3 + ...ssoadmin_managed_policy_attachment_test.go | 5 + ...admin_permission_set_inline_policy_test.go | 4 + ...source_aws_ssoadmin_permission_set_test.go | 7 + aws/resource_aws_storagegateway_cache_test.go | 10 +- ...storagegateway_cached_iscsi_volume_test.go | 6 + aws/resource_aws_storagegateway_gateway.go | 31 + ...esource_aws_storagegateway_gateway_test.go | 72 + ..._aws_storagegateway_nfs_file_share_test.go | 16 + ..._aws_storagegateway_smb_file_share_test.go | 21 + ...storagegateway_stored_iscsi_volume_test.go | 5 + ...ource_aws_storagegateway_tape_pool_test.go | 4 + ...source_aws_storagegateway_upload_buffer.go | 74 +- ...e_aws_storagegateway_upload_buffer_test.go | 76 +- ...aws_storagegateway_working_storage_test.go | 5 +- aws/resource_aws_subnet.go | 77 +- aws/resource_aws_subnet_test.go | 340 ++ aws/resource_aws_swf_domain_test.go | 5 + aws/resource_aws_synthetics_canary.go | 61 +- aws/resource_aws_synthetics_canary_test.go | 46 +- aws/resource_aws_transfer_server_test.go | 7 + aws/resource_aws_transfer_ssh_key.go | 4 +- aws/resource_aws_transfer_ssh_key_test.go | 1 + aws/resource_aws_transfer_user_test.go | 5 + aws/resource_aws_volume_attachment.go | 6 +- aws/resource_aws_volume_attachment_test.go | 5 + aws/resource_aws_vpc.go | 87 +- aws/resource_aws_vpc_dhcp_options.go | 2 +- ...e_aws_vpc_dhcp_options_association_test.go | 3 + aws/resource_aws_vpc_dhcp_options_test.go | 4 + aws/resource_aws_vpc_endpoint.go | 2 +- ...c_endpoint_connection_notification_test.go | 1 + ...c_endpoint_route_table_association_test.go | 1 + ...endpoint_service_allowed_principal_test.go | 1 + aws/resource_aws_vpc_endpoint_service_test.go | 6 + ...ws_vpc_endpoint_subnet_association_test.go | 2 + aws/resource_aws_vpc_endpoint_test.go | 10 + ...ws_vpc_ipv4_cidr_block_association_test.go | 1 + aws/resource_aws_vpc_peering_connection.go | 2 +- ...ws_vpc_peering_connection_accepter_test.go | 4 + ...aws_vpc_peering_connection_options_test.go | 3 + ...esource_aws_vpc_peering_connection_test.go | 41 +- aws/resource_aws_vpc_test.go | 334 ++ aws/resource_aws_vpn_connection_route.go | 2 +- aws/resource_aws_vpn_connection_route_test.go | 1 + aws/resource_aws_vpn_connection_test.go | 8 + ...esource_aws_vpn_gateway_attachment_test.go | 2 + ...ource_aws_vpn_gateway_route_propagation.go | 2 +- ..._aws_vpn_gateway_route_propagation_test.go | 1 + aws/resource_aws_vpn_gateway_test.go | 8 + aws/resource_aws_waf_byte_match_set_test.go | 5 + aws/resource_aws_waf_geo_match_set_test.go | 5 + aws/resource_aws_waf_ipset_test.go | 7 + aws/resource_aws_waf_rate_based_rule_test.go | 7 + aws/resource_aws_waf_regex_match_set_test.go | 4 + ...resource_aws_waf_regex_pattern_set_test.go | 4 + aws/resource_aws_waf_rule.go | 96 +- aws/resource_aws_waf_rule_group_test.go | 6 + aws/resource_aws_waf_rule_test.go | 269 +- ...source_aws_waf_size_constraint_set_test.go | 5 + ...esource_aws_waf_sql_injection_match_set.go | 2 +- ...ce_aws_waf_sql_injection_match_set_test.go | 5 + aws/resource_aws_waf_web_acl.go | 85 +- aws/resource_aws_waf_web_acl_test.go | 219 +- aws/resource_aws_waf_xss_match_set_test.go | 5 + ...rce_aws_wafregional_byte_match_set_test.go | 5 + ...urce_aws_wafregional_geo_match_set_test.go | 5 + aws/resource_aws_wafregional_ipset_test.go | 6 + ...ce_aws_wafregional_rate_based_rule_test.go | 7 + ...ce_aws_wafregional_regex_match_set_test.go | 4 + ..._aws_wafregional_regex_pattern_set_test.go | 4 + aws/resource_aws_wafregional_rule.go | 6 +- ...esource_aws_wafregional_rule_group_test.go | 6 + aws/resource_aws_wafregional_rule_test.go | 6 + ...ws_wafregional_size_constraint_set_test.go | 5 + ...afregional_sql_injection_match_set_test.go | 5 + ...ws_wafregional_web_acl_association_test.go | 4 + aws/resource_aws_wafregional_web_acl_test.go | 10 + ...urce_aws_wafregional_xss_match_set_test.go | 5 + aws/resource_aws_wafv2_ip_set_test.go | 7 + ...source_aws_wafv2_regex_pattern_set_test.go | 5 + aws/resource_aws_wafv2_rule_group_test.go | 23 + ...urce_aws_wafv2_web_acl_association_test.go | 2 + ...aws_wafv2_web_acl_logging_configuration.go | 197 +- ...afv2_web_acl_logging_configuration_test.go | 384 +- aws/resource_aws_wafv2_web_acl_test.go | 17 + aws/resource_aws_worklink_fleet_test.go | 8 + ..._certificate_authority_association_test.go | 3 + aws/resource_aws_workspaces_directory_test.go | 9 + aws/resource_aws_workspaces_ip_group.go | 12 +- aws/resource_aws_workspaces_ip_group_test.go | 4 + aws/resource_aws_workspaces_workspace_test.go | 8 + ...esource_aws_xray_encryption_config_test.go | 1 + aws/resource_aws_xray_group_test.go | 3 + aws/resource_aws_xray_sampling_rule_test.go | 4 + aws/tags.go | 42 + .../service/dms/oracle_wallet_certificate.pem | 10 + aws/validators.go | 22 +- aws/validators_test.go | 31 - aws/wafv2_helper.go | 12 + awsproviderlint/go.mod | 8 +- awsproviderlint/go.sum | 88 +- .../vendor/cloud.google.com/go/CHANGES.md | 78 +- .../cloud.google.com/go/CONTRIBUTING.md | 14 +- .../go/compute/metadata/metadata.go | 1 + .../vendor/cloud.google.com/go/go.mod | 16 +- .../vendor/cloud.google.com/go/go.sum | 30 +- .../go/internal/.repo-metadata-full.json | 58 +- .../go/internal/version/version.go | 2 +- .../go-textseg/textseg/generate.go | 7 - .../go-textseg/textseg/grapheme_clusters.go | 5276 ----------------- .../go-textseg/{ => v12}/LICENSE | 0 .../{ => v12}/textseg/all_tokens.go | 0 .../go-textseg/v12/textseg/emoji_table.rl | 290 + .../go-textseg/v12/textseg/generate.go | 8 + .../v12/textseg/grapheme_clusters.go | 4078 +++++++++++++ .../{ => v12}/textseg/grapheme_clusters.rl | 11 +- .../textseg/grapheme_clusters_table.rl | 130 +- .../go-textseg/{ => v12}/textseg/tables.go | 595 +- .../{ => v12}/textseg/unicode2ragel.rb | 2 +- .../go-textseg/{ => v12}/textseg/utf8_seqs.go | 0 .../aws/aws-sdk-go/aws/client/client.go | 4 - .../aws/aws-sdk-go/aws/client/logger.go | 8 + .../stscreds/assume_role_provider.go | 2 +- .../aws/aws-sdk-go/aws/endpoints/defaults.go | 267 +- .../aws/aws-sdk-go/aws/signer/v4/v4.go | 5 +- .../github.com/aws/aws-sdk-go/aws/version.go | 2 +- .../aws-sdk-go/internal/s3shared/arn/arn.go | 18 +- .../s3shared/arn/s3_object_lambda_arn.go | 15 + .../aws/aws-sdk-go/service/s3/api.go | 2121 ++++--- .../aws-sdk-go/service/s3/customizations.go | 2 + .../aws/aws-sdk-go/service/s3/endpoint.go | 102 +- .../aws-sdk-go/service/s3/endpoint_builder.go | 98 +- .../aws/aws-sdk-go/service/s3/errors.go | 6 +- .../helper/analysisutils/analyzers.go | 21 + .../helper/analysisutils/runners.go | 68 + .../helper/analysisutils/stdlib_analyzers.go | 13 + .../helper/analysisutils/stdlib_runners.go | 23 + .../helper/resource/type_testcase.go | 1 + .../helper/schema/type_resource.go | 40 +- .../tfproviderlint/passes/AT010/AT010.go | 48 + .../tfproviderlint/passes/AT010/README.md | 70 + .../tfproviderlint/passes/AT011/AT011.go | 53 + .../tfproviderlint/passes/AT011/README.md | 91 + .../tfproviderlint/passes/AT012/AT012.go | 118 + .../tfproviderlint/passes/AT012/README.md | 37 + .../tfproviderlint/passes/V011/README.md | 50 + .../bflad/tfproviderlint/passes/V011/V011.go | 139 + .../tfproviderlint/passes/V012/README.md | 50 + .../bflad/tfproviderlint/passes/V012/V012.go | 153 + .../tfproviderlint/passes/V013/README.md | 50 + .../bflad/tfproviderlint/passes/V013/V013.go | 126 + .../tfproviderlint/passes/V014/README.md | 50 + .../bflad/tfproviderlint/passes/V014/V014.go | 152 + .../bflad/tfproviderlint/passes/checks.go | 14 + .../osexeccommandcallexpr.go | 11 + .../osexeccommandcontextcallexpr.go | 11 + .../osexeccommandcontextselectorexpr.go | 11 + .../osexeccommandselectorexpr.go | 11 + .../tfproviderlint/xpasses/XAT001/README.md | 69 + .../tfproviderlint/xpasses/XAT001/XAT001.go | 46 + .../tfproviderlint/xpasses/XR006/XR006.go | 8 +- .../tfproviderlint/xpasses/XR007/README.md | 28 + .../tfproviderlint/xpasses/XR007/XR007.go | 15 + .../tfproviderlint/xpasses/XR008/README.md | 28 + .../tfproviderlint/xpasses/XR008/XR008.go | 15 + .../bflad/tfproviderlint/xpasses/checks.go | 6 + .../hashicorp/go-getter/.goreleaser.yml | 50 + .../github.com/hashicorp/go-getter/README.md | 4 +- .../hashicorp/go-getter/checksum.go | 5 +- .../hashicorp/go-getter/decompress.go | 4 + .../hashicorp/go-getter/decompress_tzst.go | 39 + .../hashicorp/go-getter/decompress_zstd.go | 40 + .../github.com/hashicorp/go-getter/get_s3.go | 53 +- .../github.com/hashicorp/go-getter/go.mod | 1 + .../github.com/hashicorp/go-getter/go.sum | 2 + .../github.com/hashicorp/hcl/v2/CHANGELOG.md | 90 + .../github.com/hashicorp/hcl/v2/README.md | 16 +- .../github.com/hashicorp/hcl/v2/appveyor.yml | 13 - .../github.com/hashicorp/hcl/v2/diagnostic.go | 4 +- .../vendor/github.com/hashicorp/hcl/v2/go.mod | 4 +- .../vendor/github.com/hashicorp/hcl/v2/go.sum | 2 + .../hashicorp/hcl/v2/hclsyntax/expression.go | 145 +- .../hcl/v2/hclsyntax/expression_template.go | 31 +- .../hashicorp/hcl/v2/hclsyntax/parser.go | 17 +- .../hcl/v2/hclsyntax/parser_template.go | 2 +- .../hashicorp/hcl/v2/hclsyntax/spec.md | 2 +- .../hashicorp/hcl/v2/hclsyntax/token.go | 27 +- .../vendor/github.com/hashicorp/hcl/v2/ops.go | 12 +- .../hashicorp/hcl/v2/pos_scanner.go | 2 +- .../v2/helper/schema/grpc_provider.go | 3 + .../v2/helper/schema/resource.go | 96 +- .../v2/internal/plugin/convert/diagnostics.go | 3 + .../terraform-plugin-sdk/v2/meta/meta.go | 2 +- .../github.com/klauspost/compress/LICENSE | 28 + .../klauspost/compress/fse/README.md | 79 + .../klauspost/compress/fse/bitreader.go | 122 + .../klauspost/compress/fse/bitwriter.go | 168 + .../klauspost/compress/fse/bytereader.go | 47 + .../klauspost/compress/fse/compress.go | 684 +++ .../klauspost/compress/fse/decompress.go | 374 ++ .../github.com/klauspost/compress/fse/fse.go | 144 + .../klauspost/compress/huff0/.gitignore | 1 + .../klauspost/compress/huff0/README.md | 87 + .../klauspost/compress/huff0/bitreader.go | 329 + .../klauspost/compress/huff0/bitwriter.go | 210 + .../klauspost/compress/huff0/bytereader.go | 54 + .../klauspost/compress/huff0/compress.go | 657 ++ .../klauspost/compress/huff0/decompress.go | 1164 ++++ .../klauspost/compress/huff0/huff0.go | 273 + .../klauspost/compress/snappy/.gitignore | 16 + .../klauspost/compress/snappy/AUTHORS | 15 + .../klauspost/compress/snappy/CONTRIBUTORS | 37 + .../klauspost/compress/snappy/LICENSE | 27 + .../klauspost/compress/snappy/README | 107 + .../klauspost/compress/snappy/decode.go | 237 + .../klauspost/compress/snappy/decode_amd64.go | 14 + .../klauspost/compress/snappy/decode_amd64.s | 482 ++ .../klauspost/compress/snappy/decode_other.go | 115 + .../klauspost/compress/snappy/encode.go | 285 + .../klauspost/compress/snappy/encode_amd64.go | 29 + .../klauspost/compress/snappy/encode_amd64.s | 730 +++ .../klauspost/compress/snappy/encode_other.go | 238 + .../klauspost/compress/snappy/runbench.cmd | 2 + .../klauspost/compress/snappy/snappy.go | 98 + .../klauspost/compress/zstd/README.md | 406 ++ .../klauspost/compress/zstd/bitreader.go | 136 + .../klauspost/compress/zstd/bitwriter.go | 169 + .../klauspost/compress/zstd/blockdec.go | 739 +++ .../klauspost/compress/zstd/blockenc.go | 854 +++ .../compress/zstd/blocktype_string.go | 85 + .../klauspost/compress/zstd/bytebuf.go | 127 + .../klauspost/compress/zstd/bytereader.go | 88 + .../klauspost/compress/zstd/decoder.go | 546 ++ .../compress/zstd/decoder_options.go | 84 + .../klauspost/compress/zstd/dict.go | 122 + .../klauspost/compress/zstd/enc_base.go | 155 + .../klauspost/compress/zstd/enc_better.go | 595 ++ .../klauspost/compress/zstd/enc_dfast.go | 713 +++ .../klauspost/compress/zstd/enc_fast.go | 661 +++ .../klauspost/compress/zstd/encoder.go | 570 ++ .../compress/zstd/encoder_options.go | 282 + .../klauspost/compress/zstd/framedec.go | 494 ++ .../klauspost/compress/zstd/frameenc.go | 137 + .../klauspost/compress/zstd/fse_decoder.go | 385 ++ .../klauspost/compress/zstd/fse_encoder.go | 726 +++ .../klauspost/compress/zstd/fse_predefined.go | 158 + .../klauspost/compress/zstd/hash.go | 77 + .../klauspost/compress/zstd/history.go | 89 + .../compress/zstd/internal/xxhash/LICENSE.txt | 22 + .../compress/zstd/internal/xxhash/README.md | 58 + .../compress/zstd/internal/xxhash/xxhash.go | 238 + .../zstd/internal/xxhash/xxhash_amd64.go | 13 + .../zstd/internal/xxhash/xxhash_amd64.s | 215 + .../zstd/internal/xxhash/xxhash_other.go | 76 + .../zstd/internal/xxhash/xxhash_safe.go | 11 + .../klauspost/compress/zstd/seqdec.go | 485 ++ .../klauspost/compress/zstd/seqenc.go | 115 + .../klauspost/compress/zstd/snappy.go | 436 ++ .../klauspost/compress/zstd/zstd.go | 144 + .../zclconf/go-cty/cty/convert/conversion.go | 9 + .../cty/convert/conversion_collection.go | 281 +- .../go-cty/cty/convert/conversion_object.go | 19 + .../go-cty/cty/convert/mismatch_msg.go | 8 +- .../zclconf/go-cty/cty/convert/unify.go | 43 + .../zclconf/go-cty/cty/function/function.go | 44 +- .../go-cty/cty/function/stdlib/collection.go | 1199 ++++ .../go-cty/cty/function/stdlib/conversion.go | 87 + .../go-cty/cty/function/stdlib/datetime.go | 55 +- .../go-cty/cty/function/stdlib/format.go | 4 +- .../go-cty/cty/function/stdlib/json.go | 5 + .../go-cty/cty/function/stdlib/number.go | 215 + .../zclconf/go-cty/cty/function/stdlib/set.go | 41 +- .../go-cty/cty/function/stdlib/string.go | 315 +- .../cty/function/stdlib/string_replace.go | 80 + .../github.com/zclconf/go-cty/cty/json.go | 25 +- .../zclconf/go-cty/cty/json/marshal.go | 2 +- .../github.com/zclconf/go-cty/cty/marks.go | 82 +- .../zclconf/go-cty/cty/object_type.go | 89 +- .../github.com/zclconf/go-cty/cty/path.go | 20 + .../github.com/zclconf/go-cty/cty/path_set.go | 6 + .../zclconf/go-cty/cty/set/rules.go | 4 + .../github.com/zclconf/go-cty/cty/set/set.go | 4 +- .../zclconf/go-cty/cty/set_internals.go | 11 + .../github.com/zclconf/go-cty/cty/type.go | 5 +- .../github.com/zclconf/go-cty/cty/unknown.go | 3 +- .../github.com/zclconf/go-cty/cty/value.go | 34 + .../zclconf/go-cty/cty/value_init.go | 5 - .../zclconf/go-cty/cty/value_ops.go | 150 +- .../github.com/zclconf/go-cty/cty/walk.go | 59 +- .../vendor/golang.org/x/oauth2/go.mod | 7 +- .../vendor/golang.org/x/oauth2/go.sum | 359 +- .../x/tools/go/analysis/analysis.go | 13 +- .../go/analysis/analysistest/analysistest.go | 155 +- .../golang.org/x/tools/go/analysis/doc.go | 21 +- .../go/analysis/internal/checker/checker.go | 1 + .../go/analysis/unitchecker/unitchecker.go | 2 + .../tools/go/internal/packagesdriver/sizes.go | 26 +- .../golang.org/x/tools/go/packages/golist.go | 289 +- .../x/tools/go/packages/golist_overlay.go | 4 + .../x/tools/go/packages/packages.go | 23 +- .../x/tools/internal/gocommand/invoke.go | 37 +- .../x/tools/internal/gocommand/version.go | 40 + .../x/tools/internal/imports/fix.go | 34 +- .../x/tools/internal/imports/mod.go | 26 +- .../internal/packagesinternal/packages.go | 3 + .../google.golang.org/api/internal/creds.go | 26 + .../api/internal/gensupport/media.go | 4 +- .../api/internal/impersonate/impersonate.go | 128 + .../api/internal/service-account.json | 12 - .../api/internal/settings.go | 10 +- .../option/internaloption/internaloption.go | 16 +- .../google.golang.org/api/option/option.go | 55 + .../api/storage/v1/storage-api.json | 20 +- .../api/storage/v1/storage-gen.go | 134 +- .../api/transport/http/dial.go | 100 +- .../api/transport/internal/dca/dca.go | 145 + .../api/annotations/annotations.pb.go | 14 +- .../googleapis/api/annotations/client.pb.go | 20 +- .../api/annotations/field_behavior.pb.go | 14 +- .../googleapis/api/annotations/http.pb.go | 4 +- .../googleapis/api/annotations/resource.pb.go | 30 +- .../googleapis/iam/v1/iam_policy.pb.go | 4 +- .../genproto/googleapis/iam/v1/options.pb.go | 4 +- .../genproto/googleapis/iam/v1/policy.pb.go | 4 +- .../genproto/googleapis/rpc/code/code.pb.go | 4 +- .../googleapis/rpc/status/status.pb.go | 14 +- .../genproto/googleapis/type/expr/expr.pb.go | 4 +- awsproviderlint/vendor/modules.txt | 48 +- docs/contributing/contribution-checklists.md | 3 + .../running-and-writing-acceptance-tests.md | 66 + go.mod | 10 +- go.sum | 19 +- infrastructure/repository/labels-service.tf | 1 + scripts/validate-terraform.sh | 2 - tools/go.mod | 2 +- tools/go.sum | 4 +- website/allowed-subcategories.txt | 1 + website/docs/d/acm_certificate.html.markdown | 2 +- ...acmpca_certificate_authority.html.markdown | 2 +- website/docs/d/ami.html.markdown | 2 +- website/docs/d/ami_ids.html.markdown | 2 +- .../docs/d/api_gateway_api_key.html.markdown | 2 +- .../d/api_gateway_domain_name.html.markdown | 2 +- .../docs/d/api_gateway_resource.html.markdown | 2 +- .../docs/d/api_gateway_rest_api.html.markdown | 2 +- .../docs/d/api_gateway_vpc_link.html.markdown | 2 +- website/docs/d/apigatewayv2_api.html.markdown | 2 +- .../docs/d/apigatewayv2_apis.html.markdown | 2 +- website/docs/d/arn.html.markdown | 2 +- .../docs/d/autoscaling_group.html.markdown | 2 +- .../docs/d/autoscaling_groups.html.markdown | 2 +- .../docs/d/availability_zone.html.markdown | 2 +- .../docs/d/availability_zones.html.markdown | 4 +- website/docs/d/backup_plan.html.markdown | 2 +- website/docs/d/backup_selection.html.markdown | 2 +- website/docs/d/backup_vault.html.markdown | 2 +- .../d/batch_compute_environment.html.markdown | 2 +- website/docs/d/batch_job_queue.html.markdown | 2 +- .../d/billing_service_account.html.markdown | 2 +- website/docs/d/caller_identity.html.markdown | 2 +- .../docs/d/canonical_user_id.html.markdown | 2 +- .../d/cloudformation_export.html.markdown | 2 +- .../docs/d/cloudformation_stack.html.markdown | 2 +- .../d/cloudfront_cache_policy.html.markdown | 2 +- .../d/cloudfront_distribution.html.markdown | 2 +- ...dfront_origin_request_policy.html.markdown | 2 +- .../docs/d/cloudhsm_v2_cluster.html.markdown | 2 +- .../cloudtrail_service_account.html.markdown | 2 +- .../docs/d/cloudwatch_log_group.html.markdown | 2 +- ...artifact_authorization_token.html.markdown | 2 +- ...artifact_repository_endpoint.html.markdown | 2 +- .../d/codecommit_repository.html.markdown | 2 +- ...destarconnections_connection.html.markdown | 35 + website/docs/d/cognito_user_pools.markdown | 2 +- .../d/cur_report_definition.html.markdown | 2 +- website/docs/d/customer_gateway.html.markdown | 2 +- .../docs/d/db_cluster_snapshot.html.markdown | 2 +- .../docs/d/db_event_categories.html.markdown | 4 +- website/docs/d/db_instance.html.markdown | 2 +- website/docs/d/db_snapshot.html.markdown | 2 +- website/docs/d/db_subnet_group.html.markdown | 2 +- .../directory_service_directory.html.markdown | 2 +- website/docs/d/docdb_engine_version.markdown | 2 +- .../d/docdb_orderable_db_instance.markdown | 2 +- website/docs/d/dx_gateway.html.markdown | 2 +- website/docs/d/dynamodb_table.html.markdown | 2 +- .../docs/d/ebs_default_kms_key.html.markdown | 2 +- .../d/ebs_encryption_by_default.html.markdown | 2 +- website/docs/d/ebs_snapshot.html.markdown | 2 +- website/docs/d/ebs_snapshot_ids.html.markdown | 2 +- website/docs/d/ebs_volume.html.markdown | 2 +- website/docs/d/ebs_volumes.html.markdown | 4 +- website/docs/d/ec2_coip_pool.html.markdown | 2 +- website/docs/d/ec2_coip_pools.html.markdown | 2 +- .../docs/d/ec2_instance_type.html.markdown | 2 +- .../ec2_instance_type_offering.html.markdown | 2 +- .../ec2_instance_type_offerings.html.markdown | 2 +- .../docs/d/ec2_local_gateway.html.markdown | 2 +- ...c2_local_gateway_route_table.html.markdown | 2 +- ...2_local_gateway_route_tables.html.markdown | 2 +- ...al_gateway_virtual_interface.html.markdown | 2 +- ...eway_virtual_interface_group.html.markdown | 2 +- ...way_virtual_interface_groups.html.markdown | 2 +- .../docs/d/ec2_local_gateways.html.markdown | 2 +- .../d/ec2_managed_prefix_list.html.markdown | 4 +- website/docs/d/ec2_spot_price.html.markdown | 2 +- .../docs/d/ec2_transit_gateway.html.markdown | 4 +- ...ateway_dx_gateway_attachment.html.markdown | 2 +- ...t_gateway_peering_attachment.html.markdown | 4 +- ..._transit_gateway_route_table.html.markdown | 4 +- ...transit_gateway_route_tables.html.markdown | 48 + ...ansit_gateway_vpc_attachment.html.markdown | 4 +- ...ansit_gateway_vpn_attachment.html.markdown | 4 +- .../d/ecr_authorization_token.html.markdown | 2 +- website/docs/d/ecr_image.html.markdown | 2 +- website/docs/d/ecr_repository.html.markdown | 2 +- website/docs/d/ecs_cluster.html.markdown | 2 +- .../d/ecs_container_definition.html.markdown | 2 +- website/docs/d/ecs_service.html.markdown | 2 +- .../docs/d/ecs_task_definition.html.markdown | 2 +- website/docs/d/efs_access_point.html.markdown | 2 +- .../docs/d/efs_access_points.html.markdown | 2 +- website/docs/d/efs_file_system.html.markdown | 2 +- website/docs/d/efs_mount_target.html.markdown | 2 +- website/docs/d/eip.html.markdown | 8 +- website/docs/d/eks_cluster.html.markdown | 2 +- website/docs/d/eks_cluster_auth.html.markdown | 2 +- ...lastic_beanstalk_application.html.markdown | 2 +- ...lastic_beanstalk_hosted_zone.html.markdown | 2 +- ...tic_beanstalk_solution_stack.html.markdown | 2 +- .../docs/d/elasticache_cluster.html.markdown | 2 +- ...lasticache_replication_group.html.markdown | 2 +- .../docs/d/elasticsearch_domain.html.markdown | 2 +- website/docs/d/elb.html.markdown | 2 +- .../docs/d/elb_hosted_zone_id.html.markdown | 2 +- .../docs/d/elb_service_account.html.markdown | 2 +- website/docs/d/glue_script.html.markdown | 4 +- .../docs/d/guardduty_detector.html.markdown | 2 +- .../docs/d/iam_account_alias.html.markdown | 2 +- website/docs/d/iam_group.html.markdown | 2 +- .../docs/d/iam_instance_profile.html.markdown | 2 +- website/docs/d/iam_policy.html.markdown | 4 +- .../docs/d/iam_policy_document.html.markdown | 14 +- website/docs/d/iam_role.html.markdown | 2 +- .../d/iam_server_certificate.html.markdown | 2 +- website/docs/d/iam_user.html.markdown | 2 +- .../docs/d/identitystore_group.html.markdown | 2 +- .../docs/d/identitystore_user.html.markdown | 2 +- .../d/imagebuilder_component.html.markdown | 2 +- ...r_distribution_configuration.html.markdown | 2 +- .../docs/d/imagebuilder_image.html.markdown | 2 +- .../imagebuilder_image_pipeline.html.markdown | 2 +- .../d/imagebuilder_image_recipe.html.markdown | 2 +- ...infrastructure_configuration.html.markdown | 2 +- .../d/inspector_rules_packages.html.markdown | 2 +- website/docs/d/instance.html.markdown | 2 +- website/docs/d/instances.html.markdown | 2 +- website/docs/d/internet_gateway.html.markdown | 2 +- website/docs/d/iot_endpoint.html.markdown | 2 +- website/docs/d/ip_ranges.html.markdown | 2 +- website/docs/d/kinesis_stream.html.markdown | 2 +- .../d/kinesis_stream_consumer.html.markdown | 38 + website/docs/d/kms_alias.html.markdown | 2 +- website/docs/d/kms_ciphertext.html.markdown | 2 +- website/docs/d/kms_key.html.markdown | 2 +- website/docs/d/kms_secrets.html.markdown | 2 +- ...formation_data_lake_settings.html.markdown | 2 +- .../d/lakeformation_permissions.html.markdown | 4 +- .../d/lakeformation_resource.html.markdown | 2 +- website/docs/d/lambda_alias.html.markdown | 2 +- .../lambda_code_signing_config.html.markdown | 2 +- website/docs/d/lambda_function.html.markdown | 2 +- .../docs/d/lambda_invocation.html.markdown | 2 +- .../docs/d/lambda_layer_version.html.markdown | 2 +- .../docs/d/launch_configuration.html.markdown | 2 +- website/docs/d/launch_template.html.markdown | 4 +- website/docs/d/lb.html.markdown | 2 +- website/docs/d/lb_listener.html.markdown | 2 +- website/docs/d/lb_target_group.html.markdown | 2 +- website/docs/d/lex_bot.html.markdown | 2 +- website/docs/d/lex_bot_alias.html.markdown | 2 +- website/docs/d/lex_intent.html.markdown | 2 +- website/docs/d/lex_slot_type.html.markdown | 2 +- website/docs/d/mq_broker.html.markdown | 2 +- website/docs/d/msk_cluster.html.markdown | 2 +- .../docs/d/msk_configuration.html.markdown | 2 +- website/docs/d/nat_gateway.html.markdown | 4 +- .../docs/d/neptune_engine_version.markdown | 2 +- .../d/neptune_orderable_db_instance.markdown | 2 +- website/docs/d/network_acls.html.markdown | 6 +- .../docs/d/network_interface.html.markdown | 2 +- .../docs/d/network_interfaces.html.markdown | 6 +- .../organizations_organization.html.markdown | 4 +- ...zations_organizational_units.html.markdown | 2 +- website/docs/d/outposts_outpost.html.markdown | 2 +- ...tposts_outpost_instance_type.html.markdown | 2 +- ...posts_outpost_instance_types.html.markdown | 2 +- .../docs/d/outposts_outposts.html.markdown | 2 +- website/docs/d/outposts_site.html.markdown | 2 +- website/docs/d/outposts_sites.html.markdown | 2 +- website/docs/d/partition.html.markdown | 2 +- website/docs/d/prefix_list.html.markdown | 4 +- website/docs/d/pricing_product.html.markdown | 4 +- website/docs/d/qldb_ledger.html.markdown | 2 +- .../docs/d/ram_resource_share.html.markdown | 4 +- website/docs/d/rds_certificate.html.markdown | 2 +- website/docs/d/rds_cluster.html.markdown | 2 +- website/docs/d/rds_engine_version.markdown | 2 +- .../docs/d/rds_orderable_db_instance.markdown | 4 +- website/docs/d/redshift_cluster.html.markdown | 2 +- .../redshift_orderable_cluster.html.markdown | 2 +- .../d/redshift_service_account.html.markdown | 2 +- website/docs/d/region.html.markdown | 2 +- website/docs/d/regions.html.markdown | 6 +- website/docs/d/route.html.markdown | 48 +- .../d/route53_delegation_set.html.markdown | 2 +- .../d/route53_resolver_endpoint.html.markdown | 4 +- .../d/route53_resolver_rule.html.markdown | 2 +- .../d/route53_resolver_rules.html.markdown | 4 +- website/docs/d/route53_zone.html.markdown | 2 +- website/docs/d/route_table.html.markdown | 2 +- website/docs/d/route_tables.html.markdown | 2 +- website/docs/d/s3_bucket.html.markdown | 4 +- website/docs/d/s3_bucket_object.html.markdown | 4 +- .../docs/d/s3_bucket_objects.html.markdown | 2 +- ...sagemaker_prebuilt_ecr_image.html.markdown | 2 +- .../d/secretsmanager_secret.html.markdown | 4 +- ...cretsmanager_secret_rotation.html.markdown | 2 +- ...ecretsmanager_secret_version.html.markdown | 6 +- website/docs/d/security_group.html.markdown | 2 +- website/docs/d/security_groups.html.markdown | 4 +- ...cationrepository_application.html.markdown | 2 +- .../d/servicequotas_service.html.markdown | 2 +- .../servicequotas_service_quota.html.markdown | 2 +- website/docs/d/sfn_activity.html.markdown | 2 +- .../docs/d/sfn_state_machine.html.markdown | 2 +- .../docs/d/signer_signing_job.html.markdown | 2 +- .../d/signer_signing_profile.html.markdown | 2 +- website/docs/d/sns_topic.html.markdown | 2 +- website/docs/d/sqs_queue.html.markdown | 2 +- website/docs/d/ssm_document.html.markdown | 4 +- website/docs/d/ssm_parameter.html.markdown | 2 +- .../docs/d/ssm_patch_baseline.html.markdown | 4 +- .../docs/d/ssoadmin_instances.html.markdown | 2 +- .../d/ssoadmin_permission_set.html.markdown | 2 +- .../d/storagegateway_local_disk.html.markdown | 2 +- website/docs/d/subnet.html.markdown | 4 +- website/docs/d/subnet_ids.html.markdown | 6 +- website/docs/d/transfer_server.html.markdown | 2 +- website/docs/d/vpc.html.markdown | 2 +- website/docs/d/vpc_dhcp_options.html.markdown | 4 +- website/docs/d/vpc_endpoint.html.markdown | 2 +- .../docs/d/vpc_endpoint_service.html.markdown | 6 +- .../d/vpc_peering_connection.html.markdown | 2 +- .../d/vpc_peering_connections.html.markdown | 2 +- website/docs/d/vpcs.html.markdown | 4 +- website/docs/d/vpn_gateway.html.markdown | 2 +- website/docs/d/waf_ipset.html.markdown | 2 +- .../docs/d/waf_rate_based_rule.html.markdown | 2 +- website/docs/d/waf_rule.html.markdown | 2 +- website/docs/d/waf_web_acl.html.markdown | 2 +- .../docs/d/wafregional_ipset.html.markdown | 2 +- .../wafregional_rate_based_rule.html.markdown | 2 +- website/docs/d/wafregional_rule.html.markdown | 2 +- .../docs/d/wafregional_web_acl.html.markdown | 2 +- website/docs/d/wafv2_ip_set.html.markdown | 2 +- .../d/wafv2_regex_pattern_set.html.markdown | 2 +- website/docs/d/wafv2_rule_group.html.markdown | 2 +- website/docs/d/wafv2_web_acl.html.markdown | 2 +- .../docs/d/workspaces_bundle.html.markdown | 4 +- .../docs/d/workspaces_directory.html.markdown | 2 +- website/docs/d/workspaces_image.html.markdown | 2 +- .../docs/d/workspaces_workspace.html.markdown | 4 +- .../guides/custom-service-endpoints.html.md | 7 +- website/docs/guides/resource-tagging.html.md | 16 +- website/docs/guides/version-2-upgrade.html.md | 76 +- website/docs/guides/version-3-upgrade.html.md | 104 +- website/docs/index.html.markdown | 165 +- .../r/accessanalyzer_analyzer.html.markdown | 4 +- website/docs/r/acm_certificate.html.markdown | 10 +- .../acm_certificate_validation.html.markdown | 6 +- .../docs/r/acmpca_certificate.html.markdown | 2 +- ...acmpca_certificate_authority.html.markdown | 4 +- ...ficate_authority_certificate.html.markdown | 4 + website/docs/r/ami.html.markdown | 3 +- website/docs/r/ami_copy.html.markdown | 2 +- .../docs/r/ami_from_instance.html.markdown | 2 +- .../r/ami_launch_permission.html.markdown | 2 +- .../docs/r/api_gateway_account.html.markdown | 2 +- .../docs/r/api_gateway_api_key.html.markdown | 2 +- .../r/api_gateway_authorizer.html.markdown | 2 +- ...pi_gateway_base_path_mapping.html.markdown | 6 +- ...i_gateway_client_certificate.html.markdown | 2 +- .../r/api_gateway_deployment.html.markdown | 4 +- ...i_gateway_documentation_part.html.markdown | 2 +- ...ateway_documentation_version.html.markdown | 2 +- .../r/api_gateway_domain_name.html.markdown | 8 +- .../r/api_gateway_gateway_response.markdown | 6 +- .../r/api_gateway_integration.html.markdown | 10 +- ...gateway_integration_response.html.markdown | 6 +- .../docs/r/api_gateway_method.html.markdown | 8 +- .../api_gateway_method_response.html.markdown | 6 +- .../api_gateway_method_settings.html.markdown | 6 +- .../docs/r/api_gateway_model.html.markdown | 2 +- ...pi_gateway_request_validator.html.markdown | 2 +- .../docs/r/api_gateway_resource.html.markdown | 2 +- .../docs/r/api_gateway_rest_api.html.markdown | 4 +- .../api_gateway_rest_api_policy.html.markdown | 2 +- .../docs/r/api_gateway_stage.html.markdown | 4 +- .../r/api_gateway_usage_plan.html.markdown | 2 +- .../api_gateway_usage_plan_key.html.markdown | 2 +- .../docs/r/api_gateway_vpc_link.html.markdown | 2 +- website/docs/r/apigatewayv2_api.html.markdown | 4 +- .../r/apigatewayv2_api_mapping.html.markdown | 2 +- .../r/apigatewayv2_authorizer.html.markdown | 4 +- .../r/apigatewayv2_deployment.html.markdown | 4 +- .../r/apigatewayv2_domain_name.html.markdown | 5 +- .../r/apigatewayv2_integration.html.markdown | 8 +- ...tewayv2_integration_response.html.markdown | 2 +- .../docs/r/apigatewayv2_model.html.markdown | 2 +- .../docs/r/apigatewayv2_route.html.markdown | 4 +- .../apigatewayv2_route_response.html.markdown | 2 +- .../docs/r/apigatewayv2_stage.html.markdown | 2 +- .../r/apigatewayv2_vpc_link.html.markdown | 2 +- ...app_cookie_stickiness_policy.html.markdown | 2 +- .../r/appautoscaling_policy.html.markdown | 12 +- ...autoscaling_scheduled_action.html.markdown | 4 +- .../r/appautoscaling_target.html.markdown | 12 +- .../r/appmesh_gateway_route.html.markdown | 2 +- website/docs/r/appmesh_mesh.html.markdown | 4 +- website/docs/r/appmesh_route.html.markdown | 8 +- .../r/appmesh_virtual_gateway.html.markdown | 4 +- .../docs/r/appmesh_virtual_node.html.markdown | 8 +- .../r/appmesh_virtual_router.html.markdown | 2 +- .../r/appmesh_virtual_service.html.markdown | 4 +- website/docs/r/appsync_api_key.html.markdown | 2 +- .../docs/r/appsync_datasource.html.markdown | 2 +- website/docs/r/appsync_function.html.markdown | 2 +- .../docs/r/appsync_graphql_api.html.markdown | 14 +- website/docs/r/appsync_resolver.html.markdown | 2 +- website/docs/r/athena_database.html.markdown | 2 +- .../docs/r/athena_named_query.html.markdown | 2 +- website/docs/r/athena_workgroup.html.markdown | 2 +- .../r/autoscaling_attachment.html.markdown | 9 +- .../docs/r/autoscaling_group.html.markdown | 14 +- .../autoscaling_lifecycle_hook.html.markdown | 6 +- .../r/autoscaling_notification.html.markdown | 2 +- .../docs/r/autoscaling_policy.html.markdown | 6 +- .../docs/r/autoscaling_schedule.html.markdown | 2 +- ...utoscalingplans_scaling_plan.html.markdown | 4 +- .../r/backup_global_settings.html.markdown | 2 +- website/docs/r/backup_plan.html.markdown | 2 +- .../r/backup_region_settings.html.markdown | 2 +- website/docs/r/backup_selection.html.markdown | 6 +- website/docs/r/backup_vault.html.markdown | 2 +- .../backup_vault_notifications.html.markdown | 2 +- .../docs/r/backup_vault_policy.html.markdown | 2 +- .../r/batch_compute_environment.html.markdown | 2 +- .../docs/r/batch_job_definition.html.markdown | 2 +- website/docs/r/batch_job_queue.html.markdown | 2 +- website/docs/r/budgets_budget.html.markdown | 10 +- .../r/cloud9_environment_ec2.html.markdown | 2 +- .../docs/r/cloudformation_stack.html.markdown | 2 +- .../r/cloudformation_stack_set.html.markdown | 2 +- ...formation_stack_set_instance.html.markdown | 4 +- .../r/cloudfront_cache_policy.html.markdown | 2 +- .../r/cloudfront_distribution.html.markdown | 6 +- ...front_origin_access_identity.html.markdown | 6 +- ...dfront_origin_request_policy.html.markdown | 2 +- .../r/cloudfront_public_key.html.markdown | 2 +- ...oudfront_realtime_log_config.html.markdown | 2 +- .../docs/r/cloudhsm_v2_cluster.html.markdown | 2 +- website/docs/r/cloudhsm_v2_hsm.html.markdown | 2 +- website/docs/r/cloudtrail.html.markdown | 10 +- .../cloudwatch_composite_alarm.html.markdown | 2 +- .../docs/r/cloudwatch_dashboard.html.markdown | 2 +- .../r/cloudwatch_event_archive.html.markdown | 4 +- .../docs/r/cloudwatch_event_bus.html.markdown | 2 +- .../cloudwatch_event_permission.html.markdown | 4 +- .../r/cloudwatch_event_rule.html.markdown | 2 +- .../r/cloudwatch_event_target.html.markdown | 12 +- .../cloudwatch_log_destination.html.markdown | 2 +- ...watch_log_destination_policy.html.markdown | 6 +- .../docs/r/cloudwatch_log_group.html.markdown | 2 +- ...cloudwatch_log_metric_filter.html.markdown | 2 +- ...oudwatch_log_resource_policy.html.markdown | 4 +- .../r/cloudwatch_log_stream.html.markdown | 2 +- ...atch_log_subscription_filter.html.markdown | 4 +- .../r/cloudwatch_metric_alarm.html.markdown | 16 +- .../docs/r/codeartifact_domain.html.markdown | 2 +- ...ct_domain_permissions_policy.html.markdown | 2 +- .../r/codeartifact_repository.html.markdown | 6 +- ...epository_permissions_policy.html.markdown | 2 +- .../docs/r/codebuild_project.html.markdown | 16 +- .../r/codebuild_report_group.html.markdown | 2 +- .../codebuild_source_credential.html.markdown | 4 +- .../docs/r/codebuild_webhook.html.markdown | 4 +- .../r/codecommit_repository.html.markdown | 2 +- .../docs/r/codecommit_trigger.html.markdown | 8 +- website/docs/r/codedeploy_app.html.markdown | 6 +- ...codedeploy_deployment_config.html.markdown | 4 +- .../codedeploy_deployment_group.html.markdown | 6 +- website/docs/r/codepipeline.markdown | 2 +- website/docs/r/codepipeline_webhook.markdown | 2 +- .../r/codestarconnections_connection.markdown | 2 +- ...arnotifications_notification_rule.markdown | 2 +- website/docs/r/cognito_identity_pool.markdown | 2 +- ...to_identity_pool_roles_attachment.markdown | 2 +- .../r/cognito_identity_provider.html.markdown | 6 +- .../docs/r/cognito_resource_server.markdown | 4 +- .../docs/r/cognito_user_group.html.markdown | 6 +- website/docs/r/cognito_user_pool.markdown | 8 +- .../docs/r/cognito_user_pool_client.markdown | 8 +- .../docs/r/cognito_user_pool_domain.markdown | 4 +- ...o_user_pool_ui_customization.html.markdown | 6 +- .../r/config_aggregate_authorization.markdown | 2 +- .../docs/r/config_config_rule.html.markdown | 4 +- ...fig_configuration_aggregator.html.markdown | 4 +- ...onfig_configuration_recorder.html.markdown | 2 +- ...onfiguration_recorder_status.html.markdown | 6 +- .../r/config_conformance_pack.html.markdown | 12 +- .../r/config_delivery_channel.html.markdown | 2 +- ...fig_organization_custom_rule.html.markdown | 2 +- ...ig_organization_managed_rule.html.markdown | 2 +- ...ig_remediation_configuration.html.markdown | 8 +- .../r/cur_report_definition.html.markdown | 6 +- website/docs/r/customer_gateway.html.markdown | 2 +- .../r/datapipeline_pipeline.html.markdown | 2 +- website/docs/r/datasync_agent.html.markdown | 2 +- .../r/datasync_location_efs.html.markdown | 2 +- ...tion_fsx_windows_file_system.html.markdown | 2 +- .../r/datasync_location_nfs.html.markdown | 2 +- .../docs/r/datasync_location_s3.html.markdown | 2 +- .../r/datasync_location_smb.html.markdown | 2 +- website/docs/r/datasync_task.html.markdown | 2 +- website/docs/r/dax_cluster.html.markdown | 2 +- .../docs/r/dax_parameter_group.html.markdown | 2 +- website/docs/r/dax_subnet_group.html.markdown | 2 +- .../docs/r/db_cluster_snapshot.html.markdown | 2 +- .../r/db_event_subscription.html.markdown | 6 +- website/docs/r/db_instance.html.markdown | 6 +- ...db_instance_role_association.html.markdown | 2 +- website/docs/r/db_option_group.html.markdown | 2 +- .../docs/r/db_parameter_group.html.markdown | 2 +- website/docs/r/db_proxy.html.markdown | 2 +- ...b_proxy_default_target_group.html.markdown | 2 +- website/docs/r/db_proxy_target.html.markdown | 2 +- .../docs/r/db_security_group.html.markdown | 2 +- website/docs/r/db_snapshot.html.markdown | 2 +- website/docs/r/db_subnet_group.html.markdown | 2 +- .../docs/r/default_network_acl.html.markdown | 8 +- .../docs/r/default_route_table.html.markdown | 33 +- .../r/default_security_group.html.markdown | 4 +- website/docs/r/default_subnet.html.markdown | 2 +- website/docs/r/default_vpc.html.markdown | 2 +- .../r/default_vpc_dhcp_options.html.markdown | 2 +- .../docs/r/devicefarm_project.html.markdown | 4 +- ...ervice_conditional_forwarder.html.markdown | 6 +- .../directory_service_directory.html.markdown | 6 +- ...ory_service_log_subscription.html.markdown | 6 +- website/docs/r/dlm_lifecycle_policy.markdown | 2 +- website/docs/r/dms_certificate.html.markdown | 4 +- website/docs/r/dms_endpoint.html.markdown | 2 +- .../r/dms_event_subscription.html.markdown | 8 +- .../r/dms_replication_instance.html.markdown | 2 +- ...dms_replication_subnet_group.html.markdown | 2 +- .../docs/r/dms_replication_task.html.markdown | 2 +- website/docs/r/docdb_cluster.html.markdown | 2 +- .../r/docdb_cluster_instance.html.markdown | 2 +- ...ocdb_cluster_parameter_group.html.markdown | 2 +- .../r/docdb_cluster_snapshot.html.markdown | 2 +- .../docs/r/docdb_subnet_group.html.markdown | 2 +- website/docs/r/dx_bgp_peer.html.markdown | 2 +- website/docs/r/dx_connection.html.markdown | 2 +- .../r/dx_connection_association.html.markdown | 6 +- website/docs/r/dx_gateway.html.markdown | 2 +- .../r/dx_gateway_association.html.markdown | 6 +- ...gateway_association_proposal.html.markdown | 2 +- ...ed_private_virtual_interface.html.markdown | 2 +- ...e_virtual_interface_accepter.html.markdown | 2 +- ...ted_public_virtual_interface.html.markdown | 2 +- ...c_virtual_interface_accepter.html.markdown | 2 +- ...ed_transit_virtual_interface.html.markdown | 2 +- ...t_virtual_interface_accepter.html.markdown | 2 +- website/docs/r/dx_lag.html.markdown | 2 +- ...dx_private_virtual_interface.html.markdown | 2 +- .../dx_public_virtual_interface.html.markdown | 2 +- ...dx_transit_virtual_interface.html.markdown | 2 +- .../r/dynamodb_global_table.html.markdown | 2 +- website/docs/r/dynamodb_table.html.markdown | 4 +- .../docs/r/dynamodb_table_item.html.markdown | 2 +- .../docs/r/ebs_default_kms_key.html.markdown | 6 +- .../r/ebs_encryption_by_default.html.markdown | 6 +- website/docs/r/ebs_snapshot.html.markdown | 2 +- .../docs/r/ebs_snapshot_copy.html.markdown | 2 +- website/docs/r/ebs_volume.html.markdown | 2 +- .../ec2_availability_zone_group.html.markdown | 2 +- .../r/ec2_capacity_reservation.html.markdown | 2 +- .../docs/r/ec2_carrier_gateway.html.markdown | 2 +- ...lient_vpn_authorization_rule.html.markdown | 6 +- .../r/ec2_client_vpn_endpoint.html.markdown | 2 +- ...ient_vpn_network_association.html.markdown | 4 +- .../docs/r/ec2_client_vpn_route.html.markdown | 2 +- website/docs/r/ec2_fleet.html.markdown | 4 +- .../r/ec2_local_gateway_route.html.markdown | 2 +- ..._route_table_vpc_association.html.markdown | 2 +- .../r/ec2_managed_prefix_list.html.markdown | 2 +- website/docs/r/ec2_tag.html.markdown | 2 +- .../r/ec2_traffic_mirror_filter.html.markdown | 2 +- ...2_traffic_mirror_filter_rule.html.markdown | 2 +- .../ec2_traffic_mirror_session.html.markdown | 3 +- .../r/ec2_traffic_mirror_target.html.markdown | 3 +- .../docs/r/ec2_transit_gateway.html.markdown | 2 +- ...t_gateway_peering_attachment.html.markdown | 2 +- ...teway_peering_attachment_accepter.markdown | 2 +- ...ateway_prefix_list_reference.html.markdown | 4 +- .../r/ec2_transit_gateway_route.html.markdown | 4 +- ..._transit_gateway_route_table.html.markdown | 2 +- ...eway_route_table_association.html.markdown | 2 +- ...eway_route_table_propagation.html.markdown | 2 +- ...ansit_gateway_vpc_attachment.html.markdown | 2 +- ...eway_vpc_attachment_accepter.html.markdown | 2 +- .../docs/r/ecr_lifecycle_policy.html.markdown | 4 +- website/docs/r/ecr_repository.html.markdown | 2 +- .../r/ecr_repository_policy.html.markdown | 2 +- .../docs/r/ecrpublic_repository.html.markdown | 2 +- .../r/ecs_capacity_provider.html.markdown | 2 +- website/docs/r/ecs_cluster.html.markdown | 2 +- website/docs/r/ecs_service.html.markdown | 129 +- .../docs/r/ecs_task_definition.html.markdown | 77 +- website/docs/r/efs_access_point.html.markdown | 2 +- website/docs/r/efs_file_system.html.markdown | 13 +- .../r/efs_file_system_policy.html.markdown | 2 +- website/docs/r/efs_mount_target.html.markdown | 2 +- ...egress_only_internet_gateway.html.markdown | 2 +- website/docs/r/eip.html.markdown | 8 +- website/docs/r/eip_association.html.markdown | 2 +- website/docs/r/eks_cluster.html.markdown | 8 +- .../docs/r/eks_fargate_profile.html.markdown | 4 +- website/docs/r/eks_node_group.html.markdown | 8 +- ...lastic_beanstalk_application.html.markdown | 2 +- ...eanstalk_application_version.html.markdown | 2 +- ...stalk_configuration_template.html.markdown | 2 +- ...lastic_beanstalk_environment.html.markdown | 4 +- .../docs/r/elasticache_cluster.html.markdown | 6 +- ...che_global_replication_group.html.markdown | 2 +- .../elasticache_parameter_group.html.markdown | 2 +- ...lasticache_replication_group.html.markdown | 12 +- .../elasticache_security_group.html.markdown | 2 +- .../r/elasticache_subnet_group.html.markdown | 2 +- .../docs/r/elasticsearch_domain.html.markdown | 8 +- .../elasticsearch_domain_policy.html.markdown | 6 +- .../elastictranscoder_pipeline.html.markdown | 2 +- .../r/elastictranscoder_preset.html.markdown | 8 +- website/docs/r/elb.html.markdown | 2 +- website/docs/r/elb_attachment.html.markdown | 6 +- website/docs/r/emr_cluster.html.markdown | 14 +- .../docs/r/emr_instance_fleet.html.markdown | 4 +- .../docs/r/emr_instance_group.html.markdown | 4 +- .../emr_managed_scaling_policy.html.markdown | 6 +- .../emr_security_configuration.html.markdown | 2 +- website/docs/r/flow_log.html.markdown | 4 +- .../docs/r/fms_admin_account.html.markdown | 2 +- website/docs/r/fms_policy.html.markdown | 4 +- .../r/fsx_lustre_file_system.html.markdown | 4 +- .../r/fsx_windows_file_system.html.markdown | 6 +- website/docs/r/gamelift_alias.html.markdown | 2 +- website/docs/r/gamelift_build.html.markdown | 2 +- website/docs/r/gamelift_fleet.html.markdown | 2 +- .../gamelift_game_session_queue.html.markdown | 2 +- website/docs/r/glacier_vault.html.markdown | 2 +- .../docs/r/glacier_vault_lock.html.markdown | 4 +- .../r/globalaccelerator_accelerator.markdown | 2 +- ...alaccelerator_endpoint_group.html.markdown | 4 +- .../r/globalaccelerator_listener.markdown | 4 +- .../r/glue_catalog_database.html.markdown | 2 +- .../docs/r/glue_catalog_table.html.markdown | 4 +- website/docs/r/glue_classifier.html.markdown | 8 +- website/docs/r/glue_connection.html.markdown | 4 +- website/docs/r/glue_crawler.html.markdown | 12 +- ..._catalog_encryption_settings.html.markdown | 2 +- website/docs/r/glue_dev_endpoint.markdown | 4 +- website/docs/r/glue_job.html.markdown | 6 +- .../docs/r/glue_ml_transform.html.markdown | 2 +- website/docs/r/glue_partition.html.markdown | 2 +- website/docs/r/glue_registry.html.markdown | 2 +- .../docs/r/glue_resource_policy.html.markdown | 5 +- website/docs/r/glue_schema.html.markdown | 2 +- .../glue_security_configuration.html.markdown | 2 +- website/docs/r/glue_trigger.html.markdown | 10 +- .../glue_user_defined_function.html.markdown | 2 +- website/docs/r/glue_workflow.html.markdown | 2 +- .../docs/r/guardduty_detector.html.markdown | 2 +- website/docs/r/guardduty_filter.html.markdown | 2 +- .../r/guardduty_invite_accepter.html.markdown | 2 +- website/docs/r/guardduty_ipset.html.markdown | 2 +- website/docs/r/guardduty_member.html.markdown | 2 +- ...y_organization_admin_account.html.markdown | 2 +- ...y_organization_configuration.html.markdown | 2 +- ...dduty_publishing_destination.html.markdown | 2 +- .../r/guardduty_threatintelset.html.markdown | 2 +- website/docs/r/iam_access_key.html.markdown | 4 +- .../docs/r/iam_account_alias.html.markdown | 6 +- .../iam_account_password_policy.html.markdown | 2 +- website/docs/r/iam_group.html.markdown | 2 +- .../docs/r/iam_group_membership.html.markdown | 2 +- website/docs/r/iam_group_policy.html.markdown | 2 +- .../r/iam_group_policy_attachment.markdown | 6 +- .../docs/r/iam_instance_profile.html.markdown | 5 +- .../iam_openid_connect_provider.html.markdown | 3 +- website/docs/r/iam_policy.html.markdown | 6 +- .../r/iam_policy_attachment.html.markdown | 2 +- website/docs/r/iam_role.html.markdown | 14 +- website/docs/r/iam_role_policy.html.markdown | 2 +- .../r/iam_role_policy_attachment.markdown | 6 +- .../docs/r/iam_saml_provider.html.markdown | 3 +- .../r/iam_server_certificate.html.markdown | 11 +- .../r/iam_service_linked_role.html.markdown | 2 +- website/docs/r/iam_user.html.markdown | 2 +- .../r/iam_user_group_membership.html.markdown | 7 +- .../r/iam_user_login_profile.html.markdown | 4 +- website/docs/r/iam_user_policy.html.markdown | 2 +- .../r/iam_user_policy_attachment.markdown | 6 +- website/docs/r/iam_user_ssh_key.html.markdown | 2 +- .../r/imagebuilder_component.html.markdown | 4 +- ...r_distribution_configuration.html.markdown | 2 +- .../docs/r/imagebuilder_image.html.markdown | 2 +- .../imagebuilder_image_pipeline.html.markdown | 2 +- .../r/imagebuilder_image_recipe.html.markdown | 2 +- ...infrastructure_configuration.html.markdown | 2 +- .../inspector_assessment_target.html.markdown | 2 +- ...nspector_assessment_template.html.markdown | 2 +- .../r/inspector_resource_group.html.markdown | 2 +- website/docs/r/instance.html.markdown | 12 +- website/docs/r/internet_gateway.html.markdown | 4 +- website/docs/r/iot_certificate.html.markdown | 4 +- website/docs/r/iot_policy.html.markdown | 2 +- .../r/iot_policy_attachment.html.markdown | 6 +- website/docs/r/iot_role_alias.html.markdown | 2 +- website/docs/r/iot_thing.html.markdown | 2 +- ...t_thing_principal_attachment.html.markdown | 6 +- website/docs/r/iot_thing_type.html.markdown | 2 +- website/docs/r/iot_topic_rule.html.markdown | 2 +- website/docs/r/key_pair.html.markdown | 2 +- ...inesis_analytics_application.html.markdown | 4 +- ...sis_firehose_delivery_stream.html.markdown | 16 +- website/docs/r/kinesis_stream.html.markdown | 2 +- .../r/kinesis_stream_consumer.html.markdown | 54 + .../docs/r/kinesis_video_stream.html.markdown | 2 +- ...nesisanalyticsv2_application.html.markdown | 6 +- website/docs/r/kms_alias.html.markdown | 2 +- website/docs/r/kms_ciphertext.html.markdown | 2 +- website/docs/r/kms_external_key.html.markdown | 2 +- website/docs/r/kms_grant.html.markdown | 2 +- website/docs/r/kms_key.html.markdown | 2 +- ...formation_data_lake_settings.html.markdown | 6 +- .../r/lakeformation_permissions.html.markdown | 6 +- .../r/lakeformation_resource.html.markdown | 2 +- website/docs/r/lambda_alias.html.markdown | 2 +- .../lambda_code_signing_config.html.markdown | 5 +- .../lambda_event_source_mapping.html.markdown | 8 +- website/docs/r/lambda_function.html.markdown | 10 +- ...function_event_invoke_config.html.markdown | 10 +- .../docs/r/lambda_layer_version.html.markdown | 2 +- .../docs/r/lambda_permission.html.markdown | 12 +- ...ovisioned_concurrency_config.html.markdown | 4 +- .../docs/r/launch_configuration.html.markdown | 6 +- website/docs/r/launch_template.html.markdown | 2 +- website/docs/r/lb.html.markdown | 8 +- .../lb_cookie_stickiness_policy.html.markdown | 2 +- website/docs/r/lb_listener.html.markdown | 12 +- .../r/lb_listener_certificate.html.markdown | 2 +- website/docs/r/lb_listener_rule.html.markdown | 2 +- .../r/lb_ssl_negotiation_policy.html.markdown | 2 +- website/docs/r/lb_target_group.html.markdown | 6 +- .../lb_target_group_attachment.html.markdown | 4 +- website/docs/r/lex_bot.html.markdown | 2 +- website/docs/r/lex_bot_alias.html.markdown | 2 +- website/docs/r/lex_intent.html.markdown | 2 +- website/docs/r/lex_slot_type.html.markdown | 2 +- .../r/licensemanager_association.markdown | 2 +- ...ensemanager_license_configuration.markdown | 2 +- website/docs/r/lightsail_domain.html.markdown | 4 +- .../docs/r/lightsail_instance.html.markdown | 2 +- ...htsail_instance_public_ports.html.markdown | 61 + .../docs/r/lightsail_key_pair.html.markdown | 14 +- .../docs/r/lightsail_static_ip.html.markdown | 2 +- ...ghtsail_static_ip_attachment.html.markdown | 2 +- ...lancer_backend_server_policy.html.markdown | 12 +- ...oad_balancer_listener_policy.html.markdown | 10 +- .../docs/r/load_balancer_policy.html.markdown | 12 +- ...e_member_account_association.html.markdown | 2 +- .../macie_s3_bucket_association.html.markdown | 2 +- ...main_route_table_association.html.markdown | 2 +- .../docs/r/media_convert_queue.html.markdown | 2 +- .../r/media_package_channel.html.markdown | 2 +- .../r/media_store_container.html.markdown | 2 +- ...media_store_container_policy.html.markdown | 6 +- website/docs/r/mq_broker.html.markdown | 4 +- website/docs/r/mq_configuration.html.markdown | 28 +- website/docs/r/msk_cluster.html.markdown | 2 +- .../docs/r/msk_configuration.html.markdown | 2 +- ...msk_scram_secret_association.html.markdown | 2 +- website/docs/r/nat_gateway.html.markdown | 6 +- website/docs/r/neptune_cluster.html.markdown | 2 +- .../r/neptune_cluster_instance.html.markdown | 2 +- ...tune_cluster_parameter_group.html.markdown | 2 +- .../r/neptune_cluster_snapshot.html.markdown | 2 +- .../neptune_event_subscription.html.markdown | 6 +- .../r/neptune_parameter_group.html.markdown | 2 +- .../docs/r/neptune_subnet_group.html.markdown | 2 +- website/docs/r/network_acl.html.markdown | 2 +- website/docs/r/network_acl_rule.html.markdown | 2 +- website/docs/r/network_interface.markdown | 2 +- ...network_interface_attachment.html.markdown | 2 +- ...work_interface_sg_attachment.html.markdown | 8 +- .../r/networkfirewall_firewall.html.markdown | 2 +- ...workfirewall_firewall_policy.html.markdown | 4 +- ...rewall_logging_configuration.html.markdown | 6 +- ...workfirewall_resource_policy.html.markdown | 8 +- .../networkfirewall_rule_group.html.markdown | 10 +- .../docs/r/opsworks_application.html.markdown | 2 +- .../r/opsworks_custom_layer.html.markdown | 2 +- .../r/opsworks_ganglia_layer.html.markdown | 2 +- .../r/opsworks_haproxy_layer.html.markdown | 2 +- .../docs/r/opsworks_instance.html.markdown | 2 +- .../r/opsworks_java_app_layer.html.markdown | 2 +- .../r/opsworks_memcached_layer.html.markdown | 2 +- .../docs/r/opsworks_mysql_layer.html.markdown | 2 +- .../r/opsworks_nodejs_app_layer.html.markdown | 2 +- .../docs/r/opsworks_permission.html.markdown | 2 +- .../r/opsworks_php_app_layer.html.markdown | 2 +- .../r/opsworks_rails_app_layer.html.markdown | 2 +- .../r/opsworks_rds_db_instance.html.markdown | 2 +- website/docs/r/opsworks_stack.html.markdown | 2 +- .../r/opsworks_static_web_layer.html.markdown | 2 +- .../r/opsworks_user_profile.html.markdown | 2 +- .../r/organizations_account.html.markdown | 4 +- .../organizations_organization.html.markdown | 2 +- ...izations_organizational_unit.html.markdown | 2 +- .../docs/r/organizations_policy.html.markdown | 2 +- ...anizations_policy_attachment.html.markdown | 10 +- website/docs/r/pinpoint_adm_channel.markdown | 6 +- website/docs/r/pinpoint_apns_channel.markdown | 6 +- .../r/pinpoint_apns_sandbox_channel.markdown | 6 +- .../r/pinpoint_apns_voip_channel.markdown | 6 +- ...inpoint_apns_voip_sandbox_channel.markdown | 6 +- website/docs/r/pinpoint_app.markdown | 2 +- .../docs/r/pinpoint_baidu_channel.markdown | 6 +- .../docs/r/pinpoint_email_channel.markdown | 3 +- website/docs/r/pinpoint_event_stream.markdown | 6 +- website/docs/r/pinpoint_gcm_channel.markdown | 6 +- website/docs/r/pinpoint_sms_channel.markdown | 2 +- website/docs/r/placement_group.html.markdown | 2 +- .../docs/r/prometheus_workspace.html.markdown | 2 +- .../r/proxy_protocol_policy.html.markdown | 2 +- website/docs/r/qldb_ledger.html.markdown | 2 +- website/docs/r/quicksight_group.html.markdown | 2 +- website/docs/r/quicksight_user.html.markdown | 4 +- .../docs/r/ram_principal_association.markdown | 4 +- .../r/ram_resource_association.html.markdown | 2 +- website/docs/r/ram_resource_share.markdown | 2 +- .../r/ram_resource_share_accepter.markdown | 2 +- website/docs/r/rds_cluster.html.markdown | 14 +- .../docs/r/rds_cluster_endpoint.html.markdown | 2 +- .../docs/r/rds_cluster_instance.html.markdown | 2 +- .../r/rds_cluster_parameter_group.markdown | 2 +- .../docs/r/rds_global_cluster.html.markdown | 6 +- website/docs/r/redshift_cluster.html.markdown | 2 +- .../redshift_event_subscription.html.markdown | 6 +- .../r/redshift_parameter_group.html.markdown | 2 +- .../r/redshift_security_group.html.markdown | 2 +- ...redshift_snapshot_copy_grant.html.markdown | 2 +- .../redshift_snapshot_schedule.html.markdown | 8 +- ...napshot_schedule_association.html.markdown | 6 +- .../r/redshift_subnet_group.html.markdown | 2 +- .../docs/r/resourcegroups_group.html.markdown | 2 +- website/docs/r/route.html.markdown | 7 +- .../r/route53_delegation_set.html.markdown | 2 +- .../docs/r/route53_health_check.html.markdown | 8 +- .../route53_hosted_zone_dnssec.html.markdown | 2 +- .../r/route53_key_signing_key.html.markdown | 2 +- .../docs/r/route53_query_log.html.markdown | 2 +- website/docs/r/route53_record.html.markdown | 8 +- ...ute53_resolver_dnssec_config.html.markdown | 2 +- .../r/route53_resolver_endpoint.html.markdown | 2 +- ...53_resolver_query_log_config.html.markdown | 2 +- ...query_log_config_association.html.markdown | 2 +- .../r/route53_resolver_rule.html.markdown | 4 +- ...53_resolver_rule_association.html.markdown | 2 +- ...pc_association_authorization.html.markdown | 2 +- website/docs/r/route53_zone.html.markdown | 6 +- .../r/route53_zone_association.html.markdown | 2 +- website/docs/r/route_table.html.markdown | 31 +- .../r/route_table_association.html.markdown | 4 +- website/docs/r/s3_access_point.html.markdown | 4 +- ..._account_public_access_block.html.markdown | 2 +- website/docs/r/s3_bucket.html.markdown | 18 +- ...cket_analytics_configuration.html.markdown | 8 +- .../docs/r/s3_bucket_inventory.html.markdown | 8 +- website/docs/r/s3_bucket_metric.html.markdown | 8 +- .../r/s3_bucket_notification.html.markdown | 14 +- website/docs/r/s3_bucket_object.html.markdown | 10 +- ...s3_bucket_ownership_controls.html.markdown | 2 +- website/docs/r/s3_bucket_policy.html.markdown | 5 +- ...3_bucket_public_access_block.html.markdown | 2 +- website/docs/r/s3_object_copy.html.markdown | 4 +- website/docs/r/s3control_bucket.html.markdown | 2 +- ...cket_lifecycle_configuration.html.markdown | 2 +- .../r/s3control_bucket_policy.html.markdown | 2 +- .../docs/r/s3outposts_endpoint.html.markdown | 2 +- website/docs/r/sagemaker_app.html.markdown | 5 +- .../sagemaker_app_image_config.html.markdown | 4 +- .../r/sagemaker_code_repository.html.markdown | 4 +- website/docs/r/sagemaker_domain.html.markdown | 7 +- .../docs/r/sagemaker_endpoint.html.markdown | 2 +- ...maker_endpoint_configuration.html.markdown | 2 +- .../r/sagemaker_feature_group.html.markdown | 2 +- website/docs/r/sagemaker_image.html.markdown | 4 +- .../r/sagemaker_image_version.html.markdown | 4 +- website/docs/r/sagemaker_model.html.markdown | 2 +- ...agemaker_model_package_group.html.markdown | 4 +- .../sagemaker_notebook_instance.html.markdown | 4 +- ...ance_lifecycle_configuration.html.markdown | 2 +- .../r/sagemaker_user_profile.html.markdown | 5 +- .../r/secretsmanager_secret.html.markdown | 4 +- ...secretsmanager_secret_policy.html.markdown | 6 +- ...cretsmanager_secret_rotation.html.markdown | 2 +- ...ecretsmanager_secret_version.html.markdown | 6 +- website/docs/r/security_group.html.markdown | 8 +- .../docs/r/security_group_rule.html.markdown | 4 +- website/docs/r/securityhub_account.markdown | 2 +- .../r/securityhub_action_target.html.markdown | 2 +- .../r/securityhub_invite_accepter.markdown | 8 +- website/docs/r/securityhub_member.markdown | 2 +- ...b_organization_admin_account.html.markdown | 2 +- .../securityhub_product_subscription.markdown | 2 +- ...ecurityhub_standards_subscription.markdown | 2 +- ...ository_cloudformation_stack.html.markdown | 2 +- ...ice_discovery_http_namespace.html.markdown | 2 +- ...covery_private_dns_namespace.html.markdown | 2 +- ...scovery_public_dns_namespace.html.markdown | 2 +- .../r/service_discovery_service.html.markdown | 4 +- .../r/servicecatalog_portfolio.html.markdown | 2 +- .../servicequotas_service_quota.html.markdown | 2 +- .../ses_active_receipt_rule_set.html.markdown | 4 +- .../r/ses_configuration_set.html.markdown | 6 +- website/docs/r/ses_domain_dkim.html.markdown | 2 +- .../docs/r/ses_domain_identity.html.markdown | 2 +- ...domain_identity_verification.html.markdown | 2 +- .../docs/r/ses_domain_mail_from.html.markdown | 2 +- .../docs/r/ses_email_identity.html.markdown | 2 +- .../r/ses_event_destination.html.markdown | 8 +- .../ses_identity_notification_topic.markdown | 16 +- .../docs/r/ses_identity_policy.html.markdown | 6 +- .../docs/r/ses_receipt_filter.html.markdown | 2 +- website/docs/r/ses_receipt_rule.html.markdown | 4 +- .../docs/r/ses_receipt_rule_set.html.markdown | 4 +- website/docs/r/ses_template.html.markdown | 2 +- website/docs/r/sfn_activity.html.markdown | 2 +- .../docs/r/sfn_state_machine.html.markdown | 6 +- .../docs/r/shield_protection.html.markdown | 2 +- .../docs/r/signer_signing_job.html.markdown | 2 +- .../r/signer_signing_profile.html.markdown | 2 +- ...r_signing_profile_permission.html.markdown | 6 +- website/docs/r/simpledb_domain.html.markdown | 2 +- ...hot_create_volume_permission.html.markdown | 2 +- .../r/sns_platform_application.html.markdown | 4 +- .../docs/r/sns_sms_preferences.html.markdown | 6 +- website/docs/r/sns_topic.html.markdown | 4 +- website/docs/r/sns_topic_policy.html.markdown | 6 +- .../r/sns_topic_subscription.html.markdown | 6 +- .../spot_datafeed_subscription.html.markdown | 6 +- .../docs/r/spot_fleet_request.html.markdown | 8 +- .../r/spot_instance_request.html.markdown | 2 +- website/docs/r/sqs_queue.html.markdown | 6 +- website/docs/r/sqs_queue_policy.html.markdown | 6 +- website/docs/r/ssm_activation.html.markdown | 2 +- website/docs/r/ssm_association.html.markdown | 2 +- website/docs/r/ssm_document.html.markdown | 4 +- .../r/ssm_maintenance_window.html.markdown | 2 +- ...sm_maintenance_window_target.html.markdown | 10 +- .../ssm_maintenance_window_task.html.markdown | 8 +- website/docs/r/ssm_parameter.html.markdown | 6 +- .../docs/r/ssm_patch_baseline.html.markdown | 8 +- website/docs/r/ssm_patch_group.html.markdown | 4 +- .../r/ssm_resource_data_sync.html.markdown | 6 +- .../ssoadmin_account_assignment.html.markdown | 4 +- ...in_managed_policy_attachment.html.markdown | 4 +- .../r/ssoadmin_permission_set.html.markdown | 4 +- ...permission_set_inline_policy.html.markdown | 4 +- .../docs/r/storagegateway_cache.html.markdown | 2 +- ...egateway_cached_iscsi_volume.html.markdown | 6 +- .../r/storagegateway_gateway.html.markdown | 11 +- ...toragegateway_nfs_file_share.html.markdown | 2 +- ...toragegateway_smb_file_share.html.markdown | 4 +- ...egateway_stored_iscsi_volume.html.markdown | 6 +- .../r/storagegateway_tape_pool.html.markdown | 4 +- ...storagegateway_upload_buffer.html.markdown | 26 +- ...oragegateway_working_storage.html.markdown | 2 +- website/docs/r/subnet.html.markdown | 7 +- website/docs/r/swf_domain.html.markdown | 2 +- .../docs/r/synthetics_canary.html.markdown | 2 +- website/docs/r/transfer_server.html.markdown | 3 +- website/docs/r/transfer_ssh_key.html.markdown | 7 +- website/docs/r/transfer_user.html.markdown | 3 +- .../docs/r/volume_attachment.html.markdown | 2 +- website/docs/r/vpc.html.markdown | 8 +- website/docs/r/vpc_dhcp_options.html.markdown | 4 +- ...vpc_dhcp_options_association.html.markdown | 2 +- website/docs/r/vpc_endpoint.html.markdown | 10 +- ...oint_connection_notification.html.markdown | 2 +- ...oint_route_table_association.html.markdown | 2 +- .../docs/r/vpc_endpoint_service.html.markdown | 4 +- ...nt_service_allowed_principal.html.markdown | 2 +- ..._endpoint_subnet_association.html.markdown | 2 +- ..._ipv4_cidr_block_association.html.markdown | 2 +- .../r/vpc_peering_connection.html.markdown | 20 +- ..._peering_connection_accepter.html.markdown | 6 +- ...c_peering_connection_options.html.markdown | 10 +- website/docs/r/vpn_connection.html.markdown | 4 +- .../docs/r/vpn_connection_route.html.markdown | 2 +- website/docs/r/vpn_gateway.html.markdown | 2 +- .../r/vpn_gateway_attachment.html.markdown | 2 +- ...pn_gateway_route_propagation.html.markdown | 4 +- .../docs/r/waf_byte_match_set.html.markdown | 2 +- .../docs/r/waf_geo_match_set.html.markdown | 2 +- website/docs/r/waf_ipset.html.markdown | 2 +- .../docs/r/waf_rate_based_rule.html.markdown | 2 +- .../docs/r/waf_regex_match_set.html.markdown | 2 +- .../r/waf_regex_pattern_set.html.markdown | 2 +- website/docs/r/waf_rule.html.markdown | 2 +- website/docs/r/waf_rule_group.html.markdown | 2 +- .../r/waf_size_constraint_set.html.markdown | 2 +- .../waf_sql_injection_match_set.html.markdown | 2 +- website/docs/r/waf_web_acl.html.markdown | 4 +- .../docs/r/waf_xss_match_set.html.markdown | 2 +- .../wafregional_byte_match_set.html.markdown | 2 +- .../r/wafregional_geo_match_set.html.markdown | 2 +- .../docs/r/wafregional_ipset.html.markdown | 2 +- .../wafregional_rate_based_rule.html.markdown | 2 +- .../wafregional_regex_match_set.html.markdown | 2 +- ...afregional_regex_pattern_set.html.markdown | 2 +- website/docs/r/wafregional_rule.html.markdown | 2 +- .../r/wafregional_rule_group.html.markdown | 2 +- ...regional_size_constraint_set.html.markdown | 2 +- ...onal_sql_injection_match_set.html.markdown | 2 +- .../docs/r/wafregional_web_acl.html.markdown | 6 +- ...regional_web_acl_association.html.markdown | 10 +- .../r/wafregional_xss_match_set.html.markdown | 2 +- website/docs/r/wafv2_ip_set.html.markdown | 2 +- .../r/wafv2_regex_pattern_set.html.markdown | 2 +- website/docs/r/wafv2_rule_group.html.markdown | 9 +- website/docs/r/wafv2_web_acl.html.markdown | 17 +- .../r/wafv2_web_acl_association.html.markdown | 6 +- ...eb_acl_logging_configuration.html.markdown | 19 +- website/docs/r/worklink_fleet.html.markdown | 6 +- ...ficate_authority_association.html.markdown | 2 +- .../docs/r/workspaces_directory.html.markdown | 6 +- .../docs/r/workspaces_ip_group.html.markdown | 2 +- .../docs/r/workspaces_workspace.html.markdown | 2 +- .../r/xray_encryption_config.html.markdown | 4 +- website/docs/r/xray_group.html.markdown | 2 +- .../docs/r/xray_sampling_rule.html.markdown | 2 +- 2323 files changed, 52936 insertions(+), 14650 deletions(-) create mode 100644 .changelog/11967.txt create mode 100644 .changelog/14101.txt create mode 100644 .changelog/14193.txt create mode 100644 .changelog/14247.txt create mode 100644 .changelog/14319.txt create mode 100644 .changelog/14905.txt create mode 100644 .changelog/15213.txt create mode 100644 .changelog/16815.txt create mode 100644 .changelog/16930.txt create mode 100644 .changelog/16936.txt create mode 100644 .changelog/16961.txt create mode 100644 .changelog/16963.txt create mode 100644 .changelog/16979.txt create mode 100644 .changelog/17149.txt create mode 100644 .changelog/17387.txt create mode 100644 .changelog/17465.txt create mode 100644 .changelog/17589.txt create mode 100644 .changelog/17596.txt create mode 100644 .changelog/17641.txt create mode 100644 .changelog/17830.txt create mode 100644 .changelog/17876.txt create mode 100644 .changelog/17909.txt create mode 100644 .changelog/17958.txt create mode 100644 .changelog/17962.txt create mode 100644 .changelog/17964.txt create mode 100644 .changelog/17965.txt create mode 100644 .changelog/17967.txt create mode 100644 .changelog/17968.txt create mode 100644 .changelog/17969.txt create mode 100644 .changelog/17974.txt create mode 100644 .changelog/17985.txt create mode 100644 .changelog/18042.txt create mode 100644 .changelog/18070.txt create mode 100644 .changelog/18076.txt create mode 100644 .changelog/18129.txt create mode 100644 .changelog/18203.txt create mode 100644 .changelog/18276.txt create mode 100644 .changelog/18281.txt create mode 100644 .changelog/18305.txt create mode 100644 .changelog/18313.txt create mode 100644 .changelog/18314.txt create mode 100644 .changelog/18341.txt create mode 100644 .changelog/18351.txt create mode 100644 .changelog/18361.txt create mode 100644 .changelog/18382.txt create mode 100644 .changelog/18384.txt create mode 100644 .changelog/18388.txt create mode 100644 .changelog/18391.txt create mode 100644 .changelog/18392.txt create mode 100644 .changelog/18404.txt create mode 100644 .changelog/8611.txt create mode 100644 aws/data_source_aws_codestarconnections_connection.go create mode 100644 aws/data_source_aws_codestarconnections_connection_test.go create mode 100644 aws/data_source_aws_ec2_transit_gateway_route_tables.go create mode 100644 aws/data_source_aws_ec2_transit_gateway_route_tables_test.go create mode 100644 aws/data_source_aws_kinesis_stream_consumer.go create mode 100644 aws/data_source_aws_kinesis_stream_consumer_test.go create mode 100644 aws/internal/net/cidr.go create mode 100644 aws/internal/net/cidr_test.go create mode 100644 aws/internal/service/codestarconnections/finder/finder.go create mode 100644 aws/internal/service/kinesis/finder/finder.go create mode 100644 aws/internal/service/kinesis/waiter/status.go create mode 100644 aws/internal/service/kinesis/waiter/waiter.go create mode 100644 aws/internal/service/sns/finder/finder.go create mode 100644 aws/resource_aws_kinesis_stream_consumer.go create mode 100644 aws/resource_aws_kinesis_stream_consumer_test.go create mode 100644 aws/resource_aws_lightsail_instance_public_ports.go create mode 100644 aws/resource_aws_lightsail_instance_public_ports_test.go create mode 100644 aws/resource_aws_ssm_patch_group_migrate.go create mode 100644 aws/resource_aws_ssm_patch_group_migrate_test.go create mode 100644 aws/testdata/service/dms/oracle_wallet_certificate.pem delete mode 100644 awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/generate.go delete mode 100644 awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.go rename awsproviderlint/vendor/github.com/apparentlymart/go-textseg/{ => v12}/LICENSE (100%) rename awsproviderlint/vendor/github.com/apparentlymart/go-textseg/{ => v12}/textseg/all_tokens.go (100%) create mode 100644 awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/emoji_table.rl create mode 100644 awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/generate.go create mode 100644 awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/grapheme_clusters.go rename awsproviderlint/vendor/github.com/apparentlymart/go-textseg/{ => v12}/textseg/grapheme_clusters.rl (92%) rename awsproviderlint/vendor/github.com/apparentlymart/go-textseg/{ => v12}/textseg/grapheme_clusters_table.rl (95%) rename awsproviderlint/vendor/github.com/apparentlymart/go-textseg/{ => v12}/textseg/tables.go (93%) rename awsproviderlint/vendor/github.com/apparentlymart/go-textseg/{ => v12}/textseg/unicode2ragel.rb (99%) rename awsproviderlint/vendor/github.com/apparentlymart/go-textseg/{ => v12}/textseg/utf8_seqs.go (100%) create mode 100644 awsproviderlint/vendor/github.com/aws/aws-sdk-go/internal/s3shared/arn/s3_object_lambda_arn.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT010/AT010.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT010/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT011/AT011.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT011/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT012/AT012.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT012/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V011/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V011/V011.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V012/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V012/V012.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V013/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V013/V013.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V014/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V014/V014.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr/osexeccommandcallexpr.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr/osexeccommandcontextcallexpr.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr/osexeccommandcontextselectorexpr.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr/osexeccommandselectorexpr.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XAT001/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XAT001/XAT001.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/XR007.go create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/README.md create mode 100644 awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/XR008.go create mode 100644 awsproviderlint/vendor/github.com/hashicorp/go-getter/.goreleaser.yml create mode 100644 awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress_tzst.go create mode 100644 awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress_zstd.go delete mode 100644 awsproviderlint/vendor/github.com/hashicorp/hcl/v2/appveyor.yml create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/LICENSE create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/fse/README.md create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/fse/bitreader.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/fse/bitwriter.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/fse/bytereader.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/fse/compress.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/fse/decompress.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/fse/fse.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/huff0/.gitignore create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/huff0/README.md create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/huff0/bitreader.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/huff0/bitwriter.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/huff0/bytereader.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/huff0/compress.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/huff0/decompress.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/huff0/huff0.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/.gitignore create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/AUTHORS create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/CONTRIBUTORS create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/LICENSE create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/README create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_amd64.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_amd64.s create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_other.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_amd64.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_amd64.s create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_other.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/runbench.cmd create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/snappy/snappy.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/README.md create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/bitreader.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/bitwriter.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/blockdec.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/blockenc.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/blocktype_string.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/bytebuf.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/bytereader.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/decoder.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/decoder_options.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/dict.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_base.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_better.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_dfast.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_fast.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/encoder.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/encoder_options.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/framedec.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/frameenc.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_decoder.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_encoder.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_predefined.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/hash.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/history.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/LICENSE.txt create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/README.md create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_safe.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/seqdec.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/seqenc.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/snappy.go create mode 100644 awsproviderlint/vendor/github.com/klauspost/compress/zstd/zstd.go create mode 100644 awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/conversion.go create mode 100644 awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/string_replace.go create mode 100644 awsproviderlint/vendor/golang.org/x/tools/internal/gocommand/version.go create mode 100644 awsproviderlint/vendor/google.golang.org/api/internal/impersonate/impersonate.go delete mode 100644 awsproviderlint/vendor/google.golang.org/api/internal/service-account.json create mode 100644 awsproviderlint/vendor/google.golang.org/api/transport/internal/dca/dca.go create mode 100644 website/docs/d/codestarconnections_connection.html.markdown create mode 100644 website/docs/d/ec2_transit_gateway_route_tables.html.markdown create mode 100644 website/docs/d/kinesis_stream_consumer.html.markdown create mode 100644 website/docs/r/kinesis_stream_consumer.html.markdown create mode 100644 website/docs/r/lightsail_instance_public_ports.html.markdown diff --git a/.changelog/11967.txt b/.changelog/11967.txt new file mode 100644 index 000000000000..c76920ac6e02 --- /dev/null +++ b/.changelog/11967.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_ssm_parameter: Add support for `Intelligent-Tiering` +``` diff --git a/.changelog/14101.txt b/.changelog/14101.txt new file mode 100644 index 000000000000..17b056ebb9c3 --- /dev/null +++ b/.changelog/14101.txt @@ -0,0 +1,7 @@ +```release-note:enhancement +resource/aws_sns_topic_subscription: Add plan time validation for `subscription_role_arn` and `topic_arn` +``` + +```release-note:bug +resource/aws_sns_topic_subscription: recreate subscription if topic is deleted +``` \ No newline at end of file diff --git a/.changelog/14193.txt b/.changelog/14193.txt new file mode 100644 index 000000000000..9d588853c0d2 --- /dev/null +++ b/.changelog/14193.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_ecr_repository_policy: Add plan time validation for `policy` +``` diff --git a/.changelog/14247.txt b/.changelog/14247.txt new file mode 100644 index 000000000000..93eb2aa38328 --- /dev/null +++ b/.changelog/14247.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_config_configuration_aggregator: Allow name to have uppercase characters +``` diff --git a/.changelog/14319.txt b/.changelog/14319.txt new file mode 100644 index 000000000000..71d707d9f4df --- /dev/null +++ b/.changelog/14319.txt @@ -0,0 +1,7 @@ +```release-note:bug +resource/aws_wafv2_web_acl_logging_configuration: Ensure `redacted_fields` are applied to the resource +``` + +```release-note:note +resource/aws_wafv2_web_acl_logging_configuration: The `redacted_fields` configuration block `all_query_arguments`, `body`, and `single_query_argument` arguments have been deprecated to match the WAF API documentation +``` \ No newline at end of file diff --git a/.changelog/14905.txt b/.changelog/14905.txt new file mode 100644 index 000000000000..55bc3a980016 --- /dev/null +++ b/.changelog/14905.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_light_instance_public_ports: Add `cidrs` argument to `port_info` +``` \ No newline at end of file diff --git a/.changelog/15213.txt b/.changelog/15213.txt new file mode 100644 index 000000000000..5dae4dbff30d --- /dev/null +++ b/.changelog/15213.txt @@ -0,0 +1,7 @@ +```release-note:bug +resource/aws_ssm_patch_group: Allow for a single patch group to be registered with multiple patch baselines +``` + +```release-note:bug +resource/aws_ssm_patch_group: Replace `Provider produced inconsistent result after apply` with actual error message +``` diff --git a/.changelog/16815.txt b/.changelog/16815.txt new file mode 100644 index 000000000000..a7b99a6469ed --- /dev/null +++ b/.changelog/16815.txt @@ -0,0 +1,11 @@ +```release-note:bug +resource/aws_cloudwatch_event_permission: Fix error in Event Bridge/CloudWatch Events bus name validation +``` + +```release-note:bug +resource/aws_cloudwatch_event_rule: Fix error in Event Bridge/CloudWatch Events bus name validation +``` + +```release-note:bug +resource/aws_cloudwatch_event_target: Fix error in Event Bridge/CloudWatch Events bus name validation +``` diff --git a/.changelog/16930.txt b/.changelog/16930.txt new file mode 100644 index 000000000000..7ef478508e84 --- /dev/null +++ b/.changelog/16930.txt @@ -0,0 +1,7 @@ +```release-note:enhancement +resource/aws_route: Validate route destination and target attributes +``` + +```release-note:bug +resource/aws_route: Correctly handle updates to the route target attributes (`egress_only_gateway_id`, `gateway_id`, `instance_id`, `local_gateway_id`, `nat_gateway_id`, `network_interface_id`, `transit_gateway_id`, `vpc_peering_connection_id`) +``` diff --git a/.changelog/16936.txt b/.changelog/16936.txt new file mode 100644 index 000000000000..c3d439350fa7 --- /dev/null +++ b/.changelog/16936.txt @@ -0,0 +1,7 @@ +```release-note:enhancement +resource/aws_ecs_service: Add `deployment_circuit_breaker` +``` + +```release-note:bug +resource/aws_ecs_service: Improve handling of eventual consistency including security group dependency violations on deletion +``` \ No newline at end of file diff --git a/.changelog/16961.txt b/.changelog/16961.txt new file mode 100644 index 000000000000..0d8a128b9214 --- /dev/null +++ b/.changelog/16961.txt @@ -0,0 +1,3 @@ +```release-notes:enhancement +resource/aws_route: Add `carrier_gateway_id` attribute +``` diff --git a/.changelog/16963.txt b/.changelog/16963.txt new file mode 100644 index 000000000000..fe1bfd80372d --- /dev/null +++ b/.changelog/16963.txt @@ -0,0 +1,3 @@ +```release-notes:enhancement +data-source/aws_route: Add `carrier_gateway_id` attribute +``` diff --git a/.changelog/16979.txt b/.changelog/16979.txt new file mode 100644 index 000000000000..0c1a7fc785f9 --- /dev/null +++ b/.changelog/16979.txt @@ -0,0 +1,11 @@ +```release-notes:enhancement +resource/aws_default_route_table: Add `arn` attribute +``` + +```release-notes:enhancement +resource/aws_route_table: Add `arn` attribute +``` + +```release-notes:enhancement +resource/aws_route_table: Add `carrier_gateway_id` attribute to `route` configuration block +``` diff --git a/.changelog/17149.txt b/.changelog/17149.txt new file mode 100644 index 000000000000..8d6f8cf48f14 --- /dev/null +++ b/.changelog/17149.txt @@ -0,0 +1,7 @@ +```release-note:new-data-source +aws_kinesis_stream_consumer +``` + +```release-note:new-resource +aws_kinesis_stream_consumer +``` diff --git a/.changelog/17387.txt b/.changelog/17387.txt new file mode 100644 index 000000000000..ad02895c6e8b --- /dev/null +++ b/.changelog/17387.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_ecs_service: Re-create service when `service_registries` changes +``` diff --git a/.changelog/17465.txt b/.changelog/17465.txt new file mode 100644 index 000000000000..79e78c672802 --- /dev/null +++ b/.changelog/17465.txt @@ -0,0 +1,3 @@ +```release-note:note +resource/aws_codebuild_project: The `source` and `secondary_sources` configuration block `auth` attributes have been deprecated to match the CodeBuild API documentation. Use the `aws_codebuild_source_credential` resource instead. +``` diff --git a/.changelog/17589.txt b/.changelog/17589.txt new file mode 100644 index 000000000000..17a28b7e405b --- /dev/null +++ b/.changelog/17589.txt @@ -0,0 +1,3 @@ +```release-note:new-data-source +aws_ec2_transit_gateway_route_tables +``` \ No newline at end of file diff --git a/.changelog/17596.txt b/.changelog/17596.txt new file mode 100644 index 000000000000..7847b72d61d6 --- /dev/null +++ b/.changelog/17596.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_fms_admin_account: Extend creation timeout to 10 minutes +``` diff --git a/.changelog/17641.txt b/.changelog/17641.txt new file mode 100644 index 000000000000..9b6da489e960 --- /dev/null +++ b/.changelog/17641.txt @@ -0,0 +1,7 @@ +```release-note:note +data-source/aws_vpc_endpoint_service: The `service_type` argument filtering has been switched from client-side to new EC2 API functionality +``` + +```release-note:bug +data-source/aws_vpc_endpoint_service: Prevent panic with incorrect `service_type` argument values +``` diff --git a/.changelog/17830.txt b/.changelog/17830.txt new file mode 100644 index 000000000000..ca76c19e6fc3 --- /dev/null +++ b/.changelog/17830.txt @@ -0,0 +1,7 @@ +```release-note:enhancement +resource/aws_ssm_parameter: Add plan time validation to `name`, `description` and `allowed_pattern` +``` + +```release-note:enhancement +resource/aws_ssm_parameter: Tag on create +``` diff --git a/.changelog/17876.txt b/.changelog/17876.txt new file mode 100644 index 000000000000..5c7ab8bd6028 --- /dev/null +++ b/.changelog/17876.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_waf_rule: Fix rule deletion when still referenced by a WebACL +``` diff --git a/.changelog/17909.txt b/.changelog/17909.txt new file mode 100644 index 000000000000..3eb85dae46c7 --- /dev/null +++ b/.changelog/17909.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_db_parameter_group: Store all values in lowercase to prevent unexpected diffs +``` diff --git a/.changelog/17958.txt b/.changelog/17958.txt new file mode 100644 index 000000000000..810bc032a80f --- /dev/null +++ b/.changelog/17958.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_dms_certificate: Correctly base64 decode `certificate_wallet` value +``` diff --git a/.changelog/17962.txt b/.changelog/17962.txt new file mode 100644 index 000000000000..b906cde0dbec --- /dev/null +++ b/.changelog/17962.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_iam_instance_profile: Add tagging support +``` \ No newline at end of file diff --git a/.changelog/17964.txt b/.changelog/17964.txt new file mode 100644 index 000000000000..f762457c64a5 --- /dev/null +++ b/.changelog/17964.txt @@ -0,0 +1,7 @@ +```release-note:enhancement +resource/aws_iam_openid_connect_provider: Add tagging support +``` + +```release-note:enhancement +resource/aws_iam_openid_connect_provider: Add plan time validation for `client_id_list` and `thumbprint_list` +``` diff --git a/.changelog/17965.txt b/.changelog/17965.txt new file mode 100644 index 000000000000..9451408b5c63 --- /dev/null +++ b/.changelog/17965.txt @@ -0,0 +1,7 @@ +```release-note:enhancement +resource/aws_iam_saml_provider: Add tagging support +``` + +```release-note:enhancement +resource/aws_iam_saml_provider: Add plan time validation for `name` and `saml_metadata_document` +``` diff --git a/.changelog/17967.txt b/.changelog/17967.txt new file mode 100644 index 000000000000..ff8a26838766 --- /dev/null +++ b/.changelog/17967.txt @@ -0,0 +1,7 @@ +```release-note:enhancement +resource/aws_iam_server_certificate: Add tagging support +``` + +```release-note:enhancement +resource/aws_iam_server_certificate: Add `expiration` and `upload_date` attributes +``` diff --git a/.changelog/17968.txt b/.changelog/17968.txt new file mode 100644 index 000000000000..daf69ea76e6c --- /dev/null +++ b/.changelog/17968.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_ami_from_instance: Tag on create. +``` \ No newline at end of file diff --git a/.changelog/17969.txt b/.changelog/17969.txt new file mode 100644 index 000000000000..40a3386fda36 --- /dev/null +++ b/.changelog/17969.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_efs_file_system: Add `number_of_mount_targets`, `size_in_bytes` and `owner_id` attributes +``` \ No newline at end of file diff --git a/.changelog/17974.txt b/.changelog/17974.txt new file mode 100644 index 000000000000..c854905099eb --- /dev/null +++ b/.changelog/17974.txt @@ -0,0 +1,15 @@ +```release-note:note +provider: New `default_tags` argument as a public preview for applying tags across all resources under a provider. Support for the functionality must be added to individual resources in the codebase and is only implemented for the `aws_subnet` and `aws_vpc` resources at this time. Until a general availability announcement, no compatibility promises are made with these provider arguments and their functionality. +``` + +```release-note:enhancement +provider: Add `default_tags` argument (in public preview, see note above) +``` + +```release-note:enhancement +resource/aws_subnet: Support provider-wide default tags (in public preview, see note above) +``` + +```release-note:enhancement +resource/aws_vpc: Support provider-wide default tags (in public preview, see note above) +``` diff --git a/.changelog/17985.txt b/.changelog/17985.txt new file mode 100644 index 000000000000..44f559b3325b --- /dev/null +++ b/.changelog/17985.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_globalaccelerator_accelerator: Correct length for `name` attribute validation +``` diff --git a/.changelog/18042.txt b/.changelog/18042.txt new file mode 100644 index 000000000000..a62ba19d4710 --- /dev/null +++ b/.changelog/18042.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_cloudfront_distribution: Allow `forwarded_values` to be set to empty when values were previously set +``` diff --git a/.changelog/18070.txt b/.changelog/18070.txt new file mode 100644 index 000000000000..b98c495dd801 --- /dev/null +++ b/.changelog/18070.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_mq_configuration: Add `ldap` as an `authentication_strategy` and `RabbitMQ` as an `engine_type` +``` diff --git a/.changelog/18076.txt b/.changelog/18076.txt new file mode 100644 index 000000000000..630f6f7c7e60 --- /dev/null +++ b/.changelog/18076.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +resource/aws_storagegateway_gateway: Add support for `smb_file_share_visibility`. +``` diff --git a/.changelog/18129.txt b/.changelog/18129.txt new file mode 100644 index 000000000000..2c5d15a2e64d --- /dev/null +++ b/.changelog/18129.txt @@ -0,0 +1,3 @@ +```release-note:new-data-source +aws_codestarconnections_connection +``` diff --git a/.changelog/18203.txt b/.changelog/18203.txt new file mode 100644 index 000000000000..4ea0164c8970 --- /dev/null +++ b/.changelog/18203.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_lakeformation_permissions: Properly serialize SELECT permission for `permissions` and `permissions_with_grant_option` fields +``` diff --git a/.changelog/18276.txt b/.changelog/18276.txt new file mode 100644 index 000000000000..b94e07e663c4 --- /dev/null +++ b/.changelog/18276.txt @@ -0,0 +1,11 @@ +```release-note:enhancement +resource/aws_iam_policy: Add tagging support +``` + +```release-note:enhancement +resource/aws_iam_policy: Add `policy_id` attribute +``` + +```release-note:enhancement +data-source/aws_iam_policy: Add `policy_id` and `tags` attributes +``` diff --git a/.changelog/18281.txt b/.changelog/18281.txt new file mode 100644 index 000000000000..d119487f700b --- /dev/null +++ b/.changelog/18281.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_pinpoint_sms_channel: Set all params on update +``` \ No newline at end of file diff --git a/.changelog/18305.txt b/.changelog/18305.txt new file mode 100644 index 000000000000..14fd969ad2b3 --- /dev/null +++ b/.changelog/18305.txt @@ -0,0 +1,7 @@ +```release-note:bug +resource/aws_pinpoint_event_stream: Retry on eventual consistency error +``` + +```release-note:enhancement +resource/aws_pinpoint_event_stream: Plan time validations for `destination_stream_arn` and `role_arn` +``` diff --git a/.changelog/18313.txt b/.changelog/18313.txt new file mode 100644 index 000000000000..b64ff580aba7 --- /dev/null +++ b/.changelog/18313.txt @@ -0,0 +1,11 @@ +```release-note:note +resource/aws_storagegateway_upload_buffer: The Storage Gateway `ListLocalDisks` API operation has been implemented to support the `disk_path` attribute for Cached and VTL gateway types. Environments using restrictive IAM permissions may require updates. +``` + +```release-note:bug +data-source/aws_storagegateway_local_disk: Allow `disk_path` reference on `disk_node` lookup and vice-versa +``` + +```release-note:enhancement +resource/aws_storagegateway_upload_buffer: Add `disk_path` argument for Cached and VTL gateways +``` diff --git a/.changelog/18314.txt b/.changelog/18314.txt new file mode 100644 index 000000000000..579cda25c122 --- /dev/null +++ b/.changelog/18314.txt @@ -0,0 +1,7 @@ +```release-note:enhancement +resource/aws_pinpoint_email_channel: Add `configuration_set` argument +``` + +```release-note:enhancement +resource/aws_pinpoint_email_channel: Add plan time validation for `identity` and `role_arn` +``` \ No newline at end of file diff --git a/.changelog/18341.txt b/.changelog/18341.txt new file mode 100644 index 000000000000..e732da434026 --- /dev/null +++ b/.changelog/18341.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_securityhub_organization_admin_account: Retry on `ResourceConflictException` error during creation +``` \ No newline at end of file diff --git a/.changelog/18351.txt b/.changelog/18351.txt new file mode 100644 index 000000000000..e48f26687bbd --- /dev/null +++ b/.changelog/18351.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_apigatewayv2_domain_name: Allow update of mutual TLS S3 object version +``` diff --git a/.changelog/18361.txt b/.changelog/18361.txt new file mode 100644 index 000000000000..5e50400f3e63 --- /dev/null +++ b/.changelog/18361.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_elasticache_replication_group: Prevents re-creation of secondary replication groups when encryption is enabled +``` diff --git a/.changelog/18382.txt b/.changelog/18382.txt new file mode 100644 index 000000000000..46a43e86818e --- /dev/null +++ b/.changelog/18382.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_api_gateway_vpc_link: Persist ID of failed VPC Link to state +``` diff --git a/.changelog/18384.txt b/.changelog/18384.txt new file mode 100644 index 000000000000..a1cf0941716a --- /dev/null +++ b/.changelog/18384.txt @@ -0,0 +1,4 @@ +```release-note:bug +resource/aws_wafv2_web_acl_logging_configuration: Remove deprecation warning for `redacted_fields` `single_header` argument +``` + diff --git a/.changelog/18388.txt b/.changelog/18388.txt new file mode 100644 index 000000000000..ea024aa9ef5a --- /dev/null +++ b/.changelog/18388.txt @@ -0,0 +1,7 @@ +```release-note:bug +resource/aws_network_acl: Handle EC2 eventual consistency errors on creation +``` + +```release-note:bug +resource/aws_network_acl_rule: Handle EC2 eventual consistency errors on creation +``` diff --git a/.changelog/18391.txt b/.changelog/18391.txt new file mode 100644 index 000000000000..e7a0ee19eff5 --- /dev/null +++ b/.changelog/18391.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_vpc: Handle EC2 eventual consistency errors on creation +``` diff --git a/.changelog/18392.txt b/.changelog/18392.txt new file mode 100644 index 000000000000..34bcc004200e --- /dev/null +++ b/.changelog/18392.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_subnet: Handle EC2 eventual consistency errors on creation +``` diff --git a/.changelog/18404.txt b/.changelog/18404.txt new file mode 100644 index 000000000000..43e2b28b2fe8 --- /dev/null +++ b/.changelog/18404.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_synthetics_canary: Handle asynchronous IAM eventual consistency error on creation +``` diff --git a/.changelog/8611.txt b/.changelog/8611.txt new file mode 100644 index 000000000000..350021e3c1b3 --- /dev/null +++ b/.changelog/8611.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +aws_lightsail_instance_public_ports +``` \ No newline at end of file diff --git a/.github/workflows/firewatch.yml b/.github/workflows/firewatch.yml index 3585f801d060..f4d264ed0cde 100644 --- a/.github/workflows/firewatch.yml +++ b/.github/workflows/firewatch.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Firewatch - uses: breathingdust/firewatch@v1 + uses: breathingdust/firewatch@v2 with: github_token: ${{ secrets.GITHUB_TOKEN }} alert_threshold: 10 diff --git a/.github/workflows/issues.yml b/.github/workflows/issues.yml index 5189985a451d..b37a71dd387c 100644 --- a/.github/workflows/issues.yml +++ b/.github/workflows/issues.yml @@ -9,13 +9,13 @@ jobs: - uses: actions/checkout@v2 - name: Apply Issue needs-triage Label if: github.event.action == 'opened' && !contains(fromJSON('["anGie44", "bflad", "bill-rich", "breathingdust", "DrFaust92", "ewbankkit", "gdavison", "maryelizbeth", "YakDriver"]'), github.actor) - uses: github/issue-labeler@v2.2 + uses: github/issue-labeler@v2.3 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" configuration-path: .github/labeler-issue-needs-triage.yml enable-versioned-regex: 0 - name: Apply Issue Triage Labels - uses: github/issue-labeler@v2.2 + uses: github/issue-labeler@v2.3 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" configuration-path: .github/labeler-issue-triage.yml diff --git a/.github/workflows/terraform_provider.yml b/.github/workflows/terraform_provider.yml index 086fd031f95c..cbd7fa79f276 100644 --- a/.github/workflows/terraform_provider.yml +++ b/.github/workflows/terraform_provider.yml @@ -10,7 +10,6 @@ on: - .github/workflows/terraform_provider.yml - .go-version - .golangci.yml - - .goreleaser.yml - .semgrep.yml - aws/** - awsproviderlint/** @@ -27,7 +26,7 @@ on: env: AWS_DEFAULT_REGION: us-west-2 - TERRAFORM_VERSION: "0.12.25" + TERRAFORM_VERSION: "0.14.8" jobs: go_mod_download: @@ -86,7 +85,7 @@ jobs: key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} - if: steps.cache-terraform-plugin-dir.outputs.cache-hit != 'true' || steps.cache-terraform-plugin-dir.outcome == 'failure' name: go build - run: go build -o terraform-plugin-dir/terraform-provider-aws_v99.99.99_x4 . + run: go build -o terraform-plugin-dir/registry.terraform.io/hashicorp/aws/99.99.99/$(go env GOOS)_$(go env GOARCH)/terraform-provider-aws . terraform_providers_schema: name: terraform providers schema @@ -275,32 +274,6 @@ jobs: - run: cd tools && go install github.com/pavius/impi/cmd/impi - run: impi --local . --scheme stdThirdPartyLocal ./... - goreleaser: - needs: [go_mod_download] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - # See also: https://github.com/actions/setup-go/pull/62 - - run: echo "GO_VERSION=$(cat .go-version)" >> $GITHUB_ENV - - uses: actions/setup-go@v2 - with: - go-version: ${{ env.GO_VERSION }} - - uses: actions/cache@v2 - continue-on-error: true - timeout-minutes: 2 - with: - path: ~/go/pkg/mod - key: ${{ runner.os }}-go-pkg-mod-${{ hashFiles('go.sum') }} - - name: goreleaser check - continue-on-error: true - uses: goreleaser/goreleaser-action@v2 - with: - args: check - - name: goreleaser build - uses: goreleaser/goreleaser-action@v2 - with: - args: build --snapshot --timeout 2h - semgrep: runs-on: ubuntu-latest steps: @@ -336,9 +309,9 @@ jobs: run: | tfproviderdocs check \ -allowed-resource-subcategories-file website/allowed-subcategories.txt \ + -enable-contents-check \ -ignore-file-missing-data-sources aws_alb,aws_alb_listener,aws_alb_target_group \ -ignore-file-missing-resources aws_alb,aws_alb_listener,aws_alb_listener_certificate,aws_alb_listener_rule,aws_alb_target_group,aws_alb_target_group_attachment \ - -ignore-side-navigation-data-sources aws_alb,aws_alb_listener,aws_alb_target_group,aws_kms_secret \ - -provider-name aws \ + -provider-source registry.terraform.io/hashicorp/aws \ -providers-schema-json terraform-providers-schema/schema.json \ -require-resource-subcategory diff --git a/.golangci.yml b/.golangci.yml index 8a6b2d0e9fd7..49c3405dbe26 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,6 +18,7 @@ linters: - deadcode - errcheck - gofmt + - gomnd - gosimple - ineffassign - makezero @@ -34,6 +35,132 @@ linters: linters-settings: errcheck: ignore: github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set,fmt:.*,io:Close + gomnd: + settings: + mnd: + checks: + - argument + ignored-files: + # Needing constants, comment ignores, switching to customizable timeouts, or retries moved to aws/config.go + - awserr.go + - data_source_aws_cognito_user_pools.go + - data_source_aws_lakeformation_permissions.go + - resource_aws_api_gateway_base_path_mapping.go + - resource_aws_appautoscaling_policy.go + - resource_aws_appautoscaling_scheduled_action.go + - resource_aws_appautoscaling_target.go + - resource_aws_autoscaling_lifecycle_hook.go + - resource_aws_backup_plan.go + - resource_aws_cloud9_environment_ec2.go + - resource_aws_cloudfront_distribution.go + - resource_aws_cloudhsm2_cluster.go + - resource_aws_cloudhsm2_hsm.go + - resource_aws_cloudwatch_event_target.go + - resource_aws_cloudwatch_log_destination.go + - resource_aws_cloudwatch_log_stream.go + - resource_aws_cloudwatch_log_subscription_filter.go + - resource_aws_codebuild_project.go + - resource_aws_codedeploy_deployment_group.go + - resource_aws_codepipeline_webhook.go + - resource_aws_config_config_rule.go + - resource_aws_config_delivery_channel.go + - resource_aws_customer_gateway.ogresource_aws_elasticsearch_domain + - resource_aws_datapipeline_pipeline.go + - resource_aws_db_instance.go + - resource_aws_db_parameter_group.go + - resource_aws_dms_endpoint.go + - resource_aws_docdb_cluster.go + - resource_aws_docdb_cluster_parameter_group.go + - resource_aws_docdb_subnet_group.go + - resource_aws_dynamodb_table.go + - resource_aws_ebs_snapshot_copy.go + - resource_aws_ebs_volume.go + - resource_aws_ec2_transit_gateway.go + - resource_aws_ecs_cluster.go + - resource_aws_ecs_service.go + - resource_aws_efs_file_system.go + - resource_aws_efs_mount_target.go + - resource_aws_elastic_beanstalk_application.go + - resource_aws_elasticache_cluster.go + - resource_aws_elasticache_parameter_group.go + - resource_aws_elasticache_replication_group.go + - resource_aws_elasticache_security_group.go + - resource_aws_elasticache_subnet_group.go + - resource_aws_elasticsearch_domain.go + - resource_aws_elasticsearch_domain_policy.go + - resource_aws_elb.go + - resource_aws_elb_attachment.go + - resource_aws_gamelift_build.go + - resource_aws_gamelift_fleet.go + - resource_aws_glue_dev_endpoint.go + - resource_aws_iam_access_key.go + - resource_aws_iam_server_certificate.go + - resource_aws_inspector_assessment_target.go + - resource_aws_instance.go + - resource_aws_internet_gateway.go + - resource_aws_iot_thing_type.go + - resource_aws_kms_external_key.go + - resource_aws_kms_grant.go + - resource_aws_kms_key.go + - resource_aws_lakeformation_data_lake_settings.go + - resource_aws_lakeformation_permissions.go + - resource_aws_lambda_event_source_mapping.go + - resource_aws_lambda_function_event_invoke_config.go + - resource_aws_lambda_permission.go + - resource_aws_lb_listener.go + - resource_aws_lb_listener_rule.go + - resource_aws_lb_target_group_attachment.go + - resource_aws_media_package_channel.go + - resource_aws_media_store_container.go + - resource_aws_msk_cluster.go + - resource_aws_neptune_cluster.go + - resource_aws_neptune_parameter_group.go + - resource_aws_network_acl.go + - resource_aws_network_acl_rule.go + - resource_aws_opsworks_stack.go + - resource_aws_organizations_account.go + - resource_aws_organizations_organizational_unit.go + - resource_aws_organizations_policy.go + - resource_aws_organizations_policy_attachment.go + - resource_aws_qldb_ledger.go + - resource_aws_ram_resource_share_accepter.go + - resource_aws_rds_cluster.go + - resource_aws_rds_cluster_parameter_group.go + - resource_aws_redshift_cluster.go + - resource_aws_redshift_snapshot_copy_grant.go + - resource_aws_redshift_snapshot_schedule.go + - resource_aws_redshift_snapshot_schedule_association.go + - resource_aws_route_table.go + - resource_aws_route_table_association.go + - resource_aws_s3_bucket.go + - resource_aws_sagemaker_model.go + - resource_aws_sagemaker_notebook_instance.go + - resource_aws_security_group_rule.go + - resource_aws_sfn_state_machine.go + - resource_aws_sqs_queue.go + - resource_aws_storagegateway_cached_iscsi_volume.go + - resource_aws_storagegateway_stored_iscsi_volume.go + - resource_aws_transfer_server.go + - resource_aws_vpc.go + - resource_aws_vpc_dhcp_options.go + - resource_aws_vpc_peering_connection_options.go + - resource_aws_vpn_gateway.go + - resource_aws_wafregional_web_acl_association.go + - resource_aws_wafv2_ip_set.go + - resource_aws_wafv2_regex_pattern_set.go + - resource_aws_wafv2_rule_group.go + - resource_aws_wafv2_web_acl.go + - tls.go + - waf_token_handlers.go + - wafregional_token_handlers.go + ignored-functions: + # AWS Go SDK + - aws.Int64 + - request.ConstantWaiterDelay + - request.WithWaiterMaxAttempts + # Terraform Plugin SDK + - schema.DefaultTimeout + - validation.* run: timeout: 10m diff --git a/.hashibot.hcl b/.hashibot.hcl index 51c18acafa9d..d73a58cbd43c 100644 --- a/.hashibot.hcl +++ b/.hashibot.hcl @@ -138,6 +138,9 @@ behavior "regexp_issue_labeler_v2" "service_labels" { "service/athena" = [ "aws_athena_", ], + "service/auditmanager" = [ + "aws_auditmanager_", + ], "service/autoscaling" = [ "aws_autoscaling_", "aws_launch_configuration", @@ -740,6 +743,11 @@ behavior "pull_request_path_labeler" "service_labels" { "**/*_athena_*", "**/athena_*" ] + "service/auditmanager" = [ + "aws/internal/service/auditmanager/**/*", + "**/*_auditmanager_*", + "**/auditmanager_*" + ] "service/autoscaling" = [ "aws/internal/service/autoscaling/**/*", "**/*_autoscaling_*", diff --git a/.semgrep.yml b/.semgrep.yml index c16413504bc3..1e8f05ecde47 100644 --- a/.semgrep.yml +++ b/.semgrep.yml @@ -57,7 +57,16 @@ rules: - aws/cloudfront_distribution_configuration_structure.go - aws/data_source_aws_route_table.go - aws/opsworks_layers.go - - aws/resource* + - aws/resource_aws_d* + - aws/resource_aws_e* + - aws/resource_aws_g* + - aws/resource_aws_i* + - aws/resource_aws_k* + - aws/resource_aws_l* + - aws/resource_aws_mq_broker.go + - aws/resource_aws_o* + - aws/resource_aws_r* + - aws/resource_aws_s* - aws/structure.go - aws/waf_helpers.go - aws/internal/generators/ @@ -81,7 +90,18 @@ rules: - aws/data_source_aws_route* - aws/ecs_task_definition_equivalency.go - aws/opsworks_layers.go - - aws/resource* + - aws/resource_aws_d*.go + - aws/resource_aws_e*.go + - aws/resource_aws_g*.go + - aws/resource_aws_i*.go + - aws/resource_aws_k*.go + - aws/resource_aws_l*.go + - aws/resource_aws_main_route_table_association.go + - aws/resource_aws_n*.go + - aws/resource_aws_o*.go + - aws/resource_aws_r*.go + - aws/resource_aws_s*.go + - aws/resource*_test.go - aws/structure.go - aws/internal/generators/ - aws/internal/keyvaluetags/ @@ -115,6 +135,58 @@ rules: pattern: 'd.SetId(*$VALUE)' severity: WARNING + - id: aws-go-sdk-pointer-conversion-immediate-dereference + fix: $VALUE + languages: [go] + message: Using AWS Go SDK pointer conversion, e.g. aws.String(), with immediate dereferencing is extraneous + paths: + include: + - aws/ + patterns: + - pattern-either: + - pattern: '*aws.Bool($VALUE)' + - pattern: '*aws.Float64($VALUE)' + - pattern: '*aws.Int64($VALUE)' + - pattern: '*aws.String($VALUE)' + - pattern: '*aws.Time($VALUE)' + severity: WARNING + + - id: helper-acctest-RandInt-compiled + languages: [go] + message: Using `acctest.RandInt()` in constant or variable declaration will execute during compilation and not randomize, pass into string generating function instead + paths: + include: + - aws/ + patterns: + - pattern-either: + - pattern: const $CONST = fmt.Sprintf(..., <... acctest.RandInt() ...>, ...) + - pattern: var $VAR = fmt.Sprintf(..., <... acctest.RandInt() ...>, ...) + severity: WARNING + + - id: helper-acctest-RandString-compiled + languages: [go] + message: Using `acctest.RandString()` in constant or variable declaration will execute during compilation and not randomize, pass into string generating function instead + paths: + include: + - aws/ + patterns: + - pattern-either: + - pattern: const $CONST = fmt.Sprintf(..., <... acctest.RandString(...) ...>, ...) + - pattern: var $VAR = fmt.Sprintf(..., <... acctest.RandString(...) ...>, ...) + severity: WARNING + + - id: helper-acctest-RandomWithPrefix-compiled + languages: [go] + message: Using `acctest.RandomWithPrefix()` in constant or variable declaration will execute during compilation and not randomize, pass into string generating function instead + paths: + include: + - aws/ + patterns: + - pattern-either: + - pattern: const $CONST = fmt.Sprintf(..., <... acctest.RandomWithPrefix(...) ...>, ...) + - pattern: var $VAR = fmt.Sprintf(..., <... acctest.RandomWithPrefix(...) ...>, ...) + severity: WARNING + - id: helper-schema-Set-extraneous-NewSet-with-flattenStringList languages: [go] message: Prefer `flattenStringSet()` function for casting a list of string pointers to a set @@ -155,6 +227,44 @@ rules: - pattern: if $VALUE, $OK := d.GetOk($KEY); $OK && len($VALUE.(string)) > 0 { $BODY } severity: WARNING + - id: helper-schema-ResourceData-SetId-empty-without-IsNewResource-check + languages: [go] + message: Calling `d.SetId("")` should ensure `!d.IsNewResource()` is checked first + paths: + exclude: + - aws/resource_aws_api_gateway_*.go + - aws/resource_aws_apigatewayv2_*.go + - aws/resource_aws_app_cookie_stickiness_policy.go + - aws/resource_aws_appautoscaling_*.go + - aws/resource_aws_appmesh_*.go + - aws/resource_aws_appsync_*.go + - aws/resource_aws_athena_*.go + - aws/resource_aws_autoscaling_*.go + - aws/resource_aws_autoscalingplans_scaling_plan.go + - aws/resource_aws_[b-g]*.go + - aws/resource_aws_i*.go + - aws/resource_aws_[k-t]*.go + - aws/resource_aws_[v-x]*.go + include: + - aws/resource*.go + patterns: + - pattern-either: + - pattern: | + d.SetId("") + ... + return nil + - pattern-not-inside: | + if ... { + if <... d.IsNewResource() ...> { ... } + ... + d.SetId("") + ... + return nil + } + - pattern-not-inside: | + if <... d.IsNewResource() ...> { ... } + severity: WARNING + - id: helper-schema-resource-Retry-without-TimeoutError-check languages: [go] message: Check resource.Retry() errors with tfresource.TimedOut() diff --git a/CHANGELOG.md b/CHANGELOG.md index b12907113e61..63e682b5949b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,108 @@ +## 3.35.0 (Unreleased) + +ENHANCEMENTS: + +* data-source/aws_iam_policy: Add `policy_id` and `tags` attributes ([#18276](https://github.com/hashicorp/terraform-provider-aws/issues/18276)) +* resource/aws_efs_file_system: Add `number_of_mount_targets`, `size_in_bytes` and `owner_id` attributes ([#17969](https://github.com/hashicorp/terraform-provider-aws/issues/17969)) +* resource/aws_iam_policy: Add `policy_id` attribute ([#18276](https://github.com/hashicorp/terraform-provider-aws/issues/18276)) +* resource/aws_iam_policy: Add tagging support ([#18276](https://github.com/hashicorp/terraform-provider-aws/issues/18276)) +* resource/aws_ssm_parameter: Add plan time validation to `name`, `description` and `allowed_pattern` ([#17830](https://github.com/hashicorp/terraform-provider-aws/issues/17830)) +* resource/aws_ssm_parameter: Tag on create ([#17830](https://github.com/hashicorp/terraform-provider-aws/issues/17830)) + +BUG FIXES: + +* resource/aws_securityhub_organization_admin_account: Retry on `ResourceConflictException` error during creation ([#18341](https://github.com/hashicorp/terraform-provider-aws/issues/18341)) +* resource/aws_synthetics_canary: Handle asynchronous IAM eventual consistency error on creation ([#18404](https://github.com/hashicorp/terraform-provider-aws/issues/18404)) + +## 3.34.0 (March 26, 2021) + +NOTES: + +* resource/aws_storagegateway_upload_buffer: The Storage Gateway `ListLocalDisks` API operation has been implemented to support the `disk_path` attribute for Cached and VTL gateway types. Environments using restrictive IAM permissions may require updates. ([#18313](https://github.com/hashicorp/terraform-provider-aws/issues/18313)) + +FEATURES: + +* **New Data Source:** `aws_codestarconnections_connection` ([#18129](https://github.com/hashicorp/terraform-provider-aws/issues/18129)) +* **New Resource:** `aws_lightsail_instance_public_ports` ([#8611](https://github.com/hashicorp/terraform-provider-aws/issues/8611)) + +ENHANCEMENTS: + +* resource/aws_ami_from_instance: Tag on create. ([#17968](https://github.com/hashicorp/terraform-provider-aws/issues/17968)) +* resource/aws_ecr_repository_policy: Add plan time validation for `policy` ([#14193](https://github.com/hashicorp/terraform-provider-aws/issues/14193)) +* resource/aws_fms_admin_account: Extend creation timeout to 10 minutes ([#17596](https://github.com/hashicorp/terraform-provider-aws/issues/17596)) +* resource/aws_iam_instance_profile: Add tagging support ([#17962](https://github.com/hashicorp/terraform-provider-aws/issues/17962)) +* resource/aws_iam_openid_connect_provider: Add plan time validation for `client_id_list` and `thumbprint_list` ([#17964](https://github.com/hashicorp/terraform-provider-aws/issues/17964)) +* resource/aws_iam_openid_connect_provider: Add tagging support ([#17964](https://github.com/hashicorp/terraform-provider-aws/issues/17964)) +* resource/aws_iam_saml_provider: Add plan time validation for `name` and `saml_metadata_document` ([#17965](https://github.com/hashicorp/terraform-provider-aws/issues/17965)) +* resource/aws_iam_saml_provider: Add tagging support ([#17965](https://github.com/hashicorp/terraform-provider-aws/issues/17965)) +* resource/aws_iam_server_certificate: Add `expiration` and `upload_date` attributes ([#17967](https://github.com/hashicorp/terraform-provider-aws/issues/17967)) +* resource/aws_iam_server_certificate: Add tagging support ([#17967](https://github.com/hashicorp/terraform-provider-aws/issues/17967)) +* resource/aws_light_instance_public_ports: Add `cidrs` argument to `port_info` ([#14905](https://github.com/hashicorp/terraform-provider-aws/issues/14905)) +* resource/aws_pinpoint_email_channel: Add `configuration_set` argument ([#18314](https://github.com/hashicorp/terraform-provider-aws/issues/18314)) +* resource/aws_pinpoint_email_channel: Add plan time validation for `identity` and `role_arn` ([#18314](https://github.com/hashicorp/terraform-provider-aws/issues/18314)) +* resource/aws_pinpoint_event_stream: Plan time validations for `destination_stream_arn` and `role_arn` ([#18305](https://github.com/hashicorp/terraform-provider-aws/issues/18305)) +* resource/aws_route: Validate route destination and target attributes ([#16930](https://github.com/hashicorp/terraform-provider-aws/issues/16930)) +* resource/aws_sns_topic_subscription: Add plan time validation for `subscription_role_arn` and `topic_arn` ([#14101](https://github.com/hashicorp/terraform-provider-aws/issues/14101)) +* resource/aws_storagegateway_upload_buffer: Add `disk_path` argument for Cached and VTL gateways ([#18313](https://github.com/hashicorp/terraform-provider-aws/issues/18313)) + +BUG FIXES: + +* data-source/aws_storagegateway_local_disk: Allow `disk_path` reference on `disk_node` lookup and vice-versa ([#18313](https://github.com/hashicorp/terraform-provider-aws/issues/18313)) +* resource/aws_api_gateway_vpc_link: Persist ID of failed VPC Link to state ([#18382](https://github.com/hashicorp/terraform-provider-aws/issues/18382)) +* resource/aws_apigatewayv2_domain_name: Allow update of mutual TLS S3 object version ([#18351](https://github.com/hashicorp/terraform-provider-aws/issues/18351)) +* resource/aws_cloudfront_distribution: Allow `forwarded_values` to be set to empty when values were previously set ([#18042](https://github.com/hashicorp/terraform-provider-aws/issues/18042)) +* resource/aws_cloudwatch_event_permission: Fix error in Event Bridge/CloudWatch Events bus name validation ([#16815](https://github.com/hashicorp/terraform-provider-aws/issues/16815)) +* resource/aws_cloudwatch_event_rule: Fix error in Event Bridge/CloudWatch Events bus name validation ([#16815](https://github.com/hashicorp/terraform-provider-aws/issues/16815)) +* resource/aws_cloudwatch_event_target: Fix error in Event Bridge/CloudWatch Events bus name validation ([#16815](https://github.com/hashicorp/terraform-provider-aws/issues/16815)) +* resource/aws_config_configuration_aggregator: Allow name to have uppercase characters ([#14247](https://github.com/hashicorp/terraform-provider-aws/issues/14247)) +* resource/aws_ecs_service: Re-create service when `service_registries` changes ([#17387](https://github.com/hashicorp/terraform-provider-aws/issues/17387)) +* resource/aws_elasticache_replication_group: Prevents re-creation of secondary replication groups when encryption is enabled ([#18361](https://github.com/hashicorp/terraform-provider-aws/issues/18361)) +* resource/aws_mq_configuration: Add `ldap` as an `authentication_strategy` and `RabbitMQ` as an `engine_type` ([#18070](https://github.com/hashicorp/terraform-provider-aws/issues/18070)) +* resource/aws_network_acl: Handle EC2 eventual consistency errors on creation ([#18388](https://github.com/hashicorp/terraform-provider-aws/issues/18388)) +* resource/aws_network_acl_rule: Handle EC2 eventual consistency errors on creation ([#18388](https://github.com/hashicorp/terraform-provider-aws/issues/18388)) +* resource/aws_pinpoint_event_stream: Retry on eventual consistency error ([#18305](https://github.com/hashicorp/terraform-provider-aws/issues/18305)) +* resource/aws_pinpoint_sms_channel: Set all params on update ([#18281](https://github.com/hashicorp/terraform-provider-aws/issues/18281)) +* resource/aws_route: Correctly handle updates to the route target attributes (`egress_only_gateway_id`, `gateway_id`, `instance_id`, `local_gateway_id`, `nat_gateway_id`, `network_interface_id`, `transit_gateway_id`, `vpc_peering_connection_id`) ([#16930](https://github.com/hashicorp/terraform-provider-aws/issues/16930)) +* resource/aws_sns_topic_subscription: recreate subscription if topic is deleted ([#14101](https://github.com/hashicorp/terraform-provider-aws/issues/14101)) +* resource/aws_subnet: Handle EC2 eventual consistency errors on creation ([#18392](https://github.com/hashicorp/terraform-provider-aws/issues/18392)) +* resource/aws_vpc: Handle EC2 eventual consistency errors on creation ([#18391](https://github.com/hashicorp/terraform-provider-aws/issues/18391)) +* resource/aws_wafv2_web_acl_logging_configuration: Remove deprecation warning for `redacted_fields` `single_header` argument ([#18384](https://github.com/hashicorp/terraform-provider-aws/issues/18384)) + +## 3.33.0 (March 18, 2021) + +NOTES: + +* data-source/aws_vpc_endpoint_service: The `service_type` argument filtering has been switched from client-side to new EC2 API functionality ([#17641](https://github.com/hashicorp/terraform-provider-aws/issues/17641)) +* provider: New `default_tags` argument as a public preview for applying tags across all resources under a provider. Support for the functionality must be added to individual resources in the codebase and is only implemented for the `aws_subnet` and `aws_vpc` resources at this time. Until a general availability announcement, no compatibility promises are made with these provider arguments and their functionality. ([#17974](https://github.com/hashicorp/terraform-provider-aws/issues/17974)) +* resource/aws_codebuild_project: The `source` and `secondary_sources` configuration block `auth` attributes have been deprecated to match the CodeBuild API documentation. Use the `aws_codebuild_source_credential` resource instead. ([#17465](https://github.com/hashicorp/terraform-provider-aws/issues/17465)) +* resource/aws_wafv2_web_acl_logging_configuration: The `redacted_fields` configuration block `all_query_arguments`, `body`, and `single_query_argument` arguments have been deprecated to match the WAF API documentation ([#14319](https://github.com/hashicorp/terraform-provider-aws/issues/14319)) + +FEATURES: + +* **New Data Source:** `aws_ec2_transit_gateway_route_tables` ([#17589](https://github.com/hashicorp/terraform-provider-aws/issues/17589)) +* **New Data Source:** `aws_kinesis_stream_consumer` ([#17149](https://github.com/hashicorp/terraform-provider-aws/issues/17149)) +* **New Resource:** `aws_kinesis_stream_consumer` ([#17149](https://github.com/hashicorp/terraform-provider-aws/issues/17149)) + +ENHANCEMENTS: + +* provider: Add `default_tags` argument (in public preview, see note above) ([#17974](https://github.com/hashicorp/terraform-provider-aws/issues/17974)) +* resource/aws_db_parameter_group: Store all values in lowercase to prevent unexpected diffs ([#17909](https://github.com/hashicorp/terraform-provider-aws/issues/17909)) +* resource/aws_ssm_parameter: Add support for `Intelligent-Tiering` ([#11967](https://github.com/hashicorp/terraform-provider-aws/issues/11967)) +* resource/aws_storagegateway_gateway: Add support for `smb_file_share_visibility`. ([#18076](https://github.com/hashicorp/terraform-provider-aws/issues/18076)) +* resource/aws_subnet: Support provider-wide default tags (in public preview, see note above) ([#17974](https://github.com/hashicorp/terraform-provider-aws/issues/17974)) +* resource/aws_vpc: Support provider-wide default tags (in public preview, see note above) ([#17974](https://github.com/hashicorp/terraform-provider-aws/issues/17974)) + +BUG FIXES: + +* data-source/aws_vpc_endpoint_service: Prevent panic with incorrect `service_type` argument values ([#17641](https://github.com/hashicorp/terraform-provider-aws/issues/17641)) +* resource/aws_dms_certificate: Correctly base64 decode `certificate_wallet` value ([#17958](https://github.com/hashicorp/terraform-provider-aws/issues/17958)) +* resource/aws_globalaccelerator_accelerator: Correct length for `name` attribute validation ([#17985](https://github.com/hashicorp/terraform-provider-aws/issues/17985)) +* resource/aws_lakeformation_permissions: Properly serialize SELECT permission for `permissions` and `permissions_with_grant_option` fields ([#18203](https://github.com/hashicorp/terraform-provider-aws/issues/18203)) +* resource/aws_ssm_patch_group: Allow for a single patch group to be registered with multiple patch baselines ([#15213](https://github.com/hashicorp/terraform-provider-aws/issues/15213)) +* resource/aws_ssm_patch_group: Replace `Provider produced inconsistent result after apply` with actual error message ([#15213](https://github.com/hashicorp/terraform-provider-aws/issues/15213)) +* resource/aws_waf_rule: Fix rule deletion when still referenced by a WebACL ([#17876](https://github.com/hashicorp/terraform-provider-aws/issues/17876)) +* resource/aws_wafv2_web_acl_logging_configuration: Ensure `redacted_fields` are applied to the resource ([#14319](https://github.com/hashicorp/terraform-provider-aws/issues/14319)) + ## 3.32.0 (March 12, 2021) FEATURES: diff --git a/GNUmakefile b/GNUmakefile index 61a0304aa752..2970b2890cf4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -93,12 +93,18 @@ awsproviderlint: -c 1 \ -AWSAT006=false \ -AWSV001=false \ + -AT010=false \ + -AT012=false \ -R001=false \ -R010=false \ -R018=false \ -R019=false \ -V001=false \ -V009=false \ + -V011=false \ + -V012=false \ + -V013=false \ + -V014=false \ -XR001=false \ -XR002=false \ -XR003=false \ @@ -154,4 +160,8 @@ website-lint-fix: @docker run -v $(PWD):/markdown 06kellyjac/markdownlint-cli --fix website/docs/ @terrafmt fmt ./website --pattern '*.markdown' -.PHONY: awsproviderlint build gen generate-changelog golangci-lint sweep test testacc fmt fmtcheck lint tools test-compile website-link-check website-lint website-lint-fix depscheck docscheck +semgrep: + @echo "==> Running Semgrep static analysis..." + @docker run --rm --volume "${PWD}:/src" returntocorp/semgrep --config .semgrep.yml + +.PHONY: awsproviderlint build gen generate-changelog golangci-lint sweep test testacc fmt fmtcheck lint tools test-compile website-link-check website-lint website-lint-fix depscheck docscheck semgrep diff --git a/aws/config.go b/aws/config.go index 0493b8d71a08..aafe9fbe8912 100644 --- a/aws/config.go +++ b/aws/config.go @@ -20,6 +20,7 @@ import ( "github.com/aws/aws-sdk-go/service/appstream" "github.com/aws/aws-sdk-go/service/appsync" "github.com/aws/aws-sdk-go/service/athena" + "github.com/aws/aws-sdk-go/service/auditmanager" "github.com/aws/aws-sdk-go/service/autoscaling" "github.com/aws/aws-sdk-go/service/autoscalingplans" "github.com/aws/aws-sdk-go/service/backup" @@ -191,9 +192,10 @@ type Config struct { AllowedAccountIds []string ForbiddenAccountIds []string - Endpoints map[string]string - IgnoreTagsConfig *keyvaluetags.IgnoreConfig - Insecure bool + DefaultTagsConfig *keyvaluetags.DefaultConfig + Endpoints map[string]string + IgnoreTagsConfig *keyvaluetags.IgnoreConfig + Insecure bool SkipCredsValidation bool SkipGetEC2Platforms bool @@ -219,6 +221,7 @@ type AWSClient struct { appstreamconn *appstream.AppStream appsyncconn *appsync.AppSync athenaconn *athena.Athena + auditmanagerconn *auditmanager.AuditManager autoscalingconn *autoscaling.AutoScaling autoscalingplansconn *autoscalingplans.AutoScalingPlans backupconn *backup.Backup @@ -249,6 +252,7 @@ type AWSClient struct { datapipelineconn *datapipeline.DataPipeline datasyncconn *datasync.DataSync daxconn *dax.DAX + DefaultTagsConfig *keyvaluetags.DefaultConfig devicefarmconn *devicefarm.DeviceFarm dlmconn *dlm.DLM dmsconn *databasemigrationservice.DatabaseMigrationService @@ -462,6 +466,7 @@ func (c *Config) Client() (interface{}, error) { appstreamconn: appstream.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["appstream"])})), appsyncconn: appsync.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["appsync"])})), athenaconn: athena.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["athena"])})), + auditmanagerconn: auditmanager.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["auditmanager"])})), autoscalingconn: autoscaling.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["autoscaling"])})), autoscalingplansconn: autoscalingplans.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["autoscalingplans"])})), backupconn: backup.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["backup"])})), @@ -492,6 +497,7 @@ func (c *Config) Client() (interface{}, error) { datapipelineconn: datapipeline.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["datapipeline"])})), datasyncconn: datasync.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["datasync"])})), daxconn: dax.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["dax"])})), + DefaultTagsConfig: c.DefaultTagsConfig, devicefarmconn: devicefarm.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["devicefarm"])})), dlmconn: dlm.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["dlm"])})), dmsconn: databasemigrationservice.New(sess.Copy(&aws.Config{Endpoint: aws.String(c.Endpoints["dms"])})), @@ -765,6 +771,16 @@ func (c *Config) Client() (interface{}, error) { } }) + // Reference: https://github.com/hashicorp/terraform-provider-aws/issues/17996 + client.securityhubconn.Handlers.Retry.PushBack(func(r *request.Request) { + switch r.Operation.Name { + case "EnableOrganizationAdminAccount": + if tfawserr.ErrCodeEquals(r.Error, securityhub.ErrCodeResourceConflictException) { + r.Retryable = aws.Bool(true) + } + } + }) + client.storagegatewayconn.Handlers.Retry.PushBack(func(r *request.Request) { // InvalidGatewayRequestException: The specified gateway proxy network connection is busy. if isAWSErr(r.Error, storagegateway.ErrCodeInvalidGatewayRequestException, "The specified gateway proxy network connection is busy") { diff --git a/aws/core_acceptance_test.go b/aws/core_acceptance_test.go index cdf212a86acc..3fdfa0f6a1e1 100644 --- a/aws/core_acceptance_test.go +++ b/aws/core_acceptance_test.go @@ -12,6 +12,7 @@ func TestAccAWSVpc_coreMismatchedDiffs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_acm_certificate_test.go b/aws/data_source_aws_acm_certificate_test.go index c9ebf50697c8..b4a7134c8181 100644 --- a/aws/data_source_aws_acm_certificate_test.go +++ b/aws/data_source_aws_acm_certificate_test.go @@ -36,8 +36,9 @@ func TestAccAWSAcmCertificateDataSource_singleIssued(t *testing.T) { resourceName := "data.aws_acm_certificate.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAcmCertificateDataSourceConfig(domain), @@ -108,8 +109,9 @@ func TestAccAWSAcmCertificateDataSource_multipleIssued(t *testing.T) { resourceName := "data.aws_acm_certificate.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAcmCertificateDataSourceConfig(domain), @@ -156,8 +158,9 @@ func TestAccAWSAcmCertificateDataSource_noMatchReturnsError(t *testing.T) { domain := fmt.Sprintf("tf-acc-nonexistent.%s", os.Getenv("ACM_CERTIFICATE_ROOT_DOMAIN")) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAcmCertificateDataSourceConfig(domain), @@ -195,8 +198,9 @@ func TestAccAWSAcmCertificateDataSource_KeyTypes(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAwsAcmCertificateDataSourceConfigKeyTypes(tlsPemEscapeNewlines(certificate), tlsPemEscapeNewlines(key), rName), diff --git a/aws/data_source_aws_acmpca_certificate_authority_test.go b/aws/data_source_aws_acmpca_certificate_authority_test.go index 617146b4d9d7..f57803c9c891 100644 --- a/aws/data_source_aws_acmpca_certificate_authority_test.go +++ b/aws/data_source_aws_acmpca_certificate_authority_test.go @@ -4,6 +4,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/acmpca" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,8 +13,9 @@ func TestAccDataSourceAwsAcmpcaCertificateAuthority_basic(t *testing.T) { datasourceName := "data.aws_acmpca_certificate_authority.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsAcmpcaCertificateAuthorityConfig_NonExistent, diff --git a/aws/data_source_aws_acmpca_certificate_test.go b/aws/data_source_aws_acmpca_certificate_test.go index e910995ddf3d..91f29a069a59 100644 --- a/aws/data_source_aws_acmpca_certificate_test.go +++ b/aws/data_source_aws_acmpca_certificate_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/acmpca" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAwsAcmpcaCertificate_Basic(t *testing.T) { dataSourceName := "data.aws_acmpca_certificate.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsAcmpcaCertificateConfig_NonExistent, diff --git a/aws/data_source_aws_ami_ids_test.go b/aws/data_source_aws_ami_ids_test.go index e2c6ba4689af..ae29537a228e 100644 --- a/aws/data_source_aws_ami_ids_test.go +++ b/aws/data_source_aws_ami_ids_test.go @@ -4,13 +4,15 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceAwsAmiIds_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsAmiIdsConfig_basic, @@ -24,8 +26,9 @@ func TestAccDataSourceAwsAmiIds_basic(t *testing.T) { func TestAccDataSourceAwsAmiIds_sorted(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsAmiIdsConfig_sorted(false), diff --git a/aws/data_source_aws_ami_test.go b/aws/data_source_aws_ami_test.go index e78b351d0bd8..8bb59cb297de 100644 --- a/aws/data_source_aws_ami_test.go +++ b/aws/data_source_aws_ami_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -13,8 +14,9 @@ import ( func TestAccAWSAmiDataSource_natInstance(t *testing.T) { resourceName := "data.aws_ami.nat_ami" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAmiDataSourceConfig, @@ -63,8 +65,9 @@ func TestAccAWSAmiDataSource_natInstance(t *testing.T) { func TestAccAWSAmiDataSource_windowsInstance(t *testing.T) { resourceName := "data.aws_ami.windows_ami" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAmiDataSourceWindowsConfig, @@ -106,8 +109,9 @@ func TestAccAWSAmiDataSource_windowsInstance(t *testing.T) { func TestAccAWSAmiDataSource_instanceStore(t *testing.T) { resourceName := "data.aws_ami.amzn-ami-minimal-hvm-instance-store" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccLatestAmazonLinuxHvmInstanceStoreAmiConfig(), @@ -144,8 +148,9 @@ func TestAccAWSAmiDataSource_instanceStore(t *testing.T) { func TestAccAWSAmiDataSource_localNameFilter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAmiDataSourceNameRegexConfig, @@ -164,8 +169,9 @@ func TestAccAWSAmiDataSource_Gp3BlockDevice(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAmiDataSourceConfigGp3BlockDevice(rName), diff --git a/aws/data_source_aws_api_gateway_api_key_test.go b/aws/data_source_aws_api_gateway_api_key_test.go index fc7b2374311d..0777ea585874 100644 --- a/aws/data_source_aws_api_gateway_api_key_test.go +++ b/aws/data_source_aws_api_gateway_api_key_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/apigateway" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAwsApiGatewayApiKey_basic(t *testing.T) { dataSourceName1 := "data.aws_api_gateway_api_key.test_key" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsApiGatewayApiKeyConfig(rName), diff --git a/aws/data_source_aws_api_gateway_domain_name_test.go b/aws/data_source_aws_api_gateway_domain_name_test.go index 830b69f9b6e0..a415f2becc0b 100644 --- a/aws/data_source_aws_api_gateway_domain_name_test.go +++ b/aws/data_source_aws_api_gateway_domain_name_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/apigateway" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -18,6 +19,7 @@ func TestAccDataSourceAwsApiGatewayDomainName_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDomainNameDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_api_gateway_resource_test.go b/aws/data_source_aws_api_gateway_resource_test.go index 147bb02e319f..f7c4aaf3f404 100644 --- a/aws/data_source_aws_api_gateway_resource_test.go +++ b/aws/data_source_aws_api_gateway_resource_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/apigateway" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -16,8 +17,9 @@ func TestAccDataSourceAwsApiGatewayResource_basic(t *testing.T) { dataSourceName2 := "data.aws_api_gateway_resource.example_v1_endpoint" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsApiGatewayResourceConfig(rName), diff --git a/aws/data_source_aws_api_gateway_rest_api_test.go b/aws/data_source_aws_api_gateway_rest_api_test.go index 3489e700e5da..a7e70231020a 100644 --- a/aws/data_source_aws_api_gateway_rest_api_test.go +++ b/aws/data_source_aws_api_gateway_rest_api_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/apigateway" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,8 +13,9 @@ func TestAccDataSourceAwsApiGatewayRestApi_basic(t *testing.T) { dataSourceName := "data.aws_api_gateway_rest_api.test" resourceName := "aws_api_gateway_rest_api.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: composeConfig( @@ -43,8 +45,9 @@ func TestAccDataSourceAwsApiGatewayRestApi_EndpointConfiguration_VpcEndpointIds( dataSourceName := "data.aws_api_gateway_rest_api.test" resourceName := "aws_api_gateway_rest_api.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: composeConfig( diff --git a/aws/data_source_aws_api_gateway_vpc_link_test.go b/aws/data_source_aws_api_gateway_vpc_link_test.go index 7c66203e32f7..dc726221e620 100644 --- a/aws/data_source_aws_api_gateway_vpc_link_test.go +++ b/aws/data_source_aws_api_gateway_vpc_link_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/apigateway" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccDataSourceAwsApiGatewayVpcLink_basic(t *testing.T) { resourceName := "aws_api_gateway_vpc_link.vpc_link" dataSourceName := "data.aws_api_gateway_vpc_link.vpc_link" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsApiGatewayVpcLinkConfig(rName), diff --git a/aws/data_source_aws_apigatewayv2_api_test.go b/aws/data_source_aws_apigatewayv2_api_test.go index f61c0f3bfa3d..fddaab546275 100644 --- a/aws/data_source_aws_apigatewayv2_api_test.go +++ b/aws/data_source_aws_apigatewayv2_api_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/apigatewayv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,6 +16,7 @@ func TestAccAWSAPIGatewayV2ApiDataSource_Http(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -54,6 +56,7 @@ func TestAccAWSAPIGatewayV2ApiDataSource_WebSocket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_apigatewayv2_apis_test.go b/aws/data_source_aws_apigatewayv2_apis_test.go index 8bbe938df4b1..9e8a1f554b42 100644 --- a/aws/data_source_aws_apigatewayv2_apis_test.go +++ b/aws/data_source_aws_apigatewayv2_apis_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/apigatewayv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -16,6 +17,7 @@ func TestAccAWSAPIGatewayV2ApisDataSource_Name(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -38,6 +40,7 @@ func TestAccAWSAPIGatewayV2ApisDataSource_ProtocolType(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -61,6 +64,7 @@ func TestAccAWSAPIGatewayV2ApisDataSource_Tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_arn_test.go b/aws/data_source_aws_arn_test.go index 01b366802c8c..21870dc4efa6 100644 --- a/aws/data_source_aws_arn_test.go +++ b/aws/data_source_aws_arn_test.go @@ -22,8 +22,9 @@ func TestAccDataSourceAwsArn_basic(t *testing.T) { } resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsArnConfig(testARN.String()), diff --git a/aws/data_source_aws_autoscaling_group_test.go b/aws/data_source_aws_autoscaling_group_test.go index 8378e7754b28..77c8fb57a0f3 100644 --- a/aws/data_source_aws_autoscaling_group_test.go +++ b/aws/data_source_aws_autoscaling_group_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/autoscaling" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccAwsAutoScalingGroupDataSource_basic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAutoScalingGroupDataResourceConfig(rName), @@ -46,8 +48,9 @@ func TestAccAwsAutoScalingGroupDataSource_launchTemplate(t *testing.T) { resourceName := "aws_autoscaling_group.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAutoScalingGroupDataResourceConfig_launchTemplate(), diff --git a/aws/data_source_aws_autoscaling_groups_test.go b/aws/data_source_aws_autoscaling_groups_test.go index 7059048cb154..b022e8435a26 100644 --- a/aws/data_source_aws_autoscaling_groups_test.go +++ b/aws/data_source_aws_autoscaling_groups_test.go @@ -7,6 +7,7 @@ import ( "strconv" "testing" + "github.com/aws/aws-sdk-go/service/autoscaling" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -14,8 +15,9 @@ import ( func TestAccAWSAutoscalingGroups_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAutoscalingGroupsConfig(acctest.RandInt(), acctest.RandInt(), acctest.RandInt()), diff --git a/aws/data_source_aws_availability_zone_test.go b/aws/data_source_aws_availability_zone_test.go index 9f0f28f8f440..99db4bf475c4 100644 --- a/aws/data_source_aws_availability_zone_test.go +++ b/aws/data_source_aws_availability_zone_test.go @@ -14,8 +14,9 @@ func TestAccDataSourceAwsAvailabilityZone_AllAvailabilityZones(t *testing.T) { dataSourceName := "data.aws_availability_zone.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsAvailabilityZoneConfigAllAvailabilityZones(), @@ -41,8 +42,9 @@ func TestAccDataSourceAwsAvailabilityZone_Filter(t *testing.T) { dataSourceName := "data.aws_availability_zone.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsAvailabilityZoneConfigFilter(), @@ -68,8 +70,9 @@ func TestAccDataSourceAwsAvailabilityZone_LocalZone(t *testing.T) { dataSourceName := "data.aws_availability_zone.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLocalZoneAvailable(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLocalZoneAvailable(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsAvailabilityZoneConfigZoneType("local-zone"), @@ -95,8 +98,9 @@ func TestAccDataSourceAwsAvailabilityZone_Name(t *testing.T) { dataSourceName := "data.aws_availability_zone.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsAvailabilityZoneConfigName(), @@ -122,8 +126,9 @@ func TestAccDataSourceAwsAvailabilityZone_WavelengthZone(t *testing.T) { dataSourceName := "data.aws_availability_zone.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWavelengthZoneAvailable(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWavelengthZoneAvailable(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsAvailabilityZoneConfigZoneType("wavelength-zone"), @@ -149,8 +154,9 @@ func TestAccDataSourceAwsAvailabilityZone_ZoneId(t *testing.T) { dataSourceName := "data.aws_availability_zone.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsAvailabilityZoneConfigZoneId(), diff --git a/aws/data_source_aws_availability_zones_test.go b/aws/data_source_aws_availability_zones_test.go index 28ed3881ad12..c9e77a232d95 100644 --- a/aws/data_source_aws_availability_zones_test.go +++ b/aws/data_source_aws_availability_zones_test.go @@ -75,8 +75,9 @@ func TestAvailabilityZonesSort(t *testing.T) { func TestAccAWSAvailabilityZones_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAvailabilityZonesConfig, @@ -92,8 +93,9 @@ func TestAccAWSAvailabilityZones_AllAvailabilityZones(t *testing.T) { dataSourceName := "data.aws_availability_zones.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAvailabilityZonesConfigAllAvailabilityZones(), @@ -109,8 +111,9 @@ func TestAccAWSAvailabilityZones_Filter(t *testing.T) { dataSourceName := "data.aws_availability_zones.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAvailabilityZonesConfigFilter(), @@ -127,8 +130,9 @@ func TestAccAWSAvailabilityZones_ExcludeNames(t *testing.T) { excludeDataSourceName := "data.aws_availability_zones.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAvailabilityZonesConfigExcludeNames(), @@ -145,8 +149,9 @@ func TestAccAWSAvailabilityZones_ExcludeZoneIds(t *testing.T) { excludeDataSourceName := "data.aws_availability_zones.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAvailabilityZonesConfigExcludeZoneIds(), @@ -160,8 +165,9 @@ func TestAccAWSAvailabilityZones_ExcludeZoneIds(t *testing.T) { func TestAccAWSAvailabilityZones_stateFilter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsAvailabilityZonesStateConfig, diff --git a/aws/data_source_aws_backup_plan_test.go b/aws/data_source_aws_backup_plan_test.go index 51c501e3beb8..767778cb4694 100644 --- a/aws/data_source_aws_backup_plan_test.go +++ b/aws/data_source_aws_backup_plan_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/backup" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccAWSBackupPlanDataSource_basic(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAwsBackupPlanDataSourceConfig_nonExistent, diff --git a/aws/data_source_aws_backup_selection_test.go b/aws/data_source_aws_backup_selection_test.go index 9a6adf168764..ec2c1b87bb22 100644 --- a/aws/data_source_aws_backup_selection_test.go +++ b/aws/data_source_aws_backup_selection_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/backup" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccAWSBackupSelectionDataSource_basic(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAwsBackupSelectionDataSourceConfig_nonExistent, diff --git a/aws/data_source_aws_backup_vault_test.go b/aws/data_source_aws_backup_vault_test.go index 674bb0ef0166..cfc70f6b7aed 100644 --- a/aws/data_source_aws_backup_vault_test.go +++ b/aws/data_source_aws_backup_vault_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/backup" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccAWSBackupVaultDataSource_basic(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAwsBackupVaultDataSourceConfig_nonExistent, diff --git a/aws/data_source_aws_batch_compute_environment_test.go b/aws/data_source_aws_batch_compute_environment_test.go index 29ada47ad3af..cf87cf289a7f 100644 --- a/aws/data_source_aws_batch_compute_environment_test.go +++ b/aws/data_source_aws_batch_compute_environment_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/batch" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAwsBatchComputeEnvironment_basic(t *testing.T) { datasourceName := "data.aws_batch_compute_environment.by_name" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsBatchComputeEnvironmentConfig(rName), diff --git a/aws/data_source_aws_batch_job_queue_test.go b/aws/data_source_aws_batch_job_queue_test.go index ffdf63bddf99..ee1744933d1d 100644 --- a/aws/data_source_aws_batch_job_queue_test.go +++ b/aws/data_source_aws_batch_job_queue_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/batch" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAwsBatchJobQueue_basic(t *testing.T) { datasourceName := "data.aws_batch_job_queue.by_name" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsBatchJobQueueConfig(rName), diff --git a/aws/data_source_aws_billing_service_account_test.go b/aws/data_source_aws_billing_service_account_test.go index 189d109b749e..d9a42a647d18 100644 --- a/aws/data_source_aws_billing_service_account_test.go +++ b/aws/data_source_aws_billing_service_account_test.go @@ -12,8 +12,9 @@ func TestAccAWSBillingServiceAccount_basic(t *testing.T) { billingAccountID := "386209384616" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsBillingServiceAccountConfig, diff --git a/aws/data_source_aws_caller_identity_test.go b/aws/data_source_aws_caller_identity_test.go index 12857aa20353..e73435d0ba1a 100644 --- a/aws/data_source_aws_caller_identity_test.go +++ b/aws/data_source_aws_caller_identity_test.go @@ -4,14 +4,16 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/sts" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccAWSCallerIdentity_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sts.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsCallerIdentityConfig_basic, diff --git a/aws/data_source_aws_canonical_user_id_test.go b/aws/data_source_aws_canonical_user_id_test.go index 4f482b0aa10b..27d57b02a5b3 100644 --- a/aws/data_source_aws_canonical_user_id_test.go +++ b/aws/data_source_aws_canonical_user_id_test.go @@ -4,14 +4,16 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/s3" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccDataSourceAwsCanonicalUserId_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsCanonicalUserIdConfig, diff --git a/aws/data_source_aws_cloudformation_export_test.go b/aws/data_source_aws_cloudformation_export_test.go index c5844f89e3e9..92573f4550dd 100644 --- a/aws/data_source_aws_cloudformation_export_test.go +++ b/aws/data_source_aws_cloudformation_export_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccAWSCloudformationExportDataSource_basic(t *testing.T) { dataSourceName := "data.aws_cloudformation_export.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsCloudformationExportConfigStaticValue(rName), @@ -33,8 +35,9 @@ func TestAccAWSCloudformationExportDataSource_ResourceReference(t *testing.T) { resourceName := "aws_cloudformation_stack.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsCloudformationExportConfigResourceReference(rName), diff --git a/aws/data_source_aws_cloudformation_stack_test.go b/aws/data_source_aws_cloudformation_stack_test.go index 843b6903c446..447065ec1f2e 100644 --- a/aws/data_source_aws_cloudformation_stack_test.go +++ b/aws/data_source_aws_cloudformation_stack_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/cloudformation" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccAWSCloudFormationStack_dataSource_basic(t *testing.T) { resourceName := "data.aws_cloudformation_stack.network" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsCloudFormationStackDataSourceConfig_basic(stackName), @@ -99,8 +101,9 @@ func TestAccAWSCloudFormationStack_dataSource_yaml(t *testing.T) { resourceName := "data.aws_cloudformation_stack.yaml" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsCloudFormationStackDataSourceConfig_yaml(stackName), diff --git a/aws/data_source_aws_cloudfront_cache_policy_test.go b/aws/data_source_aws_cloudfront_cache_policy_test.go index 4b8f20f93001..c0edfee27f77 100644 --- a/aws/data_source_aws_cloudfront_cache_policy_test.go +++ b/aws/data_source_aws_cloudfront_cache_policy_test.go @@ -15,6 +15,7 @@ func TestAccAWSCloudFrontDataSourceCachePolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_cloudfront_distribution_test.go b/aws/data_source_aws_cloudfront_distribution_test.go index f2f307972dec..9ae311253345 100644 --- a/aws/data_source_aws_cloudfront_distribution_test.go +++ b/aws/data_source_aws_cloudfront_distribution_test.go @@ -1,7 +1,6 @@ package aws import ( - "fmt" "testing" "github.com/aws/aws-sdk-go/service/cloudfront" @@ -12,13 +11,15 @@ import ( func TestAccAWSDataSourceCloudFrontDistribution_basic(t *testing.T) { dataSourceName := "data.aws_cloudfront_distribution.test" resourceName := "aws_cloudfront_distribution.s3_distribution" + rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionData, + Config: testAccAWSCloudFrontDistributionDataConfig(rInt), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), resource.TestCheckResourceAttrPair(dataSourceName, "domain_name", resourceName, "domain_name"), @@ -33,10 +34,12 @@ func TestAccAWSDataSourceCloudFrontDistribution_basic(t *testing.T) { }) } -var testAccAWSCloudFrontDistributionData = fmt.Sprintf(` -%s - +func testAccAWSCloudFrontDistributionDataConfig(rInt int) string { + return composeConfig( + testAccAWSCloudFrontDistributionS3ConfigWithTags(rInt), + ` data "aws_cloudfront_distribution" "test" { id = aws_cloudfront_distribution.s3_distribution.id } -`, fmt.Sprintf(testAccAWSCloudFrontDistributionS3ConfigWithTags, acctest.RandInt(), originBucket, logBucket, testAccAWSCloudFrontDistributionRetainConfig())) +`) +} diff --git a/aws/data_source_aws_cloudfront_origin_request_policy_test.go b/aws/data_source_aws_cloudfront_origin_request_policy_test.go index 10b55921ba3a..9d58f5eff1c3 100644 --- a/aws/data_source_aws_cloudfront_origin_request_policy_test.go +++ b/aws/data_source_aws_cloudfront_origin_request_policy_test.go @@ -15,6 +15,7 @@ func TestAccAWSCloudFrontDataSourceOriginRequestPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ @@ -33,6 +34,7 @@ func TestAccAWSCloudFrontDataSourceOriginRequestPolicy_basic(t *testing.T) { }, }) } + func testAccAWSCloudFrontDataSourceOriginRequestPolicyConfig(rInt int) string { return fmt.Sprintf(` data "aws_cloudfront_origin_request_policy" "example" { diff --git a/aws/data_source_aws_cloudhsm2_cluster_test.go b/aws/data_source_aws_cloudhsm2_cluster_test.go index 6063e6f91212..9f57ab509054 100644 --- a/aws/data_source_aws_cloudhsm2_cluster_test.go +++ b/aws/data_source_aws_cloudhsm2_cluster_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/cloudhsmv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccDataSourceCloudHsmV2Cluster_basic(t *testing.T) { dataSourceName := "data.aws_cloudhsm_v2_cluster.default" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudhsmv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckCloudHsmV2ClusterDataSourceConfig, diff --git a/aws/data_source_aws_cloudtrail_service_account.go b/aws/data_source_aws_cloudtrail_service_account.go index 6c4498d69211..9e2a90ffb455 100644 --- a/aws/data_source_aws_cloudtrail_service_account.go +++ b/aws/data_source_aws_cloudtrail_service_account.go @@ -16,7 +16,7 @@ var cloudTrailServiceAccountPerRegionMap = map[string]string{ endpoints.ApEast1RegionID: "119688915426", endpoints.ApNortheast1RegionID: "216624486486", endpoints.ApNortheast2RegionID: "492519147666", - "ap-northeast-3": "765225791966", //lintignore:AWSAT003 // https://github.com/aws/aws-sdk-go/issues/1863 + endpoints.ApNortheast3RegionID: "765225791966", endpoints.ApSouth1RegionID: "977081816279", endpoints.ApSoutheast1RegionID: "903692715234", endpoints.ApSoutheast2RegionID: "284668455005", diff --git a/aws/data_source_aws_cloudtrail_service_account_test.go b/aws/data_source_aws_cloudtrail_service_account_test.go index 04a489fb7496..c3b16abf9543 100644 --- a/aws/data_source_aws_cloudtrail_service_account_test.go +++ b/aws/data_source_aws_cloudtrail_service_account_test.go @@ -12,8 +12,9 @@ func TestAccAWSCloudTrailServiceAccount_basic(t *testing.T) { dataSourceName := "data.aws_cloudtrail_service_account.main" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsCloudTrailServiceAccountConfig, @@ -32,8 +33,9 @@ func TestAccAWSCloudTrailServiceAccount_Region(t *testing.T) { dataSourceName := "data.aws_cloudtrail_service_account.regional" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsCloudTrailServiceAccountConfigRegion, diff --git a/aws/data_source_aws_cloudwatch_log_group_test.go b/aws/data_source_aws_cloudwatch_log_group_test.go index bc7c14f072b8..a64db6c89211 100644 --- a/aws/data_source_aws_cloudwatch_log_group_test.go +++ b/aws/data_source_aws_cloudwatch_log_group_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/cloudwatchlogs" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccAWSCloudwatchLogGroupDataSource_basic(t *testing.T) { resourceName := "data.aws_cloudwatch_log_group.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAWSCloudwatchLogGroupDataSourceConfig(rName), @@ -34,8 +36,9 @@ func TestAccAWSCloudwatchLogGroupDataSource_tags(t *testing.T) { resourceName := "data.aws_cloudwatch_log_group.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAWSCloudwatchLogGroupDataSourceConfigTags(rName), @@ -58,8 +61,9 @@ func TestAccAWSCloudwatchLogGroupDataSource_kms(t *testing.T) { resourceName := "data.aws_cloudwatch_log_group.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAWSCloudwatchLogGroupDataSourceConfigKMS(rName), @@ -80,8 +84,9 @@ func TestAccAWSCloudwatchLogGroupDataSource_retention(t *testing.T) { resourceName := "data.aws_cloudwatch_log_group.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAWSCloudwatchLogGroupDataSourceConfigRetention(rName), diff --git a/aws/data_source_aws_codeartifact_authorization_token_test.go b/aws/data_source_aws_codeartifact_authorization_token_test.go index 9c42f339a7e9..8026a7564a58 100644 --- a/aws/data_source_aws_codeartifact_authorization_token_test.go +++ b/aws/data_source_aws_codeartifact_authorization_token_test.go @@ -14,8 +14,9 @@ func TestAccAWSCodeArtifactAuthorizationTokenDataSource_basic(t *testing.T) { dataSourceName := "data.aws_codeartifact_authorization_token.test" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAWSCodeArtifactAuthorizationTokenBasicConfig(rName), @@ -34,8 +35,9 @@ func TestAccAWSCodeArtifactAuthorizationTokenDataSource_owner(t *testing.T) { dataSourceName := "data.aws_codeartifact_authorization_token.test" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAWSCodeArtifactAuthorizationTokenOwnerConfig(rName), @@ -54,8 +56,9 @@ func TestAccAWSCodeArtifactAuthorizationTokenDataSource_duration(t *testing.T) { dataSourceName := "data.aws_codeartifact_authorization_token.test" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAWSCodeArtifactAuthorizationTokenDurationConfig(rName), diff --git a/aws/data_source_aws_codeartifact_repository_endpoint_test.go b/aws/data_source_aws_codeartifact_repository_endpoint_test.go index 6e7e0ed6d242..d35716b6a8f4 100644 --- a/aws/data_source_aws_codeartifact_repository_endpoint_test.go +++ b/aws/data_source_aws_codeartifact_repository_endpoint_test.go @@ -14,8 +14,9 @@ func TestAccAWSCodeArtifactRepositoryEndpointDataSource_basic(t *testing.T) { dataSourceName := "data.aws_codeartifact_repository_endpoint.test" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAWSCodeArtifactRepositoryEndpointBasicConfig(rName, "npm"), @@ -54,8 +55,9 @@ func TestAccAWSCodeArtifactRepositoryEndpointDataSource_owner(t *testing.T) { dataSourceName := "data.aws_codeartifact_repository_endpoint.test" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAWSCodeArtifactRepositoryEndpointOwnerConfig(rName), diff --git a/aws/data_source_aws_codecommit_repository_test.go b/aws/data_source_aws_codecommit_repository_test.go index e1a6ce85ea8f..c33b8fb58713 100644 --- a/aws/data_source_aws_codecommit_repository_test.go +++ b/aws/data_source_aws_codecommit_repository_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/codecommit" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccAWSCodeCommitRepositoryDataSource_basic(t *testing.T) { datasourceName := "data.aws_codecommit_repository.default" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codecommit.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsCodeCommitRepositoryDataSourceConfig(rName), diff --git a/aws/data_source_aws_codestarconnections_connection.go b/aws/data_source_aws_codestarconnections_connection.go new file mode 100644 index 000000000000..5834c74c51fa --- /dev/null +++ b/aws/data_source_aws_codestarconnections_connection.go @@ -0,0 +1,70 @@ +package aws + +import ( + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/codestarconnections/finder" +) + +func dataSourceAwsCodeStarConnectionsConnection() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAwsCodeStarConnectionsConnectionRead, + + Schema: map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Required: true, + }, + + "connection_status": { + Type: schema.TypeString, + Computed: true, + }, + + "name": { + Type: schema.TypeString, + Computed: true, + }, + + "provider_type": { + Type: schema.TypeString, + Computed: true, + }, + + "tags": tagsSchemaComputed(), + }, + } +} + +func dataSourceAwsCodeStarConnectionsConnectionRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).codestarconnectionsconn + ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig + + arn := d.Get("arn").(string) + + log.Printf("[DEBUG] Getting CodeStar Connection") + connection, err := finder.ConnectionByArn(conn, arn) + if err != nil { + return fmt.Errorf("error getting CodeStar Connection (%s): %w", arn, err) + } + log.Printf("[DEBUG] CodeStar Connection: %#v", connection) + + d.SetId(arn) + d.Set("connection_status", connection.ConnectionStatus) + d.Set("name", connection.ConnectionName) + d.Set("provider_type", connection.ProviderType) + + tags, err := keyvaluetags.CodestarconnectionsListTags(conn, arn) + if err != nil { + return fmt.Errorf("error listing tags for CodeStar Connection (%s): %w", arn, err) + } + + if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags for CodeStar Connection (%s): %w", arn, err) + } + + return nil +} diff --git a/aws/data_source_aws_codestarconnections_connection_test.go b/aws/data_source_aws_codestarconnections_connection_test.go new file mode 100644 index 000000000000..4c817aa39cb9 --- /dev/null +++ b/aws/data_source_aws_codestarconnections_connection_test.go @@ -0,0 +1,86 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/aws/aws-sdk-go/service/codestarconnections" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccDataSourceAwsCodeStarConnectionsConnection_basic(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + dataSourceName := "data.aws_codestarconnections_connection.test" + resourceName := "aws_codestarconnections_connection.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codestarconnections.EndpointsID), + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAWSCodeStarConnectionsConnectionConfigBasic(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(resourceName, "id", dataSourceName, "id"), + resource.TestCheckResourceAttrPair(resourceName, "arn", dataSourceName, "arn"), + resource.TestCheckResourceAttrPair(resourceName, "provider_type", dataSourceName, "provider_type"), + resource.TestCheckResourceAttrPair(resourceName, "name", dataSourceName, "name"), + resource.TestCheckResourceAttrPair(resourceName, "connection_status", dataSourceName, "connection_status"), + resource.TestCheckResourceAttrPair(resourceName, "tags.%", dataSourceName, "tags.%"), + ), + }, + }, + }) +} + +func TestAccDataSourceAwsCodeStarConnectionsConnection_tags(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + dataSourceName := "data.aws_codestarconnections_connection.test" + resourceName := "aws_codestarconnections_connection.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codestarconnections.EndpointsID), + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAWSCodeStarConnectionsConnectionConfigTags(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(resourceName, "tags.%", dataSourceName, "tags.%"), + ), + }, + }, + }) +} + +func testAccDataSourceAWSCodeStarConnectionsConnectionConfigBasic(rName string) string { + return fmt.Sprintf(` +resource "aws_codestarconnections_connection" "test" { + name = %[1]q + provider_type = "Bitbucket" +} + +data "aws_codestarconnections_connection" "test" { + arn = aws_codestarconnections_connection.test.arn +} +`, rName) +} + +func testAccDataSourceAWSCodeStarConnectionsConnectionConfigTags(rName string) string { + return fmt.Sprintf(` +resource "aws_codestarconnections_connection" "test" { + name = %[1]q + provider_type = "Bitbucket" + + tags = { + "key1" = "value1" + "key2" = "value2" + } +} + +data "aws_codestarconnections_connection" "test" { + arn = aws_codestarconnections_connection.test.arn +} +`, rName) +} diff --git a/aws/data_source_aws_cognito_user_pools_test.go b/aws/data_source_aws_cognito_user_pools_test.go index da850d68f56c..3b940f26f03b 100644 --- a/aws/data_source_aws_cognito_user_pools_test.go +++ b/aws/data_source_aws_cognito_user_pools_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/cognitoidentityprovider" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,8 +13,9 @@ import ( func TestAccDataSourceAwsCognitoUserPools_basic(t *testing.T) { rName := fmt.Sprintf("tf_acc_ds_cognito_user_pools_%s", acctest.RandString(7)) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsCognitoUserPoolsConfig_basic(rName), diff --git a/aws/data_source_aws_cur_report_definition_test.go b/aws/data_source_aws_cur_report_definition_test.go index 97d1013e93bd..5a07215fd711 100644 --- a/aws/data_source_aws_cur_report_definition_test.go +++ b/aws/data_source_aws_cur_report_definition_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/costandusagereportservice" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -18,6 +19,7 @@ func TestAccDataSourceAwsCurReportDefinition_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) }, + ErrorCheck: testAccErrorCheck(t, costandusagereportservice.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy, Steps: []resource.TestStep{ @@ -48,6 +50,7 @@ func TestAccDataSourceAwsCurReportDefinition_additional(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) }, + ErrorCheck: testAccErrorCheck(t, costandusagereportservice.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_customer_gateway_test.go b/aws/data_source_aws_customer_gateway_test.go index 3acf5c49c119..c2a94ca5f58e 100644 --- a/aws/data_source_aws_customer_gateway_test.go +++ b/aws/data_source_aws_customer_gateway_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -16,9 +17,8 @@ func TestAccAWSCustomerGatewayDataSource_Filter(t *testing.T) { hostOctet := acctest.RandIntRange(1, 254) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCustomerGatewayDestroy, Steps: []resource.TestStep{ @@ -44,9 +44,8 @@ func TestAccAWSCustomerGatewayDataSource_ID(t *testing.T) { hostOctet := acctest.RandIntRange(1, 254) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCustomerGatewayDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_db_cluster_snapshot_test.go b/aws/data_source_aws_db_cluster_snapshot_test.go index f83d4b7632cb..8f62b6e23a62 100644 --- a/aws/data_source_aws_db_cluster_snapshot_test.go +++ b/aws/data_source_aws_db_cluster_snapshot_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/rds" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -15,8 +16,9 @@ func TestAccAWSDbClusterSnapshotDataSource_DbClusterSnapshotIdentifier(t *testin resourceName := "aws_db_cluster_snapshot.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsDbClusterSnapshotDataSourceConfig_DbClusterSnapshotIdentifier(rName), @@ -51,8 +53,9 @@ func TestAccAWSDbClusterSnapshotDataSource_DbClusterIdentifier(t *testing.T) { resourceName := "aws_db_cluster_snapshot.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsDbClusterSnapshotDataSourceConfig_DbClusterIdentifier(rName), @@ -87,8 +90,9 @@ func TestAccAWSDbClusterSnapshotDataSource_MostRecent(t *testing.T) { resourceName := "aws_db_cluster_snapshot.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsDbClusterSnapshotDataSourceConfig_MostRecent(rName), diff --git a/aws/data_source_aws_db_event_categories_test.go b/aws/data_source_aws_db_event_categories_test.go index 0550386f5541..628c1ce9094f 100644 --- a/aws/data_source_aws_db_event_categories_test.go +++ b/aws/data_source_aws_db_event_categories_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/rds" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -11,8 +12,9 @@ func TestAccAWSDbEventCategories_basic(t *testing.T) { dataSourceName := "data.aws_db_event_categories.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsDbEventCategoriesConfig(), @@ -41,8 +43,9 @@ func TestAccAWSDbEventCategories_SourceType(t *testing.T) { dataSourceName := "data.aws_db_event_categories.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsDbEventCategoriesConfigSourceType("db-snapshot"), diff --git a/aws/data_source_aws_db_instance_test.go b/aws/data_source_aws_db_instance_test.go index d98d5912588f..af024079defa 100644 --- a/aws/data_source_aws_db_instance_test.go +++ b/aws/data_source_aws_db_instance_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/rds" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -11,8 +12,9 @@ import ( func TestAccAWSDbInstanceDataSource_basic(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAWSDBInstanceDataSourceConfig(rInt), @@ -45,6 +47,7 @@ func TestAccAWSDbInstanceDataSource_ec2Classic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), ProviderFactories: testAccProviderFactories, Steps: []resource.TestStep{ { diff --git a/aws/data_source_aws_db_snapshot_test.go b/aws/data_source_aws_db_snapshot_test.go index bd5629f8df2c..c983080a9ab0 100644 --- a/aws/data_source_aws_db_snapshot_test.go +++ b/aws/data_source_aws_db_snapshot_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/rds" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -12,8 +13,9 @@ import ( func TestAccAWSDbSnapshotDataSource_basic(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsDbSnapshotDataSourceConfig(rInt), diff --git a/aws/data_source_aws_db_subnet_group_test.go b/aws/data_source_aws_db_subnet_group_test.go index d4c3837d93f3..1186876c4cbc 100644 --- a/aws/data_source_aws_db_subnet_group_test.go +++ b/aws/data_source_aws_db_subnet_group_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/rds" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -16,6 +17,7 @@ func TestAccAWSDbSubnetGroupDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), ProviderFactories: testAccProviderFactories, Steps: []resource.TestStep{ { @@ -36,6 +38,7 @@ func TestAccAWSDbSubnetGroupDataSource_basic(t *testing.T) { func TestAccAWSDbSubnetGroupDataSource_nonexistent(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), ProviderFactories: testAccProviderFactories, Steps: []resource.TestStep{ { diff --git a/aws/data_source_aws_directory_service_directory_test.go b/aws/data_source_aws_directory_service_directory_test.go index a8c01c953149..f6742d3bc074 100644 --- a/aws/data_source_aws_directory_service_directory_test.go +++ b/aws/data_source_aws_directory_service_directory_test.go @@ -13,8 +13,9 @@ import ( func TestAccDataSourceAwsDirectoryServiceDirectory_NonExistent(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsDirectoryServiceDirectoryConfig_NonExistent, @@ -30,8 +31,9 @@ func TestAccDataSourceAwsDirectoryServiceDirectory_SimpleAD(t *testing.T) { dataSourceName := "data.aws_directory_service_directory.test-simple-ad" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsDirectoryServiceDirectoryConfig_SimpleAD(alias), @@ -61,8 +63,9 @@ func TestAccDataSourceAwsDirectoryServiceDirectory_MicrosoftAD(t *testing.T) { dataSourceName := "data.aws_directory_service_directory.test-microsoft-ad" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsDirectoryServiceDirectoryConfig_MicrosoftAD(alias), @@ -96,7 +99,8 @@ func TestAccDataSourceAWSDirectoryServiceDirectory_connector(t *testing.T) { testAccPreCheckAWSDirectoryService(t) testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) }, - Providers: testAccProviders, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceDirectoryServiceDirectoryConfig_connector(), diff --git a/aws/data_source_aws_docdb_engine_version_test.go b/aws/data_source_aws_docdb_engine_version_test.go index a0bdb8111c79..b5e0e9b22ab8 100644 --- a/aws/data_source_aws_docdb_engine_version_test.go +++ b/aws/data_source_aws_docdb_engine_version_test.go @@ -17,6 +17,7 @@ func TestAccAWSDocDBEngineVersionDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSDocDBEngineVersionPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -42,6 +43,7 @@ func TestAccAWSDocDBEngineVersionDataSource_preferred(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSDocDBEngineVersionPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -60,6 +62,7 @@ func TestAccAWSDocDBEngineVersionDataSource_defaultOnly(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSDocDBEngineVersionPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_docdb_orderable_db_instance_test.go b/aws/data_source_aws_docdb_orderable_db_instance_test.go index c581f95083fd..54565acaf77e 100644 --- a/aws/data_source_aws_docdb_orderable_db_instance_test.go +++ b/aws/data_source_aws_docdb_orderable_db_instance_test.go @@ -18,6 +18,7 @@ func TestAccAWSDocdbOrderableDbInstanceDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDocdbOrderableDbInstance(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -43,6 +44,7 @@ func TestAccAWSDocdbOrderableDbInstanceDataSource_preferred(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDocdbOrderableDbInstance(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_dx_gateway_test.go b/aws/data_source_aws_dx_gateway_test.go index d197da217e8a..4c57614f03d9 100644 --- a/aws/data_source_aws_dx_gateway_test.go +++ b/aws/data_source_aws_dx_gateway_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/directconnect" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAwsDxGateway_basic(t *testing.T) { datasourceName := "data.aws_dx_gateway.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsDxGatewayConfig_NonExistent, diff --git a/aws/data_source_aws_dynamodb_table_test.go b/aws/data_source_aws_dynamodb_table_test.go index 03a3d66c4a68..9177af369ae4 100644 --- a/aws/data_source_aws_dynamodb_table_test.go +++ b/aws/data_source_aws_dynamodb_table_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccDataSourceAwsDynamoDbTable_basic(t *testing.T) { tableName := fmt.Sprintf("testaccawsdynamodbtable-basic-%s", acctest.RandString(10)) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsDynamoDbTableConfigBasic(tableName), diff --git a/aws/data_source_aws_ebs_default_kms_key_test.go b/aws/data_source_aws_ebs_default_kms_key_test.go index 2049b7e1fcb8..54313ca826a1 100644 --- a/aws/data_source_aws_ebs_default_kms_key_test.go +++ b/aws/data_source_aws_ebs_default_kms_key_test.go @@ -12,8 +12,9 @@ import ( func TestAccDataSourceAwsEBSDefaultKmsKey_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEBSDefaultKmsKeyConfig, diff --git a/aws/data_source_aws_ebs_encryption_by_default_test.go b/aws/data_source_aws_ebs_encryption_by_default_test.go index 39f313de8fb3..0cbdc5c06cef 100644 --- a/aws/data_source_aws_ebs_encryption_by_default_test.go +++ b/aws/data_source_aws_ebs_encryption_by_default_test.go @@ -13,8 +13,9 @@ import ( func TestAccDataSourceAwsEBSEncryptionByDefault_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEBSEncryptionByDefaultConfig, diff --git a/aws/data_source_aws_ebs_snapshot_ids_test.go b/aws/data_source_aws_ebs_snapshot_ids_test.go index 1bca667a4755..f52756247225 100644 --- a/aws/data_source_aws_ebs_snapshot_ids_test.go +++ b/aws/data_source_aws_ebs_snapshot_ids_test.go @@ -4,14 +4,16 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceAwsEbsSnapshotIds_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEbsSnapshotIdsConfig_basic(), @@ -27,8 +29,9 @@ func TestAccDataSourceAwsEbsSnapshotIds_sorted(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEbsSnapshotIdsConfig_sorted1(rName), @@ -56,8 +59,9 @@ func TestAccDataSourceAwsEbsSnapshotIds_sorted(t *testing.T) { func TestAccDataSourceAwsEbsSnapshotIds_empty(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEbsSnapshotIdsConfig_empty, diff --git a/aws/data_source_aws_ebs_snapshot_test.go b/aws/data_source_aws_ebs_snapshot_test.go index b8df0fd13a4e..baaa94f6aa78 100644 --- a/aws/data_source_aws_ebs_snapshot_test.go +++ b/aws/data_source_aws_ebs_snapshot_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -13,8 +14,9 @@ func TestAccAWSEbsSnapshotDataSource_basic(t *testing.T) { resourceName := "aws_ebs_snapshot.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsEbsSnapshotDataSourceConfig, @@ -41,8 +43,9 @@ func TestAccAWSEbsSnapshotDataSource_Filter(t *testing.T) { resourceName := "aws_ebs_snapshot.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsEbsSnapshotDataSourceConfigFilter, @@ -60,8 +63,9 @@ func TestAccAWSEbsSnapshotDataSource_MostRecent(t *testing.T) { resourceName := "aws_ebs_snapshot.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsEbsSnapshotDataSourceConfigMostRecent, diff --git a/aws/data_source_aws_ebs_volume_test.go b/aws/data_source_aws_ebs_volume_test.go index a956929510d6..515e6c2406ab 100644 --- a/aws/data_source_aws_ebs_volume_test.go +++ b/aws/data_source_aws_ebs_volume_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -13,8 +14,9 @@ func TestAccAWSEbsVolumeDataSource_basic(t *testing.T) { dataSourceName := "data.aws_ebs_volume.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsEbsVolumeDataSourceConfig, @@ -37,8 +39,9 @@ func TestAccAWSEbsVolumeDataSource_multipleFilters(t *testing.T) { dataSourceName := "data.aws_ebs_volume.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsEbsVolumeDataSourceConfigWithMultipleFilters, diff --git a/aws/data_source_aws_ebs_volumes_test.go b/aws/data_source_aws_ebs_volumes_test.go index 9f35936ab9a3..548596efe6a7 100644 --- a/aws/data_source_aws_ebs_volumes_test.go +++ b/aws/data_source_aws_ebs_volumes_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,6 +13,7 @@ func TestAccDataSourceAwsEbsVolumes_basic(t *testing.T) { rInt := acctest.RandIntRange(0, 256) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVolumeDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_ec2_coip_pool_test.go b/aws/data_source_aws_ec2_coip_pool_test.go index 9cb93025c89b..6c6b4d4daa4b 100644 --- a/aws/data_source_aws_ec2_coip_pool_test.go +++ b/aws/data_source_aws_ec2_coip_pool_test.go @@ -4,6 +4,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -11,8 +12,9 @@ func TestAccDataSourceAwsEc2CoipPool_Filter(t *testing.T) { dataSourceName := "data.aws_ec2_coip_pool.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2CoipPoolDataSourceConfigFilter(), @@ -30,8 +32,9 @@ func TestAccDataSourceAwsEc2CoipPool_Id(t *testing.T) { dataSourceName := "data.aws_ec2_coip_pool.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2CoipPoolDataSourceConfigId(), diff --git a/aws/data_source_aws_ec2_coip_pools_test.go b/aws/data_source_aws_ec2_coip_pools_test.go index b152a7cb5eb0..e31c70bbf6ef 100644 --- a/aws/data_source_aws_ec2_coip_pools_test.go +++ b/aws/data_source_aws_ec2_coip_pools_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -10,8 +11,9 @@ func TestAccDataSourceAwsEc2CoipPools_basic(t *testing.T) { dataSourceName := "data.aws_ec2_coip_pools.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2CoipPoolsConfig(), @@ -27,8 +29,9 @@ func TestAccDataSourceAwsEc2CoipPools_Filter(t *testing.T) { dataSourceName := "data.aws_ec2_coip_pools.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2CoipPoolsConfigFilter(), diff --git a/aws/data_source_aws_ec2_instance_type_offering_test.go b/aws/data_source_aws_ec2_instance_type_offering_test.go index 43657eea38e9..3115aada695e 100644 --- a/aws/data_source_aws_ec2_instance_type_offering_test.go +++ b/aws/data_source_aws_ec2_instance_type_offering_test.go @@ -13,6 +13,7 @@ func TestAccAWSEc2InstanceTypeOfferingDataSource_Filter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2InstanceTypeOffering(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -31,6 +32,7 @@ func TestAccAWSEc2InstanceTypeOfferingDataSource_LocationType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2InstanceTypeOffering(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -49,6 +51,7 @@ func TestAccAWSEc2InstanceTypeOfferingDataSource_PreferredInstanceTypes(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2InstanceTypeOffering(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_ec2_instance_type_offerings_test.go b/aws/data_source_aws_ec2_instance_type_offerings_test.go index 73d122360cd5..b3b41eb3f720 100644 --- a/aws/data_source_aws_ec2_instance_type_offerings_test.go +++ b/aws/data_source_aws_ec2_instance_type_offerings_test.go @@ -15,6 +15,7 @@ func TestAccAWSEc2InstanceTypeOfferingsDataSource_Filter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2InstanceTypeOfferings(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -33,6 +34,7 @@ func TestAccAWSEc2InstanceTypeOfferingsDataSource_LocationType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2InstanceTypeOfferings(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_ec2_instance_type_test.go b/aws/data_source_aws_ec2_instance_type_test.go index 0a362929b001..9c94a6851cd7 100644 --- a/aws/data_source_aws_ec2_instance_type_test.go +++ b/aws/data_source_aws_ec2_instance_type_test.go @@ -3,14 +3,16 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceAwsEc2InstanceType_basic(t *testing.T) { resourceBasic := "data.aws_ec2_instance_type.basic" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceEc2InstanceTypeBasic, @@ -66,8 +68,9 @@ func TestAccDataSourceAwsEc2InstanceType_basic(t *testing.T) { func TestAccDataSourceAwsEc2InstanceType_metal(t *testing.T) { resourceMetal := "data.aws_ec2_instance_type.metal" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceEc2InstanceTypeMetal, @@ -92,8 +95,9 @@ func TestAccDataSourceAwsEc2InstanceType_metal(t *testing.T) { func TestAccDataSourceAwsEc2InstanceType_gpu(t *testing.T) { resourceGpu := "data.aws_ec2_instance_type.gpu" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceEc2InstanceTypeGpu, @@ -112,8 +116,9 @@ func TestAccDataSourceAwsEc2InstanceType_gpu(t *testing.T) { func TestAccDataSourceAwsEc2InstanceType_fpga(t *testing.T) { resourceFpga := "data.aws_ec2_instance_type.fpga" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceEc2InstanceTypeFgpa, diff --git a/aws/data_source_aws_ec2_local_gateway_route_table_test.go b/aws/data_source_aws_ec2_local_gateway_route_table_test.go index 77aab4f6f78a..76b3b38b8586 100644 --- a/aws/data_source_aws_ec2_local_gateway_route_table_test.go +++ b/aws/data_source_aws_ec2_local_gateway_route_table_test.go @@ -4,6 +4,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -11,8 +12,9 @@ func TestAccDataSourceAwsEc2LocalGatewayRouteTable_basic(t *testing.T) { dataSourceName := "data.aws_ec2_local_gateway_route_table.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayRouteTableConfigLocalGatewayRouteTableId(), @@ -31,8 +33,9 @@ func TestAccDataSourceAwsEc2LocalGatewayRouteTable_Filter(t *testing.T) { dataSourceName := "data.aws_ec2_local_gateway_route_table.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayRouteTableConfigFilter(), @@ -51,8 +54,9 @@ func TestAccDataSourceAwsEc2LocalGatewayRouteTable_LocalGatewayId(t *testing.T) dataSourceName := "data.aws_ec2_local_gateway_route_table.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayRouteTableConfigLocalGatewayId(), @@ -71,8 +75,9 @@ func TestAccDataSourceAwsEc2LocalGatewayRouteTable_OutpostArn(t *testing.T) { dataSourceName := "data.aws_ec2_local_gateway_route_table.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayRouteTableConfigOutpostArn(), diff --git a/aws/data_source_aws_ec2_local_gateway_route_tables_test.go b/aws/data_source_aws_ec2_local_gateway_route_tables_test.go index 92e4f7b801c7..372fd77269ac 100644 --- a/aws/data_source_aws_ec2_local_gateway_route_tables_test.go +++ b/aws/data_source_aws_ec2_local_gateway_route_tables_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -10,8 +11,9 @@ func TestAccDataSourceAwsEc2LocalGatewayRouteTables_basic(t *testing.T) { dataSourceName := "data.aws_ec2_local_gateway_route_tables.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayRouteTablesConfig(), @@ -27,8 +29,9 @@ func TestAccDataSourceAwsEc2LocalGatewayRouteTables_Filter(t *testing.T) { dataSourceName := "data.aws_ec2_local_gateway_route_tables.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayRouteTablesConfigFilter(), diff --git a/aws/data_source_aws_ec2_local_gateway_test.go b/aws/data_source_aws_ec2_local_gateway_test.go index 9d94560f7e7d..1ae8f2d90899 100644 --- a/aws/data_source_aws_ec2_local_gateway_test.go +++ b/aws/data_source_aws_ec2_local_gateway_test.go @@ -4,6 +4,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -11,8 +12,9 @@ func TestAccDataSourceAwsEc2LocalGateway_basic(t *testing.T) { dataSourceName := "data.aws_ec2_local_gateway.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayConfigId(), diff --git a/aws/data_source_aws_ec2_local_gateway_virtual_interface_group_test.go b/aws/data_source_aws_ec2_local_gateway_virtual_interface_group_test.go index 604931b17e43..774f913edc80 100644 --- a/aws/data_source_aws_ec2_local_gateway_virtual_interface_group_test.go +++ b/aws/data_source_aws_ec2_local_gateway_virtual_interface_group_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroup_Filter(t *testing. dataSourceName := "data.aws_ec2_local_gateway_virtual_interface_group.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroupConfigFilter(), @@ -32,8 +34,9 @@ func TestAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroup_LocalGatewayId(t * dataSourceName := "data.aws_ec2_local_gateway_virtual_interface_group.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroupConfigLocalGatewayId(), @@ -53,8 +56,9 @@ func TestAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroup_Tags(t *testing.T) dataSourceName := "data.aws_ec2_local_gateway_virtual_interface_group.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroupConfigTags(rName), diff --git a/aws/data_source_aws_ec2_local_gateway_virtual_interface_groups_test.go b/aws/data_source_aws_ec2_local_gateway_virtual_interface_groups_test.go index 5cd34d09d2f9..35f6249f79fa 100644 --- a/aws/data_source_aws_ec2_local_gateway_virtual_interface_groups_test.go +++ b/aws/data_source_aws_ec2_local_gateway_virtual_interface_groups_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,8 +13,9 @@ func TestAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroups_basic(t *testing. dataSourceName := "data.aws_ec2_local_gateway_virtual_interface_groups.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroupsConfig(), @@ -30,8 +32,9 @@ func TestAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroups_Filter(t *testing dataSourceName := "data.aws_ec2_local_gateway_virtual_interface_groups.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroupsConfigFilter(), @@ -49,8 +52,9 @@ func TestAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroups_Tags(t *testing.T dataSourceName := "data.aws_ec2_local_gateway_virtual_interface_groups.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayVirtualInterfaceGroupsConfigTags(rName), diff --git a/aws/data_source_aws_ec2_local_gateway_virtual_interface_test.go b/aws/data_source_aws_ec2_local_gateway_virtual_interface_test.go index 5c9734330c58..a8ae27809103 100644 --- a/aws/data_source_aws_ec2_local_gateway_virtual_interface_test.go +++ b/aws/data_source_aws_ec2_local_gateway_virtual_interface_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccDataSourceAwsEc2LocalGatewayVirtualInterface_Filter(t *testing.T) { dataSourceName := "data.aws_ec2_local_gateway_virtual_interface.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayVirtualInterfaceConfigFilter(), @@ -36,8 +38,9 @@ func TestAccDataSourceAwsEc2LocalGatewayVirtualInterface_Id(t *testing.T) { dataSourceName := "data.aws_ec2_local_gateway_virtual_interface.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayVirtualInterfaceConfigId(), @@ -61,8 +64,9 @@ func TestAccDataSourceAwsEc2LocalGatewayVirtualInterface_Tags(t *testing.T) { dataSourceName := "data.aws_ec2_local_gateway_virtual_interface.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewayVirtualInterfaceConfigTags(rName), diff --git a/aws/data_source_aws_ec2_local_gateways_test.go b/aws/data_source_aws_ec2_local_gateways_test.go index 18a30150d6d6..2bef51d2e0b4 100644 --- a/aws/data_source_aws_ec2_local_gateways_test.go +++ b/aws/data_source_aws_ec2_local_gateways_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -10,8 +11,9 @@ func TestAccDataSourceAwsEc2LocalGateways_basic(t *testing.T) { dataSourceName := "data.aws_ec2_local_gateways.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2LocalGatewaysConfig(), diff --git a/aws/data_source_aws_ec2_managed_prefix_list_test.go b/aws/data_source_aws_ec2_managed_prefix_list_test.go index f313a68589fc..412a7f22e86e 100644 --- a/aws/data_source_aws_ec2_managed_prefix_list_test.go +++ b/aws/data_source_aws_ec2_managed_prefix_list_test.go @@ -44,8 +44,9 @@ func TestAccDataSourceAwsEc2ManagedPrefixList_basic(t *testing.T) { prefixListResourceName := "data.aws_prefix_list.s3_by_id" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2ManagedPrefixListConfig_basic, @@ -98,8 +99,9 @@ func TestAccDataSourceAwsEc2ManagedPrefixList_filter(t *testing.T) { resourceById := "data.aws_ec2_managed_prefix_list.s3_by_id" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsEc2ManagedPrefixListConfig_filter, @@ -149,8 +151,9 @@ data "aws_ec2_managed_prefix_list" "s3_by_id" { func TestAccDataSourceAwsEc2ManagedPrefixList_matchesTooMany(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsPrefixListConfig_matchesTooMany, diff --git a/aws/data_source_aws_ec2_spot_price_test.go b/aws/data_source_aws_ec2_spot_price_test.go index 9fa7ede1b6cd..c02f5f8c91c7 100644 --- a/aws/data_source_aws_ec2_spot_price_test.go +++ b/aws/data_source_aws_ec2_spot_price_test.go @@ -14,6 +14,7 @@ func TestAccAwsEc2SpotPriceDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsEc2SpotPrice(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -33,6 +34,7 @@ func TestAccAwsEc2SpotPriceDataSource_Filter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsEc2SpotPrice(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_ec2_transit_gateway_dx_gateway_attachment_test.go b/aws/data_source_aws_ec2_transit_gateway_dx_gateway_attachment_test.go index bf0191e562dc..74ee3bf31667 100644 --- a/aws/data_source_aws_ec2_transit_gateway_dx_gateway_attachment_test.go +++ b/aws/data_source_aws_ec2_transit_gateway_dx_gateway_attachment_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -20,6 +21,7 @@ func TestAccAWSEc2TransitGatewayDxGatewayAttachmentDataSource_TransitGatewayIdAn testAccPreCheck(t) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -47,6 +49,7 @@ func TestAccAWSEc2TransitGatewayDxGatewayAttachmentDataSource_filter(t *testing. testAccPreCheck(t) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_ec2_transit_gateway_peering_attachment_test.go b/aws/data_source_aws_ec2_transit_gateway_peering_attachment_test.go index ab6a6f52a4a0..ea08e75b99c5 100644 --- a/aws/data_source_aws_ec2_transit_gateway_peering_attachment_test.go +++ b/aws/data_source_aws_ec2_transit_gateway_peering_attachment_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -19,6 +20,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Filter_sameAccount(t testAccPreCheckAWSEc2TransitGateway(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -35,6 +37,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Filter_sameAccount(t }, }) } + func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Filter_differentAccount(t *testing.T) { var providers []*schema.Provider rName := acctest.RandomWithPrefix("tf-acc-test") @@ -48,6 +51,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Filter_differentAcco testAccMultipleRegionPreCheck(t, 2) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -63,6 +67,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Filter_differentAcco }, }) } + func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_ID_sameAccount(t *testing.T) { var providers []*schema.Provider rName := acctest.RandomWithPrefix("tf-acc-test") @@ -74,6 +79,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_ID_sameAccount(t *te testAccPreCheckAWSEc2TransitGateway(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -90,6 +96,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_ID_sameAccount(t *te }, }) } + func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_ID_differentAccount(t *testing.T) { var providers []*schema.Provider rName := acctest.RandomWithPrefix("tf-acc-test") @@ -103,6 +110,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_ID_differentAccount( testAccMultipleRegionPreCheck(t, 2) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -118,6 +126,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_ID_differentAccount( }, }) } + func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Tags(t *testing.T) { var providers []*schema.Provider rName := acctest.RandomWithPrefix("tf-acc-test") @@ -129,6 +138,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentDataSource_Tags(t *testing.T) { testAccPreCheckAWSEc2TransitGateway(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_ec2_transit_gateway_route_table_test.go b/aws/data_source_aws_ec2_transit_gateway_route_table_test.go index fa1d266159c1..c12a45c72a22 100644 --- a/aws/data_source_aws_ec2_transit_gateway_route_table_test.go +++ b/aws/data_source_aws_ec2_transit_gateway_route_table_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,6 +13,7 @@ func TestAccAWSEc2TransitGatewayRouteTableDataSource_Filter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -35,6 +37,7 @@ func TestAccAWSEc2TransitGatewayRouteTableDataSource_ID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_ec2_transit_gateway_route_tables.go b/aws/data_source_aws_ec2_transit_gateway_route_tables.go new file mode 100644 index 000000000000..5be6e306ec9a --- /dev/null +++ b/aws/data_source_aws_ec2_transit_gateway_route_tables.go @@ -0,0 +1,86 @@ +package aws + +import ( + "fmt" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" +) + +func dataSourceAwsEc2TransitGatewayRouteTables() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAwsEc2TransitGatewayRouteTablesRead, + + Schema: map[string]*schema.Schema{ + "filter": ec2CustomFiltersSchema(), + + "ids": { + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + }, + + "tags": tagsSchemaComputed(), + }, + } +} + +func dataSourceAwsEc2TransitGatewayRouteTablesRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).ec2conn + + input := &ec2.DescribeTransitGatewayRouteTablesInput{} + + input.Filters = append(input.Filters, buildEC2TagFilterList( + keyvaluetags.New(d.Get("tags").(map[string]interface{})).Ec2Tags(), + )...) + + input.Filters = append(input.Filters, buildEC2CustomFilterList( + d.Get("filter").(*schema.Set), + )...) + + if len(input.Filters) == 0 { + // Don't send an empty filters list; the EC2 API won't accept it. + input.Filters = nil + } + + var transitGatewayRouteTables []*ec2.TransitGatewayRouteTable + + err := conn.DescribeTransitGatewayRouteTablesPages(input, func(page *ec2.DescribeTransitGatewayRouteTablesOutput, lastPage bool) bool { + if page == nil { + return !lastPage + } + + transitGatewayRouteTables = append(transitGatewayRouteTables, page.TransitGatewayRouteTables...) + + return !lastPage + }) + + if err != nil { + return fmt.Errorf("error describing EC2 Transit Gateway Route Tables: %w", err) + } + + if len(transitGatewayRouteTables) == 0 { + return fmt.Errorf("no matching EC2 Transit Gateway Route Tables found") + } + + var ids []string + + for _, transitGatewayRouteTable := range transitGatewayRouteTables { + if transitGatewayRouteTable == nil { + continue + } + + ids = append(ids, aws.StringValue(transitGatewayRouteTable.TransitGatewayRouteTableId)) + } + + d.SetId(meta.(*AWSClient).region) + + if err = d.Set("ids", ids); err != nil { + return fmt.Errorf("error setting ids: %w", err) + } + + return nil +} diff --git a/aws/data_source_aws_ec2_transit_gateway_route_tables_test.go b/aws/data_source_aws_ec2_transit_gateway_route_tables_test.go new file mode 100644 index 000000000000..336d05ac1ea9 --- /dev/null +++ b/aws/data_source_aws_ec2_transit_gateway_route_tables_test.go @@ -0,0 +1,73 @@ +package aws + +import ( + "testing" + + "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccDataSourceAwsEc2TransitGatewayRouteTables_basic(t *testing.T) { + dataSourceName := "data.aws_ec2_transit_gateway_route_tables.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsEc2TransitGatewayRouteTablesConfig, + Check: resource.ComposeTestCheckFunc( + testCheckResourceAttrGreaterThanValue(dataSourceName, "ids.#", "0"), + ), + }, + }, + }) +} + +func TestAccDataSourceAwsEc2TransitGatewayRouteTables_Filter(t *testing.T) { + dataSourceName := "data.aws_ec2_transit_gateway_route_tables.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsEc2TransitGatewayRouteTablesTransitGatewayFilter, + Check: resource.ComposeTestCheckFunc( + testCheckResourceAttrGreaterThanValue(dataSourceName, "ids.#", "0"), + ), + }, + }, + }) +} + +const testAccDataSourceAwsEc2TransitGatewayRouteTablesConfig = ` +resource "aws_ec2_transit_gateway" "test" {} + +resource "aws_ec2_transit_gateway_route_table" "test" { + transit_gateway_id = aws_ec2_transit_gateway.test.id +} + +data "aws_ec2_transit_gateway_route_tables" "test" { + depends_on = [aws_ec2_transit_gateway_route_table.test] +} +` + +const testAccDataSourceAwsEc2TransitGatewayRouteTablesTransitGatewayFilter = ` +resource "aws_ec2_transit_gateway" "test" {} + +resource "aws_ec2_transit_gateway_route_table" "test" { + transit_gateway_id = aws_ec2_transit_gateway.test.id +} + +data "aws_ec2_transit_gateway_route_tables" "test" { + filter { + name = "transit-gateway-id" + values = [aws_ec2_transit_gateway.test.id] + } + + depends_on = [aws_ec2_transit_gateway_route_table.test] +} +` diff --git a/aws/data_source_aws_ec2_transit_gateway_test.go b/aws/data_source_aws_ec2_transit_gateway_test.go index f681df83cf61..c0769d6b56a0 100644 --- a/aws/data_source_aws_ec2_transit_gateway_test.go +++ b/aws/data_source_aws_ec2_transit_gateway_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,6 +13,7 @@ func TestAccAWSEc2TransitGatewayDataSource_Filter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -42,6 +44,7 @@ func TestAccAWSEc2TransitGatewayDataSource_ID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_ec2_transit_gateway_vpc_attachment_test.go b/aws/data_source_aws_ec2_transit_gateway_vpc_attachment_test.go index d2a419f7b117..d496ab4e3d90 100644 --- a/aws/data_source_aws_ec2_transit_gateway_vpc_attachment_test.go +++ b/aws/data_source_aws_ec2_transit_gateway_vpc_attachment_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,6 +13,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachmentDataSource_Filter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -38,6 +40,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachmentDataSource_ID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_ec2_transit_gateway_vpn_attachment_test.go b/aws/data_source_aws_ec2_transit_gateway_vpn_attachment_test.go index c8d7a5f92a3c..322489fde910 100644 --- a/aws/data_source_aws_ec2_transit_gateway_vpn_attachment_test.go +++ b/aws/data_source_aws_ec2_transit_gateway_vpn_attachment_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -19,6 +20,7 @@ func TestAccAWSEc2TransitGatewayVpnAttachmentDataSource_TransitGatewayIdAndVpnCo testAccPreCheck(t) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -45,6 +47,7 @@ func TestAccAWSEc2TransitGatewayVpnAttachmentDataSource_filter(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_ecr_authorization_token_test.go b/aws/data_source_aws_ecr_authorization_token_test.go index 2994d1a6dba5..40a935196869 100644 --- a/aws/data_source_aws_ecr_authorization_token_test.go +++ b/aws/data_source_aws_ecr_authorization_token_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ecr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccAWSEcrAuthorizationTokenDataSource_basic(t *testing.T) { dataSourceName := "data.aws_ecr_authorization_token.repo" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecr.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsEcrAuthorizationTokenDataSourceBasicConfig, diff --git a/aws/data_source_aws_ecr_image_test.go b/aws/data_source_aws_ecr_image_test.go index 1d9c1712eb78..e2eb89a6648e 100644 --- a/aws/data_source_aws_ecr_image_test.go +++ b/aws/data_source_aws_ecr_image_test.go @@ -5,6 +5,7 @@ import ( "strconv" "testing" + "github.com/aws/aws-sdk-go/service/ecr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -15,8 +16,9 @@ func TestAccAWSEcrDataSource_ecrImage(t *testing.T) { resourceByDigest := "data.aws_ecr_image.by_digest" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecr.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsEcrImageDataSourceConfig(registry, repo, tag), diff --git a/aws/data_source_aws_ecr_repository_test.go b/aws/data_source_aws_ecr_repository_test.go index 34114e7f2ade..abf0f80343c1 100644 --- a/aws/data_source_aws_ecr_repository_test.go +++ b/aws/data_source_aws_ecr_repository_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ecr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccAWSEcrRepositoryDataSource_basic(t *testing.T) { dataSourceName := "data.aws_ecr_repository.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecr.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsEcrRepositoryDataSourceConfig(rName), @@ -40,8 +42,9 @@ func TestAccAWSEcrRepositoryDataSource_encryption(t *testing.T) { dataSourceName := "data.aws_ecr_repository.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecr.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsEcrRepositoryDataSourceConfig_encryption(rName), @@ -64,8 +67,9 @@ func TestAccAWSEcrRepositoryDataSource_encryption(t *testing.T) { func TestAccAWSEcrRepositoryDataSource_nonExistent(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecr.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsEcrRepositoryDataSourceConfig_NonExistent, diff --git a/aws/data_source_aws_ecs_cluster_test.go b/aws/data_source_aws_ecs_cluster_test.go index e65ddd4aab04..c608d36ef048 100644 --- a/aws/data_source_aws_ecs_cluster_test.go +++ b/aws/data_source_aws_ecs_cluster_test.go @@ -4,23 +4,29 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ecs" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccAWSEcsDataSource_ecsCluster(t *testing.T) { + dataSourceName := "data.aws_ecs_cluster.test" + resourceName := "aws_ecs_cluster.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckAwsEcsClusterDataSourceConfig, + Config: testAccCheckAwsEcsClusterDataSourceConfig(rName), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.aws_ecs_cluster.default", "status", "ACTIVE"), - resource.TestCheckResourceAttr("data.aws_ecs_cluster.default", "pending_tasks_count", "0"), - resource.TestCheckResourceAttr("data.aws_ecs_cluster.default", "running_tasks_count", "0"), - resource.TestCheckResourceAttr("data.aws_ecs_cluster.default", "registered_container_instances_count", "0"), - resource.TestCheckResourceAttrSet("data.aws_ecs_cluster.default", "arn"), + resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), + resource.TestCheckResourceAttr(dataSourceName, "pending_tasks_count", "0"), + resource.TestCheckResourceAttr(dataSourceName, "registered_container_instances_count", "0"), + resource.TestCheckResourceAttr(dataSourceName, "running_tasks_count", "0"), + resource.TestCheckResourceAttr(dataSourceName, "status", "ACTIVE"), ), }, }, @@ -28,38 +34,46 @@ func TestAccAWSEcsDataSource_ecsCluster(t *testing.T) { } func TestAccAWSEcsDataSource_ecsClusterContainerInsights(t *testing.T) { + dataSourceName := "data.aws_ecs_cluster.test" + resourceName := "aws_ecs_cluster.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckAwsEcsClusterDataSourceConfigContainerInsights, + Config: testAccCheckAwsEcsClusterDataSourceConfigContainerInsights(rName), Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttr("data.aws_ecs_cluster.default", "status", "ACTIVE"), - resource.TestCheckResourceAttr("data.aws_ecs_cluster.default", "pending_tasks_count", "0"), - resource.TestCheckResourceAttr("data.aws_ecs_cluster.default", "running_tasks_count", "0"), - resource.TestCheckResourceAttr("data.aws_ecs_cluster.default", "registered_container_instances_count", "0"), - resource.TestCheckResourceAttrSet("data.aws_ecs_cluster.default", "arn"), - resource.TestCheckResourceAttrPair("data.aws_ecs_cluster.default", "setting.#", "aws_ecs_cluster.default", "setting.#"), + resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), + resource.TestCheckResourceAttr(dataSourceName, "pending_tasks_count", "0"), + resource.TestCheckResourceAttr(dataSourceName, "registered_container_instances_count", "0"), + resource.TestCheckResourceAttr(dataSourceName, "running_tasks_count", "0"), + resource.TestCheckResourceAttr(dataSourceName, "status", "ACTIVE"), + resource.TestCheckResourceAttrPair(dataSourceName, "setting.#", resourceName, "setting.#"), ), }, }, }) } -var testAccCheckAwsEcsClusterDataSourceConfig = fmt.Sprintf(` -resource "aws_ecs_cluster" "default" { - name = "default-%d" +func testAccCheckAwsEcsClusterDataSourceConfig(rName string) string { + return fmt.Sprintf(` +resource "aws_ecs_cluster" "test" { + name = %[1]q } -data "aws_ecs_cluster" "default" { - cluster_name = aws_ecs_cluster.default.name +data "aws_ecs_cluster" "test" { + cluster_name = aws_ecs_cluster.test.name +} +`, rName) } -`, acctest.RandInt()) -var testAccCheckAwsEcsClusterDataSourceConfigContainerInsights = fmt.Sprintf(` -resource "aws_ecs_cluster" "default" { - name = "default-%d" +func testAccCheckAwsEcsClusterDataSourceConfigContainerInsights(rName string) string { + return fmt.Sprintf(` +resource "aws_ecs_cluster" "test" { + name = %[1]q setting { name = "containerInsights" @@ -67,7 +81,8 @@ resource "aws_ecs_cluster" "default" { } } -data "aws_ecs_cluster" "default" { - cluster_name = aws_ecs_cluster.default.name +data "aws_ecs_cluster" "test" { + cluster_name = aws_ecs_cluster.test.name +} +`, rName) } -`, acctest.RandInt()) diff --git a/aws/data_source_aws_ecs_container_definition_test.go b/aws/data_source_aws_ecs_container_definition_test.go index d26183b14f64..34d7afc7f346 100644 --- a/aws/data_source_aws_ecs_container_definition_test.go +++ b/aws/data_source_aws_ecs_container_definition_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ecs" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccAWSEcsDataSource_ecsContainerDefinition(t *testing.T) { tdName := fmt.Sprintf("tf_acc_td_ds_ecs_containter_definition_%s", rString) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsEcsContainerDefinitionDataSourceConfig(clusterName, tdName, svcName), diff --git a/aws/data_source_aws_ecs_service_test.go b/aws/data_source_aws_ecs_service_test.go index a7516974ad33..d45038aff9a4 100644 --- a/aws/data_source_aws_ecs_service_test.go +++ b/aws/data_source_aws_ecs_service_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ecs" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -11,13 +12,15 @@ import ( func TestAccAWSEcsServiceDataSource_basic(t *testing.T) { dataSourceName := "data.aws_ecs_service.test" resourceName := "aws_ecs_service.test" + rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { - Config: testAccCheckAwsEcsServiceDataSourceConfig, + Config: testAccCheckAwsEcsServiceDataSourceConfig(rName), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrPair(resourceName, "id", dataSourceName, "arn"), resource.TestCheckResourceAttrPair(resourceName, "desired_count", dataSourceName, "desired_count"), @@ -31,13 +34,14 @@ func TestAccAWSEcsServiceDataSource_basic(t *testing.T) { }) } -var testAccCheckAwsEcsServiceDataSourceConfig = fmt.Sprintf(` +func testAccCheckAwsEcsServiceDataSourceConfig(rName string) string { + return fmt.Sprintf(` resource "aws_ecs_cluster" "test" { - name = "tf-acc-%d" + name = %[1]q } resource "aws_ecs_task_definition" "test" { - family = "mongodb" + family = %[1]q container_definitions = < 1 { + return fmt.Errorf("multiple Kinesis Stream Consumers found matching criteria; try different search") + } + + consumer := results[0] + + d.SetId(aws.StringValue(consumer.ConsumerARN)) + d.Set("arn", consumer.ConsumerARN) + d.Set("name", consumer.ConsumerName) + d.Set("status", consumer.ConsumerStatus) + d.Set("stream_arn", streamArn) + d.Set("creation_timestamp", aws.TimeValue(consumer.ConsumerCreationTimestamp).Format(time.RFC3339)) + + return nil +} diff --git a/aws/data_source_aws_kinesis_stream_consumer_test.go b/aws/data_source_aws_kinesis_stream_consumer_test.go new file mode 100644 index 000000000000..6a4f18f88a44 --- /dev/null +++ b/aws/data_source_aws_kinesis_stream_consumer_test.go @@ -0,0 +1,144 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/aws/aws-sdk-go/service/kinesis" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func TestAccAWSKinesisStreamConsumerDataSource_basic(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + dataSourceName := "data.aws_kinesis_stream_consumer.test" + resourceName := "aws_kinesis_stream_consumer.test" + streamName := "aws_kinesis_stream.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kinesis.EndpointsID), + Providers: testAccProviders, + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: testAccAWSKinesisStreamConsumerDataSourceConfig(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), + resource.TestCheckResourceAttrPair(dataSourceName, "name", resourceName, "name"), + resource.TestCheckResourceAttrPair(dataSourceName, "stream_arn", streamName, "arn"), + resource.TestCheckResourceAttrSet(dataSourceName, "creation_timestamp"), + resource.TestCheckResourceAttrSet(dataSourceName, "status"), + ), + }, + }, + }) +} + +func TestAccAWSKinesisStreamConsumerDataSource_Name(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + dataSourceName := "data.aws_kinesis_stream_consumer.test" + resourceName := "aws_kinesis_stream_consumer.test" + streamName := "aws_kinesis_stream.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kinesis.EndpointsID), + Providers: testAccProviders, + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: testAccAWSKinesisStreamConsumerDataSourceConfigName(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), + resource.TestCheckResourceAttrPair(dataSourceName, "name", resourceName, "name"), + resource.TestCheckResourceAttrPair(dataSourceName, "stream_arn", streamName, "arn"), + resource.TestCheckResourceAttrSet(dataSourceName, "creation_timestamp"), + resource.TestCheckResourceAttrSet(dataSourceName, "status"), + ), + }, + }, + }) +} + +func TestAccAWSKinesisStreamConsumerDataSource_Arn(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + dataSourceName := "data.aws_kinesis_stream_consumer.test" + resourceName := "aws_kinesis_stream_consumer.test" + streamName := "aws_kinesis_stream.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kinesis.EndpointsID), + Providers: testAccProviders, + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: testAccAWSKinesisStreamConsumerDataSourceConfigArn(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(dataSourceName, "arn", resourceName, "arn"), + resource.TestCheckResourceAttrPair(dataSourceName, "name", resourceName, "name"), + resource.TestCheckResourceAttrPair(dataSourceName, "stream_arn", streamName, "arn"), + resource.TestCheckResourceAttrSet(dataSourceName, "creation_timestamp"), + resource.TestCheckResourceAttrSet(dataSourceName, "status"), + ), + }, + }, + }) +} + +func testAccAWSKinesisStreamConsumerDataSourceBaseConfig(rName string) string { + return fmt.Sprintf(` +resource "aws_kinesis_stream" "test" { + name = %q + shard_count = 2 +} +`, rName) +} + +func testAccAWSKinesisStreamConsumerDataSourceConfig(rName string) string { + return composeConfig( + testAccAWSKinesisStreamConsumerDataSourceBaseConfig(rName), + fmt.Sprintf(` +data "aws_kinesis_stream_consumer" "test" { + stream_arn = aws_kinesis_stream_consumer.test.stream_arn +} + +resource "aws_kinesis_stream_consumer" "test" { + name = %q + stream_arn = aws_kinesis_stream.test.arn +} +`, rName)) +} + +func testAccAWSKinesisStreamConsumerDataSourceConfigName(rName string) string { + return composeConfig( + testAccAWSKinesisStreamConsumerDataSourceBaseConfig(rName), + fmt.Sprintf(` +data "aws_kinesis_stream_consumer" "test" { + name = aws_kinesis_stream_consumer.test.name + stream_arn = aws_kinesis_stream_consumer.test.stream_arn +} + +resource "aws_kinesis_stream_consumer" "test" { + name = %q + stream_arn = aws_kinesis_stream.test.arn +} +`, rName)) +} + +func testAccAWSKinesisStreamConsumerDataSourceConfigArn(rName string) string { + return composeConfig( + testAccAWSKinesisStreamConsumerDataSourceBaseConfig(rName), + fmt.Sprintf(` +data "aws_kinesis_stream_consumer" "test" { + arn = aws_kinesis_stream_consumer.test.arn + stream_arn = aws_kinesis_stream_consumer.test.stream_arn +} + +resource "aws_kinesis_stream_consumer" "test" { + name = %q + stream_arn = aws_kinesis_stream.test.arn +} +`, rName)) +} diff --git a/aws/data_source_aws_kinesis_stream_test.go b/aws/data_source_aws_kinesis_stream_test.go index cf4e22a71696..11123d959d5f 100644 --- a/aws/data_source_aws_kinesis_stream_test.go +++ b/aws/data_source_aws_kinesis_stream_test.go @@ -34,6 +34,7 @@ func TestAccAWSKinesisStreamDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kinesis.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckKinesisStreamDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_kms_alias_test.go b/aws/data_source_aws_kms_alias_test.go index 0964dfe5e643..f4eed5401392 100644 --- a/aws/data_source_aws_kms_alias_test.go +++ b/aws/data_source_aws_kms_alias_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/kms" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -15,8 +16,9 @@ func TestAccDataSourceAwsKmsAlias_AwsService(t *testing.T) { resourceName := "data.aws_kms_alias.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kms.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsKmsAlias_name(name), @@ -38,8 +40,9 @@ func TestAccDataSourceAwsKmsAlias_CMK(t *testing.T) { datasourceAliasResourceName := "data.aws_kms_alias.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kms.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsKmsAlias_CMK(rInt), diff --git a/aws/data_source_aws_kms_ciphertext_test.go b/aws/data_source_aws_kms_ciphertext_test.go index b29aea85ac48..66395e475910 100644 --- a/aws/data_source_aws_kms_ciphertext_test.go +++ b/aws/data_source_aws_kms_ciphertext_test.go @@ -3,13 +3,15 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/kms" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceAwsKmsCiphertext_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kms.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsKmsCiphertextConfig_basic, @@ -24,8 +26,9 @@ func TestAccDataSourceAwsKmsCiphertext_basic(t *testing.T) { func TestAccDataSourceAwsKmsCiphertext_validate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kms.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsKmsCiphertextConfig_validate, @@ -40,8 +43,9 @@ func TestAccDataSourceAwsKmsCiphertext_validate(t *testing.T) { func TestAccDataSourceAwsKmsCiphertext_validate_withContext(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kms.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsKmsCiphertextConfig_validate_withContext, diff --git a/aws/data_source_aws_kms_key_test.go b/aws/data_source_aws_kms_key_test.go index 4f374ed25a74..63249d6d5f28 100644 --- a/aws/data_source_aws_kms_key_test.go +++ b/aws/data_source_aws_kms_key_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/kms" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -15,8 +16,9 @@ func TestAccDataSourceAwsKmsKey_basic(t *testing.T) { rName := fmt.Sprintf("tf-testacc-kms-key-%s", acctest.RandString(13)) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kms.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsKmsKeyConfig(rName), diff --git a/aws/data_source_aws_kms_secret_test.go b/aws/data_source_aws_kms_secret_test.go index 7b4d37ef0ebe..99fae3e31016 100644 --- a/aws/data_source_aws_kms_secret_test.go +++ b/aws/data_source_aws_kms_secret_test.go @@ -4,13 +4,15 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/kms" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccAWSKmsSecretDataSource_removed(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kms.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAwsKmsSecretDataSourceConfig, diff --git a/aws/data_source_aws_kms_secrets_test.go b/aws/data_source_aws_kms_secrets_test.go index c6e6cae242d1..e74d54179315 100644 --- a/aws/data_source_aws_kms_secrets_test.go +++ b/aws/data_source_aws_kms_secrets_test.go @@ -20,8 +20,9 @@ func TestAccAWSKmsSecretsDataSource_basic(t *testing.T) { // Run a resource test to setup our KMS key resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kms.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsKmsSecretsDataSourceKey, @@ -64,8 +65,9 @@ func testAccDataSourceAwsKmsSecretsDecrypt(t *testing.T, plaintext string, encry dataSourceName := "data.aws_kms_secrets.test" resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kms.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsKmsSecretsDataSourceSecret(*encryptedPayload), diff --git a/aws/data_source_aws_lakeformation_data_lake_settings_test.go b/aws/data_source_aws_lakeformation_data_lake_settings_test.go index e0ae83a99b49..fa1fe4ab7d4a 100644 --- a/aws/data_source_aws_lakeformation_data_lake_settings_test.go +++ b/aws/data_source_aws_lakeformation_data_lake_settings_test.go @@ -13,6 +13,7 @@ func testAccAWSLakeFormationDataLakeSettingsDataSource_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationDataLakeSettingsDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_lakeformation_permissions_test.go b/aws/data_source_aws_lakeformation_permissions_test.go index c6299c985c36..479f8f25032c 100644 --- a/aws/data_source_aws_lakeformation_permissions_test.go +++ b/aws/data_source_aws_lakeformation_permissions_test.go @@ -16,6 +16,7 @@ func testAccAWSLakeFormationPermissionsDataSource_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ @@ -39,6 +40,7 @@ func testAccAWSLakeFormationPermissionsDataSource_dataLocation(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ @@ -63,6 +65,7 @@ func testAccAWSLakeFormationPermissionsDataSource_database(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ @@ -91,6 +94,7 @@ func testAccAWSLakeFormationPermissionsDataSource_table(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ @@ -116,6 +120,7 @@ func testAccAWSLakeFormationPermissionsDataSource_tableWithColumns(t *testing.T) resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_lakeformation_resource_test.go b/aws/data_source_aws_lakeformation_resource_test.go index 902d8af75d90..cc53b6e211da 100644 --- a/aws/data_source_aws_lakeformation_resource_test.go +++ b/aws/data_source_aws_lakeformation_resource_test.go @@ -16,6 +16,7 @@ func TestAccAWSLakeFormationResourceDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSLakeFormationResourceDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_lambda_alias_test.go b/aws/data_source_aws_lambda_alias_test.go index 3caa4a665fcd..222d13571f46 100644 --- a/aws/data_source_aws_lambda_alias_test.go +++ b/aws/data_source_aws_lambda_alias_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/lambda" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAWSLambdaAlias_basic(t *testing.T) { resourceName := "aws_lambda_alias.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaAliasConfigBasic(rName), diff --git a/aws/data_source_aws_lambda_code_signing_config_test.go b/aws/data_source_aws_lambda_code_signing_config_test.go index cacc267b2876..57cec74f8b2a 100644 --- a/aws/data_source_aws_lambda_code_signing_config_test.go +++ b/aws/data_source_aws_lambda_code_signing_config_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/lambda" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -10,8 +11,9 @@ func TestAccDataSourceAWSLambdaCodeSigningConfig_basic(t *testing.T) { dataSourceName := "data.aws_lambda_code_signing_config.test" resourceName := "aws_lambda_code_signing_config.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaCodeSigningConfigBasic, @@ -28,8 +30,9 @@ func TestAccDataSourceAWSLambdaCodeSigningConfig_PolicyConfigId(t *testing.T) { dataSourceName := "data.aws_lambda_code_signing_config.test" resourceName := "aws_lambda_code_signing_config.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaCodeSigningConfigConfigurePolicy, @@ -48,8 +51,9 @@ func TestAccDataSourceAWSLambdaCodeSigningConfig_Description(t *testing.T) { dataSourceName := "data.aws_lambda_code_signing_config.test" resourceName := "aws_lambda_code_signing_config.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaCodeSigningConfigConfigureDescription, diff --git a/aws/data_source_aws_lambda_function_test.go b/aws/data_source_aws_lambda_function_test.go index a39366c13d11..4d065ebae282 100644 --- a/aws/data_source_aws_lambda_function_test.go +++ b/aws/data_source_aws_lambda_function_test.go @@ -5,6 +5,7 @@ import ( "os" "testing" + "github.com/aws/aws-sdk-go/service/lambda" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAWSLambdaFunction_basic(t *testing.T) { resourceName := "aws_lambda_function.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaFunctionConfigBasic(rName), @@ -55,8 +57,9 @@ func TestAccDataSourceAWSLambdaFunction_version(t *testing.T) { resourceName := "aws_lambda_function.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaFunctionConfigVersion(rName), @@ -78,8 +81,9 @@ func TestAccDataSourceAWSLambdaFunction_alias(t *testing.T) { resourceName := "aws_lambda_function.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaFunctionConfigAlias(rName), @@ -100,8 +104,9 @@ func TestAccDataSourceAWSLambdaFunction_layers(t *testing.T) { resourceName := "aws_lambda_function.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaFunctionConfigLayers(rName), @@ -120,8 +125,9 @@ func TestAccDataSourceAWSLambdaFunction_vpc(t *testing.T) { resourceName := "aws_lambda_function.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaFunctionConfigVPC(rName), @@ -142,8 +148,9 @@ func TestAccDataSourceAWSLambdaFunction_environment(t *testing.T) { resourceName := "aws_lambda_function.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaFunctionConfigEnvironment(rName), @@ -165,8 +172,9 @@ func TestAccDataSourceAWSLambdaFunction_fileSystemConfig(t *testing.T) { resourceName := "aws_lambda_function.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaFunctionConfigFileSystemConfigs(rName), @@ -189,8 +197,9 @@ func TestAccDataSourceAWSLambdaFunction_imageConfig(t *testing.T) { imageLatestID := os.Getenv("AWS_LAMBDA_IMAGE_LATEST_ID") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccDataSourceLambdaImagePreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccDataSourceLambdaImagePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaFunctionConfigImageConfig(rName, imageLatestID), diff --git a/aws/data_source_aws_lambda_invocation_test.go b/aws/data_source_aws_lambda_invocation_test.go index 83ad3f1611c7..cf876f77ed7a 100644 --- a/aws/data_source_aws_lambda_invocation_test.go +++ b/aws/data_source_aws_lambda_invocation_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/lambda" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -39,8 +40,9 @@ func TestAccDataSourceAwsLambdaInvocation_basic(t *testing.T) { testData := "value3" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsLambdaInvocation_basic_config(rName, testData), @@ -57,8 +59,9 @@ func TestAccDataSourceAwsLambdaInvocation_qualifier(t *testing.T) { testData := "value3" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsLambdaInvocation_qualifier_config(rName, testData), @@ -75,8 +78,9 @@ func TestAccDataSourceAwsLambdaInvocation_complex(t *testing.T) { testData := "value3" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsLambdaInvocation_complex_config(rName, testData), diff --git a/aws/data_source_aws_lambda_layer_version_test.go b/aws/data_source_aws_lambda_layer_version_test.go index b4611c4f171d..7b36d7171daf 100644 --- a/aws/data_source_aws_lambda_layer_version_test.go +++ b/aws/data_source_aws_lambda_layer_version_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/lambda" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAWSLambdaLayerVersion_basic(t *testing.T) { resourceName := "aws_lambda_layer_version.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaLayerVersionConfigBasic(rName), @@ -44,8 +46,9 @@ func TestAccDataSourceAWSLambdaLayerVersion_version(t *testing.T) { resourceName := "aws_lambda_layer_version.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaLayerVersionConfigVersion(rName), @@ -64,8 +67,9 @@ func TestAccDataSourceAWSLambdaLayerVersion_runtime(t *testing.T) { resourceName := "aws_lambda_layer_version.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, lambda.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLambdaLayerVersionConfigRuntimes(rName), diff --git a/aws/data_source_aws_launch_configuration_test.go b/aws/data_source_aws_launch_configuration_test.go index 5c7d826acfff..e482d551d086 100644 --- a/aws/data_source_aws_launch_configuration_test.go +++ b/aws/data_source_aws_launch_configuration_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/autoscaling" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccAWSLaunchConfigurationDataSource_basic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccLaunchConfigurationDataSourceConfig_basic(rName), @@ -42,8 +44,9 @@ func TestAccAWSLaunchConfigurationDataSource_securityGroups(t *testing.T) { rName := "data.aws_launch_configuration.foo" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccLaunchConfigurationDataSourceConfig_securityGroups(rInt), @@ -61,8 +64,9 @@ func TestAccAWSLaunchConfigurationDataSource_ebsNoDevice(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccLaunchConfigurationDataSourceConfigEbsNoDevice(rName), @@ -84,6 +88,7 @@ func TestAccLaunchConfigurationDataSource_metadataOptions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchConfigurationDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_launch_template_test.go b/aws/data_source_aws_launch_template_test.go index 41d8dfb559ea..84919d90e73e 100644 --- a/aws/data_source_aws_launch_template_test.go +++ b/aws/data_source_aws_launch_template_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -16,6 +17,7 @@ func TestAccAWSLaunchTemplateDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchTemplateDestroy, Steps: []resource.TestStep{ @@ -40,6 +42,7 @@ func TestAccAWSLaunchTemplateDataSource_id_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchTemplateDestroy, Steps: []resource.TestStep{ @@ -64,6 +67,7 @@ func TestAccAWSLaunchTemplateDataSource_filter_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchTemplateDestroy, Steps: []resource.TestStep{ @@ -109,6 +113,7 @@ func TestAccAWSLaunchTemplateDataSource_filter_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchTemplateDestroy, Steps: []resource.TestStep{ @@ -133,6 +138,7 @@ func TestAccAWSLaunchTemplateDataSource_metadataOptions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchTemplateDestroy, Steps: []resource.TestStep{ @@ -156,6 +162,7 @@ func TestAccAWSLaunchTemplateDataSource_enclaveOptions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchTemplateDestroy, Steps: []resource.TestStep{ @@ -177,6 +184,7 @@ func TestAccAWSLaunchTemplateDataSource_associatePublicIPAddress(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchTemplateDestroy, Steps: []resource.TestStep{ @@ -212,6 +220,7 @@ func TestAccAWSLaunchTemplateDataSource_associateCarrierIPAddress(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchTemplateDestroy, Steps: []resource.TestStep{ @@ -247,6 +256,7 @@ func TestAccAWSLaunchTemplateDataSource_networkInterfaces_deleteOnTermination(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchTemplateDestroy, Steps: []resource.TestStep{ @@ -278,6 +288,7 @@ func TestAccAWSLaunchTemplateDataSource_networkInterfaces_deleteOnTermination(t func TestAccAWSLaunchTemplateDataSource_NonExistent(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchTemplateDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_lb_listener_test.go b/aws/data_source_aws_lb_listener_test.go index 7247ac2d94ea..b15f0336c30f 100644 --- a/aws/data_source_aws_lb_listener_test.go +++ b/aws/data_source_aws_lb_listener_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/elbv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccDataSourceAWSLBListener_basic(t *testing.T) { targetGroupName := fmt.Sprintf("testtargetgroup-%s", acctest.RandString(10)) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLBListenerConfigBasic(lbName, targetGroupName), @@ -44,8 +46,9 @@ func TestAccDataSourceAWSLBListener_BackwardsCompatibility(t *testing.T) { targetGroupName := fmt.Sprintf("testtargetgroup-%s", acctest.RandString(10)) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLBListenerConfigBackwardsCompatibility(lbName, targetGroupName), @@ -77,8 +80,9 @@ func TestAccDataSourceAWSLBListener_https(t *testing.T) { certificate := tlsRsaX509SelfSignedCertificatePem(key, "example.com") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLBListenerConfigHTTPS(lbName, targetGroupName, tlsPemEscapeNewlines(certificate), tlsPemEscapeNewlines(key)), @@ -113,8 +117,9 @@ func TestAccDataSourceAWSLBListener_DefaultAction_Forward(t *testing.T) { resourceName := "aws_lb_listener.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLBListenerConfigDefaultActionForward(rName), diff --git a/aws/data_source_aws_lb_target_group_test.go b/aws/data_source_aws_lb_target_group_test.go index 2bf0191f30ce..388cd5706f1b 100644 --- a/aws/data_source_aws_lb_target_group_test.go +++ b/aws/data_source_aws_lb_target_group_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/elbv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAWSALBTargetGroup_basic(t *testing.T) { resourceName := "data.aws_lb_target_group.alb_tg_test_with_name" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLBTargetGroupConfigBasic(lbName, targetGroupName), @@ -76,8 +78,9 @@ func TestAccDataSourceAWSLBTargetGroup_BackwardsCompatibility(t *testing.T) { resourceName := "data.aws_alb_target_group.alb_tg_test_with_name" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLBTargetGroupConfigBackwardsCompatibility(lbName, targetGroupName), diff --git a/aws/data_source_aws_lb_test.go b/aws/data_source_aws_lb_test.go index 4e7b18db73ff..d7ae474fbe20 100644 --- a/aws/data_source_aws_lb_test.go +++ b/aws/data_source_aws_lb_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/elbv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAWSLB_basic(t *testing.T) { resourceName := "aws_lb.alb_test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLBConfigBasic(lbName), @@ -61,8 +63,9 @@ func TestAccDataSourceAWSLB_outpost(t *testing.T) { resourceName := "aws_lb.alb_test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLBConfigOutpost(lbName), @@ -95,8 +98,9 @@ func TestAccDataSourceAWSLB_BackwardsCompatibility(t *testing.T) { resourceName := "aws_alb.alb_test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSLBConfigBackardsCompatibility(lbName), diff --git a/aws/data_source_aws_lex_bot_alias_test.go b/aws/data_source_aws_lex_bot_alias_test.go index 4498da3a41f4..622649097fa0 100644 --- a/aws/data_source_aws_lex_bot_alias_test.go +++ b/aws/data_source_aws_lex_bot_alias_test.go @@ -15,8 +15,9 @@ func testAccDataSourceAwsLexBotAlias_basic(t *testing.T) { // If this test runs in parallel with other Lex Bot tests, it loses its description resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lexmodelbuildingservice.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: composeConfig( diff --git a/aws/data_source_aws_lex_bot_test.go b/aws/data_source_aws_lex_bot_test.go index 2d13bc19621a..a89236f27d2a 100644 --- a/aws/data_source_aws_lex_bot_test.go +++ b/aws/data_source_aws_lex_bot_test.go @@ -14,8 +14,9 @@ func TestAccDataSourceAwsLexBot_basic(t *testing.T) { resourceName := "aws_lex_bot.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lexmodelbuildingservice.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: composeConfig( @@ -52,8 +53,9 @@ func testAccDataSourceAwsLexBot_withVersion(t *testing.T) { // If this test runs in parallel with other Lex Bot tests, it loses its description resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lexmodelbuildingservice.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: composeConfig( diff --git a/aws/data_source_aws_lex_intent_test.go b/aws/data_source_aws_lex_intent_test.go index 2cca31c93e6b..e8a1e64e9173 100644 --- a/aws/data_source_aws_lex_intent_test.go +++ b/aws/data_source_aws_lex_intent_test.go @@ -14,8 +14,9 @@ func TestAccDataSourceAwsLexIntent_basic(t *testing.T) { resourceName := "aws_lex_intent.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lexmodelbuildingservice.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: composeConfig( @@ -42,8 +43,9 @@ func TestAccDataSourceAwsLexIntent_withVersion(t *testing.T) { resourceName := "aws_lex_intent.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lexmodelbuildingservice.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: composeConfig( diff --git a/aws/data_source_aws_lex_slot_type_test.go b/aws/data_source_aws_lex_slot_type_test.go index 0d2f7cffcd14..ae8a3e223d98 100644 --- a/aws/data_source_aws_lex_slot_type_test.go +++ b/aws/data_source_aws_lex_slot_type_test.go @@ -14,8 +14,9 @@ func TestAccDataSourceAwsLexSlotType_basic(t *testing.T) { resourceName := "aws_lex_slot_type.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lexmodelbuildingservice.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: composeConfig( @@ -43,8 +44,9 @@ func TestAccDataSourceAwsLexSlotType_withVersion(t *testing.T) { resourceName := "aws_lex_slot_type.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lexmodelbuildingservice.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lexmodelbuildingservice.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: composeConfig( diff --git a/aws/data_source_aws_mq_broker_test.go b/aws/data_source_aws_mq_broker_test.go index 051225180ad4..089d4bcefcd6 100644 --- a/aws/data_source_aws_mq_broker_test.go +++ b/aws/data_source_aws_mq_broker_test.go @@ -19,8 +19,9 @@ func TestAccDataSourceAWSMqBroker_basic(t *testing.T) { resourceName := "aws_mq_broker.acctest" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(mq.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(mq.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSMqBrokerConfig_byId(brokerName, prefix), diff --git a/aws/data_source_aws_msk_cluster_test.go b/aws/data_source_aws_msk_cluster_test.go index 850d703a7532..4ddfe159bc2e 100644 --- a/aws/data_source_aws_msk_cluster_test.go +++ b/aws/data_source_aws_msk_cluster_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/kafka" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,6 +16,7 @@ func TestAccAWSMskClusterDataSource_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_msk_configuration_test.go b/aws/data_source_aws_msk_configuration_test.go index 7211f6ea51fa..cd9fbcb0576a 100644 --- a/aws/data_source_aws_msk_configuration_test.go +++ b/aws/data_source_aws_msk_configuration_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/kafka" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,6 +16,7 @@ func TestAccAWSMskConfigurationDataSource_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskConfigurationDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_nat_gateway_test.go b/aws/data_source_aws_nat_gateway_test.go index 8fdfba88cc11..138474e41bbe 100644 --- a/aws/data_source_aws_nat_gateway_test.go +++ b/aws/data_source_aws_nat_gateway_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccDataSourceAwsNatGateway_basic(t *testing.T) { rInt := acctest.RandIntRange(4, 254) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsNatGatewayConfig(rInt), diff --git a/aws/data_source_aws_neptune_engine_version_test.go b/aws/data_source_aws_neptune_engine_version_test.go index fd3f3b46e6a1..7c052a403838 100644 --- a/aws/data_source_aws_neptune_engine_version_test.go +++ b/aws/data_source_aws_neptune_engine_version_test.go @@ -16,6 +16,7 @@ func TestAccAWSNeptuneEngineVersionDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSNeptuneEngineVersionPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -43,6 +44,7 @@ func TestAccAWSNeptuneEngineVersionDataSource_preferred(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSNeptuneEngineVersionPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -62,6 +64,7 @@ func TestAccAWSNeptuneEngineVersionDataSource_defaultOnly(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSNeptuneEngineVersionPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_neptune_orderable_db_instance_test.go b/aws/data_source_aws_neptune_orderable_db_instance_test.go index aca11e22234e..420bfae1a8a1 100644 --- a/aws/data_source_aws_neptune_orderable_db_instance_test.go +++ b/aws/data_source_aws_neptune_orderable_db_instance_test.go @@ -18,6 +18,7 @@ func TestAccAWSNeptuneOrderableDbInstanceDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSNeptuneOrderableDbInstance(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -43,6 +44,7 @@ func TestAccAWSNeptuneOrderableDbInstanceDataSource_preferred(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSNeptuneOrderableDbInstance(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_network_acls_test.go b/aws/data_source_aws_network_acls_test.go index e153fcbf3d86..b4bb0b89536d 100644 --- a/aws/data_source_aws_network_acls_test.go +++ b/aws/data_source_aws_network_acls_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,6 +16,7 @@ func TestAccDataSourceAwsNetworkAcls_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -39,6 +41,7 @@ func TestAccDataSourceAwsNetworkAcls_Filter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -58,6 +61,7 @@ func TestAccDataSourceAwsNetworkAcls_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -77,6 +81,7 @@ func TestAccDataSourceAwsNetworkAcls_VpcID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_network_interface_test.go b/aws/data_source_aws_network_interface_test.go index f5f101db7b35..c609fbcab6e5 100644 --- a/aws/data_source_aws_network_interface_test.go +++ b/aws/data_source_aws_network_interface_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAwsNetworkInterface_basic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsNetworkInterfaceConfigBasic(rName), @@ -41,8 +43,9 @@ func TestAccDataSourceAwsNetworkInterface_filters(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsNetworkInterfaceConfigFilters(rName), @@ -65,8 +68,9 @@ func TestAccDataSourceAwsNetworkInterface_CarrierIPAssociation(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWavelengthZoneAvailable(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWavelengthZoneAvailable(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsNetworkInterfaceConfigCarrierIPAssociation(rName), @@ -112,8 +116,9 @@ func TestAccDataSourceAwsNetworkInterface_PublicIPAssociation(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsNetworkInterfaceConfigPublicIPAssociation(rName), diff --git a/aws/data_source_aws_network_interfaces_test.go b/aws/data_source_aws_network_interfaces_test.go index d1341e75d284..c11165ebfdb3 100644 --- a/aws/data_source_aws_network_interfaces_test.go +++ b/aws/data_source_aws_network_interfaces_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,6 +13,7 @@ func TestAccDataSourceAwsNetworkInterfaces_Filter(t *testing.T) { rName := acctest.RandString(5) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -29,6 +31,7 @@ func TestAccDataSourceAwsNetworkInterfaces_Tags(t *testing.T) { rName := acctest.RandString(5) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_organizations_organization_test.go b/aws/data_source_aws_organizations_organization_test.go index ee6258b56a9f..725fb60a733a 100644 --- a/aws/data_source_aws_organizations_organization_test.go +++ b/aws/data_source_aws_organizations_organization_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/organizations" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,7 +16,8 @@ func testAccDataSourceAwsOrganizationsOrganization_basic(t *testing.T) { testAccPreCheck(t) testAccOrganizationsAccountPreCheck(t) }, - Providers: testAccProviders, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsOrganizationResourceOnlyConfig, diff --git a/aws/data_source_aws_organizations_organizational_units_test.go b/aws/data_source_aws_organizations_organizational_units_test.go index 9301852dcb8d..f1640d4003cf 100644 --- a/aws/data_source_aws_organizations_organizational_units_test.go +++ b/aws/data_source_aws_organizations_organizational_units_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/organizations" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,7 +15,8 @@ func testAccDataSourceAwsOrganizationsOrganizationalUnits_basic(t *testing.T) { testAccPreCheck(t) testAccOrganizationsAccountPreCheck(t) }, - Providers: testAccProviders, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsOrganizationsOrganizationalUnitsConfig, diff --git a/aws/data_source_aws_outposts_outpost_instance_type_test.go b/aws/data_source_aws_outposts_outpost_instance_type_test.go index 5b01b6a96452..e2a0fec6a6a4 100644 --- a/aws/data_source_aws_outposts_outpost_instance_type_test.go +++ b/aws/data_source_aws_outposts_outpost_instance_type_test.go @@ -4,6 +4,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/outposts" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,6 +13,7 @@ func TestAccAWSOutpostsOutpostInstanceTypeDataSource_InstanceType(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -30,6 +32,7 @@ func TestAccAWSOutpostsOutpostInstanceTypeDataSource_PreferredInstanceTypes(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_outposts_outpost_instance_types_test.go b/aws/data_source_aws_outposts_outpost_instance_types_test.go index be5e3b1cd825..eaed60144e17 100644 --- a/aws/data_source_aws_outposts_outpost_instance_types_test.go +++ b/aws/data_source_aws_outposts_outpost_instance_types_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/outposts" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -13,6 +14,7 @@ func TestAccAWSOutpostsOutpostInstanceTypesDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_outposts_outpost_test.go b/aws/data_source_aws_outposts_outpost_test.go index c4bc6899ac44..4651a7a75991 100644 --- a/aws/data_source_aws_outposts_outpost_test.go +++ b/aws/data_source_aws_outposts_outpost_test.go @@ -4,6 +4,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/outposts" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,6 +13,7 @@ func TestAccAWSOutpostsOutpostDataSource_Id(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -37,6 +39,7 @@ func TestAccAWSOutpostsOutpostDataSource_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -62,6 +65,7 @@ func TestAccAWSOutpostsOutpostDataSource_Arn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_outposts_outposts_test.go b/aws/data_source_aws_outposts_outposts_test.go index 8c64f4dd36e4..cb2da8da7d2c 100644 --- a/aws/data_source_aws_outposts_outposts_test.go +++ b/aws/data_source_aws_outposts_outposts_test.go @@ -14,6 +14,7 @@ func TestAccAWSOutpostsOutpostsDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_outposts_site_test.go b/aws/data_source_aws_outposts_site_test.go index 491e015b1dab..ec8778c82f8c 100644 --- a/aws/data_source_aws_outposts_site_test.go +++ b/aws/data_source_aws_outposts_site_test.go @@ -4,6 +4,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/outposts" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,6 +13,7 @@ func TestAccAWSOutpostsSiteDataSource_Id(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsSites(t) }, + ErrorCheck: testAccErrorCheck(t, outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -34,6 +36,7 @@ func TestAccAWSOutpostsSiteDataSource_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsSites(t) }, + ErrorCheck: testAccErrorCheck(t, outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_outposts_sites_test.go b/aws/data_source_aws_outposts_sites_test.go index e5a2dbce1da5..ec52762b696f 100644 --- a/aws/data_source_aws_outposts_sites_test.go +++ b/aws/data_source_aws_outposts_sites_test.go @@ -14,6 +14,7 @@ func TestAccAWSOutpostsSitesDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsSites(t) }, + ErrorCheck: testAccErrorCheck(t, outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_partition_test.go b/aws/data_source_aws_partition_test.go index f23951978dd1..eaa1d576be51 100644 --- a/aws/data_source_aws_partition_test.go +++ b/aws/data_source_aws_partition_test.go @@ -10,8 +10,9 @@ import ( func TestAccAWSPartition_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsPartitionConfig_basic, diff --git a/aws/data_source_aws_prefix_list_test.go b/aws/data_source_aws_prefix_list_test.go index 4c5304e7d9c1..a28adc29b796 100644 --- a/aws/data_source_aws_prefix_list_test.go +++ b/aws/data_source_aws_prefix_list_test.go @@ -14,8 +14,9 @@ import ( func TestAccDataSourceAwsPrefixList_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsPrefixListConfig, @@ -30,8 +31,9 @@ func TestAccDataSourceAwsPrefixList_basic(t *testing.T) { func TestAccDataSourceAwsPrefixList_filter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsPrefixListConfigFilter, @@ -46,8 +48,9 @@ func TestAccDataSourceAwsPrefixList_filter(t *testing.T) { func TestAccDataSourceAwsPrefixList_nameDoesNotOverrideFilter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsPrefixListConfig_nameDoesNotOverrideFilter, diff --git a/aws/data_source_aws_pricing_product_test.go b/aws/data_source_aws_pricing_product_test.go index 46ea0cded56c..33c215fe3a9f 100644 --- a/aws/data_source_aws_pricing_product_test.go +++ b/aws/data_source_aws_pricing_product_test.go @@ -5,6 +5,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/pricing" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -12,6 +13,7 @@ import ( func TestAccDataSourceAwsPricingProduct_ec2(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckPricing(t) }, + ErrorCheck: testAccErrorCheck(t, pricing.EndpointsID), ProviderFactories: testAccProviderFactories, Steps: []resource.TestStep{ { @@ -28,6 +30,7 @@ func TestAccDataSourceAwsPricingProduct_ec2(t *testing.T) { func TestAccDataSourceAwsPricingProduct_redshift(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckPricing(t) }, + ErrorCheck: testAccErrorCheck(t, pricing.EndpointsID), ProviderFactories: testAccProviderFactories, Steps: []resource.TestStep{ { diff --git a/aws/data_source_aws_qldb_ledger_test.go b/aws/data_source_aws_qldb_ledger_test.go index e2b1b0a8fd0c..8abfa6173bc6 100644 --- a/aws/data_source_aws_qldb_ledger_test.go +++ b/aws/data_source_aws_qldb_ledger_test.go @@ -13,8 +13,9 @@ func TestAccDataSourceAwsQLDBLedger_basic(t *testing.T) { rName := fmt.Sprintf("tf-acc-test-%s", acctest.RandString(7)) // QLDB name cannot be longer than 32 characters resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(qldb.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(qldb.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, qldb.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsQLDBLedgerConfig(rName), diff --git a/aws/data_source_aws_ram_resource_share_test.go b/aws/data_source_aws_ram_resource_share_test.go index 9e304bd91e84..81b46bcecf2d 100644 --- a/aws/data_source_aws_ram_resource_share_test.go +++ b/aws/data_source_aws_ram_resource_share_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ram" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAwsRamResourceShare_basic(t *testing.T) { datasourceName := "data.aws_ram_resource_share.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ram.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRamResourceShareConfig_NonExistent, @@ -40,8 +42,9 @@ func TestAccDataSourceAwsRamResourceShare_Tags(t *testing.T) { datasourceName := "data.aws_ram_resource_share.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ram.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRamResourceShareConfig_Tags(rName), diff --git a/aws/data_source_aws_rds_certificate_test.go b/aws/data_source_aws_rds_certificate_test.go index 0d3a630217df..31aca530c240 100644 --- a/aws/data_source_aws_rds_certificate_test.go +++ b/aws/data_source_aws_rds_certificate_test.go @@ -13,6 +13,7 @@ func TestAccAWSRDSCertificateDataSource_Id(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRDSCertificatePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -31,6 +32,7 @@ func TestAccAWSRDSCertificateDataSource_LatestValidTill(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRDSCertificatePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_rds_cluster_test.go b/aws/data_source_aws_rds_cluster_test.go index fe4d956d078d..701ca1ad5472 100644 --- a/aws/data_source_aws_rds_cluster_test.go +++ b/aws/data_source_aws_rds_cluster_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/rds" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAWSRDSCluster_basic(t *testing.T) { resourceName := "aws_rds_cluster.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRdsClusterConfigBasic(clusterName), diff --git a/aws/data_source_aws_rds_engine_version_test.go b/aws/data_source_aws_rds_engine_version_test.go index ae24f8358fba..cfe939a69702 100644 --- a/aws/data_source_aws_rds_engine_version_test.go +++ b/aws/data_source_aws_rds_engine_version_test.go @@ -18,6 +18,7 @@ func TestAccAWSRDSEngineVersionDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRDSEngineVersionPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSRDSEngineVersionDataSource_upgradeTargets(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRDSEngineVersionPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -70,6 +72,7 @@ func TestAccAWSRDSEngineVersionDataSource_preferred(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRDSEngineVersionPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -88,6 +91,7 @@ func TestAccAWSRDSEngineVersionDataSource_defaultOnly(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRDSEngineVersionPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_rds_orderable_db_instance_test.go b/aws/data_source_aws_rds_orderable_db_instance_test.go index 0e7cacd68294..faa7622eb773 100644 --- a/aws/data_source_aws_rds_orderable_db_instance_test.go +++ b/aws/data_source_aws_rds_orderable_db_instance_test.go @@ -19,6 +19,7 @@ func TestAccAWSRdsOrderableDbInstanceDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRdsOrderableDbInstancePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -42,6 +43,7 @@ func TestAccAWSRdsOrderableDbInstanceDataSource_preferredClass(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRdsOrderableDbInstancePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -61,6 +63,7 @@ func TestAccAWSRdsOrderableDbInstanceDataSource_preferredVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRdsOrderableDbInstancePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -81,6 +84,7 @@ func TestAccAWSRdsOrderableDbInstanceDataSource_preferredClassAndVersion(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRdsOrderableDbInstancePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -100,6 +104,7 @@ func TestAccAWSRdsOrderableDbInstanceDataSource_supportsEnhancedMonitoring(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRdsOrderableDbInstancePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -118,6 +123,7 @@ func TestAccAWSRdsOrderableDbInstanceDataSource_supportsIAMDatabaseAuthenticatio resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRdsOrderableDbInstancePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -136,6 +142,7 @@ func TestAccAWSRdsOrderableDbInstanceDataSource_supportsIops(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRdsOrderableDbInstancePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -154,6 +161,7 @@ func TestAccAWSRdsOrderableDbInstanceDataSource_supportsKerberosAuthentication(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRdsOrderableDbInstancePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -176,6 +184,7 @@ func TestAccAWSRdsOrderableDbInstanceDataSource_supportsPerformanceInsights(t *t testAccAWSRdsOrderableDbInstancePreCheck(t) testAccRDSPerformanceInsightsDefaultVersionPreCheck(t, "mysql") }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -194,6 +203,7 @@ func TestAccAWSRdsOrderableDbInstanceDataSource_supportsStorageAutoscaling(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRdsOrderableDbInstancePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -212,6 +222,7 @@ func TestAccAWSRdsOrderableDbInstanceDataSource_supportsStorageEncryption(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRdsOrderableDbInstancePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_redshift_cluster_test.go b/aws/data_source_aws_redshift_cluster_test.go index 5d91358d91ee..34fd5c2f130c 100644 --- a/aws/data_source_aws_redshift_cluster_test.go +++ b/aws/data_source_aws_redshift_cluster_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/redshift" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -11,8 +12,9 @@ import ( func TestAccAWSDataSourceRedshiftCluster_basic(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAWSDataSourceRedshiftClusterConfig(rInt), @@ -44,8 +46,9 @@ func TestAccAWSDataSourceRedshiftCluster_basic(t *testing.T) { func TestAccAWSDataSourceRedshiftCluster_vpc(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAWSDataSourceRedshiftClusterConfigWithVpc(rInt), @@ -63,8 +66,9 @@ func TestAccAWSDataSourceRedshiftCluster_vpc(t *testing.T) { func TestAccAWSDataSourceRedshiftCluster_logging(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAWSDataSourceRedshiftClusterConfigWithLogging(rInt), diff --git a/aws/data_source_aws_redshift_orderable_cluster_test.go b/aws/data_source_aws_redshift_orderable_cluster_test.go index 48ba04454c0f..6b0d606d7a58 100644 --- a/aws/data_source_aws_redshift_orderable_cluster_test.go +++ b/aws/data_source_aws_redshift_orderable_cluster_test.go @@ -14,6 +14,7 @@ func TestAccAWSRedshiftOrderableClusterDataSource_ClusterType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRedshiftOrderableClusterPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -32,6 +33,7 @@ func TestAccAWSRedshiftOrderableClusterDataSource_ClusterVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRedshiftOrderableClusterPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -51,6 +53,7 @@ func TestAccAWSRedshiftOrderableClusterDataSource_NodeType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRedshiftOrderableClusterPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -70,6 +73,7 @@ func TestAccAWSRedshiftOrderableClusterDataSource_PreferredNodeTypes(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAWSRedshiftOrderableClusterPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_redshift_service_account.go b/aws/data_source_aws_redshift_service_account.go index bcd877cbeac1..efd2c731a18a 100644 --- a/aws/data_source_aws_redshift_service_account.go +++ b/aws/data_source_aws_redshift_service_account.go @@ -16,7 +16,7 @@ var redshiftServiceAccountPerRegionMap = map[string]string{ endpoints.ApEast1RegionID: "313564881002", endpoints.ApNortheast1RegionID: "404641285394", endpoints.ApNortheast2RegionID: "760740231472", - "ap-northeast-3": "090321488786", //lintignore:AWSAT003 // https://github.com/aws/aws-sdk-go/issues/1863 + endpoints.ApNortheast3RegionID: "090321488786", endpoints.ApSouth1RegionID: "865932855811", endpoints.ApSoutheast1RegionID: "361669875840", endpoints.ApSoutheast2RegionID: "762762565011", diff --git a/aws/data_source_aws_redshift_service_account_test.go b/aws/data_source_aws_redshift_service_account_test.go index 3e6d2be4bba2..7218d1cb301c 100644 --- a/aws/data_source_aws_redshift_service_account_test.go +++ b/aws/data_source_aws_redshift_service_account_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/redshift" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,8 +13,9 @@ func TestAccAWSRedshiftServiceAccount_basic(t *testing.T) { dataSourceName := "data.aws_redshift_service_account.main" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsRedshiftServiceAccountConfig, @@ -32,8 +34,9 @@ func TestAccAWSRedshiftServiceAccount_Region(t *testing.T) { dataSourceName := "data.aws_redshift_service_account.regional" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, redshift.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsRedshiftServiceAccountExplicitRegionConfig, diff --git a/aws/data_source_aws_region_test.go b/aws/data_source_aws_region_test.go index 11a847dba41c..54a29f005153 100644 --- a/aws/data_source_aws_region_test.go +++ b/aws/data_source_aws_region_test.go @@ -77,8 +77,9 @@ func TestAccDataSourceAwsRegion_basic(t *testing.T) { dataSourceName := "data.aws_region.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRegionConfig_empty, @@ -96,8 +97,9 @@ func TestAccDataSourceAwsRegion_endpoint(t *testing.T) { dataSourceName := "data.aws_region.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRegionConfig_endpoint(), @@ -115,8 +117,9 @@ func TestAccDataSourceAwsRegion_endpointAndName(t *testing.T) { dataSourceName := "data.aws_region.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRegionConfig_endpointAndName(), @@ -134,8 +137,9 @@ func TestAccDataSourceAwsRegion_name(t *testing.T) { dataSourceName := "data.aws_region.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRegionConfig_name(), diff --git a/aws/data_source_aws_regions_test.go b/aws/data_source_aws_regions_test.go index b4a3c0803320..e68e812b06dc 100644 --- a/aws/data_source_aws_regions_test.go +++ b/aws/data_source_aws_regions_test.go @@ -5,6 +5,7 @@ import ( "strconv" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -13,8 +14,9 @@ func TestAccDataSourceAwsRegions_basic(t *testing.T) { resourceName := "data.aws_regions.empty" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRegionsConfig_empty(), @@ -31,8 +33,9 @@ func TestAccDataSourceAwsRegions_Filter(t *testing.T) { resourceName := "data.aws_regions.opt_in_status" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRegionsConfig_allRegionsFiltered("opt-in-not-required"), @@ -48,8 +51,9 @@ func TestAccDataSourceAwsRegions_AllRegions(t *testing.T) { resourceAllRegions := "data.aws_regions.all_regions" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRegionsConfig_allRegions(), diff --git a/aws/data_source_aws_route.go b/aws/data_source_aws_route.go index 3d34bc11cd94..0a3afb6225c1 100644 --- a/aws/data_source_aws_route.go +++ b/aws/data_source_aws_route.go @@ -2,10 +2,12 @@ package aws import ( "fmt" - "log" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + tfec2 "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2/finder" ) func dataSourceAwsRoute() *schema.Resource { @@ -17,6 +19,10 @@ func dataSourceAwsRoute() *schema.Resource { Type: schema.TypeString, Required: true, }, + + /// + // Destinations. + /// "destination_cidr_block": { Type: schema.TypeString, Optional: true, @@ -27,6 +33,15 @@ func dataSourceAwsRoute() *schema.Resource { Optional: true, Computed: true, }, + + // + // Targets. + // + "carrier_gateway_id": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, "egress_only_gateway_id": { Type: schema.TypeString, Optional: true, @@ -42,27 +57,27 @@ func dataSourceAwsRoute() *schema.Resource { Optional: true, Computed: true, }, - "nat_gateway_id": { + "local_gateway_id": { Type: schema.TypeString, Optional: true, Computed: true, }, - "local_gateway_id": { + "nat_gateway_id": { Type: schema.TypeString, Optional: true, Computed: true, }, - "transit_gateway_id": { + "network_interface_id": { Type: schema.TypeString, Optional: true, Computed: true, }, - "vpc_peering_connection_id": { + "transit_gateway_id": { Type: schema.TypeString, Optional: true, Computed: true, }, - "network_interface_id": { + "vpc_peering_connection_id": { Type: schema.TypeString, Optional: true, Computed: true, @@ -73,63 +88,19 @@ func dataSourceAwsRoute() *schema.Resource { func dataSourceAwsRouteRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn - req := &ec2.DescribeRouteTablesInput{} - rtbId := d.Get("route_table_id") - cidr := d.Get("destination_cidr_block") - ipv6Cidr := d.Get("destination_ipv6_cidr_block") - - req.Filters = buildEC2AttributeFilterList( - map[string]string{ - "route-table-id": rtbId.(string), - "route.destination-cidr-block": cidr.(string), - "route.destination-ipv6-cidr-block": ipv6Cidr.(string), - }, - ) - log.Printf("[DEBUG] Reading Route Table: %s", req) - resp, err := conn.DescribeRouteTables(req) - if err != nil { - return err - } - if resp == nil || len(resp.RouteTables) == 0 { - return fmt.Errorf("Your query returned no results. Please change your search criteria and try again.") - } - if len(resp.RouteTables) > 1 { - return fmt.Errorf("Your query returned more than one route table. Please change your search criteria and try again.") - } + routeTableID := d.Get("route_table_id").(string) - results := getRoutes(resp.RouteTables[0], d) + routeTable, err := finder.RouteTableByID(conn, routeTableID) - if len(results) == 0 { - return fmt.Errorf("No routes matching supplied arguments found in table(s)") - } - if len(results) > 1 { - return fmt.Errorf("Multiple routes matched; use additional constraints to reduce matches to a single route") + if err != nil { + return fmt.Errorf("error reading Route Table (%s): %w", routeTableID, err) } - route := results[0] - - d.SetId(resourceAwsRouteID(d, route)) // using function from "resource_aws_route.go" - d.Set("destination_cidr_block", route.DestinationCidrBlock) - d.Set("destination_ipv6_cidr_block", route.DestinationIpv6CidrBlock) - d.Set("egress_only_gateway_id", route.EgressOnlyInternetGatewayId) - d.Set("gateway_id", route.GatewayId) - d.Set("instance_id", route.InstanceId) - d.Set("nat_gateway_id", route.NatGatewayId) - d.Set("local_gateway_id", route.LocalGatewayId) - d.Set("transit_gateway_id", route.TransitGatewayId) - d.Set("vpc_peering_connection_id", route.VpcPeeringConnectionId) - d.Set("network_interface_id", route.NetworkInterfaceId) - return nil -} + routes := []*ec2.Route{} -func getRoutes(table *ec2.RouteTable, d *schema.ResourceData) []*ec2.Route { - ec2Routes := table.Routes - routes := make([]*ec2.Route, 0, len(ec2Routes)) - // Loop through the routes and add them to the set - for _, r := range ec2Routes { - - if r.Origin != nil && *r.Origin == "EnableVgwRoutePropagation" { + for _, r := range routeTable.Routes { + if aws.StringValue(r.Origin) == ec2.RouteOriginEnableVgwRoutePropagation { continue } @@ -139,66 +110,80 @@ func getRoutes(table *ec2.RouteTable, d *schema.ResourceData) []*ec2.Route { continue } - if v, ok := d.GetOk("destination_cidr_block"); ok { - if r.DestinationCidrBlock == nil || *r.DestinationCidrBlock != v.(string) { - continue - } + if v, ok := d.GetOk("destination_cidr_block"); ok && aws.StringValue(r.DestinationCidrBlock) != v.(string) { + continue } - if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { - if r.DestinationIpv6CidrBlock == nil || *r.DestinationIpv6CidrBlock != v.(string) { - continue - } + if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok && aws.StringValue(r.DestinationIpv6CidrBlock) != v.(string) { + continue } - if v, ok := d.GetOk("egress_only_gateway_id"); ok { - if r.EgressOnlyInternetGatewayId == nil || *r.EgressOnlyInternetGatewayId != v.(string) { - continue - } + if v, ok := d.GetOk("carrier_gateway_id"); ok && aws.StringValue(r.CarrierGatewayId) != v.(string) { + continue } - if v, ok := d.GetOk("gateway_id"); ok { - if r.GatewayId == nil || *r.GatewayId != v.(string) { - continue - } + if v, ok := d.GetOk("egress_only_gateway_id"); ok && aws.StringValue(r.EgressOnlyInternetGatewayId) != v.(string) { + continue } - if v, ok := d.GetOk("instance_id"); ok { - if r.InstanceId == nil || *r.InstanceId != v.(string) { - continue - } + if v, ok := d.GetOk("gateway_id"); ok && aws.StringValue(r.GatewayId) != v.(string) { + continue + } + + if v, ok := d.GetOk("instance_id"); ok && aws.StringValue(r.InstanceId) != v.(string) { + continue } - if v, ok := d.GetOk("nat_gateway_id"); ok { - if r.NatGatewayId == nil || *r.NatGatewayId != v.(string) { - continue - } + if v, ok := d.GetOk("local_gateway_id"); ok && aws.StringValue(r.LocalGatewayId) != v.(string) { + continue } - if v, ok := d.GetOk("local_gateway_id"); ok { - if r.LocalGatewayId == nil || *r.LocalGatewayId != v.(string) { - continue - } + if v, ok := d.GetOk("nat_gateway_id"); ok && aws.StringValue(r.NatGatewayId) != v.(string) { + continue } - if v, ok := d.GetOk("transit_gateway_id"); ok { - if r.TransitGatewayId == nil || *r.TransitGatewayId != v.(string) { - continue - } + if v, ok := d.GetOk("network_interface_id"); ok && aws.StringValue(r.NetworkInterfaceId) != v.(string) { + continue } - if v, ok := d.GetOk("vpc_peering_connection_id"); ok { - if r.VpcPeeringConnectionId == nil || *r.VpcPeeringConnectionId != v.(string) { - continue - } + if v, ok := d.GetOk("transit_gateway_id"); ok && aws.StringValue(r.TransitGatewayId) != v.(string) { + continue } - if v, ok := d.GetOk("network_interface_id"); ok { - if r.NetworkInterfaceId == nil || *r.NetworkInterfaceId != v.(string) { - continue - } + if v, ok := d.GetOk("vpc_peering_connection_id"); ok && aws.StringValue(r.VpcPeeringConnectionId) != v.(string) { + continue } + routes = append(routes, r) } - return routes + + if len(routes) == 0 { + return fmt.Errorf("No routes matching supplied arguments found in Route Table (%s)", routeTableID) + } + + if len(routes) > 1 { + return fmt.Errorf("%d routes matched in Route Table (%s); use additional constraints to reduce matches to a single route", len(routes), routeTableID) + } + + route := routes[0] + + if destination := aws.StringValue(route.DestinationCidrBlock); destination != "" { + d.SetId(tfec2.RouteCreateID(routeTableID, destination)) + } else if destination := aws.StringValue(route.DestinationIpv6CidrBlock); destination != "" { + d.SetId(tfec2.RouteCreateID(routeTableID, destination)) + } + + d.Set("carrier_gateway_id", route.CarrierGatewayId) + d.Set("destination_cidr_block", route.DestinationCidrBlock) + d.Set("destination_ipv6_cidr_block", route.DestinationIpv6CidrBlock) + d.Set("egress_only_gateway_id", route.EgressOnlyInternetGatewayId) + d.Set("gateway_id", route.GatewayId) + d.Set("instance_id", route.InstanceId) + d.Set("local_gateway_id", route.LocalGatewayId) + d.Set("nat_gateway_id", route.NatGatewayId) + d.Set("network_interface_id", route.NetworkInterfaceId) + d.Set("transit_gateway_id", route.TransitGatewayId) + d.Set("vpc_peering_connection_id", route.VpcPeeringConnectionId) + + return nil } diff --git a/aws/data_source_aws_route53_delegation_set_test.go b/aws/data_source_aws_route53_delegation_set_test.go index 337118822d75..0f69e70e3057 100644 --- a/aws/data_source_aws_route53_delegation_set_test.go +++ b/aws/data_source_aws_route53_delegation_set_test.go @@ -4,6 +4,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/route53" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,7 +14,7 @@ func TestAccAWSRoute53DelegationSetDataSource_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, Steps: []resource.TestStep{ { diff --git a/aws/data_source_aws_route53_resolver_endpoint_test.go b/aws/data_source_aws_route53_resolver_endpoint_test.go index 8c7cccbb0166..bbcb9ddc621e 100644 --- a/aws/data_source_aws_route53_resolver_endpoint_test.go +++ b/aws/data_source_aws_route53_resolver_endpoint_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/route53resolver" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -18,7 +19,7 @@ func TestAccAWSRoute53ResolverEndpointDataSource_Basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, Steps: []resource.TestStep{ { @@ -47,7 +48,7 @@ func TestAccAWSRoute53ResolverEndpointDataSource_Filter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, Steps: []resource.TestStep{ { diff --git a/aws/data_source_aws_route53_resolver_rule_test.go b/aws/data_source_aws_route53_resolver_rule_test.go index adc1324a0452..5774911ad258 100644 --- a/aws/data_source_aws_route53_resolver_rule_test.go +++ b/aws/data_source_aws_route53_resolver_rule_test.go @@ -4,11 +4,16 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/route53resolver" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" ) +func init() { + RegisterServiceErrorCheckFunc(route53resolver.EndpointsID, testAccErrorCheckSkipRoute53) +} + func TestAccAWSRoute53ResolverRuleDataSource_basic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_route53_resolver_rule.example" @@ -18,7 +23,7 @@ func TestAccAWSRoute53ResolverRuleDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, Steps: []resource.TestStep{ { @@ -69,7 +74,7 @@ func TestAccAWSRoute53ResolverRuleDataSource_ResolverEndpointIdWithTags(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, Steps: []resource.TestStep{ { @@ -106,7 +111,7 @@ func TestAccAWSRoute53ResolverRuleDataSource_SharedByMe(t *testing.T) { testAccAlternateAccountPreCheck(t) testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), Steps: []resource.TestStep{ { @@ -144,7 +149,7 @@ func TestAccAWSRoute53ResolverRuleDataSource_SharedWithMe(t *testing.T) { testAccAlternateAccountPreCheck(t) testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), Steps: []resource.TestStep{ { diff --git a/aws/data_source_aws_route53_resolver_rules_test.go b/aws/data_source_aws_route53_resolver_rules_test.go index e22287e880b9..213a82d046dc 100644 --- a/aws/data_source_aws_route53_resolver_rules_test.go +++ b/aws/data_source_aws_route53_resolver_rules_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/route53resolver" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,7 +14,7 @@ func TestAccAWSRoute53ResolverRulesDataSource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, Steps: []resource.TestStep{ { @@ -36,7 +37,7 @@ func TestAccAWSRoute53ResolverRulesDataSource_ResolverEndpointId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, Steps: []resource.TestStep{ { diff --git a/aws/data_source_aws_route53_zone_test.go b/aws/data_source_aws_route53_zone_test.go index 5e504e8418ac..dcdcc6063135 100644 --- a/aws/data_source_aws_route53_zone_test.go +++ b/aws/data_source_aws_route53_zone_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/aws/aws-sdk-go/service/servicediscovery" + "github.com/aws/aws-sdk-go/service/route53" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -16,7 +16,7 @@ func TestAccAWSRoute53ZoneDataSource_id(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -40,7 +40,7 @@ func TestAccAWSRoute53ZoneDataSource_name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -64,7 +64,7 @@ func TestAccAWSRoute53ZoneDataSource_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -88,7 +88,7 @@ func TestAccAWSRoute53ZoneDataSource_vpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -111,8 +111,8 @@ func TestAccAWSRoute53ZoneDataSource_serviceDiscovery(t *testing.T) { dataSourceName := "data.aws_route53_zone.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicediscovery.EndpointsID, t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck("servicediscovery", t) }, + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_route_table_test.go b/aws/data_source_aws_route_table_test.go index 49672939e369..fb52049ba024 100644 --- a/aws/data_source_aws_route_table_test.go +++ b/aws/data_source_aws_route_table_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -22,8 +23,9 @@ func TestAccDataSourceAwsRouteTable_basic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRouteTableConfigBasic(rName), @@ -99,8 +101,9 @@ func TestAccDataSourceAwsRouteTable_main(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRouteTableConfigMain(rName), diff --git a/aws/data_source_aws_route_tables_test.go b/aws/data_source_aws_route_tables_test.go index 710f47f8d906..abbcd124f439 100644 --- a/aws/data_source_aws_route_tables_test.go +++ b/aws/data_source_aws_route_tables_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,6 +13,7 @@ func TestAccDataSourceAwsRouteTables_basic(t *testing.T) { rInt := acctest.RandIntRange(0, 256) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_route_test.go b/aws/data_source_aws_route_test.go index f1a97b41cb31..6a6228378db0 100644 --- a/aws/data_source_aws_route_test.go +++ b/aws/data_source_aws_route_test.go @@ -21,8 +21,9 @@ func TestAccAWSRouteDataSource_basic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsRouteConfigBasic(rName), @@ -47,20 +48,19 @@ func TestAccAWSRouteDataSource_basic(t *testing.T) { } func TestAccAWSRouteDataSource_TransitGatewayID(t *testing.T) { - var route ec2.Route dataSourceName := "data.aws_route.test" resourceName := "aws_route.test" rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { Config: testAccAWSRouteDataSourceConfigIpv4TransitGateway(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists(resourceName, &route), resource.TestCheckResourceAttrPair(resourceName, "destination_cidr_block", dataSourceName, "destination_cidr_block"), resource.TestCheckResourceAttrPair(resourceName, "route_table_id", dataSourceName, "route_table_id"), resource.TestCheckResourceAttrPair(resourceName, "transit_gateway_id", dataSourceName, "transit_gateway_id"), @@ -77,6 +77,7 @@ func TestAccAWSRouteDataSource_IPv6DestinationCidr(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ @@ -92,20 +93,19 @@ func TestAccAWSRouteDataSource_IPv6DestinationCidr(t *testing.T) { } func TestAccAWSRouteDataSource_LocalGatewayID(t *testing.T) { - var route ec2.Route dataSourceName := "data.aws_route.by_local_gateway_id" resourceName := "aws_route.test" rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { Config: testAccAWSRouteDataSourceConfigIpv4LocalGateway(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists(resourceName, &route), resource.TestCheckResourceAttrPair(resourceName, "destination_cidr_block", dataSourceName, "destination_cidr_block"), resource.TestCheckResourceAttrPair(resourceName, "route_table_id", dataSourceName, "route_table_id"), resource.TestCheckResourceAttrPair(resourceName, "local_gateway_id", dataSourceName, "local_gateway_id"), @@ -115,6 +115,29 @@ func TestAccAWSRouteDataSource_LocalGatewayID(t *testing.T) { }) } +func TestAccAWSRouteDataSource_CarrierGatewayID(t *testing.T) { + dataSourceName := "data.aws_route.test" + resourceName := "aws_route.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWavelengthZoneAvailable(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteDataSourceConfigIpv4CarrierGateway(rName), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrPair(resourceName, "destination_cidr_block", dataSourceName, "destination_cidr_block"), + resource.TestCheckResourceAttrPair(resourceName, "route_table_id", dataSourceName, "route_table_id"), + resource.TestCheckResourceAttrPair(resourceName, "carrier_gateway_id", dataSourceName, "carrier_gateway_id"), + ), + }, + }, + }) +} + func testAccDataSourceAwsRouteConfigBasic(rName string) string { return composeConfig( testAccLatestAmazonLinuxHvmEbsAmiConfig(), @@ -352,3 +375,42 @@ data "aws_route" "by_local_gateway_id" { } `, rName) } + +func testAccAWSRouteDataSourceConfigIpv4CarrierGateway(rName string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.0.0.0/16" + + tags = { + Name = %[1]q + } +} + +resource "aws_ec2_carrier_gateway" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route" "test" { + destination_cidr_block = "0.0.0.0/0" + route_table_id = aws_route_table.test.id + carrier_gateway_id = aws_ec2_carrier_gateway.test.id +} + +data "aws_route" "test" { + route_table_id = aws_route.test.route_table_id + carrier_gateway_id = aws_route.test.carrier_gateway_id +} +`, rName) +} diff --git a/aws/data_source_aws_s3_bucket_object_test.go b/aws/data_source_aws_s3_bucket_object_test.go index dc555b570c9b..9c67dd70a519 100644 --- a/aws/data_source_aws_s3_bucket_object_test.go +++ b/aws/data_source_aws_s3_bucket_object_test.go @@ -26,6 +26,7 @@ func TestAccDataSourceAWSS3BucketObject_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -57,8 +58,9 @@ func TestAccDataSourceAWSS3BucketObject_basicViaAccessPoint(t *testing.T) { accessPointResourceName := "aws_s3_access_point.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAWSDataSourceS3ObjectConfig_basicViaAccessPoint(rName), @@ -85,6 +87,7 @@ func TestAccDataSourceAWSS3BucketObject_readableBody(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -118,6 +121,7 @@ func TestAccDataSourceAWSS3BucketObject_kmsEncrypted(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -153,6 +157,7 @@ func TestAccDataSourceAWSS3BucketObject_allParams(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -202,6 +207,7 @@ func TestAccDataSourceAWSS3BucketObject_ObjectLockLegalHoldOff(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -236,6 +242,7 @@ func TestAccDataSourceAWSS3BucketObject_ObjectLockLegalHoldOn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -272,6 +279,7 @@ func TestAccDataSourceAWSS3BucketObject_LeadingSlash(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -325,6 +333,7 @@ func TestAccDataSourceAWSS3BucketObject_MultipleSlashes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -366,6 +375,7 @@ func TestAccDataSourceAWSS3BucketObject_SingleSlashAsKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_s3_bucket_objects_test.go b/aws/data_source_aws_s3_bucket_objects_test.go index f97f3adfd034..385a7b089a0a 100644 --- a/aws/data_source_aws_s3_bucket_objects_test.go +++ b/aws/data_source_aws_s3_bucket_objects_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/s3" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -14,6 +15,7 @@ func TestAccDataSourceAWSS3BucketObjects_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -39,6 +41,7 @@ func TestAccDataSourceAWSS3BucketObjects_basicViaAccessPoint(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -64,6 +67,7 @@ func TestAccDataSourceAWSS3BucketObjects_all(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -94,6 +98,7 @@ func TestAccDataSourceAWSS3BucketObjects_prefixes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -123,6 +128,7 @@ func TestAccDataSourceAWSS3BucketObjects_encoded(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -148,6 +154,7 @@ func TestAccDataSourceAWSS3BucketObjects_maxKeys(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -173,6 +180,7 @@ func TestAccDataSourceAWSS3BucketObjects_startAfter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ @@ -197,6 +205,7 @@ func TestAccDataSourceAWSS3BucketObjects_fetchOwner(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, PreventPostDestroyRefresh: true, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_s3_bucket_test.go b/aws/data_source_aws_s3_bucket_test.go index bcf5d4b1da0a..42cea10b5778 100644 --- a/aws/data_source_aws_s3_bucket_test.go +++ b/aws/data_source_aws_s3_bucket_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/s3" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceS3Bucket_basic(t *testing.T) { hostedZoneID, _ := HostedZoneIDForRegion(region) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAWSDataSourceS3BucketConfig_basic(bucketName), @@ -38,8 +40,9 @@ func TestAccDataSourceS3Bucket_website(t *testing.T) { region := testAccGetRegion() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAWSDataSourceS3BucketWebsiteConfig(bucketName), diff --git a/aws/data_source_aws_sagemaker_prebuilt_ecr_image_test.go b/aws/data_source_aws_sagemaker_prebuilt_ecr_image_test.go index b50bde85dd75..8c8a8c5cc63b 100644 --- a/aws/data_source_aws_sagemaker_prebuilt_ecr_image_test.go +++ b/aws/data_source_aws_sagemaker_prebuilt_ecr_image_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/sagemaker" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,8 +13,9 @@ func TestAccAWSSageMakerPrebuiltECRImage_basic(t *testing.T) { dataSourceName := "data.aws_sagemaker_prebuilt_ecr_image.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsSageMakerPrebuiltECRImageConfig, @@ -33,8 +35,9 @@ func TestAccAWSSageMakerPrebuiltECRImage_region(t *testing.T) { dataSourceName := "data.aws_sagemaker_prebuilt_ecr_image.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsSageMakerPrebuiltECRImageExplicitRegionConfig, diff --git a/aws/data_source_aws_secretsmanager_secret_rotation_test.go b/aws/data_source_aws_secretsmanager_secret_rotation_test.go index d1b35731d88e..aff33bd113c0 100644 --- a/aws/data_source_aws_secretsmanager_secret_rotation_test.go +++ b/aws/data_source_aws_secretsmanager_secret_rotation_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/secretsmanager" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAwsSecretsManagerSecretRotation_basic(t *testing.T) { datasourceName := "data.aws_secretsmanager_secret_rotation.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSecretsManagerSecretRotationConfig_NonExistent, diff --git a/aws/data_source_aws_secretsmanager_secret_test.go b/aws/data_source_aws_secretsmanager_secret_test.go index cf48bcce885a..6038dbb9fff2 100644 --- a/aws/data_source_aws_secretsmanager_secret_test.go +++ b/aws/data_source_aws_secretsmanager_secret_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/secretsmanager" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -12,8 +13,9 @@ import ( func TestAccDataSourceAwsSecretsManagerSecret_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSecretsManagerSecretConfig_MissingRequired, @@ -37,8 +39,9 @@ func TestAccDataSourceAwsSecretsManagerSecret_ARN(t *testing.T) { datasourceName := "data.aws_secretsmanager_secret.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSecretsManagerSecretConfig_ARN(rName), @@ -56,8 +59,9 @@ func TestAccDataSourceAwsSecretsManagerSecret_Name(t *testing.T) { datasourceName := "data.aws_secretsmanager_secret.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSecretsManagerSecretConfig_Name(rName), @@ -75,8 +79,9 @@ func TestAccDataSourceAwsSecretsManagerSecret_Policy(t *testing.T) { datasourceName := "data.aws_secretsmanager_secret.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSecretsManagerSecretConfig_Policy(rName), diff --git a/aws/data_source_aws_secretsmanager_secret_version_test.go b/aws/data_source_aws_secretsmanager_secret_version_test.go index 83862ed41050..6b9ecb921fa4 100644 --- a/aws/data_source_aws_secretsmanager_secret_version_test.go +++ b/aws/data_source_aws_secretsmanager_secret_version_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/secretsmanager" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -16,8 +17,9 @@ func TestAccDataSourceAwsSecretsManagerSecretVersion_basic(t *testing.T) { datasourceName := "data.aws_secretsmanager_secret_version.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSecretsManagerSecretVersionConfig_NonExistent, @@ -39,8 +41,9 @@ func TestAccDataSourceAwsSecretsManagerSecretVersion_VersionID(t *testing.T) { datasourceName := "data.aws_secretsmanager_secret_version.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSecretsManagerSecretVersionConfig_VersionID(rName), @@ -58,8 +61,9 @@ func TestAccDataSourceAwsSecretsManagerSecretVersion_VersionStage(t *testing.T) datasourceName := "data.aws_secretsmanager_secret_version.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSecretsManagerSecretVersionConfig_VersionStage_Custom(rName), diff --git a/aws/data_source_aws_security_group_test.go b/aws/data_source_aws_security_group_test.go index fe89ea606240..b805b7f6ce23 100644 --- a/aws/data_source_aws_security_group_test.go +++ b/aws/data_source_aws_security_group_test.go @@ -5,6 +5,7 @@ import ( "strings" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -13,8 +14,9 @@ import ( func TestAccDataSourceAwsSecurityGroup_basic(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSecurityGroupConfig(rInt), diff --git a/aws/data_source_aws_security_groups_test.go b/aws/data_source_aws_security_groups_test.go index 646865bc8bee..4e004a4befd1 100644 --- a/aws/data_source_aws_security_groups_test.go +++ b/aws/data_source_aws_security_groups_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,8 +13,9 @@ func TestAccDataSourceAwsSecurityGroups_tag(t *testing.T) { rInt := acctest.RandInt() dataSourceName := "data.aws_security_groups.by_tag" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSecurityGroupsConfig_tag(rInt), @@ -31,8 +33,9 @@ func TestAccDataSourceAwsSecurityGroups_filter(t *testing.T) { rInt := acctest.RandInt() dataSourceName := "data.aws_security_groups.by_filter" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSecurityGroupsConfig_filter(rInt), diff --git a/aws/data_source_aws_serverlessapplicationrepository_application_test.go b/aws/data_source_aws_serverlessapplicationrepository_application_test.go index a22b68bdb52e..c99cd4dc2408 100644 --- a/aws/data_source_aws_serverlessapplicationrepository_application_test.go +++ b/aws/data_source_aws_serverlessapplicationrepository_application_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/serverlessapplicationrepository" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAwsServerlessApplicationRepositoryApplication_Basic(t *tes appARN := testAccAwsServerlessApplicationRepositoryCloudFormationApplicationID() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, serverlessapplicationrepository.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsServerlessApplicationRepositoryApplicationDataSourceConfig(appARN), @@ -35,6 +37,7 @@ func TestAccDataSourceAwsServerlessApplicationRepositoryApplication_Basic(t *tes }, }) } + func TestAccDataSourceAwsServerlessApplicationRepositoryApplication_Versioned(t *testing.T) { datasourceName := "data.aws_serverlessapplicationrepository_application.secrets_manager_postgres_single_user_rotator" appARN := testAccAwsServerlessApplicationRepositoryCloudFormationApplicationID() @@ -45,8 +48,9 @@ func TestAccDataSourceAwsServerlessApplicationRepositoryApplication_Versioned(t ) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, serverlessapplicationrepository.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsServerlessApplicationRepositoryApplicationDataSourceConfig_Versioned(appARN, version1), diff --git a/aws/data_source_aws_servicequotas_service_quota_test.go b/aws/data_source_aws_servicequotas_service_quota_test.go index 0b6ce5f7e0d7..d1fa2ad2d217 100644 --- a/aws/data_source_aws_servicequotas_service_quota_test.go +++ b/aws/data_source_aws_servicequotas_service_quota_test.go @@ -13,8 +13,9 @@ func TestAccAwsServiceQuotasServiceQuotaDataSource_QuotaCode(t *testing.T) { dataSourceName := "data.aws_servicequotas_service_quota.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicequotas.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicequotas.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, servicequotas.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAwsServiceQuotasServiceQuotaDataSourceConfigQuotaCode("vpc", "L-F678F1CE"), @@ -38,8 +39,9 @@ func TestAccAwsServiceQuotasServiceQuotaDataSource_QuotaName(t *testing.T) { dataSourceName := "data.aws_servicequotas_service_quota.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicequotas.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicequotas.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, servicequotas.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAwsServiceQuotasServiceQuotaDataSourceConfigQuotaName("vpc", "VPCs per Region"), diff --git a/aws/data_source_aws_servicequotas_service_test.go b/aws/data_source_aws_servicequotas_service_test.go index 9aa922bc8d96..7979ed3a356b 100644 --- a/aws/data_source_aws_servicequotas_service_test.go +++ b/aws/data_source_aws_servicequotas_service_test.go @@ -12,8 +12,9 @@ func TestAccAwsServiceQuotasServiceDataSource_ServiceName(t *testing.T) { dataSourceName := "data.aws_servicequotas_service.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicequotas.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicequotas.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, servicequotas.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccAwsServiceQuotasServiceDataSourceConfigServiceName("Amazon Virtual Private Cloud (Amazon VPC)"), diff --git a/aws/data_source_aws_sfn_activity_test.go b/aws/data_source_aws_sfn_activity_test.go index 4d107a0b9de7..b7a002ec1733 100644 --- a/aws/data_source_aws_sfn_activity_test.go +++ b/aws/data_source_aws_sfn_activity_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/sfn" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccAWSStepFunctionsActivityDataSource_basic(t *testing.T) { dataName := "data.aws_sfn_activity.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sfn.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAWSStepFunctionsActivityDataSourceConfig_ActivityArn(rName), diff --git a/aws/data_source_aws_sfn_state_machine_test.go b/aws/data_source_aws_sfn_state_machine_test.go index 6d5913461bf3..b4c0cb17d19f 100644 --- a/aws/data_source_aws_sfn_state_machine_test.go +++ b/aws/data_source_aws_sfn_state_machine_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/sfn" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAwsSfnStateMachine_basic(t *testing.T) { resourceName := "aws_sfn_state_machine.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sfn.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSfnStateMachineConfig(rName), diff --git a/aws/data_source_aws_signer_signing_job_test.go b/aws/data_source_aws_signer_signing_job_test.go index 522a40ab2e55..27929e150aff 100644 --- a/aws/data_source_aws_signer_signing_job_test.go +++ b/aws/data_source_aws_signer_signing_job_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/signer" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAWSSignerSigningJob_basic(t *testing.T) { resourceName := "aws_signer_signing_job.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSSignerSigningJobConfigBasic(rName), diff --git a/aws/data_source_aws_signer_signing_profile_test.go b/aws/data_source_aws_signer_signing_profile_test.go index c8f96b41d987..c4a8c9707bc8 100644 --- a/aws/data_source_aws_signer_signing_profile_test.go +++ b/aws/data_source_aws_signer_signing_profile_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/signer" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAWSSignerSigningProfile_basic(t *testing.T) { profileName := fmt.Sprintf("tf_acc_sp_basic_%s", rString) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSSignerSigningProfileConfigBasic(profileName), diff --git a/aws/data_source_aws_sns_test.go b/aws/data_source_aws_sns_test.go index 00ccb8f6ae2d..b8ed1d3c8287 100644 --- a/aws/data_source_aws_sns_test.go +++ b/aws/data_source_aws_sns_test.go @@ -4,14 +4,16 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/sns" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccDataSourceAwsSnsTopic_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSnsTopicConfig, diff --git a/aws/data_source_aws_sqs_queue_test.go b/aws/data_source_aws_sqs_queue_test.go index eb710cca0a45..602671d943c3 100644 --- a/aws/data_source_aws_sqs_queue_test.go +++ b/aws/data_source_aws_sqs_queue_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/sqs" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -15,8 +16,9 @@ func TestAccDataSourceAwsSqsQueue_basic(t *testing.T) { datasourceName := "data.aws_sqs_queue.by_name" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSqsQueueConfig(rName), @@ -35,8 +37,9 @@ func TestAccDataSourceAwsSqsQueue_tags(t *testing.T) { datasourceName := "data.aws_sqs_queue.by_name" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSqsQueueConfigTags(rName), diff --git a/aws/data_source_aws_ssm_document_test.go b/aws/data_source_aws_ssm_document_test.go index d2bf0d727e5c..1e86e69a48df 100644 --- a/aws/data_source_aws_ssm_document_test.go +++ b/aws/data_source_aws_ssm_document_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ssm" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccAWSSsmDocumentDataSource_basic(t *testing.T) { name := fmt.Sprintf("test_document-%d", acctest.RandInt()) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsSsmDocumentDataSourceConfig(name, "JSON"), diff --git a/aws/data_source_aws_ssm_parameter_test.go b/aws/data_source_aws_ssm_parameter_test.go index 65c484943fd8..b8f64fd13182 100644 --- a/aws/data_source_aws_ssm_parameter_test.go +++ b/aws/data_source_aws_ssm_parameter_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ssm" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,10 +14,9 @@ func TestAccAWSSsmParameterDataSource_basic(t *testing.T) { name := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsSsmParameterDataSourceConfig(name, "false"), @@ -48,10 +48,9 @@ func TestAccAWSSsmParameterDataSource_fullPath(t *testing.T) { name := acctest.RandomWithPrefix("/tf-acc-test/tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsSsmParameterDataSourceConfig(name, "false"), diff --git a/aws/data_source_aws_ssm_patch_baseline_test.go b/aws/data_source_aws_ssm_patch_baseline_test.go index 292922d06bc0..a2d661a0997f 100644 --- a/aws/data_source_aws_ssm_patch_baseline_test.go +++ b/aws/data_source_aws_ssm_patch_baseline_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ssm" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,8 +13,9 @@ func TestAccAWSSsmPatchBaselineDataSource_existingBaseline(t *testing.T) { resourceName := "data.aws_ssm_patch_baseline.test_existing" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccCheckAwsSsmPatchBaselineDataSourceConfig_existingBaseline(), @@ -32,6 +34,7 @@ func TestAccAWSSsmPatchBaselineDataSource_newBaseline(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMPatchBaselineDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_ssoadmin_instances_test.go b/aws/data_source_aws_ssoadmin_instances_test.go index a4c4eb48fb9b..f2c2a9158964 100644 --- a/aws/data_source_aws_ssoadmin_instances_test.go +++ b/aws/data_source_aws_ssoadmin_instances_test.go @@ -39,8 +39,9 @@ func TestAccDataSourceAWSSSOAdminInstances_basic(t *testing.T) { dataSourceName := "data.aws_ssoadmin_instances.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSSSOAdminInstancesConfigBasic, diff --git a/aws/data_source_aws_ssoadmin_permission_set_test.go b/aws/data_source_aws_ssoadmin_permission_set_test.go index d83cfc949309..c11864d0379d 100644 --- a/aws/data_source_aws_ssoadmin_permission_set_test.go +++ b/aws/data_source_aws_ssoadmin_permission_set_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ssoadmin" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAWSSSOAdminPermissionSet_arn(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSSSOPermissionSetByArnConfig(rName), @@ -39,8 +41,9 @@ func TestAccDataSourceAWSSSOAdminPermissionSet_name(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSSSOPermissionSetByNameConfig(rName), @@ -60,8 +63,9 @@ func TestAccDataSourceAWSSSOAdminPermissionSet_name(t *testing.T) { func TestAccDataSourceAWSSSOAdminPermissionSet_nonExistent(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAWSSSOPermissionSetByNameConfig_nonExistent, diff --git a/aws/data_source_aws_storagegateway_local_disk.go b/aws/data_source_aws_storagegateway_local_disk.go index 61ea759a4530..247d83c6684a 100644 --- a/aws/data_source_aws_storagegateway_local_disk.go +++ b/aws/data_source_aws_storagegateway_local_disk.go @@ -22,10 +22,12 @@ func dataSourceAwsStorageGatewayLocalDisk() *schema.Resource { "disk_node": { Type: schema.TypeString, Optional: true, + Computed: true, }, "disk_path": { Type: schema.TypeString, Optional: true, + Computed: true, }, "gateway_arn": { Type: schema.TypeString, diff --git a/aws/data_source_aws_storagegateway_local_disk_test.go b/aws/data_source_aws_storagegateway_local_disk_test.go index 2c37af7da9cf..6ca557cf330c 100644 --- a/aws/data_source_aws_storagegateway_local_disk_test.go +++ b/aws/data_source_aws_storagegateway_local_disk_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/storagegateway" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -16,6 +17,7 @@ func TestAccAWSStorageGatewayLocalDiskDataSource_DiskNode(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -27,7 +29,9 @@ func TestAccAWSStorageGatewayLocalDiskDataSource_DiskNode(t *testing.T) { Config: testAccAWSStorageGatewayLocalDiskDataSourceConfig_DiskNode(rName), Check: resource.ComposeTestCheckFunc( testAccAWSStorageGatewayLocalDiskDataSourceExists(dataSourceName), - resource.TestCheckResourceAttrSet(dataSourceName, "disk_id"), + resource.TestMatchResourceAttr(dataSourceName, "disk_id", regexp.MustCompile(`.+`)), + resource.TestMatchResourceAttr(dataSourceName, "disk_node", regexp.MustCompile(`.+`)), + resource.TestMatchResourceAttr(dataSourceName, "disk_path", regexp.MustCompile(`.+`)), ), }, }, @@ -40,6 +44,7 @@ func TestAccAWSStorageGatewayLocalDiskDataSource_DiskPath(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -51,7 +56,9 @@ func TestAccAWSStorageGatewayLocalDiskDataSource_DiskPath(t *testing.T) { Config: testAccAWSStorageGatewayLocalDiskDataSourceConfig_DiskPath(rName), Check: resource.ComposeTestCheckFunc( testAccAWSStorageGatewayLocalDiskDataSourceExists(dataSourceName), - resource.TestCheckResourceAttrSet(dataSourceName, "disk_id"), + resource.TestMatchResourceAttr(dataSourceName, "disk_id", regexp.MustCompile(`.+`)), + resource.TestMatchResourceAttr(dataSourceName, "disk_node", regexp.MustCompile(`.+`)), + resource.TestMatchResourceAttr(dataSourceName, "disk_path", regexp.MustCompile(`.+`)), ), }, }, diff --git a/aws/data_source_aws_subnet_ids_test.go b/aws/data_source_aws_subnet_ids_test.go index 8b4615ba89e6..afa25a12111e 100644 --- a/aws/data_source_aws_subnet_ids_test.go +++ b/aws/data_source_aws_subnet_ids_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,6 +13,7 @@ func TestAccDataSourceAwsSubnetIDs_basic(t *testing.T) { rInt := acctest.RandIntRange(0, 256) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -35,6 +37,7 @@ func TestAccDataSourceAwsSubnetIDs_filter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_subnet_test.go b/aws/data_source_aws_subnet_test.go index ce7d549ddc27..da7307be7a9e 100644 --- a/aws/data_source_aws_subnet_test.go +++ b/aws/data_source_aws_subnet_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -24,6 +25,7 @@ func TestAccDataSourceAwsSubnet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -113,8 +115,9 @@ func TestAccDataSourceAwsSubnet_basic(t *testing.T) { func TestAccDataSourceAwsSubnet_ipv6ByIpv6Filter(t *testing.T) { rInt := acctest.RandIntRange(0, 256) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSubnetConfigIpv6(rInt), @@ -133,8 +136,9 @@ func TestAccDataSourceAwsSubnet_ipv6ByIpv6Filter(t *testing.T) { func TestAccDataSourceAwsSubnet_ipv6ByIpv6CidrBlock(t *testing.T) { rInt := acctest.RandIntRange(0, 256) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsSubnetConfigIpv6(rInt), diff --git a/aws/data_source_aws_transfer_server_test.go b/aws/data_source_aws_transfer_server_test.go index e624772be42e..ad55309eb065 100644 --- a/aws/data_source_aws_transfer_server_test.go +++ b/aws/data_source_aws_transfer_server_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/transfer" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccDataSourceAwsTransferServer_basic(t *testing.T) { datasourceName := "data.aws_transfer_server.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsTransferServerConfig_basic, @@ -35,8 +37,9 @@ func TestAccDataSourceAwsTransferServer_service_managed(t *testing.T) { datasourceName := "data.aws_transfer_server.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsTransferServerConfig_service_managed(rName), @@ -57,8 +60,9 @@ func TestAccDataSourceAwsTransferServer_apigateway(t *testing.T) { datasourceName := "data.aws_transfer_server.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsTransferServerConfig_apigateway(rName), diff --git a/aws/data_source_aws_vpc.go b/aws/data_source_aws_vpc.go index 446fbc61e0c6..430fcd62b916 100644 --- a/aws/data_source_aws_vpc.go +++ b/aws/data_source_aws_vpc.go @@ -194,7 +194,7 @@ func dataSourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error { Partition: meta.(*AWSClient).partition, Service: ec2.ServiceName, Region: meta.(*AWSClient).region, - AccountID: meta.(*AWSClient).accountid, + AccountID: aws.StringValue(vpc.OwnerId), Resource: fmt.Sprintf("vpc/%s", d.Id()), }.String() d.Set("arn", arn) diff --git a/aws/data_source_aws_vpc_dhcp_options.go b/aws/data_source_aws_vpc_dhcp_options.go index 7d8fa1d87e42..667e424a909f 100644 --- a/aws/data_source_aws_vpc_dhcp_options.go +++ b/aws/data_source_aws_vpc_dhcp_options.go @@ -138,7 +138,7 @@ func dataSourceAwsVpcDhcpOptionsRead(d *schema.ResourceData, meta interface{}) e Partition: meta.(*AWSClient).partition, Service: ec2.ServiceName, Region: meta.(*AWSClient).region, - AccountID: meta.(*AWSClient).accountid, + AccountID: aws.StringValue(output.DhcpOptions[0].OwnerId), Resource: fmt.Sprintf("dhcp-options/%s", d.Id()), }.String() diff --git a/aws/data_source_aws_vpc_dhcp_options_test.go b/aws/data_source_aws_vpc_dhcp_options_test.go index 2e00e4fba2bc..bf42a68fa240 100644 --- a/aws/data_source_aws_vpc_dhcp_options_test.go +++ b/aws/data_source_aws_vpc_dhcp_options_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAwsVpcDhcpOptions_basic(t *testing.T) { datasourceName := "data.aws_vpc_dhcp_options.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcDhcpOptionsConfig_Missing, @@ -50,8 +52,9 @@ func TestAccDataSourceAwsVpcDhcpOptions_Filter(t *testing.T) { datasourceName := "data.aws_vpc_dhcp_options.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcDhcpOptionsConfig_Filter(rInt, 1), diff --git a/aws/data_source_aws_vpc_endpoint.go b/aws/data_source_aws_vpc_endpoint.go index e3d778e807da..3dee22f20b01 100644 --- a/aws/data_source_aws_vpc_endpoint.go +++ b/aws/data_source_aws_vpc_endpoint.go @@ -163,7 +163,7 @@ func dataSourceAwsVpcEndpointRead(d *schema.ResourceData, meta interface{}) erro Partition: meta.(*AWSClient).partition, Service: ec2.ServiceName, Region: meta.(*AWSClient).region, - AccountID: meta.(*AWSClient).accountid, + AccountID: aws.StringValue(vpce.OwnerId), Resource: fmt.Sprintf("vpc-endpoint/%s", d.Id()), }.String() d.Set("arn", arn) diff --git a/aws/data_source_aws_vpc_endpoint_service.go b/aws/data_source_aws_vpc_endpoint_service.go index ce7ba5e0eb65..15626866d16c 100644 --- a/aws/data_source_aws_vpc_endpoint_service.go +++ b/aws/data_source_aws_vpc_endpoint_service.go @@ -9,6 +9,7 @@ import ( "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" ) @@ -66,9 +67,10 @@ func dataSourceAwsVpcEndpointService() *schema.Resource { ConflictsWith: []string{"service"}, }, "service_type": { - Type: schema.TypeString, - Optional: true, - Computed: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice(ec2.ServiceType_Values(), false), }, "tags": tagsSchemaComputed(), "vpc_endpoint_policy_supported": { @@ -104,6 +106,14 @@ func dataSourceAwsVpcEndpointServiceRead(d *schema.ResourceData, meta interface{ if serviceNameOk { req.ServiceNames = aws.StringSlice([]string{serviceName}) } + + if v, ok := d.GetOk("service_type"); ok { + req.Filters = append(req.Filters, &ec2.Filter{ + Name: aws.String("service-type"), + Values: aws.StringSlice([]string{v.(string)}), + }) + } + if tagsOk { req.Filters = append(req.Filters, ec2TagFiltersFromMap(tags.(map[string]interface{}))...) } @@ -134,29 +144,11 @@ func dataSourceAwsVpcEndpointServiceRead(d *schema.ResourceData, meta interface{ return fmt.Errorf("no matching VPC Endpoint Service found") } - var serviceDetails []*ec2.ServiceDetail - - // Client-side filtering. When the EC2 API supports this functionality - // server-side it should be moved. - for _, serviceDetail := range resp.ServiceDetails { - if serviceDetail == nil { - continue - } - - if v, ok := d.GetOk("service_type"); ok { - if len(serviceDetail.ServiceType) > 0 && serviceDetail.ServiceType[0] != nil && v.(string) != aws.StringValue(serviceDetail.ServiceType[0].ServiceType) { - continue - } - } - - serviceDetails = append(serviceDetails, serviceDetail) - } - - if len(serviceDetails) > 1 { + if len(resp.ServiceDetails) > 1 { return fmt.Errorf("multiple VPC Endpoint Services matched; use additional constraints to reduce matches to a single VPC Endpoint Service") } - sd := serviceDetails[0] + sd := resp.ServiceDetails[0] serviceId := aws.StringValue(sd.ServiceId) serviceName = aws.StringValue(sd.ServiceName) diff --git a/aws/data_source_aws_vpc_endpoint_service_test.go b/aws/data_source_aws_vpc_endpoint_service_test.go index 755edaba5198..ee05a1a11d7c 100644 --- a/aws/data_source_aws_vpc_endpoint_service_test.go +++ b/aws/data_source_aws_vpc_endpoint_service_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccDataSourceAwsVpcEndpointService_gateway(t *testing.T) { datasourceName := "data.aws_vpc_endpoint_service.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointServiceGatewayConfig, @@ -40,8 +42,9 @@ func TestAccDataSourceAwsVpcEndpointService_interface(t *testing.T) { datasourceName := "data.aws_vpc_endpoint_service.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointServiceInterfaceConfig, @@ -67,8 +70,9 @@ func TestAccDataSourceAwsVpcEndpointService_custom(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointServiceCustomConfig(rName), @@ -93,8 +97,9 @@ func TestAccDataSourceAwsVpcEndpointService_custom_filter(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointServiceCustomConfigFilter(rName), @@ -119,8 +124,9 @@ func TestAccDataSourceAwsVpcEndpointService_custom_filter_tags(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointServiceCustomConfigFilterTags(rName), @@ -144,8 +150,9 @@ func TestAccDataSourceAwsVpcEndpointService_ServiceType_Gateway(t *testing.T) { datasourceName := "data.aws_vpc_endpoint_service.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointServiceConfig_ServiceType("s3", "Gateway"), @@ -162,8 +169,9 @@ func TestAccDataSourceAwsVpcEndpointService_ServiceType_Interface(t *testing.T) datasourceName := "data.aws_vpc_endpoint_service.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointServiceConfig_ServiceType("ec2", "Interface"), diff --git a/aws/data_source_aws_vpc_endpoint_test.go b/aws/data_source_aws_vpc_endpoint_test.go index bc6c7827a360..2d8ec584f786 100644 --- a/aws/data_source_aws_vpc_endpoint_test.go +++ b/aws/data_source_aws_vpc_endpoint_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAwsVpcEndpoint_gatewayBasic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointConfig_gatewayBasic(rName), @@ -43,8 +45,9 @@ func TestAccDataSourceAwsVpcEndpoint_byId(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointConfig_byId(rName), @@ -72,8 +75,9 @@ func TestAccDataSourceAwsVpcEndpoint_byFilter(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointConfig_byFilter(rName), @@ -101,8 +105,9 @@ func TestAccDataSourceAwsVpcEndpoint_byTags(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointConfig_byTags(rName), @@ -130,8 +135,9 @@ func TestAccDataSourceAwsVpcEndpoint_gatewayWithRouteTableAndTags(t *testing.T) rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointConfig_gatewayWithRouteTableAndTags(rName), @@ -160,8 +166,9 @@ func TestAccDataSourceAwsVpcEndpoint_interface(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcEndpointConfig_interface(rName), diff --git a/aws/data_source_aws_vpc_peering_connection_test.go b/aws/data_source_aws_vpc_peering_connection_test.go index ab4bff7c2fd5..b8f387ba6383 100644 --- a/aws/data_source_aws_vpc_peering_connection_test.go +++ b/aws/data_source_aws_vpc_peering_connection_test.go @@ -3,6 +3,7 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,8 +13,9 @@ func TestAccDataSourceAwsVpcPeeringConnection_CidrBlock(t *testing.T) { requesterVpcResourceName := "aws_vpc.requester" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcPeeringConnectionConfigCidrBlock(), @@ -33,8 +35,9 @@ func TestAccDataSourceAwsVpcPeeringConnection_Id(t *testing.T) { requesterVpcResourceName := "aws_vpc.requester" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcPeeringConnectionConfigId(), @@ -70,8 +73,9 @@ func TestAccDataSourceAwsVpcPeeringConnection_PeerCidrBlock(t *testing.T) { accepterVpcResourceName := "aws_vpc.accepter" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcPeeringConnectionConfigPeerCidrBlock(), @@ -89,8 +93,9 @@ func TestAccDataSourceAwsVpcPeeringConnection_PeerVpcId(t *testing.T) { resourceName := "aws_vpc_peering_connection.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcPeeringConnectionConfigPeerVpcId(), @@ -108,8 +113,9 @@ func TestAccDataSourceAwsVpcPeeringConnection_VpcId(t *testing.T) { resourceName := "aws_vpc_peering_connection.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcPeeringConnectionConfigVpcId(), diff --git a/aws/data_source_aws_vpc_peering_connections_test.go b/aws/data_source_aws_vpc_peering_connections_test.go index 6fe61df74892..51fc55ca0628 100644 --- a/aws/data_source_aws_vpc_peering_connections_test.go +++ b/aws/data_source_aws_vpc_peering_connections_test.go @@ -3,13 +3,15 @@ package aws import ( "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) func TestAccDataSourceAwsVpcPeeringConnections_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcPeeringConnectionsConfig, diff --git a/aws/data_source_aws_vpc_test.go b/aws/data_source_aws_vpc_test.go index cc2e973d24a1..019945f7a483 100644 --- a/aws/data_source_aws_vpc_test.go +++ b/aws/data_source_aws_vpc_test.go @@ -6,6 +6,7 @@ import ( "testing" "time" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -22,8 +23,9 @@ func TestAccDataSourceAwsVpc_basic(t *testing.T) { ds4ResourceName := "data.aws_vpc.by_filter" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcConfig(cidr, tag), @@ -87,8 +89,9 @@ func TestAccDataSourceAwsVpc_ipv6Associated(t *testing.T) { ds1ResourceName := "data.aws_vpc.by_id" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcConfigIpv6(cidr, tag), @@ -116,6 +119,7 @@ func TestAccDataSourceAwsVpc_CidrBlockAssociations_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ diff --git a/aws/data_source_aws_vpcs_test.go b/aws/data_source_aws_vpcs_test.go index 85658fca81f0..97eedab56b64 100644 --- a/aws/data_source_aws_vpcs_test.go +++ b/aws/data_source_aws_vpcs_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -11,8 +12,9 @@ import ( func TestAccDataSourceAwsVpcs_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcsConfig(), @@ -27,8 +29,9 @@ func TestAccDataSourceAwsVpcs_basic(t *testing.T) { func TestAccDataSourceAwsVpcs_tags(t *testing.T) { rName := acctest.RandString(5) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcsConfig_tags(rName), @@ -44,8 +47,9 @@ func TestAccDataSourceAwsVpcs_tags(t *testing.T) { func TestAccDataSourceAwsVpcs_filters(t *testing.T) { rName := acctest.RandString(5) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpcsConfig_filters(rName), diff --git a/aws/data_source_aws_vpn_gateway_test.go b/aws/data_source_aws_vpn_gateway_test.go index 6c8c1f752e77..738b2ce31ab1 100644 --- a/aws/data_source_aws_vpn_gateway_test.go +++ b/aws/data_source_aws_vpn_gateway_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -17,8 +18,9 @@ func TestAccDataSourceAwsVpnGateway_unattached(t *testing.T) { resourceName := "aws_vpn_gateway.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpnGatewayUnattachedConfig(rInt), @@ -42,8 +44,9 @@ func TestAccDataSourceAwsVpnGateway_attached(t *testing.T) { dataSourceName := "data.aws_vpn_gateway.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsVpnGatewayAttachedConfig(rInt), diff --git a/aws/data_source_aws_waf_ipset_test.go b/aws/data_source_aws_waf_ipset_test.go index 813acb19318c..9a7fefb45969 100644 --- a/aws/data_source_aws_waf_ipset_test.go +++ b/aws/data_source_aws_waf_ipset_test.go @@ -16,8 +16,9 @@ func TestAccDataSourceAwsWafIPSet_basic(t *testing.T) { datasourceName := "data.aws_waf_ipset.ipset" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(waf.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(waf.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafIPSet_NonExistent, diff --git a/aws/data_source_aws_waf_rate_based_rule_test.go b/aws/data_source_aws_waf_rate_based_rule_test.go index bf86b5c14094..3cfa56c67454 100644 --- a/aws/data_source_aws_waf_rate_based_rule_test.go +++ b/aws/data_source_aws_waf_rate_based_rule_test.go @@ -16,8 +16,9 @@ func TestAccDataSourceAwsWafRateBasedRule_basic(t *testing.T) { datasourceName := "data.aws_waf_rate_based_rule.wafrule" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(waf.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(waf.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafRateBasedRuleConfig_NonExistent, diff --git a/aws/data_source_aws_waf_rule_test.go b/aws/data_source_aws_waf_rule_test.go index 5d28f6f420d0..3dfe62431f75 100644 --- a/aws/data_source_aws_waf_rule_test.go +++ b/aws/data_source_aws_waf_rule_test.go @@ -16,8 +16,9 @@ func TestAccDataSourceAwsWafRule_basic(t *testing.T) { datasourceName := "data.aws_waf_rule.wafrule" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(waf.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(waf.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafRuleConfig_NonExistent, diff --git a/aws/data_source_aws_waf_web_acl_test.go b/aws/data_source_aws_waf_web_acl_test.go index 604fb14019c5..ca5204767835 100644 --- a/aws/data_source_aws_waf_web_acl_test.go +++ b/aws/data_source_aws_waf_web_acl_test.go @@ -16,8 +16,9 @@ func TestAccDataSourceAwsWafWebAcl_basic(t *testing.T) { datasourceName := "data.aws_waf_web_acl.web_acl" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(waf.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(waf.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafWebAclConfig_NonExistent, diff --git a/aws/data_source_aws_wafregional_ipset_test.go b/aws/data_source_aws_wafregional_ipset_test.go index e4ab2fec9681..443b3015e7a9 100644 --- a/aws/data_source_aws_wafregional_ipset_test.go +++ b/aws/data_source_aws_wafregional_ipset_test.go @@ -16,8 +16,9 @@ func TestAccDataSourceAwsWafRegionalIPSet_basic(t *testing.T) { datasourceName := "data.aws_wafregional_ipset.ipset" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafRegionalIPSet_NonExistent, diff --git a/aws/data_source_aws_wafregional_rate_based_rule_test.go b/aws/data_source_aws_wafregional_rate_based_rule_test.go index 515881661934..f83d0425f305 100644 --- a/aws/data_source_aws_wafregional_rate_based_rule_test.go +++ b/aws/data_source_aws_wafregional_rate_based_rule_test.go @@ -16,8 +16,9 @@ func TestAccDataSourceAwsWafRegionalRateBasedRule_basic(t *testing.T) { datasourceName := "data.aws_wafregional_rate_based_rule.wafrule" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafRegionalRateBasedRuleConfig_NonExistent, diff --git a/aws/data_source_aws_wafregional_rule_test.go b/aws/data_source_aws_wafregional_rule_test.go index 1563833169cb..ad330a337370 100644 --- a/aws/data_source_aws_wafregional_rule_test.go +++ b/aws/data_source_aws_wafregional_rule_test.go @@ -16,8 +16,9 @@ func TestAccDataSourceAwsWafRegionalRule_basic(t *testing.T) { datasourceName := "data.aws_wafregional_rule.wafrule" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafRegionalRuleConfig_NonExistent, diff --git a/aws/data_source_aws_wafregional_web_acl_test.go b/aws/data_source_aws_wafregional_web_acl_test.go index 2b3a874a967d..2e22a4e1d4fd 100644 --- a/aws/data_source_aws_wafregional_web_acl_test.go +++ b/aws/data_source_aws_wafregional_web_acl_test.go @@ -16,8 +16,9 @@ func TestAccDataSourceAwsWafRegionalWebAcl_basic(t *testing.T) { datasourceName := "data.aws_wafregional_web_acl.web_acl" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafRegionalWebAclConfig_NonExistent, diff --git a/aws/data_source_aws_wafv2_ip_set_test.go b/aws/data_source_aws_wafv2_ip_set_test.go index 593de0250a8d..5078f954865c 100644 --- a/aws/data_source_aws_wafv2_ip_set_test.go +++ b/aws/data_source_aws_wafv2_ip_set_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/wafv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAwsWafv2IPSet_basic(t *testing.T) { datasourceName := "data.aws_wafv2_ip_set.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafv2IPSet_NonExistent(name), diff --git a/aws/data_source_aws_wafv2_regex_pattern_set_test.go b/aws/data_source_aws_wafv2_regex_pattern_set_test.go index 89f7ed917ca4..0d2fb68921d5 100644 --- a/aws/data_source_aws_wafv2_regex_pattern_set_test.go +++ b/aws/data_source_aws_wafv2_regex_pattern_set_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/wafv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAwsWafv2RegexPatternSet_basic(t *testing.T) { datasourceName := "data.aws_wafv2_regex_pattern_set.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafv2RegexPatternSet_NonExistent(name), diff --git a/aws/data_source_aws_wafv2_rule_group_test.go b/aws/data_source_aws_wafv2_rule_group_test.go index 1a3756ca020c..afcac7e1a687 100644 --- a/aws/data_source_aws_wafv2_rule_group_test.go +++ b/aws/data_source_aws_wafv2_rule_group_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/wafv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAwsWafv2RuleGroup_basic(t *testing.T) { datasourceName := "data.aws_wafv2_rule_group.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafv2RuleGroup_NonExistent(name), diff --git a/aws/data_source_aws_wafv2_web_acl_test.go b/aws/data_source_aws_wafv2_web_acl_test.go index 90f3a74843fd..adcb45528c0d 100644 --- a/aws/data_source_aws_wafv2_web_acl_test.go +++ b/aws/data_source_aws_wafv2_web_acl_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/wafv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -15,8 +16,9 @@ func TestAccDataSourceAwsWafv2WebACL_basic(t *testing.T) { datasourceName := "data.aws_wafv2_web_acl.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWafv2WebACL_NonExistent(name), diff --git a/aws/data_source_aws_workspaces_bundle_test.go b/aws/data_source_aws_workspaces_bundle_test.go index 8fd09e92b27b..3b98b1668882 100644 --- a/aws/data_source_aws_workspaces_bundle_test.go +++ b/aws/data_source_aws_workspaces_bundle_test.go @@ -6,6 +6,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/workspaces" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,8 +14,9 @@ func TestAccDataSourceAwsWorkspaceBundle_basic(t *testing.T) { dataSourceName := "data.aws_workspaces_bundle.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWorkspaceBundleConfig("wsb-b0s22j3d7"), @@ -39,8 +41,9 @@ func TestAccDataSourceAwsWorkspaceBundle_byOwnerName(t *testing.T) { dataSourceName := "data.aws_workspaces_bundle.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWorkspaceBundleConfig_byOwnerName("AMAZON", "Value with Windows 10 and Office 2016"), @@ -63,8 +66,9 @@ func TestAccDataSourceAwsWorkspaceBundle_byOwnerName(t *testing.T) { func TestAccDataSourceAwsWorkspaceBundle_bundleIDAndNameConflict(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWorkspaceBundleConfig_bundleIDAndOwnerNameConflict("wsb-df76rqys9", "AMAZON", "Value with Windows 10 and Office 2016"), @@ -83,7 +87,8 @@ func TestAccDataSourceAwsWorkspaceBundle_privateOwner(t *testing.T) { testAccPreCheck(t) testAccWorkspacesBundlePreCheck(t) }, - Providers: testAccProviders, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWorkspaceBundleConfig_privateOwner(bundleName), diff --git a/aws/data_source_aws_workspaces_directory_test.go b/aws/data_source_aws_workspaces_directory_test.go index 68eb7e95d12e..6de831f4b1de 100644 --- a/aws/data_source_aws_workspaces_directory_test.go +++ b/aws/data_source_aws_workspaces_directory_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/workspaces" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -21,7 +22,8 @@ func TestAccDataSourceAwsWorkspacesDirectory_basic(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, - Providers: testAccProviders, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWorkspacesDirectoryConfig(rName), diff --git a/aws/data_source_aws_workspaces_image_test.go b/aws/data_source_aws_workspaces_image_test.go index cd176d8ac79d..446720c78f94 100644 --- a/aws/data_source_aws_workspaces_image_test.go +++ b/aws/data_source_aws_workspaces_image_test.go @@ -21,7 +21,8 @@ func TestAccDataSourceAwsWorkspacesImage_basic(t *testing.T) { testAccPreCheck(t) testAccWorkspacesImagePreCheck(t) }, - Providers: testAccProviders, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWorkspacesImageConfig(imageID), diff --git a/aws/data_source_aws_workspaces_workspace_test.go b/aws/data_source_aws_workspaces_workspace_test.go index f60a85e8b18c..fdd13bd6938e 100644 --- a/aws/data_source_aws_workspaces_workspace_test.go +++ b/aws/data_source_aws_workspaces_workspace_test.go @@ -4,6 +4,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/workspaces" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -14,8 +15,9 @@ func TestAccDataSourceAwsWorkspacesWorkspace_byWorkspaceID(t *testing.T) { resourceName := "aws_workspaces_workspace.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceWorkspacesWorkspaceConfig_byWorkspaceID(rName), @@ -46,8 +48,9 @@ func TestAccDataSourceAwsWorkspacesWorkspace_byDirectoryID_userName(t *testing.T resourceName := "aws_workspaces_workspace.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceWorkspacesWorkspaceConfig_byDirectoryID_userName(rName), @@ -74,8 +77,9 @@ func TestAccDataSourceAwsWorkspacesWorkspace_byDirectoryID_userName(t *testing.T func TestAccDataSourceAwsWorkspacesWorkspace_workspaceIDAndDirectoryIDConflict(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), + Providers: testAccProviders, Steps: []resource.TestStep{ { Config: testAccDataSourceAwsWorkspacesWorkspaceConfig_workspaceIDAndDirectoryIDConflict(), diff --git a/aws/hosted_zones.go b/aws/hosted_zones.go index a45ae249dcc1..722f22f747f2 100644 --- a/aws/hosted_zones.go +++ b/aws/hosted_zones.go @@ -17,7 +17,7 @@ var hostedZoneIDsMap = map[string]string{ endpoints.ApEast1RegionID: "ZNB98KWMFR0R6", endpoints.ApNortheast1RegionID: "Z2M4EHUR26P7ZW", endpoints.ApNortheast2RegionID: "Z3W03O7B5YMIYP", - "ap-northeast-3": "Z2YQB5RD63NC85", //lintignore:AWSAT003 // https://github.com/aws/aws-sdk-go/issues/1863 + endpoints.ApNortheast3RegionID: "Z2YQB5RD63NC85", endpoints.ApSouth1RegionID: "Z11RGJOFQNVJUP", endpoints.ApSoutheast1RegionID: "Z3O0J2DXBE1FTB", endpoints.ApSoutheast2RegionID: "Z1WCIGYICN2BYD", diff --git a/aws/internal/keyvaluetags/iam_tags.go b/aws/internal/keyvaluetags/iam_tags.go index 1059708d2806..f67281a2f33a 100644 --- a/aws/internal/keyvaluetags/iam_tags.go +++ b/aws/internal/keyvaluetags/iam_tags.go @@ -80,3 +80,178 @@ func IamUserUpdateTags(conn *iam.IAM, identifier string, oldTagsMap interface{}, return nil } + +// IamInstanceProfileUpdateTags updates IAM Instance Profile tags. +// The identifier is the Instance Profile name. +func IamInstanceProfileUpdateTags(conn *iam.IAM, identifier string, oldTagsMap interface{}, newTagsMap interface{}) error { + oldTags := New(oldTagsMap) + newTags := New(newTagsMap) + + if removedTags := oldTags.Removed(newTags); len(removedTags) > 0 { + input := &iam.UntagInstanceProfileInput{ + InstanceProfileName: aws.String(identifier), + TagKeys: aws.StringSlice(removedTags.Keys()), + } + + _, err := conn.UntagInstanceProfile(input) + + if err != nil { + return fmt.Errorf("error untagging resource (%s): %w", identifier, err) + } + } + + if updatedTags := oldTags.Updated(newTags); len(updatedTags) > 0 { + input := &iam.TagInstanceProfileInput{ + InstanceProfileName: aws.String(identifier), + Tags: updatedTags.IgnoreAws().IamTags(), + } + + _, err := conn.TagInstanceProfile(input) + + if err != nil { + return fmt.Errorf("error tagging resource (%s): %w", identifier, err) + } + } + + return nil +} + +// IamOpenIDConnectProviderUpdateTags updates IAM OpenID Connect Provider tags. +// The identifier is the OpenID Connect Provider ARN. +func IamOpenIDConnectProviderUpdateTags(conn *iam.IAM, identifier string, oldTagsMap interface{}, newTagsMap interface{}) error { + oldTags := New(oldTagsMap) + newTags := New(newTagsMap) + + if removedTags := oldTags.Removed(newTags); len(removedTags) > 0 { + input := &iam.UntagOpenIDConnectProviderInput{ + OpenIDConnectProviderArn: aws.String(identifier), + TagKeys: aws.StringSlice(removedTags.Keys()), + } + + _, err := conn.UntagOpenIDConnectProvider(input) + + if err != nil { + return fmt.Errorf("error untagging resource (%s): %w", identifier, err) + } + } + + if updatedTags := oldTags.Updated(newTags); len(updatedTags) > 0 { + input := &iam.TagOpenIDConnectProviderInput{ + OpenIDConnectProviderArn: aws.String(identifier), + Tags: updatedTags.IgnoreAws().IamTags(), + } + + _, err := conn.TagOpenIDConnectProvider(input) + + if err != nil { + return fmt.Errorf("error tagging resource (%s): %w", identifier, err) + } + } + + return nil +} + +// IamPolicyUpdateTags updates IAM Policy tags. +// The identifier is the Policy ARN. +func IamPolicyUpdateTags(conn *iam.IAM, identifier string, oldTagsMap interface{}, newTagsMap interface{}) error { + oldTags := New(oldTagsMap) + newTags := New(newTagsMap) + + if removedTags := oldTags.Removed(newTags); len(removedTags) > 0 { + input := &iam.UntagPolicyInput{ + PolicyArn: aws.String(identifier), + TagKeys: aws.StringSlice(removedTags.Keys()), + } + + _, err := conn.UntagPolicy(input) + + if err != nil { + return fmt.Errorf("error untagging resource (%s): %w", identifier, err) + } + } + + if updatedTags := oldTags.Updated(newTags); len(updatedTags) > 0 { + input := &iam.TagPolicyInput{ + PolicyArn: aws.String(identifier), + Tags: updatedTags.IgnoreAws().IamTags(), + } + + _, err := conn.TagPolicy(input) + + if err != nil { + return fmt.Errorf("error tagging resource (%s): %w", identifier, err) + } + } + + return nil +} + +// IamSAMLProviderUpdateTags updates IAM SAML Provider tags. +// The identifier is the SAML Provider ARN. +func IamSAMLProviderUpdateTags(conn *iam.IAM, identifier string, oldTagsMap interface{}, newTagsMap interface{}) error { + oldTags := New(oldTagsMap) + newTags := New(newTagsMap) + + if removedTags := oldTags.Removed(newTags); len(removedTags) > 0 { + input := &iam.UntagSAMLProviderInput{ + SAMLProviderArn: aws.String(identifier), + TagKeys: aws.StringSlice(removedTags.Keys()), + } + + _, err := conn.UntagSAMLProvider(input) + + if err != nil { + return fmt.Errorf("error untagging resource (%s): %w", identifier, err) + } + } + + if updatedTags := oldTags.Updated(newTags); len(updatedTags) > 0 { + input := &iam.TagSAMLProviderInput{ + SAMLProviderArn: aws.String(identifier), + Tags: updatedTags.IgnoreAws().IamTags(), + } + + _, err := conn.TagSAMLProvider(input) + + if err != nil { + return fmt.Errorf("error tagging resource (%s): %w", identifier, err) + } + } + + return nil +} + +// IamServerCertificateUpdateTags updates IAM Server Certificate tags. +// The identifier is the Server Certificate name. +func IamServerCertificateUpdateTags(conn *iam.IAM, identifier string, oldTagsMap interface{}, newTagsMap interface{}) error { + oldTags := New(oldTagsMap) + newTags := New(newTagsMap) + + if removedTags := oldTags.Removed(newTags); len(removedTags) > 0 { + input := &iam.UntagServerCertificateInput{ + ServerCertificateName: aws.String(identifier), + TagKeys: aws.StringSlice(removedTags.Keys()), + } + + _, err := conn.UntagServerCertificate(input) + + if err != nil { + return fmt.Errorf("error untagging resource (%s): %w", identifier, err) + } + } + + if updatedTags := oldTags.Updated(newTags); len(updatedTags) > 0 { + input := &iam.TagServerCertificateInput{ + ServerCertificateName: aws.String(identifier), + Tags: updatedTags.IgnoreAws().IamTags(), + } + + _, err := conn.TagServerCertificate(input) + + if err != nil { + return fmt.Errorf("error tagging resource (%s): %w", identifier, err) + } + } + + return nil +} diff --git a/aws/internal/keyvaluetags/key_value_tags.go b/aws/internal/keyvaluetags/key_value_tags.go index f9af201a7c07..1f48f3c1cd68 100644 --- a/aws/internal/keyvaluetags/key_value_tags.go +++ b/aws/internal/keyvaluetags/key_value_tags.go @@ -25,6 +25,11 @@ const ( ServerlessApplicationRepositoryTagKeyPrefix = `serverlessrepo:` ) +// DefaultConfig contains tags to default across all resources. +type DefaultConfig struct { + Tags KeyValueTags +} + // IgnoreConfig contains various options for removing resource tags. type IgnoreConfig struct { Keys KeyValueTags @@ -50,6 +55,36 @@ func (tags KeyValueTags) IgnoreAws() KeyValueTags { return result } +// MergeTags returns the result of keyvaluetags.Merge() on the given +// DefaultConfig.Tags with KeyValueTags provided as an argument, +// overriding the value of any tag with a matching key. +func (dc *DefaultConfig) MergeTags(tags KeyValueTags) KeyValueTags { + if dc == nil || dc.Tags == nil { + return tags + } + + return dc.Tags.Merge(tags) +} + +// TagsEqual returns true if the given configuration's Tags +// are equal to those passed in as an argument; +// otherwise returns false +func (dc *DefaultConfig) TagsEqual(tags KeyValueTags) bool { + if dc == nil || dc.Tags == nil { + return tags == nil + } + + if tags == nil { + return false + } + + if len(tags) == 0 { + return len(dc.Tags) == 0 + } + + return dc.Tags.ContainsAll(tags) +} + // IgnoreConfig returns any tags not removed by a given configuration. func (tags KeyValueTags) IgnoreConfig(config *IgnoreConfig) KeyValueTags { if config == nil { @@ -401,6 +436,27 @@ func (tags KeyValueTags) Hash() int { return hash } +// RemoveDefaultConfig returns tags not present in a DefaultConfig object +// in addition to tags with key/value pairs that override those in a DefaultConfig; +// however, if all tags present in the DefaultConfig object are equivalent to those +// in the given KeyValueTags, then the KeyValueTags are returned, effectively +// bypassing the need to remove differing tags. +func (tags KeyValueTags) RemoveDefaultConfig(dc *DefaultConfig) KeyValueTags { + if dc == nil || dc.Tags == nil { + return tags + } + + result := make(KeyValueTags) + + for k, v := range tags { + if defaultVal, ok := dc.Tags[k]; !ok || !v.Equal(defaultVal) { + result[k] = v + } + } + + return result +} + // String returns the default string representation of the KeyValueTags. func (tags KeyValueTags) String() string { var builder strings.Builder diff --git a/aws/internal/keyvaluetags/key_value_tags_test.go b/aws/internal/keyvaluetags/key_value_tags_test.go index 08a9376a2bc4..39717e697577 100644 --- a/aws/internal/keyvaluetags/key_value_tags_test.go +++ b/aws/internal/keyvaluetags/key_value_tags_test.go @@ -4,6 +4,254 @@ import ( "testing" ) +func TestKeyValueTagsDefaultConfigMergeTags(t *testing.T) { + testCases := []struct { + name string + tags KeyValueTags + defaultConfig *DefaultConfig + want map[string]string + }{ + { + name: "empty config", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{}, + want: map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }, + }, + { + name: "no config", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: nil, + want: map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }, + }, + { + name: "no tags", + tags: New(map[string]string{}), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + }, + want: map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }, + }, + { + name: "keys all matching", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + }, + want: map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }, + }, + { + name: "keys some matching", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value1", + }), + }, + want: map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }, + }, + { + name: "keys some overridden", + tags: New(map[string]string{ + "key1": "value2", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value1", + }), + }, + want: map[string]string{ + "key1": "value2", + "key2": "value2", + "key3": "value3", + }, + }, + { + name: "keys none matching", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key4": "value4", + "key5": "value5", + "key6": "value6", + }), + }, + want: map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + "key4": "value4", + "key5": "value5", + "key6": "value6", + }, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + got := testCase.defaultConfig.MergeTags(testCase.tags) + testKeyValueTagsVerifyMap(t, got.Map(), testCase.want) + }) + } +} + +func TestKeyValueTagsDefaultConfigTagsEqual(t *testing.T) { + testCases := []struct { + name string + tags KeyValueTags + defaultConfig *DefaultConfig + want bool + }{ + { + name: "empty config", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{}, + want: false, + }, + { + name: "no config", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: nil, + want: false, + }, + { + name: "empty tags", + tags: New(map[string]string{}), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + }, + want: false, + }, + { + name: "no tags", + tags: nil, + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + }, + want: false, + }, + { + name: "empty config and no tags", + tags: nil, + defaultConfig: &DefaultConfig{}, + want: true, + }, + { + name: "no config and tags", + tags: nil, + defaultConfig: nil, + want: true, + }, + { + name: "keys and values all matching", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + }, + want: true, + }, + { + name: "only keys matching", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value0", + "key2": "value1", + "key3": "value2", + }), + }, + want: false, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + got := testCase.defaultConfig.TagsEqual(testCase.tags) + + if got != testCase.want { + t.Errorf("got %t; want %t", got, testCase.want) + } + }) + } +} + func TestKeyValueTagsIgnoreAws(t *testing.T) { testCases := []struct { name string @@ -1578,6 +1826,135 @@ func TestKeyValueTagsHash(t *testing.T) { } } +func TestKeyValueTagsRemoveDefaultConfig(t *testing.T) { + testCases := []struct { + name string + tags KeyValueTags + defaultConfig *DefaultConfig + want map[string]string + }{ + { + name: "empty config", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{}, + want: map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }, + }, + { + name: "no config", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: nil, + want: map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }, + }, + { + name: "no tags", + tags: New(map[string]string{}), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + }, + want: map[string]string{}, + }, + { + name: "keys all matching", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + }, + want: map[string]string{}, + }, + { + name: "keys some matching", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value1", + }), + }, + want: map[string]string{ + "key2": "value2", + "key3": "value3", + }, + }, + { + name: "keys some overridden", + tags: New(map[string]string{ + "key1": "value2", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key1": "value1", + }), + }, + want: map[string]string{ + "key1": "value2", + "key2": "value2", + "key3": "value3", + }, + }, + { + name: "keys none matching", + tags: New(map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }), + defaultConfig: &DefaultConfig{ + Tags: New(map[string]string{ + "key4": "value4", + "key5": "value5", + "key6": "value6", + }), + }, + want: map[string]string{ + "key1": "value1", + "key2": "value2", + "key3": "value3", + }, + }, + } + + for _, testCase := range testCases { + t.Run(testCase.name, func(t *testing.T) { + got := testCase.tags.RemoveDefaultConfig(testCase.defaultConfig) + + testKeyValueTagsVerifyMap(t, got.Map(), testCase.want) + }) + } +} + func TestKeyValueTagsUrlEncode(t *testing.T) { testCases := []struct { name string diff --git a/aws/internal/net/cidr.go b/aws/internal/net/cidr.go new file mode 100644 index 000000000000..5d4e8db05259 --- /dev/null +++ b/aws/internal/net/cidr.go @@ -0,0 +1,23 @@ +package net + +import ( + "net" +) + +// CIDRBlocksEqual returns whether or not two CIDR blocks are equal: +// - Both CIDR blocks parse to an IP address and network +// - The string representation of the IP addresses are equal +// - The string representation of the networks are equal +// This function is especially useful for IPv6 CIDR blocks which have multiple valid representations. +func CIDRBlocksEqual(cidr1, cidr2 string) bool { + ip1, ipnet1, err := net.ParseCIDR(cidr1) + if err != nil { + return false + } + ip2, ipnet2, err := net.ParseCIDR(cidr2) + if err != nil { + return false + } + + return ip2.String() == ip1.String() && ipnet2.String() == ipnet1.String() +} diff --git a/aws/internal/net/cidr_test.go b/aws/internal/net/cidr_test.go new file mode 100644 index 000000000000..a557b64a5797 --- /dev/null +++ b/aws/internal/net/cidr_test.go @@ -0,0 +1,26 @@ +package net + +import ( + "testing" +) + +func Test_CIDRBlocksEqual(t *testing.T) { + for _, ts := range []struct { + cidr1 string + cidr2 string + equal bool + }{ + {"10.2.2.0/24", "10.2.2.0/24", true}, + {"10.2.2.0/1234", "10.2.2.0/24", false}, + {"10.2.2.0/24", "10.2.2.0/1234", false}, + {"2001::/15", "2001::/15", true}, + {"::/0", "2001::/15", false}, + {"::/0", "::0/0", true}, + {"", "", false}, + } { + equal := CIDRBlocksEqual(ts.cidr1, ts.cidr2) + if ts.equal != equal { + t.Fatalf("CIDRBlocksEqual(%q, %q) should be: %t", ts.cidr1, ts.cidr2, ts.equal) + } + } +} diff --git a/aws/internal/service/apigatewayv2/finder/finder.go b/aws/internal/service/apigatewayv2/finder/finder.go index 949f6bd48969..ca399d41d85e 100644 --- a/aws/internal/service/apigatewayv2/finder/finder.go +++ b/aws/internal/service/apigatewayv2/finder/finder.go @@ -72,3 +72,36 @@ func Apis(conn *apigatewayv2.ApiGatewayV2, input *apigatewayv2.GetApisInput) ([] return apis, nil } + +func DomainNameByName(conn *apigatewayv2.ApiGatewayV2, name string) (*apigatewayv2.GetDomainNameOutput, error) { + input := &apigatewayv2.GetDomainNameInput{ + DomainName: aws.String(name), + } + + return DomainName(conn, input) +} + +func DomainName(conn *apigatewayv2.ApiGatewayV2, input *apigatewayv2.GetDomainNameInput) (*apigatewayv2.GetDomainNameOutput, error) { + output, err := conn.GetDomainName(input) + + if tfawserr.ErrCodeEquals(err, apigatewayv2.ErrCodeNotFoundException) { + return nil, &resource.NotFoundError{ + LastError: err, + LastRequest: input, + } + } + + if err != nil { + return nil, err + } + + // Handle any empty result. + if output == nil || len(output.DomainNameConfigurations) == 0 { + return nil, &resource.NotFoundError{ + Message: "Empty result", + LastRequest: input, + } + } + + return output, nil +} diff --git a/aws/internal/service/apigatewayv2/lister/list.go b/aws/internal/service/apigatewayv2/lister/list.go index c4a03d8c38ca..0ba32f6e67e7 100644 --- a/aws/internal/service/apigatewayv2/lister/list.go +++ b/aws/internal/service/apigatewayv2/lister/list.go @@ -1,3 +1,3 @@ -//go:generate go run ../../../generators/listpages/main.go -function=GetApis github.com/aws/aws-sdk-go/service/apigatewayv2 +//go:generate go run ../../../generators/listpages/main.go -function=GetApis,GetDomainNames github.com/aws/aws-sdk-go/service/apigatewayv2 package lister diff --git a/aws/internal/service/apigatewayv2/lister/list_pages_gen.go b/aws/internal/service/apigatewayv2/lister/list_pages_gen.go index 90eba3aac464..499fa7f2c9b9 100644 --- a/aws/internal/service/apigatewayv2/lister/list_pages_gen.go +++ b/aws/internal/service/apigatewayv2/lister/list_pages_gen.go @@ -1,4 +1,4 @@ -// Code generated by "aws/internal/generators/listpages/main.go -function=GetApis github.com/aws/aws-sdk-go/service/apigatewayv2"; DO NOT EDIT. +// Code generated by "aws/internal/generators/listpages/main.go -function=GetApis,GetDomainNames github.com/aws/aws-sdk-go/service/apigatewayv2"; DO NOT EDIT. package lister @@ -29,3 +29,24 @@ func GetApisPagesWithContext(ctx context.Context, conn *apigatewayv2.ApiGatewayV } return nil } + +func GetDomainNamesPages(conn *apigatewayv2.ApiGatewayV2, input *apigatewayv2.GetDomainNamesInput, fn func(*apigatewayv2.GetDomainNamesOutput, bool) bool) error { + return GetDomainNamesPagesWithContext(context.Background(), conn, input, fn) +} + +func GetDomainNamesPagesWithContext(ctx context.Context, conn *apigatewayv2.ApiGatewayV2, input *apigatewayv2.GetDomainNamesInput, fn func(*apigatewayv2.GetDomainNamesOutput, bool) bool) error { + for { + output, err := conn.GetDomainNamesWithContext(ctx, input) + if err != nil { + return err + } + + lastPage := aws.StringValue(output.NextToken) == "" + if !fn(output, lastPage) || lastPage { + break + } + + input.NextToken = output.NextToken + } + return nil +} diff --git a/aws/internal/service/apigatewayv2/waiter/status.go b/aws/internal/service/apigatewayv2/waiter/status.go index 478600fa77aa..dc0bd7e20525 100644 --- a/aws/internal/service/apigatewayv2/waiter/status.go +++ b/aws/internal/service/apigatewayv2/waiter/status.go @@ -2,10 +2,13 @@ package waiter import ( "fmt" + "log" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/apigatewayv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/apigatewayv2/finder" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource" ) // DeploymentStatus fetches the Deployment and its Status @@ -32,6 +35,26 @@ func DeploymentStatus(conn *apigatewayv2.ApiGatewayV2, apiId, deploymentId strin } } +func DomainNameStatus(conn *apigatewayv2.ApiGatewayV2, name string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + domainName, err := finder.DomainNameByName(conn, name) + + if tfresource.NotFound(err) { + return nil, "", nil + } + + if err != nil { + return nil, "", err + } + + if statusMessage := aws.StringValue(domainName.DomainNameConfigurations[0].DomainNameStatusMessage); statusMessage != "" { + log.Printf("[INFO] API Gateway v2 domain name (%s) status message: %s", name, statusMessage) + } + + return domainName, aws.StringValue(domainName.DomainNameConfigurations[0].DomainNameStatus), nil + } +} + // VpcLinkStatus fetches the VPC Link and its Status func VpcLinkStatus(conn *apigatewayv2.ApiGatewayV2, vpcLinkId string) resource.StateRefreshFunc { return func() (interface{}, string, error) { diff --git a/aws/internal/service/apigatewayv2/waiter/waiter.go b/aws/internal/service/apigatewayv2/waiter/waiter.go index 4f3d536f5b99..73419717ff17 100644 --- a/aws/internal/service/apigatewayv2/waiter/waiter.go +++ b/aws/internal/service/apigatewayv2/waiter/waiter.go @@ -36,6 +36,23 @@ func DeploymentDeployed(conn *apigatewayv2.ApiGatewayV2, apiId, deploymentId str return nil, err } +func DomainNameAvailable(conn *apigatewayv2.ApiGatewayV2, name string, timeout time.Duration) (*apigatewayv2.GetDomainNameOutput, error) { + stateConf := &resource.StateChangeConf{ + Pending: []string{apigatewayv2.DomainNameStatusUpdating}, + Target: []string{apigatewayv2.DomainNameStatusAvailable}, + Refresh: DomainNameStatus(conn, name), + Timeout: timeout, + } + + outputRaw, err := stateConf.WaitForState() + + if v, ok := outputRaw.(*apigatewayv2.GetDomainNameOutput); ok { + return v, err + } + + return nil, err +} + // VpcLinkAvailable waits for a VPC Link to return Available func VpcLinkAvailable(conn *apigatewayv2.ApiGatewayV2, vpcLinkId string) (*apigatewayv2.GetVpcLinkOutput, error) { stateConf := &resource.StateChangeConf{ diff --git a/aws/internal/service/codestarconnections/finder/finder.go b/aws/internal/service/codestarconnections/finder/finder.go new file mode 100644 index 000000000000..f0ae5bc1f0df --- /dev/null +++ b/aws/internal/service/codestarconnections/finder/finder.go @@ -0,0 +1,22 @@ +package finder + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/codestarconnections" +) + +// ConnectionByArn returns the Connection corresponding to the specified Arn. +func ConnectionByArn(conn *codestarconnections.CodeStarConnections, arn string) (*codestarconnections.Connection, error) { + output, err := conn.GetConnection(&codestarconnections.GetConnectionInput{ + ConnectionArn: aws.String(arn), + }) + if err != nil { + return nil, err + } + + if output == nil || output.Connection == nil { + return nil, nil + } + + return output.Connection, nil +} diff --git a/aws/internal/service/ec2/errors.go b/aws/internal/service/ec2/errors.go index 0dafebe3f564..4414e732b062 100644 --- a/aws/internal/service/ec2/errors.go +++ b/aws/internal/service/ec2/errors.go @@ -9,7 +9,8 @@ import ( ) const ( - ErrCodeInvalidParameterValue = "InvalidParameterValue" + ErrCodeInvalidParameterException = "InvalidParameterException" + ErrCodeInvalidParameterValue = "InvalidParameterValue" ) const ( @@ -21,9 +22,14 @@ const ( ) const ( + ErrCodeInvalidRouteNotFound = "InvalidRoute.NotFound" ErrCodeInvalidRouteTableIDNotFound = "InvalidRouteTableID.NotFound" ) +const ( + ErrCodeInvalidTransitGatewayIDNotFound = "InvalidTransitGatewayID.NotFound" +) + const ( ErrCodeClientVpnEndpointIdNotFound = "InvalidClientVpnEndpointId.NotFound" ErrCodeClientVpnAuthorizationRuleNotFound = "InvalidClientVpnEndpointAuthorizationRuleNotFound" diff --git a/aws/internal/service/ec2/finder/finder.go b/aws/internal/service/ec2/finder/finder.go index f3c18a863372..cad843458937 100644 --- a/aws/internal/service/ec2/finder/finder.go +++ b/aws/internal/service/ec2/finder/finder.go @@ -5,6 +5,9 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + tfnet "github.com/terraform-providers/terraform-provider-aws/aws/internal/net" tfec2 "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2" ) @@ -95,6 +98,162 @@ func InstanceByID(conn *ec2.EC2, id string) (*ec2.Instance, error) { return output.Reservations[0].Instances[0], nil } +// NetworkAclByID looks up a NetworkAcl by ID. When not found, returns nil and potentially an API error. +func NetworkAclByID(conn *ec2.EC2, id string) (*ec2.NetworkAcl, error) { + input := &ec2.DescribeNetworkAclsInput{ + NetworkAclIds: aws.StringSlice([]string{id}), + } + + output, err := conn.DescribeNetworkAcls(input) + + if err != nil { + return nil, err + } + + if output == nil { + return nil, nil + } + + for _, networkAcl := range output.NetworkAcls { + if networkAcl == nil { + continue + } + + if aws.StringValue(networkAcl.NetworkAclId) != id { + continue + } + + return networkAcl, nil + } + + return nil, nil +} + +// NetworkAclEntry looks up a NetworkAclEntry by Network ACL ID, Egress, and Rule Number. When not found, returns nil and potentially an API error. +func NetworkAclEntry(conn *ec2.EC2, networkAclID string, egress bool, ruleNumber int) (*ec2.NetworkAclEntry, error) { + input := &ec2.DescribeNetworkAclsInput{ + Filters: []*ec2.Filter{ + { + Name: aws.String("entry.egress"), + Values: aws.StringSlice([]string{fmt.Sprintf("%t", egress)}), + }, + { + Name: aws.String("entry.rule-number"), + Values: aws.StringSlice([]string{fmt.Sprintf("%d", ruleNumber)}), + }, + }, + NetworkAclIds: aws.StringSlice([]string{networkAclID}), + } + + output, err := conn.DescribeNetworkAcls(input) + + if err != nil { + return nil, err + } + + if output == nil { + return nil, nil + } + + for _, networkAcl := range output.NetworkAcls { + if networkAcl == nil { + continue + } + + if aws.StringValue(networkAcl.NetworkAclId) != networkAclID { + continue + } + + for _, entry := range output.NetworkAcls[0].Entries { + if entry == nil { + continue + } + + if aws.BoolValue(entry.Egress) != egress || aws.Int64Value(entry.RuleNumber) != int64(ruleNumber) { + continue + } + + return entry, nil + } + } + + return nil, nil +} + +// RouteTableByID returns the route table corresponding to the specified identifier. +// Returns NotFoundError if no route table is found. +func RouteTableByID(conn *ec2.EC2, routeTableID string) (*ec2.RouteTable, error) { + input := &ec2.DescribeRouteTablesInput{ + RouteTableIds: aws.StringSlice([]string{routeTableID}), + } + + return RouteTable(conn, input) +} + +func RouteTable(conn *ec2.EC2, input *ec2.DescribeRouteTablesInput) (*ec2.RouteTable, error) { + output, err := conn.DescribeRouteTables(input) + + if tfawserr.ErrCodeEquals(err, tfec2.ErrCodeInvalidRouteTableIDNotFound) { + return nil, &resource.NotFoundError{ + LastError: err, + LastRequest: input, + } + } + + if err != nil { + return nil, err + } + + if output == nil || len(output.RouteTables) == 0 || output.RouteTables[0] == nil { + return nil, &resource.NotFoundError{ + Message: "Empty result", + LastRequest: input, + } + } + + return output.RouteTables[0], nil +} + +// RouteFinder returns the route corresponding to the specified destination. +// Returns NotFoundError if no route is found. +type RouteFinder func(*ec2.EC2, string, string) (*ec2.Route, error) + +// RouteByIPv4Destination returns the route corresponding to the specified IPv4 destination. +// Returns NotFoundError if no route is found. +func RouteByIPv4Destination(conn *ec2.EC2, routeTableID, destinationCidr string) (*ec2.Route, error) { + routeTable, err := RouteTableByID(conn, routeTableID) + + if err != nil { + return nil, err + } + + for _, route := range routeTable.Routes { + if tfnet.CIDRBlocksEqual(aws.StringValue(route.DestinationCidrBlock), destinationCidr) { + return route, nil + } + } + + return nil, &resource.NotFoundError{} +} + +// RouteByIPv6Destination returns the route corresponding to the specified IPv6 destination. +// Returns NotFoundError if no route is found. +func RouteByIPv6Destination(conn *ec2.EC2, routeTableID, destinationIpv6Cidr string) (*ec2.Route, error) { + routeTable, err := RouteTableByID(conn, routeTableID) + + if err != nil { + return nil, err + } + + for _, route := range routeTable.Routes { + if tfnet.CIDRBlocksEqual(aws.StringValue(route.DestinationIpv6CidrBlock), destinationIpv6Cidr) { + return route, nil + } + } + + return nil, &resource.NotFoundError{} +} + // SecurityGroupByID looks up a security group by ID. When not found, returns nil and potentially an API error. func SecurityGroupByID(conn *ec2.EC2, id string) (*ec2.SecurityGroup, error) { req := &ec2.DescribeSecurityGroupsInput{ @@ -210,6 +369,37 @@ func VpcAttribute(conn *ec2.EC2, vpcID string, attribute string) (*bool, error) return nil, fmt.Errorf("unimplemented VPC attribute: %s", attribute) } +// VpcByID looks up a Vpc by ID. When not found, returns nil and potentially an API error. +func VpcByID(conn *ec2.EC2, id string) (*ec2.Vpc, error) { + input := &ec2.DescribeVpcsInput{ + VpcIds: aws.StringSlice([]string{id}), + } + + output, err := conn.DescribeVpcs(input) + + if err != nil { + return nil, err + } + + if output == nil { + return nil, nil + } + + for _, vpc := range output.Vpcs { + if vpc == nil { + continue + } + + if aws.StringValue(vpc.VpcId) != id { + continue + } + + return vpc, nil + } + + return nil, nil +} + // VpcPeeringConnectionByID returns the VPC peering connection corresponding to the specified identifier. // Returns nil and potentially an error if no VPC peering connection is found. func VpcPeeringConnectionByID(conn *ec2.EC2, id string) (*ec2.VpcPeeringConnection, error) { diff --git a/aws/internal/service/ec2/id.go b/aws/internal/service/ec2/id.go index 3eb2a65c3e1a..c7fa5040e0f7 100644 --- a/aws/internal/service/ec2/id.go +++ b/aws/internal/service/ec2/id.go @@ -71,6 +71,11 @@ func ClientVpnRouteParseID(id string) (string, string, string, error) { "target-subnet-id"+clientVpnRouteIDSeparator+"destination-cidr-block", id) } +// RouteCreateID returns a route resource ID. +func RouteCreateID(routeTableID, destination string) string { + return fmt.Sprintf("r-%s%d", routeTableID, hashcode.String(destination)) +} + const transitGatewayPrefixListReferenceSeparator = "_" func TransitGatewayPrefixListReferenceCreateID(transitGatewayRouteTableID string, prefixListID string) string { diff --git a/aws/internal/service/ec2/waiter/waiter.go b/aws/internal/service/ec2/waiter/waiter.go index 503210314bff..a7385d40cef7 100644 --- a/aws/internal/service/ec2/waiter/waiter.go +++ b/aws/internal/service/ec2/waiter/waiter.go @@ -252,6 +252,11 @@ func InstanceIamInstanceProfileUpdated(conn *ec2.EC2, instanceID string, expecte return nil, err } +const ( + NetworkAclPropagationTimeout = 2 * time.Minute + NetworkAclEntryPropagationTimeout = 5 * time.Minute +) + func SecurityGroupCreated(conn *ec2.EC2, id string, timeout time.Duration) (*ec2.SecurityGroup, error) { stateConf := &resource.StateChangeConf{ Pending: []string{SecurityGroupStatusNotFound}, @@ -270,6 +275,7 @@ func SecurityGroupCreated(conn *ec2.EC2, id string, timeout time.Duration) (*ec2 } const ( + SubnetPropagationTimeout = 2 * time.Minute SubnetAttributePropagationTimeout = 5 * time.Minute ) @@ -369,6 +375,7 @@ func TransitGatewayPrefixListReferenceStateUpdated(conn *ec2.EC2, transitGateway } const ( + VpcPropagationTimeout = 2 * time.Minute VpcAttributePropagationTimeout = 5 * time.Minute ) diff --git a/aws/internal/service/ecs/waiter/status.go b/aws/internal/service/ecs/waiter/status.go index 9b1ba797bb25..3e69362b027d 100644 --- a/aws/internal/service/ecs/waiter/status.go +++ b/aws/internal/service/ecs/waiter/status.go @@ -1,8 +1,11 @@ package waiter import ( + "log" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ecs" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -12,6 +15,14 @@ const ( // EventSubscription Unknown CapacityProviderStatusUnknown = "Unknown" + + // AWS will likely add consts for these at some point + ServiceStatusInactive = "INACTIVE" + ServiceStatusActive = "ACTIVE" + ServiceStatusDraining = "DRAINING" + + ServiceStatusError = "ERROR" + ServiceStatusNone = "NONE" ) // CapacityProviderStatus fetches the Capacity Provider and its Status @@ -34,3 +45,29 @@ func CapacityProviderStatus(conn *ecs.ECS, capacityProvider string) resource.Sta return output.CapacityProviders[0], aws.StringValue(output.CapacityProviders[0].Status), nil } } + +func ServiceStatus(conn *ecs.ECS, id, cluster string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + input := &ecs.DescribeServicesInput{ + Services: aws.StringSlice([]string{id}), + Cluster: aws.String(cluster), + } + + output, err := conn.DescribeServices(input) + + if tfawserr.ErrCodeEquals(err, ecs.ErrCodeServiceNotFoundException) { + return nil, ServiceStatusNone, nil + } + + if err != nil { + return nil, ServiceStatusError, err + } + + if len(output.Services) == 0 { + return nil, ServiceStatusNone, nil + } + + log.Printf("[DEBUG] ECS service (%s) is currently %q", id, *output.Services[0].Status) + return output, aws.StringValue(output.Services[0].Status), err + } +} diff --git a/aws/internal/service/ecs/waiter/waiter.go b/aws/internal/service/ecs/waiter/waiter.go index dd4a3ca4895f..3f12cef4d75f 100644 --- a/aws/internal/service/ecs/waiter/waiter.go +++ b/aws/internal/service/ecs/waiter/waiter.go @@ -3,6 +3,7 @@ package waiter import ( "time" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ecs" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -10,6 +11,12 @@ import ( const ( // Maximum amount of time to wait for a Capacity Provider to return INACTIVE CapacityProviderInactiveTimeout = 20 * time.Minute + + ServiceCreateTimeout = 2 * time.Minute + ServiceInactiveTimeout = 10 * time.Minute + ServiceInactiveTimeoutMin = 1 * time.Second + ServiceDescribeTimeout = 2 * time.Minute + ServiceUpdateTimeout = 2 * time.Minute ) // CapacityProviderInactive waits for a Capacity Provider to return INACTIVE @@ -29,3 +36,65 @@ func CapacityProviderInactive(conn *ecs.ECS, capacityProvider string) (*ecs.Capa return nil, err } + +func ServiceStable(conn *ecs.ECS, id, cluster string) error { + input := &ecs.DescribeServicesInput{ + Services: aws.StringSlice([]string{id}), + } + + if cluster != "" { + input.Cluster = aws.String(cluster) + } + + if err := conn.WaitUntilServicesStable(input); err != nil { + return err + } + return nil +} + +func ServiceInactive(conn *ecs.ECS, id, cluster string) error { + input := &ecs.DescribeServicesInput{ + Services: aws.StringSlice([]string{id}), + } + + if cluster != "" { + input.Cluster = aws.String(cluster) + } + + if err := conn.WaitUntilServicesInactive(input); err != nil { + return err + } + + stateConf := &resource.StateChangeConf{ + Pending: []string{ServiceStatusActive, ServiceStatusDraining}, + Target: []string{ServiceStatusInactive, ServiceStatusNone}, + Refresh: ServiceStatus(conn, id, cluster), + Timeout: ServiceInactiveTimeout, + MinTimeout: ServiceInactiveTimeoutMin, + } + + _, err := stateConf.WaitForState() + + if err != nil { + return err + } + + return nil +} + +func ServiceDescribeReady(conn *ecs.ECS, id, cluster string) (*ecs.DescribeServicesOutput, error) { + stateConf := &resource.StateChangeConf{ + Pending: []string{ServiceStatusInactive, ServiceStatusDraining, ServiceStatusNone}, + Target: []string{ServiceStatusActive}, + Refresh: ServiceStatus(conn, id, cluster), + Timeout: ServiceDescribeTimeout, + } + + outputRaw, err := stateConf.WaitForState() + + if v, ok := outputRaw.(*ecs.DescribeServicesOutput); ok { + return v, err + } + + return nil, err +} diff --git a/aws/internal/service/efs/waiter/status.go b/aws/internal/service/efs/waiter/status.go index d48fb58c92b5..97d4f7d1612d 100644 --- a/aws/internal/service/efs/waiter/status.go +++ b/aws/internal/service/efs/waiter/status.go @@ -28,3 +28,26 @@ func AccessPointLifeCycleState(conn *efs.EFS, accessPointId string) resource.Sta return mt, aws.StringValue(mt.LifeCycleState), nil } } + +// FileSystemLifeCycleState fetches the Access Point and its LifecycleState +func FileSystemLifeCycleState(conn *efs.EFS, fileSystemID string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + input := &efs.DescribeFileSystemsInput{ + FileSystemId: aws.String(fileSystemID), + } + + output, err := conn.DescribeFileSystems(input) + + if err != nil { + return nil, "", err + } + + if output == nil || len(output.FileSystems) == 0 || output.FileSystems[0] == nil { + return nil, "", nil + } + + mt := output.FileSystems[0] + + return mt, aws.StringValue(mt.LifeCycleState), nil + } +} diff --git a/aws/internal/service/efs/waiter/waiter.go b/aws/internal/service/efs/waiter/waiter.go index 71db067975ae..fd065e5c89d4 100644 --- a/aws/internal/service/efs/waiter/waiter.go +++ b/aws/internal/service/efs/waiter/waiter.go @@ -9,8 +9,14 @@ import ( const ( // Maximum amount of time to wait for an Operation to return Success - AccessPointCreatedTimeout = 10 * time.Minute - AccessPointDeletedTimeout = 10 * time.Minute + AccessPointCreatedTimeout = 10 * time.Minute + AccessPointDeletedTimeout = 10 * time.Minute + FileSystemAvailableTimeout = 10 * time.Minute + FileSystemAvailableDelayTimeout = 2 * time.Second + FileSystemAvailableMinTimeout = 3 * time.Second + FileSystemDeletedTimeout = 10 * time.Minute + FileSystemDeletedDelayTimeout = 2 * time.Second + FileSystemDeletedMinTimeout = 3 * time.Second ) // AccessPointCreated waits for an Operation to return Success @@ -48,3 +54,43 @@ func AccessPointDeleted(conn *efs.EFS, accessPointId string) (*efs.AccessPointDe return nil, err } + +// FileSystemAvailable waits for an Operation to return Available +func FileSystemAvailable(conn *efs.EFS, fileSystemID string) (*efs.FileSystemDescription, error) { + stateConf := &resource.StateChangeConf{ + Pending: []string{efs.LifeCycleStateCreating, efs.LifeCycleStateUpdating}, + Target: []string{efs.LifeCycleStateAvailable}, + Refresh: FileSystemLifeCycleState(conn, fileSystemID), + Timeout: FileSystemAvailableTimeout, + Delay: FileSystemAvailableDelayTimeout, + MinTimeout: FileSystemAvailableMinTimeout, + } + + outputRaw, err := stateConf.WaitForState() + + if output, ok := outputRaw.(*efs.FileSystemDescription); ok { + return output, err + } + + return nil, err +} + +// FileSystemDeleted waits for an Operation to return Deleted +func FileSystemDeleted(conn *efs.EFS, fileSystemID string) (*efs.FileSystemDescription, error) { + stateConf := &resource.StateChangeConf{ + Pending: []string{efs.LifeCycleStateAvailable, efs.LifeCycleStateDeleting}, + Target: []string{}, + Refresh: FileSystemLifeCycleState(conn, fileSystemID), + Timeout: FileSystemDeletedTimeout, + Delay: FileSystemDeletedDelayTimeout, + MinTimeout: FileSystemDeletedMinTimeout, + } + + outputRaw, err := stateConf.WaitForState() + + if output, ok := outputRaw.(*efs.FileSystemDescription); ok { + return output, err + } + + return nil, err +} diff --git a/aws/internal/service/kinesis/finder/finder.go b/aws/internal/service/kinesis/finder/finder.go new file mode 100644 index 000000000000..ac13b1b0d059 --- /dev/null +++ b/aws/internal/service/kinesis/finder/finder.go @@ -0,0 +1,25 @@ +package finder + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/kinesis" +) + +// StreamConsumerByARN returns the stream consumer corresponding to the specified ARN. +// Returns nil if no stream consumer is found. +func StreamConsumerByARN(conn *kinesis.Kinesis, arn string) (*kinesis.ConsumerDescription, error) { + input := &kinesis.DescribeStreamConsumerInput{ + ConsumerARN: aws.String(arn), + } + + output, err := conn.DescribeStreamConsumer(input) + if err != nil { + return nil, err + } + + if output == nil { + return nil, nil + } + + return output.ConsumerDescription, nil +} diff --git a/aws/internal/service/kinesis/waiter/status.go b/aws/internal/service/kinesis/waiter/status.go new file mode 100644 index 000000000000..b8403ac6e27d --- /dev/null +++ b/aws/internal/service/kinesis/waiter/status.go @@ -0,0 +1,30 @@ +package waiter + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/kinesis" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/kinesis/finder" +) + +const ( + StreamConsumerStatusNotFound = "NotFound" + StreamConsumerStatusUnknown = "Unknown" +) + +// StreamConsumerStatus fetches the StreamConsumer and its Status +func StreamConsumerStatus(conn *kinesis.Kinesis, arn string) resource.StateRefreshFunc { + return func() (interface{}, string, error) { + consumer, err := finder.StreamConsumerByARN(conn, arn) + + if err != nil { + return nil, StreamConsumerStatusUnknown, err + } + + if consumer == nil { + return nil, StreamConsumerStatusNotFound, nil + } + + return consumer, aws.StringValue(consumer.ConsumerStatus), nil + } +} diff --git a/aws/internal/service/kinesis/waiter/waiter.go b/aws/internal/service/kinesis/waiter/waiter.go new file mode 100644 index 000000000000..1e3814bcd656 --- /dev/null +++ b/aws/internal/service/kinesis/waiter/waiter.go @@ -0,0 +1,49 @@ +package waiter + +import ( + "time" + + "github.com/aws/aws-sdk-go/service/kinesis" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +const ( + StreamConsumerCreatedTimeout = 5 * time.Minute + StreamConsumerDeletedTimeout = 5 * time.Minute +) + +// StreamConsumerCreated waits for an Stream Consumer to return Active +func StreamConsumerCreated(conn *kinesis.Kinesis, arn string) (*kinesis.ConsumerDescription, error) { + stateConf := &resource.StateChangeConf{ + Pending: []string{kinesis.ConsumerStatusCreating}, + Target: []string{kinesis.ConsumerStatusActive}, + Refresh: StreamConsumerStatus(conn, arn), + Timeout: StreamConsumerCreatedTimeout, + } + + outputRaw, err := stateConf.WaitForState() + + if v, ok := outputRaw.(*kinesis.ConsumerDescription); ok { + return v, err + } + + return nil, err +} + +// StreamConsumerDeleted waits for a Stream Consumer to be deleted +func StreamConsumerDeleted(conn *kinesis.Kinesis, arn string) (*kinesis.ConsumerDescription, error) { + stateConf := &resource.StateChangeConf{ + Pending: []string{kinesis.ConsumerStatusDeleting}, + Target: []string{}, + Refresh: StreamConsumerStatus(conn, arn), + Timeout: StreamConsumerDeletedTimeout, + } + + outputRaw, err := stateConf.WaitForState() + + if v, ok := outputRaw.(*kinesis.ConsumerDescription); ok { + return v, err + } + + return nil, err +} diff --git a/aws/internal/service/sagemaker/waiter/waiter.go b/aws/internal/service/sagemaker/waiter/waiter.go index 34273d0324ff..ba063adf6edd 100644 --- a/aws/internal/service/sagemaker/waiter/waiter.go +++ b/aws/internal/service/sagemaker/waiter/waiter.go @@ -8,7 +8,7 @@ import ( ) const ( - NotebookInstanceInServiceTimeout = 10 * time.Minute + NotebookInstanceInServiceTimeout = 60 * time.Minute NotebookInstanceStoppedTimeout = 10 * time.Minute NotebookInstanceDeletedTimeout = 10 * time.Minute ModelPackageGroupCompletedTimeout = 10 * time.Minute diff --git a/aws/internal/service/sns/finder/finder.go b/aws/internal/service/sns/finder/finder.go new file mode 100644 index 000000000000..79628328ebfa --- /dev/null +++ b/aws/internal/service/sns/finder/finder.go @@ -0,0 +1,26 @@ +package finder + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/sns" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" +) + +func SubscriptionByARN(conn *sns.SNS, id string) (*sns.GetSubscriptionAttributesOutput, error) { + output, err := conn.GetSubscriptionAttributes(&sns.GetSubscriptionAttributesInput{ + SubscriptionArn: aws.String(id), + }) + if tfawserr.ErrCodeEquals(err, sns.ErrCodeNotFoundException) { + return nil, nil + } + + if err != nil { + return nil, err + } + + if output == nil || output.Attributes == nil || len(output.Attributes) == 0 { + return nil, nil + } + + return output, nil +} diff --git a/aws/internal/service/sns/waiter/status.go b/aws/internal/service/sns/waiter/status.go index 310132194040..45e2f163327f 100644 --- a/aws/internal/service/sns/waiter/status.go +++ b/aws/internal/service/sns/waiter/status.go @@ -3,20 +3,13 @@ package waiter import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/sns" - "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/sns/finder" ) func SubscriptionPendingConfirmation(conn *sns.SNS, id string) resource.StateRefreshFunc { return func() (interface{}, string, error) { - output, err := conn.GetSubscriptionAttributes(&sns.GetSubscriptionAttributesInput{ - SubscriptionArn: aws.String(id), - }) - - if tfawserr.ErrCodeEquals(err, sns.ErrCodeResourceNotFoundException) { - return nil, "", nil - } - + output, err := finder.SubscriptionByARN(conn, id) if err != nil { return nil, "", err } diff --git a/aws/internal/service/sns/waiter/waiter.go b/aws/internal/service/sns/waiter/waiter.go index fb7c5a850088..efd75f3ed494 100644 --- a/aws/internal/service/sns/waiter/waiter.go +++ b/aws/internal/service/sns/waiter/waiter.go @@ -9,6 +9,7 @@ import ( const ( SubscriptionPendingConfirmationTimeout = 2 * time.Minute + SubscriptionDeleteTimeout = 2 * time.Minute ) func SubscriptionConfirmed(conn *sns.SNS, id, expectedValue string, timeout time.Duration) (*sns.GetSubscriptionAttributesOutput, error) { @@ -26,3 +27,20 @@ func SubscriptionConfirmed(conn *sns.SNS, id, expectedValue string, timeout time return nil, err } + +func SubscriptionDeleted(conn *sns.SNS, id string) (*sns.GetSubscriptionAttributesOutput, error) { + stateConf := &resource.StateChangeConf{ + Pending: []string{"false", "true"}, + Target: []string{}, + Refresh: SubscriptionPendingConfirmation(conn, id), + Timeout: SubscriptionDeleteTimeout, + } + + outputRaw, err := stateConf.WaitForState() + + if output, ok := outputRaw.(*sns.GetSubscriptionAttributesOutput); ok { + return output, err + } + + return nil, err +} diff --git a/aws/internal/service/ssm/finder/finder.go b/aws/internal/service/ssm/finder/finder.go index 4621f375fe51..66f938b8a2e4 100644 --- a/aws/internal/service/ssm/finder/finder.go +++ b/aws/internal/service/ssm/finder/finder.go @@ -30,3 +30,32 @@ func DocumentByName(conn *ssm.SSM, name string) (*ssm.DocumentDescription, error return output.Document, nil } + +// PatchGroup returns matching SSM Patch Group by Patch Group and BaselineId. +func PatchGroup(conn *ssm.SSM, patchGroup, baselineId string) (*ssm.PatchGroupPatchBaselineMapping, error) { + input := &ssm.DescribePatchGroupsInput{} + var result *ssm.PatchGroupPatchBaselineMapping + + err := conn.DescribePatchGroupsPages(input, func(page *ssm.DescribePatchGroupsOutput, lastPage bool) bool { + if page == nil { + return !lastPage + } + + for _, mapping := range page.Mappings { + if mapping == nil { + continue + } + + if aws.StringValue(mapping.PatchGroup) == patchGroup { + if mapping.BaselineIdentity != nil && aws.StringValue(mapping.BaselineIdentity.BaselineId) == baselineId { + result = mapping + return false + } + } + } + + return !lastPage + }) + + return result, err +} diff --git a/aws/internal/service/storagegateway/finder/finder.go b/aws/internal/service/storagegateway/finder/finder.go index 986d73fd63b8..c0269abda394 100644 --- a/aws/internal/service/storagegateway/finder/finder.go +++ b/aws/internal/service/storagegateway/finder/finder.go @@ -5,6 +5,54 @@ import ( "github.com/aws/aws-sdk-go/service/storagegateway" ) +func LocalDiskByDiskId(conn *storagegateway.StorageGateway, gatewayARN string, diskID string) (*storagegateway.Disk, error) { + input := &storagegateway.ListLocalDisksInput{ + GatewayARN: aws.String(gatewayARN), + } + + output, err := conn.ListLocalDisks(input) + + if err != nil { + return nil, err + } + + if output == nil { + return nil, nil + } + + for _, disk := range output.Disks { + if aws.StringValue(disk.DiskId) == diskID { + return disk, nil + } + } + + return nil, nil +} + +func LocalDiskByDiskPath(conn *storagegateway.StorageGateway, gatewayARN string, diskPath string) (*storagegateway.Disk, error) { + input := &storagegateway.ListLocalDisksInput{ + GatewayARN: aws.String(gatewayARN), + } + + output, err := conn.ListLocalDisks(input) + + if err != nil { + return nil, err + } + + if output == nil { + return nil, nil + } + + for _, disk := range output.Disks { + if aws.StringValue(disk.DiskPath) == diskPath { + return disk, nil + } + } + + return nil, nil +} + func UploadBufferDisk(conn *storagegateway.StorageGateway, gatewayARN string, diskID string) (*string, error) { input := &storagegateway.DescribeUploadBufferInput{ GatewayARN: aws.String(gatewayARN), diff --git a/aws/provider.go b/aws/provider.go index a8078c1ff527..27bf36d6f018 100644 --- a/aws/provider.go +++ b/aws/provider.go @@ -89,6 +89,23 @@ func Provider() *schema.Provider { Set: schema.HashString, }, + "default_tags": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Description: "Configuration block with settings to default resource tags across all resources.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "tags": { + Type: schema.TypeMap, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Description: "Resource tags to default across all resources", + }, + }, + }, + }, + "endpoints": endpointsSchema(), "ignore_tags": { @@ -204,6 +221,7 @@ func Provider() *schema.Provider { "aws_codeartifact_repository_endpoint": dataSourceAwsCodeArtifactRepositoryEndpoint(), "aws_cognito_user_pools": dataSourceAwsCognitoUserPools(), "aws_codecommit_repository": dataSourceAwsCodeCommitRepository(), + "aws_codestarconnections_connection": dataSourceAwsCodeStarConnectionsConnection(), "aws_cur_report_definition": dataSourceAwsCurReportDefinition(), "aws_db_cluster_snapshot": dataSourceAwsDbClusterSnapshot(), "aws_db_event_categories": dataSourceAwsDbEventCategories(), @@ -239,6 +257,7 @@ func Provider() *schema.Provider { "aws_ec2_transit_gateway_dx_gateway_attachment": dataSourceAwsEc2TransitGatewayDxGatewayAttachment(), "aws_ec2_transit_gateway_peering_attachment": dataSourceAwsEc2TransitGatewayPeeringAttachment(), "aws_ec2_transit_gateway_route_table": dataSourceAwsEc2TransitGatewayRouteTable(), + "aws_ec2_transit_gateway_route_tables": dataSourceAwsEc2TransitGatewayRouteTables(), "aws_ec2_transit_gateway_vpc_attachment": dataSourceAwsEc2TransitGatewayVpcAttachment(), "aws_ec2_transit_gateway_vpn_attachment": dataSourceAwsEc2TransitGatewayVpnAttachment(), "aws_ecr_authorization_token": dataSourceAwsEcrAuthorizationToken(), @@ -290,6 +309,7 @@ func Provider() *schema.Provider { "aws_iot_endpoint": dataSourceAwsIotEndpoint(), "aws_ip_ranges": dataSourceAwsIPRanges(), "aws_kinesis_stream": dataSourceAwsKinesisStream(), + "aws_kinesis_stream_consumer": dataSourceAwsKinesisStreamConsumer(), "aws_kms_alias": dataSourceAwsKmsAlias(), "aws_kms_ciphertext": dataSourceAwsKmsCiphertext(), "aws_kms_key": dataSourceAwsKmsKey(), @@ -770,6 +790,7 @@ func Provider() *schema.Provider { "aws_kinesisanalyticsv2_application": resourceAwsKinesisAnalyticsV2Application(), "aws_kinesis_firehose_delivery_stream": resourceAwsKinesisFirehoseDeliveryStream(), "aws_kinesis_stream": resourceAwsKinesisStream(), + "aws_kinesis_stream_consumer": resourceAwsKinesisStreamConsumer(), "aws_kinesis_video_stream": resourceAwsKinesisVideoStream(), "aws_kms_alias": resourceAwsKmsAlias(), "aws_kms_external_key": resourceAwsKmsExternalKey(), @@ -797,6 +818,7 @@ func Provider() *schema.Provider { "aws_licensemanager_license_configuration": resourceAwsLicenseManagerLicenseConfiguration(), "aws_lightsail_domain": resourceAwsLightsailDomain(), "aws_lightsail_instance": resourceAwsLightsailInstance(), + "aws_lightsail_instance_public_ports": resourceAwsLightsailInstancePublicPorts(), "aws_lightsail_key_pair": resourceAwsLightsailKeyPair(), "aws_lightsail_static_ip": resourceAwsLightsailStaticIp(), "aws_lightsail_static_ip_attachment": resourceAwsLightsailStaticIpAttachment(), @@ -1189,6 +1211,7 @@ func init() { "appstream", "appsync", "athena", + "auditmanager", "autoscaling", "autoscalingplans", "backup", @@ -1340,6 +1363,7 @@ func providerConfigure(d *schema.ResourceData, terraformVersion string) (interfa Token: d.Get("token").(string), Region: d.Get("region").(string), CredsFilename: d.Get("shared_credentials_file").(string), + DefaultTagsConfig: expandProviderDefaultTags(d.Get("default_tags").([]interface{})), Endpoints: make(map[string]string), MaxRetries: d.Get("max_retries").(int), IgnoreTagsConfig: expandProviderIgnoreTags(d.Get("ignore_tags").([]interface{})), @@ -1525,6 +1549,20 @@ func endpointsSchema() *schema.Schema { } } +func expandProviderDefaultTags(l []interface{}) *keyvaluetags.DefaultConfig { + if len(l) == 0 || l[0] == nil { + return nil + } + + defaultConfig := &keyvaluetags.DefaultConfig{} + m := l[0].(map[string]interface{}) + + if v, ok := m["tags"].(map[string]interface{}); ok { + defaultConfig.Tags = keyvaluetags.New(v) + } + return defaultConfig +} + func expandProviderIgnoreTags(l []interface{}) *keyvaluetags.IgnoreConfig { if len(l) == 0 || l[0] == nil { return nil diff --git a/aws/provider_test.go b/aws/provider_test.go index 70af59809dbe..c93a9d5dfb57 100644 --- a/aws/provider_test.go +++ b/aws/provider_test.go @@ -888,6 +888,38 @@ func testAccMultipleRegionProviderConfig(regions int) string { return config.String() } +func testAccProviderConfigDefaultAndIgnoreTagsKeyPrefixes1(key1, value1, keyPrefix1 string) string { + //lintignore:AT004 + return fmt.Sprintf(` +provider "aws" { + default_tags { + tags = { + %q = %q + } + } + ignore_tags { + key_prefixes = [%q] + } +} +`, key1, value1, keyPrefix1) +} + +func testAccProviderConfigDefaultAndIgnoreTagsKeys1(key1, value1 string) string { + //lintignore:AT004 + return fmt.Sprintf(` +provider "aws" { + default_tags { + tags = { + %[1]q = %q + } + } + ignore_tags { + keys = [%[1]q] + } +} +`, key1, value1) +} + func testAccProviderConfigIgnoreTagsKeyPrefixes1(keyPrefix1 string) string { //lintignore:AT004 return fmt.Sprintf(` @@ -1036,6 +1068,79 @@ func testAccErrorCheckSkipMessagesContaining(t *testing.T, messages ...string) r } } +type ServiceErrorCheckFunc func(*testing.T) resource.ErrorCheckFunc + +var serviceErrorCheckFuncs map[string]ServiceErrorCheckFunc + +func RegisterServiceErrorCheckFunc(endpointID string, f ServiceErrorCheckFunc) { + if serviceErrorCheckFuncs == nil { + serviceErrorCheckFuncs = make(map[string]ServiceErrorCheckFunc) + } + + if _, ok := serviceErrorCheckFuncs[endpointID]; ok { + // already registered + panic(fmt.Sprintf("Cannot re-register a service! ServiceErrorCheckFunc exists for %s", endpointID)) //lintignore:R009 + } + + serviceErrorCheckFuncs[endpointID] = f +} + +func testAccErrorCheck(t *testing.T, endpointIDs ...string) resource.ErrorCheckFunc { + return func(err error) error { + if err == nil { + return err + } + + for _, endpointID := range endpointIDs { + if f, ok := serviceErrorCheckFuncs[endpointID]; ok { + ef := f(t) + err = ef(err) + } + + if err == nil { + break + } + } + + if testAccErrorCheckCommon(err) { + t.Skipf("skipping test for %s/%s: %s", testAccGetPartition(), testAccGetRegion(), err.Error()) + } + + return err + } +} + +// NOTE: This function cannot use the standard tfawserr helpers +// as it is receiving error strings from the SDK testing framework, +// not actual error types from the resource logic. +func testAccErrorCheckCommon(err error) bool { + if strings.Contains(err.Error(), "is not supported in this") { + return true + } + + if strings.Contains(err.Error(), "is currently not supported") { + return true + } + + if strings.Contains(err.Error(), "InvalidAction") { + return true + } + + if strings.Contains(err.Error(), "Unknown operation") { + return true + } + + if strings.Contains(err.Error(), "UnknownOperationException") { + return true + } + + if strings.Contains(err.Error(), "UnsupportedOperation") { + return true + } + + return false +} + // Check service API call error for reasons to skip acceptance testing // These include missing API endpoints and unsupported API calls func testAccPreCheckSkipError(err error) bool { @@ -1118,6 +1223,106 @@ func testSweepSkipResourceError(err error) bool { return tfawserr.ErrCodeContains(err, "AccessDenied") } +func TestAccProvider_DefaultTags_EmptyConfigurationBlock(t *testing.T) { + var providers []*schema.Provider + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: testAccAWSProviderConfigDefaultTagsEmptyConfigurationBlock(), + Check: resource.ComposeTestCheckFunc( + testAccCheckProviderDefaultTags_Tags(&providers, map[string]string{}), + ), + }, + }, + }) +} + +func TestAccAWSProvider_DefaultTags_Tags_None(t *testing.T) { + var providers []*schema.Provider + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: testAccAWSProviderConfigDefaultTags_Tags0(), + Check: resource.ComposeTestCheckFunc( + testAccCheckProviderDefaultTags_Tags(&providers, map[string]string{}), + ), + }, + }, + }) +} + +func TestAccAWSProvider_DefaultTags_Tags_One(t *testing.T) { + var providers []*schema.Provider + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: testAccAWSProviderConfigDefaultTags_Tags1("test", "value"), + Check: resource.ComposeTestCheckFunc( + testAccCheckProviderDefaultTags_Tags(&providers, map[string]string{"test": "value"}), + ), + }, + }, + }) +} + +func TestAccAWSProvider_DefaultTags_Tags_Multiple(t *testing.T) { + var providers []*schema.Provider + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: testAccAWSProviderConfigDefaultTags_Tags2("test1", "value1", "test2", "value2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckProviderDefaultTags_Tags(&providers, map[string]string{ + "test1": "value1", + "test2": "value2", + }), + ), + }, + }, + }) +} + +func TestAccAWSProvider_DefaultAndIgnoreTags_EmptyConfigurationBlocks(t *testing.T) { + var providers []*schema.Provider + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: testAccAWSProviderConfigDefaultAndIgnoreTagsEmptyConfigurationBlock(), + Check: resource.ComposeTestCheckFunc( + testAccCheckProviderDefaultTags_Tags(&providers, map[string]string{}), + testAccCheckAWSProviderIgnoreTagsKeys(&providers, []string{}), + testAccCheckAWSProviderIgnoreTagsKeyPrefixes(&providers, []string{}), + ), + }, + }, + }) +} + func TestAccAWSProvider_Endpoints(t *testing.T) { var providers []*schema.Provider var endpoints strings.Builder @@ -1129,6 +1334,7 @@ func TestAccAWSProvider_Endpoints(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1147,6 +1353,7 @@ func TestAccAWSProvider_IgnoreTags_EmptyConfigurationBlock(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1166,6 +1373,7 @@ func TestAccAWSProvider_IgnoreTags_KeyPrefixes_None(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1184,6 +1392,7 @@ func TestAccAWSProvider_IgnoreTags_KeyPrefixes_One(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1202,6 +1411,7 @@ func TestAccAWSProvider_IgnoreTags_KeyPrefixes_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1220,6 +1430,7 @@ func TestAccAWSProvider_IgnoreTags_Keys_None(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1238,6 +1449,7 @@ func TestAccAWSProvider_IgnoreTags_Keys_One(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1256,6 +1468,7 @@ func TestAccAWSProvider_IgnoreTags_Keys_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1274,6 +1487,7 @@ func TestAccAWSProvider_Region_AwsC2S(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1295,6 +1509,7 @@ func TestAccAWSProvider_Region_AwsChina(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1316,6 +1531,7 @@ func TestAccAWSProvider_Region_AwsCommercial(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1337,6 +1553,7 @@ func TestAccAWSProvider_Region_AwsGovCloudUs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1358,6 +1575,7 @@ func TestAccAWSProvider_Region_AwsSC2S(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1379,6 +1597,7 @@ func TestAccAWSProvider_AssumeRole_Empty(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: nil, Steps: []resource.TestStep{ @@ -1613,6 +1832,69 @@ func testAccCheckAWSProviderIgnoreTagsKeys(providers *[]*schema.Provider, expect } } +func testAccCheckProviderDefaultTags_Tags(providers *[]*schema.Provider, expectedTags map[string]string) resource.TestCheckFunc { + return func(s *terraform.State) error { + if providers == nil { + return fmt.Errorf("no providers initialized") + } + + for _, provider := range *providers { + if provider == nil || provider.Meta() == nil || provider.Meta().(*AWSClient) == nil { + continue + } + + providerClient := provider.Meta().(*AWSClient) + defaultTagsConfig := providerClient.DefaultTagsConfig + + if defaultTagsConfig == nil || len(defaultTagsConfig.Tags) == 0 { + if len(expectedTags) != 0 { + return fmt.Errorf("expected keys (%d) length, got: 0", len(expectedTags)) + } + + continue + } + + actualTags := defaultTagsConfig.Tags + + if len(actualTags) != len(expectedTags) { + return fmt.Errorf("expected tags (%d) length, got: %d", len(expectedTags), len(actualTags)) + } + + for _, expectedElement := range expectedTags { + var found bool + + for _, actualElement := range actualTags { + if aws.StringValue(actualElement.Value) == expectedElement { + found = true + break + } + } + + if !found { + return fmt.Errorf("expected tags element, but was missing: %s", expectedElement) + } + } + + for _, actualElement := range actualTags { + var found bool + + for _, expectedElement := range expectedTags { + if aws.StringValue(actualElement.Value) == expectedElement { + found = true + break + } + } + + if !found { + return fmt.Errorf("unexpected tags element: %s", actualElement) + } + } + } + + return nil + } +} + func testAccCheckAWSProviderPartition(providers *[]*schema.Provider, expectedPartition string) resource.TestCheckFunc { return func(s *terraform.State) error { if providers == nil { @@ -1709,72 +1991,147 @@ func testAccDefaultSubnetCount(t *testing.T) int { return len(output.Subnets) } -func testAccAWSProviderConfigEndpoints(endpoints string) string { +func testAccAWSProviderConfigDefaultTags_Tags0() string { //lintignore:AT004 - return fmt.Sprintf(` + return composeConfig( + testAccProviderConfigBase, + ` provider "aws" { skip_credentials_validation = true skip_get_ec2_platforms = true skip_metadata_api_check = true skip_requesting_account_id = true +} +`) +} - endpoints { - %[1]s +func testAccAWSProviderConfigDefaultTags_Tags1(tag1, value1 string) string { + //lintignore:AT004 + return composeConfig( + testAccProviderConfigBase, + fmt.Sprintf(` +provider "aws" { + default_tags { + tags = { + %q = %q + } } + + skip_credentials_validation = true + skip_get_ec2_platforms = true + skip_metadata_api_check = true + skip_requesting_account_id = true +} +`, tag1, value1)) } -data "aws_partition" "provider_test" {} +func testAccAWSProviderConfigDefaultTags_Tags2(tag1, value1, tag2, value2 string) string { + //lintignore:AT004 + return composeConfig( + testAccProviderConfigBase, + fmt.Sprintf(` +provider "aws" { + default_tags { + tags = { + %q = %q + %q = %q + } + } -# Required to initialize the provider -data "aws_arn" "test" { - arn = "arn:${data.aws_partition.provider_test.partition}:s3:::test" + skip_credentials_validation = true + skip_get_ec2_platforms = true + skip_metadata_api_check = true + skip_requesting_account_id = true } -`, endpoints) +`, tag1, value1, tag2, value2)) } -func testAccAWSProviderConfigIgnoreTagsEmptyConfigurationBlock() string { +func testAccAWSProviderConfigDefaultTagsEmptyConfigurationBlock() string { //lintignore:AT004 - return ` + return composeConfig( + testAccProviderConfigBase, + ` provider "aws" { - ignore_tags {} + default_tags {} skip_credentials_validation = true skip_get_ec2_platforms = true skip_metadata_api_check = true skip_requesting_account_id = true } +`) +} -data "aws_partition" "provider_test" {} +func testAccAWSProviderConfigDefaultAndIgnoreTagsEmptyConfigurationBlock() string { + //lintignore:AT004 + return composeConfig( + testAccProviderConfigBase, + ` +provider "aws" { + default_tags {} + ignore_tags {} -# Required to initialize the provider -data "aws_arn" "test" { - arn = "arn:${data.aws_partition.provider_test.partition}:s3:::test" + skip_credentials_validation = true + skip_get_ec2_platforms = true + skip_metadata_api_check = true + skip_requesting_account_id = true } -` +`) } -func testAccAWSProviderConfigIgnoreTagsKeyPrefixes0() string { +func testAccAWSProviderConfigEndpoints(endpoints string) string { //lintignore:AT004 - return ` + return composeConfig( + testAccProviderConfigBase, + fmt.Sprintf(` provider "aws" { skip_credentials_validation = true skip_get_ec2_platforms = true skip_metadata_api_check = true skip_requesting_account_id = true + + endpoints { + %[1]s + } +} +`, endpoints)) } -data "aws_partition" "provider_test" {} +func testAccAWSProviderConfigIgnoreTagsEmptyConfigurationBlock() string { + //lintignore:AT004 + return composeConfig( + testAccProviderConfigBase, + ` +provider "aws" { + ignore_tags {} -# Required to initialize the provider -data "aws_arn" "test" { - arn = "arn:${data.aws_partition.provider_test.partition}:s3:::test" + skip_credentials_validation = true + skip_get_ec2_platforms = true + skip_metadata_api_check = true + skip_requesting_account_id = true } -` +`) +} + +func testAccAWSProviderConfigIgnoreTagsKeyPrefixes0() string { + //lintignore:AT004 + return composeConfig( + testAccProviderConfigBase, + ` +provider "aws" { + skip_credentials_validation = true + skip_get_ec2_platforms = true + skip_metadata_api_check = true + skip_requesting_account_id = true +} +`) } func testAccAWSProviderConfigIgnoreTagsKeyPrefixes1(tagPrefix1 string) string { //lintignore:AT004 - return fmt.Sprintf(` + return composeConfig( + testAccProviderConfigBase, + fmt.Sprintf(` provider "aws" { ignore_tags { key_prefixes = [%[1]q] @@ -1785,19 +2142,14 @@ provider "aws" { skip_metadata_api_check = true skip_requesting_account_id = true } - -data "aws_partition" "provider_test" {} - -# Required to initialize the provider -data "aws_arn" "test" { - arn = "arn:${data.aws_partition.provider_test.partition}:s3:::test" -} -`, tagPrefix1) +`, tagPrefix1)) } func testAccAWSProviderConfigIgnoreTagsKeyPrefixes2(tagPrefix1, tagPrefix2 string) string { //lintignore:AT004 - return fmt.Sprintf(` + return composeConfig( + testAccProviderConfigBase, + fmt.Sprintf(` provider "aws" { ignore_tags { key_prefixes = [%[1]q, %[2]q] @@ -1808,38 +2160,28 @@ provider "aws" { skip_metadata_api_check = true skip_requesting_account_id = true } - -data "aws_partition" "provider_test" {} - -# Required to initialize the provider -data "aws_arn" "test" { - arn = "arn:${data.aws_partition.provider_test.partition}:s3:::test" -} -`, tagPrefix1, tagPrefix2) +`, tagPrefix1, tagPrefix2)) } func testAccAWSProviderConfigIgnoreTagsKeys0() string { //lintignore:AT004 - return ` + return composeConfig( + testAccProviderConfigBase, + ` provider "aws" { skip_credentials_validation = true skip_get_ec2_platforms = true skip_metadata_api_check = true skip_requesting_account_id = true } - -data "aws_partition" "provider_test" {} - -# Required to initialize the provider -data "aws_arn" "test" { - arn = "arn:${data.aws_partition.provider_test.partition}:s3:::test" -} -` +`) } func testAccAWSProviderConfigIgnoreTagsKeys1(tag1 string) string { //lintignore:AT004 - return fmt.Sprintf(` + return composeConfig( + testAccProviderConfigBase, + fmt.Sprintf(` provider "aws" { ignore_tags { keys = [%[1]q] @@ -1850,19 +2192,14 @@ provider "aws" { skip_metadata_api_check = true skip_requesting_account_id = true } - -data "aws_partition" "provider_test" {} - -# Required to initialize the provider -data "aws_arn" "test" { - arn = "arn:${data.aws_partition.provider_test.partition}:s3:::test" -} -`, tag1) +`, tag1)) } func testAccAWSProviderConfigIgnoreTagsKeys2(tag1, tag2 string) string { //lintignore:AT004 - return fmt.Sprintf(` + return composeConfig( + testAccProviderConfigBase, + fmt.Sprintf(` provider "aws" { ignore_tags { keys = [%[1]q, %[2]q] @@ -1873,19 +2210,14 @@ provider "aws" { skip_metadata_api_check = true skip_requesting_account_id = true } - -data "aws_partition" "provider_test" {} - -# Required to initialize the provider -data "aws_arn" "test" { - arn = "arn:${data.aws_partition.provider_test.partition}:s3:::test" -} -`, tag1, tag2) +`, tag1, tag2)) } func testAccAWSProviderConfigRegion(region string) string { //lintignore:AT004 - return fmt.Sprintf(` + return composeConfig( + testAccProviderConfigBase, + fmt.Sprintf(` provider "aws" { region = %[1]q skip_credentials_validation = true @@ -1893,14 +2225,7 @@ provider "aws" { skip_metadata_api_check = true skip_requesting_account_id = true } - -data "aws_partition" "provider_test" {} - -# Required to initialize the provider -data "aws_arn" "test" { - arn = "arn:${data.aws_partition.provider_test.partition}:s3:::test" -} -`, region) +`, region)) } func testAccAssumeRoleARNPreCheck(t *testing.T) { @@ -1928,6 +2253,15 @@ provider "aws" { data "aws_caller_identity" "current" {} ` //lintignore:AT004 +const testAccProviderConfigBase = ` +data "aws_partition" "provider_test" {} + +# Required to initialize the provider +data "aws_arn" "test" { + arn = "arn:${data.aws_partition.provider_test.partition}:s3:::test" +} +` + func testCheckResourceAttrIsSortedCsv(resourceName, attributeName string) resource.TestCheckFunc { return func(s *terraform.State) error { is, err := primaryInstanceState(s, resourceName) diff --git a/aws/resource_aws_accessanalyzer_analyzer.go b/aws/resource_aws_accessanalyzer_analyzer.go index c07154b97fc5..52fda89c7c69 100644 --- a/aws/resource_aws_accessanalyzer_analyzer.go +++ b/aws/resource_aws_accessanalyzer_analyzer.go @@ -8,6 +8,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/accessanalyzer" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" @@ -110,7 +111,7 @@ func resourceAwsAccessAnalyzerAnalyzerRead(d *schema.ResourceData, meta interfac output, err := conn.GetAnalyzer(input) - if isAWSErr(err, accessanalyzer.ErrCodeResourceNotFoundException, "") { + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, accessanalyzer.ErrCodeResourceNotFoundException) { log.Printf("[WARN] Access Analyzer Analyzer (%s) not found, removing from state", d.Id()) d.SetId("") return nil diff --git a/aws/resource_aws_accessanalyzer_analyzer_test.go b/aws/resource_aws_accessanalyzer_analyzer_test.go index a0b94018a153..2ae070d71734 100644 --- a/aws/resource_aws_accessanalyzer_analyzer_test.go +++ b/aws/resource_aws_accessanalyzer_analyzer_test.go @@ -20,6 +20,7 @@ func testAccAWSAccessAnalyzerAnalyzer_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSAccessAnalyzer(t) }, + ErrorCheck: testAccErrorCheck(t, accessanalyzer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAccessAnalyzerAnalyzerDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func testAccAWSAccessAnalyzerAnalyzer_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSAccessAnalyzer(t) }, + ErrorCheck: testAccErrorCheck(t, accessanalyzer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAccessAnalyzerAnalyzerDestroy, Steps: []resource.TestStep{ @@ -75,6 +77,7 @@ func testAccAWSAccessAnalyzerAnalyzer_Tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSAccessAnalyzer(t) }, + ErrorCheck: testAccErrorCheck(t, accessanalyzer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAccessAnalyzerAnalyzerDestroy, Steps: []resource.TestStep{ @@ -125,6 +128,7 @@ func testAccAWSAccessAnalyzerAnalyzer_Type_Organization(t *testing.T) { testAccPreCheckAWSAccessAnalyzer(t) testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, accessanalyzer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAccessAnalyzerAnalyzerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_acm_certificate_test.go b/aws/resource_aws_acm_certificate_test.go index 399a5d83b905..c9bf26df4b1e 100644 --- a/aws/resource_aws_acm_certificate_test.go +++ b/aws/resource_aws_acm_certificate_test.go @@ -122,6 +122,7 @@ func TestAccAWSAcmCertificate_emailValidation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -154,6 +155,7 @@ func TestAccAWSAcmCertificate_dnsValidation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -188,6 +190,7 @@ func TestAccAWSAcmCertificate_root(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -223,6 +226,7 @@ func TestAccAWSAcmCertificate_privateCert(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -256,6 +260,7 @@ func TestAccAWSAcmCertificate_root_TrailingPeriod(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -274,6 +279,7 @@ func TestAccAWSAcmCertificate_rootAndWildcardSan(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -313,6 +319,7 @@ func TestAccAWSAcmCertificate_SubjectAlternativeNames_EmptyString(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -332,6 +339,7 @@ func TestAccAWSAcmCertificate_san_single(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -374,6 +382,7 @@ func TestAccAWSAcmCertificate_san_multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -420,6 +429,7 @@ func TestAccAWSAcmCertificate_san_TrailingPeriod(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -460,6 +470,7 @@ func TestAccAWSAcmCertificate_wildcard(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -495,6 +506,7 @@ func TestAccAWSAcmCertificate_wildcardAndRootSan(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -534,6 +546,7 @@ func TestAccAWSAcmCertificate_disableCTLogging(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -571,6 +584,7 @@ func TestAccAWSAcmCertificate_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -628,6 +642,7 @@ func TestAccAWSAcmCertificate_imported_DomainName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -671,6 +686,7 @@ func TestAccAWSAcmCertificate_imported_IpAddress(t *testing.T) { // Reference: h resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -699,6 +715,7 @@ func TestAccAWSAcmCertificate_PrivateKey_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_acm_certificate_validation.go b/aws/resource_aws_acm_certificate_validation.go index 89ffc3459e6a..e35a802e3afc 100644 --- a/aws/resource_aws_acm_certificate_validation.go +++ b/aws/resource_aws_acm_certificate_validation.go @@ -8,6 +8,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/acm" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" multierror "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -177,19 +178,32 @@ func resourceAwsAcmCertificateValidationRead(d *schema.ResourceData, meta interf resp, err := acmconn.DescribeCertificate(params) - if err != nil && isAWSErr(err, acm.ErrCodeResourceNotFoundException, "") { + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, acm.ErrCodeResourceNotFoundException) { + log.Printf("[WARN] ACM Certificate (%s) not found, removing from state", d.Id()) d.SetId("") return nil - } else if err != nil { - return fmt.Errorf("Error describing certificate: %w", err) } - if aws.StringValue(resp.Certificate.Status) != acm.CertificateStatusIssued { - log.Printf("[INFO] Certificate status not issued, was %s, tainting validation", aws.StringValue(resp.Certificate.Status)) + if err != nil { + return fmt.Errorf("error describing ACM Certificate (%s): %w", d.Id(), err) + } + + if resp == nil || resp.Certificate == nil { + return fmt.Errorf("error describing ACM Certificate (%s): empty response", d.Id()) + } + + if status := aws.StringValue(resp.Certificate.Status); status != acm.CertificateStatusIssued { + if d.IsNewResource() { + return fmt.Errorf("ACM Certificate (%s) status not issued: %s", d.Id(), status) + } + + log.Printf("[WARN] ACM Certificate (%s) status not issued (%s), removing from state", d.Id(), status) d.SetId("") - } else { - d.SetId(aws.TimeValue(resp.Certificate.IssuedAt).String()) + return nil } + + d.SetId(aws.TimeValue(resp.Certificate.IssuedAt).String()) + return nil } diff --git a/aws/resource_aws_acm_certificate_validation_test.go b/aws/resource_aws_acm_certificate_validation_test.go index cb9d001435ae..e541f762a0e5 100644 --- a/aws/resource_aws_acm_certificate_validation_test.go +++ b/aws/resource_aws_acm_certificate_validation_test.go @@ -6,6 +6,7 @@ import ( "strconv" "testing" + "github.com/aws/aws-sdk-go/service/acm" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -17,6 +18,7 @@ func TestAccAWSAcmCertificateValidation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -37,6 +39,7 @@ func TestAccAWSAcmCertificateValidation_timeout(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -56,6 +59,7 @@ func TestAccAWSAcmCertificateValidation_validationRecordFqdns(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -81,6 +85,7 @@ func TestAccAWSAcmCertificateValidation_validationRecordFqdnsEmail(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -99,6 +104,7 @@ func TestAccAWSAcmCertificateValidation_validationRecordFqdnsRoot(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -120,6 +126,7 @@ func TestAccAWSAcmCertificateValidation_validationRecordFqdnsRootAndWildcard(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -142,6 +149,7 @@ func TestAccAWSAcmCertificateValidation_validationRecordFqdnsSan(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -163,6 +171,7 @@ func TestAccAWSAcmCertificateValidation_validationRecordFqdnsWildcard(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ @@ -184,6 +193,7 @@ func TestAccAWSAcmCertificateValidation_validationRecordFqdnsWildcardAndRoot(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAcmCertificateDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_acmpca_certificate.go b/aws/resource_aws_acmpca_certificate.go index 5a6317d0ec47..afbcb51f8a3c 100644 --- a/aws/resource_aws_acmpca_certificate.go +++ b/aws/resource_aws_acmpca_certificate.go @@ -169,13 +169,19 @@ func resourceAwsAcmpcaCertificateRead(d *schema.ResourceData, meta interface{}) log.Printf("[DEBUG] Reading ACM PCA Certificate: %s", getCertificateInput) certificateOutput, err := conn.GetCertificate(getCertificateInput) + + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, acmpca.ErrCodeResourceNotFoundException) { + log.Printf("[WARN] ACM PCA Certificate (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + if err != nil { - if isAWSErr(err, acmpca.ErrCodeResourceNotFoundException, "") { - log.Printf("[WARN] ACM PCA Certificate (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - return fmt.Errorf("error reading ACM PCA Certificate: %s", err) + return fmt.Errorf("error reading ACM PCA Certificate (%s): %w", d.Id(), err) + } + + if certificateOutput == nil { + return fmt.Errorf("error reading ACM PCA Certificate (%s): empty response", d.Id()) } d.Set("arn", d.Id()) diff --git a/aws/resource_aws_acmpca_certificate_authority.go b/aws/resource_aws_acmpca_certificate_authority.go index 2455f26e22a1..a27cde4b8825 100644 --- a/aws/resource_aws_acmpca_certificate_authority.go +++ b/aws/resource_aws_acmpca_certificate_authority.go @@ -324,17 +324,21 @@ func resourceAwsAcmpcaCertificateAuthorityRead(d *schema.ResourceData, meta inte certificateAuthority, err := finder.CertificateAuthorityByARN(conn, d.Id()) - if isAWSErr(err, acmpca.ErrCodeResourceNotFoundException, "") { + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, acmpca.ErrCodeResourceNotFoundException) { log.Printf("[WARN] ACM PCA Certificate Authority (%s) not found, removing from state", d.Id()) d.SetId("") return nil } if err != nil { - return fmt.Errorf("error reading ACM PCA Certificate Authority: %s", err) + return fmt.Errorf("error reading ACM PCA Certificate Authority (%s): %w", d.Id(), err) } if certificateAuthority == nil || aws.StringValue(certificateAuthority.Status) == acmpca.CertificateAuthorityStatusDeleted { + if d.IsNewResource() { + return fmt.Errorf("error reading ACM PCA Certificate Authority (%s): not found or deleted", d.Id()) + } + log.Printf("[WARN] ACM PCA Certificate Authority (%s) not found, removing from state", d.Id()) d.SetId("") return nil @@ -365,17 +369,17 @@ func resourceAwsAcmpcaCertificateAuthorityRead(d *schema.ResourceData, meta inte log.Printf("[DEBUG] Reading ACM PCA Certificate Authority Certificate: %s", getCertificateAuthorityCertificateInput) getCertificateAuthorityCertificateOutput, err := conn.GetCertificateAuthorityCertificate(getCertificateAuthorityCertificateInput) - if err != nil { - if isAWSErr(err, acmpca.ErrCodeResourceNotFoundException, "") { - log.Printf("[WARN] ACM PCA Certificate Authority (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - // Returned when in PENDING_CERTIFICATE status - // InvalidStateException: The certificate authority XXXXX is not in the correct state to have a certificate signing request. - if !isAWSErr(err, acmpca.ErrCodeInvalidStateException, "") { - return fmt.Errorf("error reading ACM PCA Certificate Authority Certificate: %s", err) - } + + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, acmpca.ErrCodeResourceNotFoundException) { + log.Printf("[WARN] ACM PCA Certificate Authority (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + + // Returned when in PENDING_CERTIFICATE status + // InvalidStateException: The certificate authority XXXXX is not in the correct state to have a certificate signing request. + if err != nil && !tfawserr.ErrCodeEquals(err, acmpca.ErrCodeInvalidStateException) { + return fmt.Errorf("error reading ACM PCA Certificate Authority (%s) Certificate: %w", d.Id(), err) } d.Set("certificate", "") @@ -392,15 +396,17 @@ func resourceAwsAcmpcaCertificateAuthorityRead(d *schema.ResourceData, meta inte log.Printf("[DEBUG] Reading ACM PCA Certificate Authority Certificate Signing Request: %s", getCertificateAuthorityCsrInput) getCertificateAuthorityCsrOutput, err := conn.GetCertificateAuthorityCsr(getCertificateAuthorityCsrInput) - if err != nil { - if isAWSErr(err, acmpca.ErrCodeResourceNotFoundException, "") { - log.Printf("[WARN] ACM PCA Certificate Authority (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - if !isAWSErr(err, acmpca.ErrCodeInvalidStateException, "") { - return fmt.Errorf("error reading ACM PCA Certificate Authority Certificate Signing Request: %s", err) - } + + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, acmpca.ErrCodeResourceNotFoundException) { + log.Printf("[WARN] ACM PCA Certificate Authority (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + + // Returned when in PENDING_CERTIFICATE status + // InvalidStateException: The certificate authority XXXXX is not in the correct state to have a certificate signing request. + if err != nil && !tfawserr.ErrCodeEquals(err, acmpca.ErrCodeInvalidStateException) { + return fmt.Errorf("error reading ACM PCA Certificate Authority (%s) Certificate Signing Request: %w", d.Id(), err) } d.Set("certificate_signing_request", "") diff --git a/aws/resource_aws_acmpca_certificate_authority_certificate_test.go b/aws/resource_aws_acmpca_certificate_authority_certificate_test.go index bd4231c4506c..bea2c761e1ca 100644 --- a/aws/resource_aws_acmpca_certificate_authority_certificate_test.go +++ b/aws/resource_aws_acmpca_certificate_authority_certificate_test.go @@ -19,6 +19,7 @@ func TestAccAwsAcmpcaCertificateAuthorityCertificate_RootCA(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, // Certificate authority certificates cannot be deleted Steps: []resource.TestStep{ @@ -48,6 +49,7 @@ func TestAccAwsAcmpcaCertificateAuthorityCertificate_UpdateRootCA(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, // Certificate authority certificates cannot be deleted Steps: []resource.TestStep{ @@ -80,6 +82,7 @@ func TestAccAwsAcmpcaCertificateAuthorityCertificate_SubordinateCA(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, // Certificate authority certificates cannot be deleted Steps: []resource.TestStep{ diff --git a/aws/resource_aws_acmpca_certificate_authority_test.go b/aws/resource_aws_acmpca_certificate_authority_test.go index 031d2a974ee0..f2543d6ce261 100644 --- a/aws/resource_aws_acmpca_certificate_authority_test.go +++ b/aws/resource_aws_acmpca_certificate_authority_test.go @@ -88,6 +88,7 @@ func TestAccAwsAcmpcaCertificateAuthority_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, Steps: []resource.TestStep{ @@ -132,6 +133,7 @@ func TestAccAwsAcmpcaCertificateAuthority_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, Steps: []resource.TestStep{ @@ -154,6 +156,7 @@ func TestAccAwsAcmpcaCertificateAuthority_Enabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, Steps: []resource.TestStep{ @@ -203,6 +206,7 @@ func TestAccAwsAcmpcaCertificateAuthority_DeleteFromActiveState(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, Steps: []resource.TestStep{ @@ -228,6 +232,7 @@ func TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfigurati resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, Steps: []resource.TestStep{ @@ -313,6 +318,7 @@ func TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfigurati resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, Steps: []resource.TestStep{ @@ -382,6 +388,7 @@ func TestAccAwsAcmpcaCertificateAuthority_RevocationConfiguration_CrlConfigurati resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, Steps: []resource.TestStep{ @@ -439,6 +446,7 @@ func TestAccAwsAcmpcaCertificateAuthority_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_acmpca_certificate_test.go b/aws/resource_aws_acmpca_certificate_test.go index 516502483ccb..68e2de1400d7 100644 --- a/aws/resource_aws_acmpca_certificate_test.go +++ b/aws/resource_aws_acmpca_certificate_test.go @@ -22,6 +22,7 @@ func TestAccAwsAcmpcaCertificate_RootCertificate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateDestroy, Steps: []resource.TestStep{ @@ -63,6 +64,7 @@ func TestAccAwsAcmpcaCertificate_SubordinateCertificate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateDestroy, Steps: []resource.TestStep{ @@ -103,6 +105,7 @@ func TestAccAwsAcmpcaCertificate_EndEntityCertificate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateDestroy, Steps: []resource.TestStep{ @@ -143,6 +146,7 @@ func TestAccAwsAcmpcaCertificate_Validity_EndDate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateDestroy, Steps: []resource.TestStep{ @@ -183,6 +187,7 @@ func TestAccAwsAcmpcaCertificate_Validity_Absolute(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, acmpca.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_alb_target_group_test.go b/aws/resource_aws_alb_target_group_test.go index c1061cb746e9..f05873f99e9e 100644 --- a/aws/resource_aws_alb_target_group_test.go +++ b/aws/resource_aws_alb_target_group_test.go @@ -50,6 +50,7 @@ func TestAccAWSALBTargetGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -92,6 +93,7 @@ func TestAccAWSALBTargetGroup_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -112,6 +114,7 @@ func TestAccAWSALBTargetGroup_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -133,6 +136,7 @@ func TestAccAWSALBTargetGroup_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -161,6 +165,7 @@ func TestAccAWSALBTargetGroup_changeProtocolForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -189,6 +194,7 @@ func TestAccAWSALBTargetGroup_changePortForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -217,6 +223,7 @@ func TestAccAWSALBTargetGroup_changeVpcForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -243,6 +250,7 @@ func TestAccAWSALBTargetGroup_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -274,6 +282,7 @@ func TestAccAWSALBTargetGroup_updateHealthCheck(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -336,6 +345,7 @@ func TestAccAWSALBTargetGroup_updateSticknessEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -421,6 +431,7 @@ func TestAccAWSALBTargetGroup_setAndUpdateSlowStart(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -449,6 +460,7 @@ func TestAccAWSALBTargetGroup_updateLoadBalancingAlgorithmType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), IDRefreshName: "aws_alb_target_group.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, @@ -552,6 +564,7 @@ func TestAccAWSALBTargetGroup_lambda(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, Steps: []resource.TestStep{ @@ -585,6 +598,7 @@ func TestAccAWSALBTargetGroup_lambdaMultiValueHeadersEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, Steps: []resource.TestStep{ @@ -632,6 +646,7 @@ func TestAccAWSALBTargetGroup_missingPortProtocolVpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elbv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSALBTargetGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ami.go b/aws/resource_aws_ami.go index 22dea77ea647..5a11ffe13e0e 100644 --- a/aws/resource_aws_ami.go +++ b/aws/resource_aws_ami.go @@ -46,12 +46,6 @@ func resourceAwsAmi() *schema.Resource { }, Schema: map[string]*schema.Schema{ - "image_location": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ForceNew: true, - }, "architecture": { Type: schema.TypeString, Optional: true, @@ -59,6 +53,10 @@ func resourceAwsAmi() *schema.Resource { Default: ec2.ArchitectureValuesX8664, ValidateFunc: validation.StringInSlice(ec2.ArchitectureValues_Values(), false), }, + "arn": { + Type: schema.TypeString, + Computed: true, + }, "description": { Type: schema.TypeString, Optional: true, @@ -81,45 +79,38 @@ func resourceAwsAmi() *schema.Resource { Default: true, ForceNew: true, }, - "device_name": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "encrypted": { Type: schema.TypeBool, Optional: true, ForceNew: true, }, - "iops": { Type: schema.TypeInt, Optional: true, ForceNew: true, }, - "snapshot_id": { Type: schema.TypeString, Optional: true, ForceNew: true, }, - "throughput": { Type: schema.TypeInt, Optional: true, Computed: true, ForceNew: true, }, - "volume_size": { Type: schema.TypeInt, Optional: true, Computed: true, ForceNew: true, }, - "volume_type": { Type: schema.TypeString, Optional: true, @@ -153,7 +144,6 @@ func resourceAwsAmi() *schema.Resource { Type: schema.TypeString, Required: true, }, - "virtual_name": { Type: schema.TypeString, Required: true, @@ -168,6 +158,24 @@ func resourceAwsAmi() *schema.Resource { return hashcode.String(buf.String()) }, }, + "hypervisor": { + Type: schema.TypeString, + Computed: true, + }, + "image_location": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + }, + "image_owner_alias": { + Type: schema.TypeString, + Computed: true, + }, + "image_type": { + Type: schema.TypeString, + Computed: true, + }, "kernel_id": { Type: schema.TypeString, Optional: true, @@ -186,6 +194,22 @@ func resourceAwsAmi() *schema.Resource { Required: true, ForceNew: true, }, + "owner_id": { + Type: schema.TypeString, + Computed: true, + }, + "platform_details": { + Type: schema.TypeString, + Computed: true, + }, + "platform": { + Type: schema.TypeString, + Computed: true, + }, + "public": { + Type: schema.TypeBool, + Computed: true, + }, "ramdisk_id": { Type: schema.TypeString, Optional: true, @@ -207,6 +231,10 @@ func resourceAwsAmi() *schema.Resource { Default: "simple", }, "tags": tagsSchema(), + "usage_operation": { + Type: schema.TypeString, + Computed: true, + }, "virtualization_type": { Type: schema.TypeString, Optional: true, @@ -214,42 +242,6 @@ func resourceAwsAmi() *schema.Resource { Default: ec2.VirtualizationTypeParavirtual, ValidateFunc: validation.StringInSlice(ec2.VirtualizationType_Values(), false), }, - "arn": { - Type: schema.TypeString, - Computed: true, - }, - "usage_operation": { - Type: schema.TypeString, - Computed: true, - }, - "platform_details": { - Type: schema.TypeString, - Computed: true, - }, - "image_owner_alias": { - Type: schema.TypeString, - Computed: true, - }, - "image_type": { - Type: schema.TypeString, - Computed: true, - }, - "hypervisor": { - Type: schema.TypeString, - Computed: true, - }, - "owner_id": { - Type: schema.TypeString, - Computed: true, - }, - "platform": { - Type: schema.TypeString, - Computed: true, - }, - "public": { - Type: schema.TypeBool, - Computed: true, - }, }, } } @@ -258,14 +250,14 @@ func resourceAwsAmiCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*AWSClient).ec2conn req := &ec2.RegisterImageInput{ - Name: aws.String(d.Get("name").(string)), - Description: aws.String(d.Get("description").(string)), Architecture: aws.String(d.Get("architecture").(string)), + Description: aws.String(d.Get("description").(string)), + EnaSupport: aws.Bool(d.Get("ena_support").(bool)), ImageLocation: aws.String(d.Get("image_location").(string)), + Name: aws.String(d.Get("name").(string)), RootDeviceName: aws.String(d.Get("root_device_name").(string)), SriovNetSupport: aws.String(d.Get("sriov_net_support").(string)), VirtualizationType: aws.String(d.Get("virtualization_type").(string)), - EnaSupport: aws.Bool(d.Get("ena_support").(bool)), } if kernelId := d.Get("kernel_id").(string); kernelId != "" { @@ -364,7 +356,11 @@ func resourceAwsAmiRead(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("Unable to find AMI after retries: %s", err) } - if len(res.Images) != 1 { + if res == nil || len(res.Images) != 1 { + if d.IsNewResource() { + return fmt.Errorf("error reading EC2 AMI (%s): empty response", d.Id()) + } + log.Printf("[WARN] AMI (%s) not found, removing from state", d.Id()) d.SetId("") return nil @@ -383,10 +379,14 @@ func resourceAwsAmiRead(d *schema.ResourceData, meta interface{}) error { if err != nil { return err } - state = *image.State + state = aws.StringValue(image.State) } if state == ec2.ImageStateDeregistered { + if d.IsNewResource() { + return fmt.Errorf("error reading EC2 AMI (%s): deregistered", d.Id()) + } + log.Printf("[WARN] AMI (%s) not found, removing from state", d.Id()) d.SetId("") return nil @@ -396,25 +396,25 @@ func resourceAwsAmiRead(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("AMI has become %s", state) } - d.Set("name", image.Name) + d.Set("architecture", image.Architecture) d.Set("description", image.Description) + d.Set("ena_support", image.EnaSupport) + d.Set("hypervisor", image.Hypervisor) d.Set("image_location", image.ImageLocation) - d.Set("architecture", image.Architecture) + d.Set("image_owner_alias", image.ImageOwnerAlias) + d.Set("image_type", image.ImageType) d.Set("kernel_id", image.KernelId) + d.Set("name", image.Name) + d.Set("owner_id", image.OwnerId) + d.Set("platform_details", image.PlatformDetails) + d.Set("platform", image.Platform) + d.Set("public", image.Public) d.Set("ramdisk_id", image.RamdiskId) d.Set("root_device_name", image.RootDeviceName) d.Set("root_snapshot_id", amiRootSnapshotId(image)) d.Set("sriov_net_support", image.SriovNetSupport) - d.Set("virtualization_type", image.VirtualizationType) - d.Set("ena_support", image.EnaSupport) d.Set("usage_operation", image.UsageOperation) - d.Set("platform_details", image.PlatformDetails) - d.Set("hypervisor", image.Hypervisor) - d.Set("image_type", image.ImageType) - d.Set("owner_id", image.OwnerId) - d.Set("public", image.Public) - d.Set("image_owner_alias", image.ImageOwnerAlias) - d.Set("platform", image.Platform) + d.Set("virtualization_type", image.VirtualizationType) imageArn := arn.ARN{ Partition: meta.(*AWSClient).partition, diff --git a/aws/resource_aws_ami_copy.go b/aws/resource_aws_ami_copy.go index 769510ee12d3..9a4a863238b8 100644 --- a/aws/resource_aws_ami_copy.go +++ b/aws/resource_aws_ami_copy.go @@ -26,6 +26,10 @@ func resourceAwsAmiCopy() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "arn": { + Type: schema.TypeString, + Computed: true, + }, "description": { Type: schema.TypeString, Optional: true, @@ -91,6 +95,16 @@ func resourceAwsAmiCopy() *schema.Resource { return hashcode.String(buf.String()) }, }, + "ena_support": { + Type: schema.TypeBool, + Computed: true, + }, + "encrypted": { + Type: schema.TypeBool, + Optional: true, + Default: false, + ForceNew: true, + }, "ephemeral_block_device": { Type: schema.TypeSet, Optional: true, @@ -117,20 +131,22 @@ func resourceAwsAmiCopy() *schema.Resource { return hashcode.String(buf.String()) }, }, - "ena_support": { - Type: schema.TypeBool, + "hypervisor": { + Type: schema.TypeString, Computed: true, }, - "encrypted": { - Type: schema.TypeBool, - Optional: true, - Default: false, - ForceNew: true, - }, "image_location": { Type: schema.TypeString, Computed: true, }, + "image_owner_alias": { + Type: schema.TypeString, + Computed: true, + }, + "image_type": { + Type: schema.TypeString, + Computed: true, + }, "kernel_id": { Type: schema.TypeString, Computed: true, @@ -155,6 +171,22 @@ func resourceAwsAmiCopy() *schema.Resource { Required: true, ForceNew: true, }, + "owner_id": { + Type: schema.TypeString, + Computed: true, + }, + "platform": { + Type: schema.TypeString, + Computed: true, + }, + "platform_details": { + Type: schema.TypeString, + Computed: true, + }, + "public": { + Type: schema.TypeBool, + Computed: true, + }, "ramdisk_id": { Type: schema.TypeString, Computed: true, @@ -186,42 +218,10 @@ func resourceAwsAmiCopy() *schema.Resource { Type: schema.TypeString, Computed: true, }, - "arn": { - Type: schema.TypeString, - Computed: true, - }, "usage_operation": { Type: schema.TypeString, Computed: true, }, - "platform_details": { - Type: schema.TypeString, - Computed: true, - }, - "image_owner_alias": { - Type: schema.TypeString, - Computed: true, - }, - "image_type": { - Type: schema.TypeString, - Computed: true, - }, - "hypervisor": { - Type: schema.TypeString, - Computed: true, - }, - "owner_id": { - Type: schema.TypeString, - Computed: true, - }, - "platform": { - Type: schema.TypeString, - Computed: true, - }, - "public": { - Type: schema.TypeBool, - Computed: true, - }, }, // The remaining operations are shared with the generic aws_ami resource, @@ -236,11 +236,11 @@ func resourceAwsAmiCopyCreate(d *schema.ResourceData, meta interface{}) error { client := meta.(*AWSClient).ec2conn req := &ec2.CopyImageInput{ - Name: aws.String(d.Get("name").(string)), Description: aws.String(d.Get("description").(string)), + Encrypted: aws.Bool(d.Get("encrypted").(bool)), + Name: aws.String(d.Get("name").(string)), SourceImageId: aws.String(d.Get("source_ami_id").(string)), SourceRegion: aws.String(d.Get("source_ami_region").(string)), - Encrypted: aws.Bool(d.Get("encrypted").(bool)), } if v, ok := d.GetOk("kms_key_id"); ok { diff --git a/aws/resource_aws_ami_copy_test.go b/aws/resource_aws_ami_copy_test.go index c24807304ed0..48a2b8bf3cd3 100644 --- a/aws/resource_aws_ami_copy_test.go +++ b/aws/resource_aws_ami_copy_test.go @@ -19,6 +19,7 @@ func TestAccAWSAMICopy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAMICopyDestroy, Steps: []resource.TestStep{ @@ -46,6 +47,7 @@ func TestAccAWSAMICopy_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAMICopyDestroy, Steps: []resource.TestStep{ @@ -74,6 +76,7 @@ func TestAccAWSAMICopy_EnaSupport(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAMICopyDestroy, Steps: []resource.TestStep{ @@ -95,6 +98,7 @@ func TestAccAWSAMICopy_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAMICopyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ami_from_instance.go b/aws/resource_aws_ami_from_instance.go index c996483e867e..f5da16dd8746 100644 --- a/aws/resource_aws_ami_from_instance.go +++ b/aws/resource_aws_ami_from_instance.go @@ -8,7 +8,6 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode" - "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" ) func resourceAwsAmiFromInstance() *schema.Resource { @@ -26,6 +25,10 @@ func resourceAwsAmiFromInstance() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "arn": { + Type: schema.TypeString, + Computed: true, + }, "description": { Type: schema.TypeString, Optional: true, @@ -121,10 +124,22 @@ func resourceAwsAmiFromInstance() *schema.Resource { return hashcode.String(buf.String()) }, }, + "hypervisor": { + Type: schema.TypeString, + Computed: true, + }, "image_location": { Type: schema.TypeString, Computed: true, }, + "image_owner_alias": { + Type: schema.TypeString, + Computed: true, + }, + "image_type": { + Type: schema.TypeString, + Computed: true, + }, "kernel_id": { Type: schema.TypeString, Computed: true, @@ -142,6 +157,22 @@ func resourceAwsAmiFromInstance() *schema.Resource { Required: true, ForceNew: true, }, + "owner_id": { + Type: schema.TypeString, + Computed: true, + }, + "platform": { + Type: schema.TypeString, + Computed: true, + }, + "platform_details": { + Type: schema.TypeString, + Computed: true, + }, + "public": { + Type: schema.TypeBool, + Computed: true, + }, "ramdisk_id": { Type: schema.TypeString, Computed: true, @@ -169,46 +200,14 @@ func resourceAwsAmiFromInstance() *schema.Resource { Computed: true, }, "tags": tagsSchema(), - "virtualization_type": { - Type: schema.TypeString, - Computed: true, - }, - "arn": { - Type: schema.TypeString, - Computed: true, - }, "usage_operation": { Type: schema.TypeString, Computed: true, }, - "platform_details": { - Type: schema.TypeString, - Computed: true, - }, - "image_owner_alias": { - Type: schema.TypeString, - Computed: true, - }, - "image_type": { - Type: schema.TypeString, - Computed: true, - }, - "hypervisor": { - Type: schema.TypeString, - Computed: true, - }, - "owner_id": { - Type: schema.TypeString, - Computed: true, - }, - "platform": { + "virtualization_type": { Type: schema.TypeString, Computed: true, }, - "public": { - Type: schema.TypeBool, - Computed: true, - }, }, // The remaining operations are shared with the generic aws_ami resource, @@ -223,10 +222,11 @@ func resourceAwsAmiFromInstanceCreate(d *schema.ResourceData, meta interface{}) client := meta.(*AWSClient).ec2conn req := &ec2.CreateImageInput{ - Name: aws.String(d.Get("name").(string)), - Description: aws.String(d.Get("description").(string)), - InstanceId: aws.String(d.Get("source_instance_id").(string)), - NoReboot: aws.Bool(d.Get("snapshot_without_reboot").(bool)), + Description: aws.String(d.Get("description").(string)), + InstanceId: aws.String(d.Get("source_instance_id").(string)), + Name: aws.String(d.Get("name").(string)), + NoReboot: aws.Bool(d.Get("snapshot_without_reboot").(bool)), + TagSpecifications: ec2TagSpecificationsFromMap(d.Get("tags").(map[string]interface{}), ec2.ResourceTypeImage), } res, err := client.CreateImage(req) @@ -237,12 +237,6 @@ func resourceAwsAmiFromInstanceCreate(d *schema.ResourceData, meta interface{}) d.SetId(aws.StringValue(res.ImageId)) d.Set("manage_ebs_snapshots", true) - if v := d.Get("tags").(map[string]interface{}); len(v) > 0 { - if err := keyvaluetags.Ec2CreateTags(client, d.Id(), v); err != nil { - return fmt.Errorf("error adding tags: %s", err) - } - } - _, err = resourceAwsAmiWaitForAvailable(d.Timeout(schema.TimeoutCreate), d.Id(), client) if err != nil { return err diff --git a/aws/resource_aws_ami_from_instance_test.go b/aws/resource_aws_ami_from_instance_test.go index d2e7ef443913..98cc9c5a9ed7 100644 --- a/aws/resource_aws_ami_from_instance_test.go +++ b/aws/resource_aws_ami_from_instance_test.go @@ -19,6 +19,7 @@ func TestAccAWSAMIFromInstance_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAMIFromInstanceDestroy, Steps: []resource.TestStep{ @@ -33,6 +34,7 @@ func TestAccAWSAMIFromInstance_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "image_type", "machine"), resource.TestCheckResourceAttr(resourceName, "hypervisor", "xen"), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, }, @@ -46,6 +48,7 @@ func TestAccAWSAMIFromInstance_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAMIFromInstanceDestroy, Steps: []resource.TestStep{ @@ -78,6 +81,29 @@ func TestAccAWSAMIFromInstance_tags(t *testing.T) { }) } +func TestAccAWSAMIFromInstance_disappears(t *testing.T) { + var image ec2.Image + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ami_from_instance.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSAMIFromInstanceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSAMIFromInstanceConfig(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAMIFromInstanceExists(resourceName, &image), + testAccCheckResourceDisappears(testAccProvider, resourceAwsAmiFromInstance(), resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + func testAccCheckAWSAMIFromInstanceExists(resourceName string, image *ec2.Image) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[resourceName] diff --git a/aws/resource_aws_ami_launch_permission.go b/aws/resource_aws_ami_launch_permission.go index 43bcd8f21f82..8d4d190d2812 100644 --- a/aws/resource_aws_ami_launch_permission.go +++ b/aws/resource_aws_ami_launch_permission.go @@ -77,6 +77,10 @@ func resourceAwsAmiLaunchPermissionRead(d *schema.ResourceData, meta interface{} return fmt.Errorf("error reading AMI launch permission (%s): %w", d.Id(), err) } if !exists { + if d.IsNewResource() { + return fmt.Errorf("error reading EC2 AMI Launch Permission (%s): not found", d.Id()) + } + log.Printf("[WARN] AMI launch permission (%s) not found, removing from state", d.Id()) d.SetId("") return nil diff --git a/aws/resource_aws_ami_launch_permission_test.go b/aws/resource_aws_ami_launch_permission_test.go index 417ba85c2cfa..65dc0e311d35 100644 --- a/aws/resource_aws_ami_launch_permission_test.go +++ b/aws/resource_aws_ami_launch_permission_test.go @@ -17,6 +17,7 @@ func TestAccAWSAMILaunchPermission_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAMILaunchPermissionDestroy, Steps: []resource.TestStep{ @@ -42,6 +43,7 @@ func TestAccAWSAMILaunchPermission_Disappears_LaunchPermission(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAMILaunchPermissionDestroy, Steps: []resource.TestStep{ @@ -65,6 +67,7 @@ func TestAccAWSAMILaunchPermission_Disappears_LaunchPermission_Public(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAMILaunchPermissionDestroy, Steps: []resource.TestStep{ @@ -88,6 +91,7 @@ func TestAccAWSAMILaunchPermission_Disappears_AMI(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAMILaunchPermissionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ami_test.go b/aws/resource_aws_ami_test.go index fc6511b800ab..3d601b905521 100644 --- a/aws/resource_aws_ami_test.go +++ b/aws/resource_aws_ami_test.go @@ -22,6 +22,7 @@ func TestAccAWSAMI_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAmiDestroy, Steps: []resource.TestStep{ @@ -47,6 +48,7 @@ func TestAccAWSAMI_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "ephemeral_block_device.#", "0"), resource.TestCheckResourceAttr(resourceName, "kernel_id", ""), resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "ramdisk_id", ""), resource.TestCheckResourceAttr(resourceName, "root_device_name", "/dev/sda1"), resource.TestCheckResourceAttrPair(resourceName, "root_snapshot_id", snapshotResourceName, "id"), @@ -82,6 +84,7 @@ func TestAccAWSAMI_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAmiDestroy, Steps: []resource.TestStep{ @@ -107,6 +110,7 @@ func TestAccAWSAMI_description(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "ephemeral_block_device.#", "0"), resource.TestCheckResourceAttr(resourceName, "kernel_id", ""), resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "ramdisk_id", ""), resource.TestCheckResourceAttr(resourceName, "root_device_name", "/dev/sda1"), resource.TestCheckResourceAttrPair(resourceName, "root_snapshot_id", snapshotResourceName, "id"), @@ -145,6 +149,7 @@ func TestAccAWSAMI_description(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "ephemeral_block_device.#", "0"), resource.TestCheckResourceAttr(resourceName, "kernel_id", ""), resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "ramdisk_id", ""), resource.TestCheckResourceAttr(resourceName, "root_device_name", "/dev/sda1"), resource.TestCheckResourceAttrPair(resourceName, "root_snapshot_id", snapshotResourceName, "id"), @@ -164,6 +169,7 @@ func TestAccAWSAMI_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAmiDestroy, Steps: []resource.TestStep{ @@ -187,6 +193,7 @@ func TestAccAWSAMI_EphemeralBlockDevices(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAmiDestroy, Steps: []resource.TestStep{ @@ -219,6 +226,7 @@ func TestAccAWSAMI_EphemeralBlockDevices(t *testing.T) { }), resource.TestCheckResourceAttr(resourceName, "kernel_id", ""), resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "ramdisk_id", ""), resource.TestCheckResourceAttr(resourceName, "root_device_name", "/dev/sda1"), resource.TestCheckResourceAttrPair(resourceName, "root_snapshot_id", snapshotResourceName, "id"), @@ -247,6 +255,7 @@ func TestAccAWSAMI_Gp3BlockDevice(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAmiDestroy, Steps: []resource.TestStep{ @@ -281,6 +290,7 @@ func TestAccAWSAMI_Gp3BlockDevice(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "ephemeral_block_device.#", "0"), resource.TestCheckResourceAttr(resourceName, "kernel_id", ""), resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "ramdisk_id", ""), resource.TestCheckResourceAttr(resourceName, "root_device_name", "/dev/sda1"), resource.TestCheckResourceAttrPair(resourceName, "root_snapshot_id", snapshotResourceName, "id"), @@ -308,6 +318,7 @@ func TestAccAWSAMI_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAmiDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_account.go b/aws/resource_aws_api_gateway_account.go index d37b831bf938..ffa32fb3a460 100644 --- a/aws/resource_aws_api_gateway_account.go +++ b/aws/resource_aws_api_gateway_account.go @@ -3,12 +3,12 @@ package aws import ( "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/apigateway" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsApiGatewayAccount() *schema.Resource { @@ -96,7 +96,7 @@ func resourceAwsApiGatewayAccountUpdate(d *schema.ResourceData, meta interface{} otherErrMsg := "API Gateway could not successfully write to CloudWatch Logs using the ARN specified" var out *apigateway.Account var err error - err = resource.Retry(2*time.Minute, func() *resource.RetryError { + err = resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { out, err = conn.UpdateAccount(&input) if err != nil { diff --git a/aws/resource_aws_api_gateway_account_test.go b/aws/resource_aws_api_gateway_account_test.go index 2c47a9b7c066..a44e1ef2fa4f 100644 --- a/aws/resource_aws_api_gateway_account_test.go +++ b/aws/resource_aws_api_gateway_account_test.go @@ -24,6 +24,7 @@ func TestAccAWSAPIGatewayAccount_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayAccountDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_api_key_test.go b/aws/resource_aws_api_gateway_api_key_test.go index 44116b1fefa4..d97ec60f7d47 100644 --- a/aws/resource_aws_api_gateway_api_key_test.go +++ b/aws/resource_aws_api_gateway_api_key_test.go @@ -20,6 +20,7 @@ func TestAccAWSAPIGatewayApiKey_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayApiKeyDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSAPIGatewayApiKey_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayApiKeyDestroy, Steps: []resource.TestStep{ @@ -96,6 +98,7 @@ func TestAccAWSAPIGatewayApiKey_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayApiKeyDestroy, Steps: []resource.TestStep{ @@ -130,6 +133,7 @@ func TestAccAWSAPIGatewayApiKey_Enabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayApiKeyDestroy, Steps: []resource.TestStep{ @@ -164,6 +168,7 @@ func TestAccAWSAPIGatewayApiKey_Value(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayApiKeyDestroy, Steps: []resource.TestStep{ @@ -190,6 +195,7 @@ func TestAccAWSAPIGatewayApiKey_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayApiKeyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_authorizer_test.go b/aws/resource_aws_api_gateway_authorizer_test.go index aaf8293087f1..9d11a29236da 100644 --- a/aws/resource_aws_api_gateway_authorizer_test.go +++ b/aws/resource_aws_api_gateway_authorizer_test.go @@ -23,6 +23,7 @@ func TestAccAWSAPIGatewayAuthorizer_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayAuthorizerDestroy, Steps: []resource.TestStep{ @@ -68,6 +69,7 @@ func TestAccAWSAPIGatewayAuthorizer_cognito(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayAuthorizerDestroy, Steps: []resource.TestStep{ @@ -105,6 +107,7 @@ func TestAccAWSAPIGatewayAuthorizer_cognito_authorizerCredentials(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayAuthorizerDestroy, Steps: []resource.TestStep{ @@ -135,6 +138,7 @@ func TestAccAWSAPIGatewayAuthorizer_switchAuthType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayAuthorizerDestroy, Steps: []resource.TestStep{ @@ -181,6 +185,7 @@ func TestAccAWSAPIGatewayAuthorizer_switchAuthorizerTTL(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayAuthorizerDestroy, Steps: []resource.TestStep{ @@ -227,6 +232,7 @@ func TestAccAWSAPIGatewayAuthorizer_authTypeValidation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayAuthorizerDestroy, Steps: []resource.TestStep{ @@ -253,6 +259,7 @@ func TestAccAWSAPIGatewayAuthorizer_zero_ttl(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayAuthorizerDestroy, Steps: []resource.TestStep{ @@ -280,6 +287,7 @@ func TestAccAWSAPIGatewayAuthorizer_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayAuthorizerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_base_path_mapping.go b/aws/resource_aws_api_gateway_base_path_mapping.go index 30e1385174c5..f4b0205ad3de 100644 --- a/aws/resource_aws_api_gateway_base_path_mapping.go +++ b/aws/resource_aws_api_gateway_base_path_mapping.go @@ -167,7 +167,7 @@ func resourceAwsApiGatewayBasePathMappingRead(d *schema.ResourceData, meta inter return fmt.Errorf("Error reading Gateway base path mapping: %s", err) } - mappingBasePath := *mapping.BasePath + mappingBasePath := aws.StringValue(mapping.BasePath) if mappingBasePath == emptyBasePathMappingValue { mappingBasePath = "" diff --git a/aws/resource_aws_api_gateway_base_path_mapping_test.go b/aws/resource_aws_api_gateway_base_path_mapping_test.go index 0686ef72da0b..0462b29e55ed 100644 --- a/aws/resource_aws_api_gateway_base_path_mapping_test.go +++ b/aws/resource_aws_api_gateway_base_path_mapping_test.go @@ -73,6 +73,7 @@ func TestAccAWSAPIGatewayBasePathMapping_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayBasePathDestroy(name), Steps: []resource.TestStep{ @@ -102,6 +103,7 @@ func TestAccAWSAPIGatewayBasePathMapping_BasePath_Empty(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayBasePathDestroy(name), Steps: []resource.TestStep{ @@ -130,6 +132,7 @@ func TestAccAWSAPIGatewayBasePathMapping_updates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayBasePathDestroy(name), Steps: []resource.TestStep{ @@ -180,6 +183,7 @@ func TestAccAWSAPIGatewayBasePathMapping_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayBasePathDestroy(name), Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_client_certificate_test.go b/aws/resource_aws_api_gateway_client_certificate_test.go index d1a5c20c334f..875e5f904bb2 100644 --- a/aws/resource_aws_api_gateway_client_certificate_test.go +++ b/aws/resource_aws_api_gateway_client_certificate_test.go @@ -18,6 +18,7 @@ func TestAccAWSAPIGatewayClientCertificate_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayClientCertificateDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSAPIGatewayClientCertificate_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayClientCertificateDestroy, Steps: []resource.TestStep{ @@ -95,6 +97,7 @@ func TestAccAWSAPIGatewayClientCertificate_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayClientCertificateDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_deployment_test.go b/aws/resource_aws_api_gateway_deployment_test.go index fc43116f73bc..dfb0121c787b 100644 --- a/aws/resource_aws_api_gateway_deployment_test.go +++ b/aws/resource_aws_api_gateway_deployment_test.go @@ -20,6 +20,7 @@ func TestAccAWSAPIGatewayDeployment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDeploymentDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSAPIGatewayDeployment_disappears_RestApi(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDeploymentDestroy, Steps: []resource.TestStep{ @@ -73,6 +75,7 @@ func TestAccAWSAPIGatewayDeployment_Triggers(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDeploymentDestroy, Steps: []resource.TestStep{ @@ -128,6 +131,7 @@ func TestAccAWSAPIGatewayDeployment_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDeploymentDestroy, Steps: []resource.TestStep{ @@ -156,6 +160,7 @@ func TestAccAWSAPIGatewayDeployment_StageDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDeploymentDestroy, Steps: []resource.TestStep{ @@ -178,6 +183,7 @@ func TestAccAWSAPIGatewayDeployment_StageName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDeploymentDestroy, Steps: []resource.TestStep{ @@ -205,6 +211,7 @@ func TestAccAWSAPIGatewayDeployment_StageName_EmptyString(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDeploymentDestroy, Steps: []resource.TestStep{ @@ -225,6 +232,7 @@ func TestAccAWSAPIGatewayDeployment_Variables(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDeploymentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_documentation_part.go b/aws/resource_aws_api_gateway_documentation_part.go index a3b5df3c2c19..9131db188403 100644 --- a/aws/resource_aws_api_gateway_documentation_part.go +++ b/aws/resource_aws_api_gateway_documentation_part.go @@ -200,18 +200,25 @@ func flattenApiGatewayDocumentationPartLocation(l *apigateway.DocumentationPartL } m := make(map[string]interface{}) - m["type"] = *l.Type - if l.Method != nil { - m["method"] = *l.Method + + if v := l.Method; v != nil { + m["method"] = aws.StringValue(v) + } + + if v := l.Name; v != nil { + m["name"] = aws.StringValue(v) } - if l.Name != nil { - m["name"] = *l.Name + + if v := l.Path; v != nil { + m["path"] = aws.StringValue(v) } - if l.Path != nil { - m["path"] = *l.Path + + if v := l.StatusCode; v != nil { + m["status_code"] = aws.StringValue(v) } - if l.StatusCode != nil { - m["status_code"] = *l.StatusCode + + if v := l.Type; v != nil { + m["type"] = aws.StringValue(v) } return []interface{}{m} diff --git a/aws/resource_aws_api_gateway_documentation_part_test.go b/aws/resource_aws_api_gateway_documentation_part_test.go index 90ac8f6fb6d5..67d589355081 100644 --- a/aws/resource_aws_api_gateway_documentation_part_test.go +++ b/aws/resource_aws_api_gateway_documentation_part_test.go @@ -24,6 +24,7 @@ func TestAccAWSAPIGatewayDocumentationPart_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDocumentationPartDestroy, Steps: []resource.TestStep{ @@ -68,6 +69,7 @@ func TestAccAWSAPIGatewayDocumentationPart_method(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDocumentationPartDestroy, Steps: []resource.TestStep{ @@ -116,6 +118,7 @@ func TestAccAWSAPIGatewayDocumentationPart_responseHeader(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDocumentationPartDestroy, Steps: []resource.TestStep{ @@ -167,6 +170,7 @@ func TestAccAWSAPIGatewayDocumentationPart_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDocumentationPartDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_documentation_version_test.go b/aws/resource_aws_api_gateway_documentation_version_test.go index 9508ee861616..2c95d55395f5 100644 --- a/aws/resource_aws_api_gateway_documentation_version_test.go +++ b/aws/resource_aws_api_gateway_documentation_version_test.go @@ -22,6 +22,7 @@ func TestAccAWSAPIGatewayDocumentationVersion_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDocumentationVersionDestroy, Steps: []resource.TestStep{ @@ -56,6 +57,7 @@ func TestAccAWSAPIGatewayDocumentationVersion_allFields(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDocumentationVersionDestroy, Steps: []resource.TestStep{ @@ -97,6 +99,7 @@ func TestAccAWSAPIGatewayDocumentationVersion_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDocumentationVersionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_domain_name_test.go b/aws/resource_aws_api_gateway_domain_name_test.go index 1a2b47407679..b0e7e33dcd45 100644 --- a/aws/resource_aws_api_gateway_domain_name_test.go +++ b/aws/resource_aws_api_gateway_domain_name_test.go @@ -24,6 +24,7 @@ func TestAccAWSAPIGatewayDomainName_CertificateArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckApigatewayEdgeDomainName(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSAPIGatewayEdgeDomainNameDestroy, Steps: []resource.TestStep{ @@ -85,6 +86,7 @@ func TestAccAWSAPIGatewayDomainName_CertificateName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDomainNameDestroy, Steps: []resource.TestStep{ @@ -120,6 +122,7 @@ func TestAccAWSAPIGatewayDomainName_RegionalCertificateArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDomainNameDestroy, Steps: []resource.TestStep{ @@ -163,6 +166,7 @@ func TestAccAWSAPIGatewayDomainName_RegionalCertificateName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDomainNameDestroy, Steps: []resource.TestStep{ @@ -195,6 +199,7 @@ func TestAccAWSAPIGatewayDomainName_SecurityPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDomainNameDestroy, Steps: []resource.TestStep{ @@ -224,6 +229,7 @@ func TestAccAWSAPIGatewayDomainName_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDomainNameDestroy, Steps: []resource.TestStep{ @@ -271,6 +277,7 @@ func TestAccAWSAPIGatewayDomainName_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDomainNameDestroy, Steps: []resource.TestStep{ @@ -298,6 +305,7 @@ func TestAccAWSAPIGatewayDomainName_MutualTlsAuthentication(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayDomainNameDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_gateway_response_test.go b/aws/resource_aws_api_gateway_gateway_response_test.go index 91f16f273bcf..5374d21e92ff 100644 --- a/aws/resource_aws_api_gateway_gateway_response_test.go +++ b/aws/resource_aws_api_gateway_gateway_response_test.go @@ -20,6 +20,7 @@ func TestAccAWSAPIGatewayGatewayResponse_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayGatewayResponseDestroy, Steps: []resource.TestStep{ @@ -62,6 +63,7 @@ func TestAccAWSAPIGatewayGatewayResponse_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayGatewayResponseDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_integration.go b/aws/resource_aws_api_gateway_integration.go index f2c3813375b4..bace0b28e27f 100644 --- a/aws/resource_aws_api_gateway_integration.go +++ b/aws/resource_aws_api_gateway_integration.go @@ -174,95 +174,69 @@ func resourceAwsApiGatewayIntegrationCreate(d *schema.ResourceData, meta interfa log.Print("[DEBUG] Creating API Gateway Integration") - connectionType := aws.String(d.Get("connection_type").(string)) - var connectionId *string - if *connectionType == apigateway.ConnectionTypeVpcLink { - if _, ok := d.GetOk("connection_id"); !ok { - return fmt.Errorf("connection_id required when connection_type set to VPC_LINK") - } - connectionId = aws.String(d.Get("connection_id").(string)) + input := &apigateway.PutIntegrationInput{ + HttpMethod: aws.String(d.Get("http_method").(string)), + ResourceId: aws.String(d.Get("resource_id").(string)), + RestApiId: aws.String(d.Get("rest_api_id").(string)), + Type: aws.String(d.Get("type").(string)), } - var integrationHttpMethod *string - if v, ok := d.GetOk("integration_http_method"); ok { - integrationHttpMethod = aws.String(v.(string)) + if v, ok := d.GetOk("cache_key_parameters"); ok && v.(*schema.Set).Len() > 0 { + input.CacheKeyParameters = expandStringSet(v.(*schema.Set)) } - var uri *string - if v, ok := d.GetOk("uri"); ok { - uri = aws.String(v.(string)) + if v, ok := d.GetOk("cache_namespace"); ok { + input.CacheNamespace = aws.String(v.(string)) + } else if input.CacheKeyParameters != nil { + input.CacheNamespace = aws.String(d.Get("resource_id").(string)) } - templates := make(map[string]string) - for k, v := range d.Get("request_templates").(map[string]interface{}) { - templates[k] = v.(string) + if v, ok := d.GetOk("connection_id"); ok { + input.ConnectionId = aws.String(v.(string)) } - parameters := make(map[string]string) - if kv, ok := d.GetOk("request_parameters"); ok { - for k, v := range kv.(map[string]interface{}) { - parameters[k] = v.(string) - } + if v, ok := d.GetOk("connection_type"); ok { + input.ConnectionType = aws.String(v.(string)) } - var passthroughBehavior *string - if v, ok := d.GetOk("passthrough_behavior"); ok { - passthroughBehavior = aws.String(v.(string)) + if v, ok := d.GetOk("content_handling"); ok { + input.ContentHandling = aws.String(v.(string)) } - var credentials *string - if val, ok := d.GetOk("credentials"); ok { - credentials = aws.String(val.(string)) + if v, ok := d.GetOk("credentials"); ok { + input.Credentials = aws.String(v.(string)) } - var contentHandling *string - if val, ok := d.GetOk("content_handling"); ok { - contentHandling = aws.String(val.(string)) + if v, ok := d.GetOk("integration_http_method"); ok { + input.IntegrationHttpMethod = aws.String(v.(string)) } - var cacheKeyParameters []*string - if v, ok := d.GetOk("cache_key_parameters"); ok { - cacheKeyParameters = expandStringSet(v.(*schema.Set)) + if v, ok := d.GetOk("passthrough_behavior"); ok { + input.PassthroughBehavior = aws.String(v.(string)) } - var cacheNamespace *string - if cacheKeyParameters != nil { - // Use resource_id unless user provides a custom name - cacheNamespace = aws.String(d.Get("resource_id").(string)) + if v, ok := d.GetOk("request_parameters"); ok && len(v.(map[string]interface{})) > 0 { + input.RequestParameters = stringMapToPointers(v.(map[string]interface{})) } - if v, ok := d.GetOk("cache_namespace"); ok { - cacheNamespace = aws.String(v.(string)) + + if v, ok := d.GetOk("request_templates"); ok && len(v.(map[string]interface{})) > 0 { + input.RequestTemplates = stringMapToPointers(v.(map[string]interface{})) } - var timeoutInMillis *int64 if v, ok := d.GetOk("timeout_milliseconds"); ok { - timeoutInMillis = aws.Int64(int64(v.(int))) - } - - var tlsConfig *apigateway.TlsConfig - if v, ok := d.GetOk("tls_config"); ok { - tlsConfig = expandApiGatewayTlsConfig(v.([]interface{})) - } - - _, err := conn.PutIntegration(&apigateway.PutIntegrationInput{ - HttpMethod: aws.String(d.Get("http_method").(string)), - ResourceId: aws.String(d.Get("resource_id").(string)), - RestApiId: aws.String(d.Get("rest_api_id").(string)), - Type: aws.String(d.Get("type").(string)), - IntegrationHttpMethod: integrationHttpMethod, - Uri: uri, - RequestParameters: aws.StringMap(parameters), - RequestTemplates: aws.StringMap(templates), - Credentials: credentials, - CacheNamespace: cacheNamespace, - CacheKeyParameters: cacheKeyParameters, - PassthroughBehavior: passthroughBehavior, - ContentHandling: contentHandling, - ConnectionType: connectionType, - ConnectionId: connectionId, - TimeoutInMillis: timeoutInMillis, - TlsConfig: tlsConfig, - }) + input.TimeoutInMillis = aws.Int64(int64(v.(int))) + } + + if v, ok := d.GetOk("tls_config"); ok && len(v.([]interface{})) > 0 { + input.TlsConfig = expandApiGatewayTlsConfig(v.([]interface{})) + } + + if v, ok := d.GetOk("uri"); ok { + input.Uri = aws.String(v.(string)) + } + + _, err := conn.PutIntegration(input) + if err != nil { return fmt.Errorf("Error creating API Gateway Integration: %s", err) } diff --git a/aws/resource_aws_api_gateway_integration_response_test.go b/aws/resource_aws_api_gateway_integration_response_test.go index c08533b75981..d0ebb075eb65 100644 --- a/aws/resource_aws_api_gateway_integration_response_test.go +++ b/aws/resource_aws_api_gateway_integration_response_test.go @@ -19,6 +19,7 @@ func TestAccAWSAPIGatewayIntegrationResponse_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayIntegrationResponseDestroy, Steps: []resource.TestStep{ @@ -66,6 +67,7 @@ func TestAccAWSAPIGatewayIntegrationResponse_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayIntegrationResponseDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_integration_test.go b/aws/resource_aws_api_gateway_integration_test.go index 4f07224dbf0f..959f4bd8cbcf 100644 --- a/aws/resource_aws_api_gateway_integration_test.go +++ b/aws/resource_aws_api_gateway_integration_test.go @@ -20,6 +20,7 @@ func TestAccAWSAPIGatewayIntegration_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayIntegrationDestroy, Steps: []resource.TestStep{ @@ -135,6 +136,7 @@ func TestAccAWSAPIGatewayIntegration_contentHandling(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayIntegrationDestroy, Steps: []resource.TestStep{ @@ -210,6 +212,7 @@ func TestAccAWSAPIGatewayIntegration_cache_key_parameters(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayIntegrationDestroy, Steps: []resource.TestStep{ @@ -252,6 +255,7 @@ func TestAccAWSAPIGatewayIntegration_integrationType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayIntegrationDestroy, Steps: []resource.TestStep{ @@ -296,6 +300,7 @@ func TestAccAWSAPIGatewayIntegration_TlsConfig_InsecureSkipVerification(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayIntegrationDestroy, Steps: []resource.TestStep{ @@ -332,6 +337,7 @@ func TestAccAWSAPIGatewayIntegration_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayIntegrationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_method_response_test.go b/aws/resource_aws_api_gateway_method_response_test.go index 3c8e31741f09..0f453085818c 100644 --- a/aws/resource_aws_api_gateway_method_response_test.go +++ b/aws/resource_aws_api_gateway_method_response_test.go @@ -19,6 +19,7 @@ func TestAccAWSAPIGatewayMethodResponse_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodResponseDestroy, Steps: []resource.TestStep{ @@ -62,6 +63,7 @@ func TestAccAWSAPIGatewayMethodResponse_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodResponseDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_method_settings_test.go b/aws/resource_aws_api_gateway_method_settings_test.go index 1fe37b10ba71..4454e0116574 100644 --- a/aws/resource_aws_api_gateway_method_settings_test.go +++ b/aws/resource_aws_api_gateway_method_settings_test.go @@ -19,6 +19,7 @@ func TestAccAWSAPIGatewayMethodSettings_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -47,6 +48,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_CacheDataEncrypted(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -83,6 +85,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_CacheTtlInSeconds(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -127,6 +130,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_CachingEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -163,6 +167,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_DataTraceEnabled(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -199,6 +204,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_LoggingLevel(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -237,6 +243,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_MetricsEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -275,6 +282,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -317,6 +325,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_RequireAuthorizationForCacheCon resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -353,6 +362,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_ThrottlingBurstLimit(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -390,6 +400,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_ThrottlingBurstLimitDisabledByD resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -426,6 +437,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_ThrottlingRateLimit(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -463,6 +475,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_ThrottlingRateLimitDisabledByDe resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -499,6 +512,7 @@ func TestAccAWSAPIGatewayMethodSettings_Settings_UnauthorizedCacheControlHeaderS resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ @@ -568,6 +582,7 @@ func TestAccAWSAPIGatewayMethodSettings_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodSettingsDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_method_test.go b/aws/resource_aws_api_gateway_method_test.go index 723946410323..414d1369a1fe 100644 --- a/aws/resource_aws_api_gateway_method_test.go +++ b/aws/resource_aws_api_gateway_method_test.go @@ -20,6 +20,7 @@ func TestAccAWSAPIGatewayMethod_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodDestroy, Steps: []resource.TestStep{ @@ -58,6 +59,7 @@ func TestAccAWSAPIGatewayMethod_customauthorizer(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodDestroy, Steps: []resource.TestStep{ @@ -99,6 +101,7 @@ func TestAccAWSAPIGatewayMethod_cognitoauthorizer(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodDestroy, Steps: []resource.TestStep{ @@ -143,6 +146,7 @@ func TestAccAWSAPIGatewayMethod_customrequestvalidator(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodDestroy, Steps: []resource.TestStep{ @@ -183,6 +187,7 @@ func TestAccAWSAPIGatewayMethod_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodDestroy, Steps: []resource.TestStep{ @@ -205,6 +210,7 @@ func TestAccAWSAPIGatewayMethod_OperationName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayMethodDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_model_test.go b/aws/resource_aws_api_gateway_model_test.go index f0d812f9d54b..08c5097704b4 100644 --- a/aws/resource_aws_api_gateway_model_test.go +++ b/aws/resource_aws_api_gateway_model_test.go @@ -21,6 +21,7 @@ func TestAccAWSAPIGatewayModel_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayModelDestroy, Steps: []resource.TestStep{ @@ -56,6 +57,7 @@ func TestAccAWSAPIGatewayModel_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayModelDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_request_validator_test.go b/aws/resource_aws_api_gateway_request_validator_test.go index 3dbf820e19d2..77877dc92dd2 100644 --- a/aws/resource_aws_api_gateway_request_validator_test.go +++ b/aws/resource_aws_api_gateway_request_validator_test.go @@ -19,6 +19,7 @@ func TestAccAWSAPIGatewayRequestValidator_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRequestValidatorDestroy, Steps: []resource.TestStep{ @@ -63,6 +64,7 @@ func TestAccAWSAPIGatewayRequestValidator_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRequestValidatorDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_resource_test.go b/aws/resource_aws_api_gateway_resource_test.go index d18f6932b981..ac33c4336dab 100644 --- a/aws/resource_aws_api_gateway_resource_test.go +++ b/aws/resource_aws_api_gateway_resource_test.go @@ -19,6 +19,7 @@ func TestAccAWSAPIGatewayResource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayResourceDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSAPIGatewayResource_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayResourceDestroy, Steps: []resource.TestStep{ @@ -93,6 +95,7 @@ func TestAccAWSAPIGatewayResource_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayResourceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_rest_api_policy_test.go b/aws/resource_aws_api_gateway_rest_api_policy_test.go index 1e667919e858..a308e84af856 100644 --- a/aws/resource_aws_api_gateway_rest_api_policy_test.go +++ b/aws/resource_aws_api_gateway_rest_api_policy_test.go @@ -21,6 +21,7 @@ func TestAccAWSAPIGatewayRestApiPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestApiPolicyDestroy, Steps: []resource.TestStep{ @@ -53,6 +54,7 @@ func TestAccAWSAPIGatewayRestApiPolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestApiPolicyDestroy, Steps: []resource.TestStep{ @@ -75,6 +77,7 @@ func TestAccAWSAPIGatewayRestApiPolicy_disappears_restApi(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestApiPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_rest_api_test.go b/aws/resource_aws_api_gateway_rest_api_test.go index 2efa40cd6216..7c788fbaafaa 100644 --- a/aws/resource_aws_api_gateway_rest_api_test.go +++ b/aws/resource_aws_api_gateway_rest_api_test.go @@ -71,6 +71,7 @@ func TestAccAWSAPIGatewayRestApi_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -110,6 +111,7 @@ func TestAccAWSAPIGatewayRestApi_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -159,6 +161,7 @@ func TestAccAWSAPIGatewayRestApi_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -181,6 +184,7 @@ func TestAccAWSAPIGatewayRestApi_EndpointConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -256,6 +260,7 @@ func TestAccAWSAPIGatewayRestApi_EndpointConfiguration_Private(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -308,6 +313,7 @@ func TestAccAWSAPIGatewayRestApi_ApiKeySource(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -345,6 +351,7 @@ func TestAccAWSAPIGatewayRestApi_ApiKeySource_OverrideBody(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -388,6 +395,7 @@ func TestAccAWSAPIGatewayRestApi_ApiKeySource_SetByBody(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -415,6 +423,7 @@ func TestAccAWSAPIGatewayRestApi_BinaryMediaTypes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -451,6 +460,7 @@ func TestAccAWSAPIGatewayRestApi_BinaryMediaTypes_OverrideBody(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -497,6 +507,7 @@ func TestAccAWSAPIGatewayRestApi_BinaryMediaTypes_SetByBody(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -525,6 +536,7 @@ func TestAccAWSAPIGatewayRestApi_Body(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -568,6 +580,7 @@ func TestAccAWSAPIGatewayRestApi_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -602,6 +615,7 @@ func TestAccAWSAPIGatewayRestApi_Description_OverrideBody(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -645,6 +659,7 @@ func TestAccAWSAPIGatewayRestApi_Description_SetByBody(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -671,6 +686,7 @@ func TestAccAWSAPIGatewayRestApi_DisableExecuteApiEndpoint(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -708,6 +724,7 @@ func TestAccAWSAPIGatewayRestApi_DisableExecuteApiEndpoint_OverrideBody(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -751,6 +768,7 @@ func TestAccAWSAPIGatewayRestApi_DisableExecuteApiEndpoint_SetByBody(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -780,6 +798,7 @@ func TestAccAWSAPIGatewayRestApi_EndpointConfiguration_VpcEndpointIds(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -837,6 +856,7 @@ func TestAccAWSAPIGatewayRestApi_EndpointConfiguration_VpcEndpointIds_OverrideBo resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -887,6 +907,7 @@ func TestAccAWSAPIGatewayRestApi_EndpointConfiguration_VpcEndpointIds_SetByBody( resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -916,6 +937,7 @@ func TestAccAWSAPIGatewayRestApi_MinimumCompressionSize(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -957,6 +979,7 @@ func TestAccAWSAPIGatewayRestApi_MinimumCompressionSize_OverrideBody(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -1000,6 +1023,7 @@ func TestAccAWSAPIGatewayRestApi_MinimumCompressionSize_SetByBody(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -1030,6 +1054,7 @@ func TestAccAWSAPIGatewayRestApi_Name_OverrideBody(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -1073,6 +1098,7 @@ func TestAccAWSAPIGatewayRestApi_Parameters(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -1108,6 +1134,7 @@ func TestAccAWSAPIGatewayRestApi_Policy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -1139,6 +1166,7 @@ func TestAccAWSAPIGatewayRestApi_Policy_OverrideBody(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ @@ -1185,6 +1213,7 @@ func TestAccAWSAPIGatewayRestApi_Policy_SetByBody(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayRestAPIDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_stage.go b/aws/resource_aws_api_gateway_stage.go index a7d4b39f6a5c..d496e9df4ad5 100644 --- a/aws/resource_aws_api_gateway_stage.go +++ b/aws/resource_aws_api_gateway_stage.go @@ -169,7 +169,7 @@ func resourceAwsApiGatewayStageCreate(d *schema.ResourceData, meta interface{}) d.SetId(fmt.Sprintf("ags-%s-%s", d.Get("rest_api_id").(string), d.Get("stage_name").(string))) - if waitForCache && *out.CacheClusterStatus != apigateway.CacheClusterStatusNotAvailable { + if waitForCache && out != nil && aws.StringValue(out.CacheClusterStatus) != apigateway.CacheClusterStatusNotAvailable { stateConf := &resource.StateChangeConf{ Pending: []string{ apigateway.CacheClusterStatusCreateInProgress, @@ -229,7 +229,7 @@ func resourceAwsApiGatewayStageRead(d *schema.ResourceData, meta interface{}) er d.Set("client_certificate_id", stage.ClientCertificateId) - if stage.CacheClusterStatus != nil && *stage.CacheClusterStatus == apigateway.CacheClusterStatusDeleteInProgress { + if aws.StringValue(stage.CacheClusterStatus) == apigateway.CacheClusterStatusDeleteInProgress { d.Set("cache_cluster_enabled", false) d.Set("cache_cluster_size", nil) } else { @@ -379,7 +379,7 @@ func resourceAwsApiGatewayStageUpdate(d *schema.ResourceData, meta interface{}) return fmt.Errorf("Updating API Gateway Stage failed: %s", err) } - if waitForCache && *out.CacheClusterStatus != apigateway.CacheClusterStatusNotAvailable { + if waitForCache && out != nil && aws.StringValue(out.CacheClusterStatus) != apigateway.CacheClusterStatusNotAvailable { stateConf := &resource.StateChangeConf{ Pending: []string{ apigateway.CacheClusterStatusCreateInProgress, diff --git a/aws/resource_aws_api_gateway_stage_test.go b/aws/resource_aws_api_gateway_stage_test.go index 40e497378b54..fa99189e9663 100644 --- a/aws/resource_aws_api_gateway_stage_test.go +++ b/aws/resource_aws_api_gateway_stage_test.go @@ -20,6 +20,7 @@ func TestAccAWSAPIGatewayStage_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayStageDestroy, Steps: []resource.TestStep{ @@ -85,6 +86,7 @@ func TestAccAWSAPIGatewayStage_disappears_ReferencingDeployment(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayStageDestroy, Steps: []resource.TestStep{ @@ -111,6 +113,7 @@ func TestAccAWSAPIGatewayStage_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayStageDestroy, Steps: []resource.TestStep{ @@ -138,6 +141,7 @@ func TestAccAWSAPIGatewayStage_accessLogSettings(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayStageDestroy, Steps: []resource.TestStep{ @@ -205,6 +209,7 @@ func TestAccAWSAPIGatewayStage_accessLogSettings_kinesis(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayStageDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_usage_plan_key_test.go b/aws/resource_aws_api_gateway_usage_plan_key_test.go index a76d39fa33a6..11bfca8be4c7 100644 --- a/aws/resource_aws_api_gateway_usage_plan_key_test.go +++ b/aws/resource_aws_api_gateway_usage_plan_key_test.go @@ -22,6 +22,7 @@ func TestAccAWSAPIGatewayUsagePlanKey_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanKeyDestroy, Steps: []resource.TestStep{ @@ -53,6 +54,7 @@ func TestAccAWSAPIGatewayUsagePlanKey_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanKeyDestroy, Steps: []resource.TestStep{ @@ -74,6 +76,7 @@ func TestAccAWSAPIGatewayUsagePlanKey_KeyId_Concurrency(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanKeyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_usage_plan_test.go b/aws/resource_aws_api_gateway_usage_plan_test.go index 400eca313919..bfa231af4977 100644 --- a/aws/resource_aws_api_gateway_usage_plan_test.go +++ b/aws/resource_aws_api_gateway_usage_plan_test.go @@ -20,6 +20,7 @@ func TestAccAWSAPIGatewayUsagePlan_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, Steps: []resource.TestStep{ @@ -59,6 +60,7 @@ func TestAccAWSAPIGatewayUsagePlan_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, Steps: []resource.TestStep{ @@ -105,6 +107,7 @@ func TestAccAWSAPIGatewayUsagePlan_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, Steps: []resource.TestStep{ @@ -158,6 +161,7 @@ func TestAccAWSAPIGatewayUsagePlan_productCode(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, Steps: []resource.TestStep{ @@ -205,6 +209,7 @@ func TestAccAWSAPIGatewayUsagePlan_throttling(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, Steps: []resource.TestStep{ @@ -259,6 +264,7 @@ func TestAccAWSAPIGatewayUsagePlan_throttlingInitialRateLimit(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, Steps: []resource.TestStep{ @@ -285,6 +291,7 @@ func TestAccAWSAPIGatewayUsagePlan_quota(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, Steps: []resource.TestStep{ @@ -340,6 +347,7 @@ func TestAccAWSAPIGatewayUsagePlan_apiStages(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, Steps: []resource.TestStep{ @@ -423,6 +431,7 @@ func TestAccAWSAPIGatewayUsagePlan_apiStages_multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, Steps: []resource.TestStep{ @@ -455,6 +464,7 @@ func TestAccAWSAPIGatewayUsagePlan_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayUsagePlanDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_api_gateway_vpc_link.go b/aws/resource_aws_api_gateway_vpc_link.go index 9bc2ae15e985..d608fbba5d79 100644 --- a/aws/resource_aws_api_gateway_vpc_link.go +++ b/aws/resource_aws_api_gateway_vpc_link.go @@ -86,8 +86,7 @@ func resourceAwsApiGatewayVpcLinkCreate(d *schema.ResourceData, meta interface{} _, err = stateConf.WaitForState() if err != nil { - d.SetId("") - return fmt.Errorf("Error waiting for APIGateway Vpc Link status to be \"%s\": %s", apigateway.VpcLinkStatusAvailable, err) + return fmt.Errorf("error waiting for APIGateway Vpc Link status to be \"%s\": %w", apigateway.VpcLinkStatusAvailable, err) } return resourceAwsApiGatewayVpcLinkRead(d, meta) diff --git a/aws/resource_aws_api_gateway_vpc_link_test.go b/aws/resource_aws_api_gateway_vpc_link_test.go index 0cb2d3bcebf8..253cf6395294 100644 --- a/aws/resource_aws_api_gateway_vpc_link_test.go +++ b/aws/resource_aws_api_gateway_vpc_link_test.go @@ -67,6 +67,7 @@ func TestAccAWSAPIGatewayVpcLink_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAPIGatewayVpcLinkDestroy, Steps: []resource.TestStep{ @@ -107,6 +108,7 @@ func TestAccAWSAPIGatewayVpcLink_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAPIGatewayVpcLinkDestroy, Steps: []resource.TestStep{ @@ -159,6 +161,7 @@ func TestAccAWSAPIGatewayVpcLink_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAPIGatewayVpcLinkDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_apigatewayv2_api_mapping_test.go b/aws/resource_aws_apigatewayv2_api_mapping_test.go index ae77f9ea59af..0ca812940f04 100644 --- a/aws/resource_aws_apigatewayv2_api_mapping_test.go +++ b/aws/resource_aws_apigatewayv2_api_mapping_test.go @@ -43,6 +43,7 @@ func TestAccAWSAPIGatewayV2ApiMapping_basic(t *testing.T) { func testAccAWSAPIGatewayV2ApiMapping_createCertificate(t *testing.T, rName string, certificateArn *string) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -67,6 +68,7 @@ func testAccAWSAPIGatewayV2ApiMapping_basic(t *testing.T, rName string, certific resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiMappingDestroy, Steps: []resource.TestStep{ @@ -94,6 +96,7 @@ func testAccAWSAPIGatewayV2ApiMapping_disappears(t *testing.T, rName string, cer resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiMappingDestroy, Steps: []resource.TestStep{ @@ -118,6 +121,7 @@ func testAccAWSAPIGatewayV2ApiMapping_ApiMappingKey(t *testing.T, rName string, resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiMappingDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_apigatewayv2_api_test.go b/aws/resource_aws_apigatewayv2_api_test.go index c1f6d7da02aa..64653b3d4177 100644 --- a/aws/resource_aws_apigatewayv2_api_test.go +++ b/aws/resource_aws_apigatewayv2_api_test.go @@ -75,6 +75,7 @@ func TestAccAWSAPIGatewayV2Api_basicWebSocket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ @@ -112,6 +113,7 @@ func TestAccAWSAPIGatewayV2Api_basicHttp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ @@ -149,6 +151,7 @@ func TestAccAWSAPIGatewayV2Api_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ @@ -172,6 +175,7 @@ func TestAccAWSAPIGatewayV2Api_AllAttributesWebSocket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ @@ -253,6 +257,7 @@ func TestAccAWSAPIGatewayV2Api_AllAttributesHttp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ @@ -333,6 +338,7 @@ func TestAccAWSAPIGatewayV2Api_Openapi(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ @@ -379,6 +385,7 @@ func TestAccAWSAPIGatewayV2Api_Openapi_WithTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ @@ -423,6 +430,7 @@ func TestAccAWSAPIGatewayV2Api_Openapi_WithCorsConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ @@ -479,6 +487,7 @@ func TestAccAWSAPIGatewayV2Api_OpenapiWithMoreFields(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ @@ -562,6 +571,7 @@ func TestAccAWSAPIGatewayV2Api_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ @@ -614,6 +624,7 @@ func TestAccAWSAPIGatewayV2Api_CorsConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ @@ -704,6 +715,7 @@ func TestAccAWSAPIGatewayV2Api_QuickCreate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ApiDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_apigatewayv2_authorizer_test.go b/aws/resource_aws_apigatewayv2_authorizer_test.go index 29dc02a15dbe..7d977a6b137c 100644 --- a/aws/resource_aws_apigatewayv2_authorizer_test.go +++ b/aws/resource_aws_apigatewayv2_authorizer_test.go @@ -20,6 +20,7 @@ func TestAccAWSAPIGatewayV2Authorizer_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2AuthorizerDestroy, Steps: []resource.TestStep{ @@ -56,6 +57,7 @@ func TestAccAWSAPIGatewayV2Authorizer_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2AuthorizerDestroy, Steps: []resource.TestStep{ @@ -81,6 +83,7 @@ func TestAccAWSAPIGatewayV2Authorizer_Credentials(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2AuthorizerDestroy, Steps: []resource.TestStep{ @@ -150,6 +153,7 @@ func TestAccAWSAPIGatewayV2Authorizer_JWT(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2AuthorizerDestroy, Steps: []resource.TestStep{ @@ -209,6 +213,7 @@ func TestAccAWSAPIGatewayV2Authorizer_HttpApiLambdaRequestAuthorizer_InitialMiss resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2AuthorizerDestroy, Steps: []resource.TestStep{ @@ -281,6 +286,7 @@ func TestAccAWSAPIGatewayV2Authorizer_HttpApiLambdaRequestAuthorizer_InitialZero resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2AuthorizerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_apigatewayv2_deployment_test.go b/aws/resource_aws_apigatewayv2_deployment_test.go index 8edecee1598c..a1703648ef5a 100644 --- a/aws/resource_aws_apigatewayv2_deployment_test.go +++ b/aws/resource_aws_apigatewayv2_deployment_test.go @@ -19,6 +19,7 @@ func TestAccAWSAPIGatewayV2Deployment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2DeploymentDestroy, Steps: []resource.TestStep{ @@ -56,6 +57,7 @@ func TestAccAWSAPIGatewayV2Deployment_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2DeploymentDestroy, Steps: []resource.TestStep{ @@ -79,6 +81,7 @@ func TestAccAWSAPIGatewayV2Deployment_Triggers(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2DeploymentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_apigatewayv2_domain_name.go b/aws/resource_aws_apigatewayv2_domain_name.go index 096585064678..a6c48dc2f10f 100644 --- a/aws/resource_aws_apigatewayv2_domain_name.go +++ b/aws/resource_aws_apigatewayv2_domain_name.go @@ -8,14 +8,13 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/service/apigatewayv2" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" -) - -const ( - apiGatewayV2DomainNameStatusDeleted = "DELETED" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/apigatewayv2/finder" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/apigatewayv2/waiter" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource" ) func resourceAwsApiGatewayV2DomainName() *schema.Resource { @@ -29,6 +28,7 @@ func resourceAwsApiGatewayV2DomainName() *schema.Resource { }, Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), Update: schema.DefaultTimeout(60 * time.Minute), }, @@ -109,21 +109,27 @@ func resourceAwsApiGatewayV2DomainName() *schema.Resource { func resourceAwsApiGatewayV2DomainNameCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).apigatewayv2conn + domainName := d.Get("domain_name").(string) - req := &apigatewayv2.CreateDomainNameInput{ - DomainName: aws.String(d.Get("domain_name").(string)), + input := &apigatewayv2.CreateDomainNameInput{ + DomainName: aws.String(domainName), DomainNameConfigurations: expandApiGatewayV2DomainNameConfiguration(d.Get("domain_name_configuration").([]interface{})), MutualTlsAuthentication: expandApiGatewayV2MutualTlsAuthentication(d.Get("mutual_tls_authentication").([]interface{})), Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().Apigatewayv2Tags(), } - log.Printf("[DEBUG] Creating API Gateway v2 domain name: %s", req) - resp, err := conn.CreateDomainName(req) + log.Printf("[DEBUG] Creating API Gateway v2 domain name: %s", input) + output, err := conn.CreateDomainName(input) + if err != nil { - return fmt.Errorf("error creating API Gateway v2 domain name: %s", err) + return fmt.Errorf("error creating API Gateway v2 domain name (%s): %w", domainName, err) } - d.SetId(aws.StringValue(resp.DomainName)) + d.SetId(aws.StringValue(output.DomainName)) + + if _, err := waiter.DomainNameAvailable(conn, d.Id(), d.Timeout(schema.TimeoutCreate)); err != nil { + return fmt.Errorf("error waiting for API Gateway v2 domain name (%s) to become available: %w", d.Id(), err) + } return resourceAwsApiGatewayV2DomainNameRead(d, meta) } @@ -132,19 +138,19 @@ func resourceAwsApiGatewayV2DomainNameRead(d *schema.ResourceData, meta interfac conn := meta.(*AWSClient).apigatewayv2conn ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig - respRaw, state, err := apiGatewayV2DomainNameRefresh(conn, d.Id())() - if err != nil { - return fmt.Errorf("error reading API Gateway v2 domain name (%s): %s", d.Id(), err) - } + output, err := finder.DomainNameByName(conn, d.Id()) - if state == apiGatewayV2DomainNameStatusDeleted { + if !d.IsNewResource() && tfresource.NotFound(err) { log.Printf("[WARN] API Gateway v2 domain name (%s) not found, removing from state", d.Id()) d.SetId("") return nil } - resp := respRaw.(*apigatewayv2.GetDomainNameOutput) - d.Set("api_mapping_selection_expression", resp.ApiMappingSelectionExpression) + if err != nil { + return fmt.Errorf("error reading API Gateway v2 domain name (%s): %w", d.Id(), err) + } + + d.Set("api_mapping_selection_expression", output.ApiMappingSelectionExpression) arn := arn.ARN{ Partition: meta.(*AWSClient).partition, Service: "apigateway", @@ -152,17 +158,17 @@ func resourceAwsApiGatewayV2DomainNameRead(d *schema.ResourceData, meta interfac Resource: fmt.Sprintf("/domainnames/%s", d.Id()), }.String() d.Set("arn", arn) - d.Set("domain_name", resp.DomainName) - err = d.Set("domain_name_configuration", flattenApiGatewayV2DomainNameConfiguration(resp.DomainNameConfigurations[0])) + d.Set("domain_name", output.DomainName) + err = d.Set("domain_name_configuration", flattenApiGatewayV2DomainNameConfiguration(output.DomainNameConfigurations[0])) if err != nil { - return fmt.Errorf("error setting domain_name_configuration: %s", err) + return fmt.Errorf("error setting domain_name_configuration: %w", err) } - err = d.Set("mutual_tls_authentication", flattenApiGatewayV2MutualTlsAuthentication(resp.MutualTlsAuthentication)) + err = d.Set("mutual_tls_authentication", flattenApiGatewayV2MutualTlsAuthentication(output.MutualTlsAuthentication)) if err != nil { - return fmt.Errorf("error setting mutual_tls_authentication: %s", err) + return fmt.Errorf("error setting mutual_tls_authentication: %w", err) } - if err := d.Set("tags", keyvaluetags.Apigatewayv2KeyValueTags(resp.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + if err := d.Set("tags", keyvaluetags.Apigatewayv2KeyValueTags(output.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) } return nil @@ -172,43 +178,42 @@ func resourceAwsApiGatewayV2DomainNameUpdate(d *schema.ResourceData, meta interf conn := meta.(*AWSClient).apigatewayv2conn if d.HasChanges("domain_name_configuration", "mutual_tls_authentication") { - req := &apigatewayv2.UpdateDomainNameInput{ - DomainName: aws.String(d.Id()), + input := &apigatewayv2.UpdateDomainNameInput{ + DomainName: aws.String(d.Id()), + DomainNameConfigurations: expandApiGatewayV2DomainNameConfiguration(d.Get("domain_name_configuration").([]interface{})), } - if d.HasChange("domain_name_configuration") { - req.DomainNameConfigurations = expandApiGatewayV2DomainNameConfiguration(d.Get("domain_name_configuration").([]interface{})) - } if d.HasChange("mutual_tls_authentication") { vMutualTlsAuthentication := d.Get("mutual_tls_authentication").([]interface{}) if len(vMutualTlsAuthentication) == 0 || vMutualTlsAuthentication[0] == nil { // To disable mutual TLS for a custom domain name, remove the truststore from your custom domain name. - req.MutualTlsAuthentication = &apigatewayv2.MutualTlsAuthenticationInput{ + input.MutualTlsAuthentication = &apigatewayv2.MutualTlsAuthenticationInput{ TruststoreUri: aws.String(""), } } else { - req.MutualTlsAuthentication = &apigatewayv2.MutualTlsAuthenticationInput{ + input.MutualTlsAuthentication = &apigatewayv2.MutualTlsAuthenticationInput{ TruststoreVersion: aws.String(vMutualTlsAuthentication[0].(map[string]interface{})["truststore_version"].(string)), } } } - log.Printf("[DEBUG] Updating API Gateway v2 domain name: %s", req) - _, err := conn.UpdateDomainName(req) + log.Printf("[DEBUG] Updating API Gateway v2 domain name: %s", input) + _, err := conn.UpdateDomainName(input) + if err != nil { - return fmt.Errorf("error updating API Gateway v2 domain name (%s): %s", d.Id(), err) + return fmt.Errorf("error updating API Gateway v2 domain name (%s): %w", d.Id(), err) } - if err := waitForApiGatewayV2DomainNameAvailabilityOnUpdate(conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { - return fmt.Errorf("error waiting for API Gateway v2 domain name (%s) to become available: %s", d.Id(), err) + if _, err := waiter.DomainNameAvailable(conn, d.Id(), d.Timeout(schema.TimeoutUpdate)); err != nil { + return fmt.Errorf("error waiting for API Gateway v2 domain name (%s) to become available: %w", d.Id(), err) } } if d.HasChange("tags") { o, n := d.GetChange("tags") if err := keyvaluetags.Apigatewayv2UpdateTags(conn, d.Get("arn").(string), o, n); err != nil { - return fmt.Errorf("error updating API Gateway v2 domain name (%s) tags: %s", d.Id(), err) + return fmt.Errorf("error updating API Gateway v2 domain name (%s) tags: %w", d.Id(), err) } } @@ -222,56 +227,18 @@ func resourceAwsApiGatewayV2DomainNameDelete(d *schema.ResourceData, meta interf _, err := conn.DeleteDomainName(&apigatewayv2.DeleteDomainNameInput{ DomainName: aws.String(d.Id()), }) - if isAWSErr(err, apigatewayv2.ErrCodeNotFoundException, "") { + + if tfawserr.ErrCodeEquals(err, apigatewayv2.ErrCodeNotFoundException) { return nil } + if err != nil { - return fmt.Errorf("error deleting API Gateway v2 domain name (%s): %s", d.Id(), err) + return fmt.Errorf("error deleting API Gateway v2 domain name (%s): %w", d.Id(), err) } return nil } -func apiGatewayV2DomainNameRefresh(conn *apigatewayv2.ApiGatewayV2, domainName string) resource.StateRefreshFunc { - return func() (interface{}, string, error) { - resp, err := conn.GetDomainName(&apigatewayv2.GetDomainNameInput{ - DomainName: aws.String(domainName), - }) - if isAWSErr(err, apigatewayv2.ErrCodeNotFoundException, "") { - return "", apiGatewayV2DomainNameStatusDeleted, nil - } - if err != nil { - return nil, "", err - } - - if n := len(resp.DomainNameConfigurations); n != 1 { - return nil, "", fmt.Errorf("Found %d domain name configurations for %s, expected 1", n, domainName) - } - - domainNameConfiguration := resp.DomainNameConfigurations[0] - if statusMessage := aws.StringValue(domainNameConfiguration.DomainNameStatusMessage); statusMessage != "" { - log.Printf("[INFO] Domain name (%s) status message: %s", domainName, statusMessage) - } - - return resp, aws.StringValue(domainNameConfiguration.DomainNameStatus), nil - } -} - -func waitForApiGatewayV2DomainNameAvailabilityOnUpdate(conn *apigatewayv2.ApiGatewayV2, domainName string, timeout time.Duration) error { - stateConf := &resource.StateChangeConf{ - Pending: []string{apigatewayv2.DomainNameStatusUpdating}, - Target: []string{apigatewayv2.DomainNameStatusAvailable}, - Refresh: apiGatewayV2DomainNameRefresh(conn, domainName), - Timeout: timeout, - Delay: 10 * time.Second, - MinTimeout: 5 * time.Second, - } - - _, err := stateConf.WaitForState() - - return err -} - func expandApiGatewayV2DomainNameConfiguration(vDomainNameConfiguration []interface{}) []*apigatewayv2.DomainNameConfiguration { if len(vDomainNameConfiguration) == 0 || vDomainNameConfiguration[0] == nil { return nil diff --git a/aws/resource_aws_apigatewayv2_domain_name_test.go b/aws/resource_aws_apigatewayv2_domain_name_test.go index 5efe6323f62d..cafa275f04f2 100644 --- a/aws/resource_aws_apigatewayv2_domain_name_test.go +++ b/aws/resource_aws_apigatewayv2_domain_name_test.go @@ -12,6 +12,9 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/apigatewayv2/finder" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/apigatewayv2/lister" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource" ) func init() { @@ -24,42 +27,40 @@ func init() { func testSweepAPIGatewayV2DomainNames(region string) error { client, err := sharedClientForRegion(region) if err != nil { - return fmt.Errorf("error getting client: %s", err) + return fmt.Errorf("error getting client: %w", err) } conn := client.(*AWSClient).apigatewayv2conn input := &apigatewayv2.GetDomainNamesInput{} var sweeperErrs *multierror.Error - for { - output, err := conn.GetDomainNames(input) - if testSweepSkipSweepError(err) { - log.Printf("[WARN] Skipping API Gateway v2 domain names sweep for %s: %s", region, err) - return nil - } - if err != nil { - return fmt.Errorf("error retrieving API Gateway v2 domain names: %s", err) + err = lister.GetDomainNamesPages(conn, input, func(page *apigatewayv2.GetDomainNamesOutput, isLast bool) bool { + if page == nil { + return !isLast } - for _, domainName := range output.Items { - log.Printf("[INFO] Deleting API Gateway v2 domain name: %s", aws.StringValue(domainName.DomainName)) - _, err := conn.DeleteDomainName(&apigatewayv2.DeleteDomainNameInput{ - DomainName: domainName.DomainName, - }) - if isAWSErr(err, apigatewayv2.ErrCodeNotFoundException, "") { - continue - } + for _, domainName := range page.Items { + r := resourceAwsApiGatewayV2DomainName() + d := r.Data(nil) + d.SetId(aws.StringValue(domainName.DomainName)) + err = r.Delete(d, client) + if err != nil { - sweeperErr := fmt.Errorf("error deleting API Gateway v2 domain name (%s): %s", aws.StringValue(domainName.DomainName), err) - log.Printf("[ERROR] %s", sweeperErr) - sweeperErrs = multierror.Append(sweeperErrs, sweeperErr) + log.Printf("[ERROR] %s", err) + sweeperErrs = multierror.Append(sweeperErrs, err) continue } } - if aws.StringValue(output.NextToken) == "" { - break - } - input.NextToken = output.NextToken + return !isLast + }) + + if testSweepSkipSweepError(err) { + log.Printf("[WARN] Skipping API Gateway v2 domain names sweep for %s: %s", region, err) + return sweeperErrs.ErrorOrNil() // In case we have completed some pages, but had errors + } + + if err != nil { + sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error listing API Gateway v2 domain names: %w", err)) } return sweeperErrs.ErrorOrNil() @@ -76,6 +77,7 @@ func TestAccAWSAPIGatewayV2DomainName_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2DomainNameDestroy, Steps: []resource.TestStep{ @@ -114,6 +116,7 @@ func TestAccAWSAPIGatewayV2DomainName_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2DomainNameDestroy, Steps: []resource.TestStep{ @@ -140,6 +143,7 @@ func TestAccAWSAPIGatewayV2DomainName_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2DomainNameDestroy, Steps: []resource.TestStep{ @@ -198,6 +202,7 @@ func TestAccAWSAPIGatewayV2DomainName_UpdateCertificate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2DomainNameDestroy, Steps: []resource.TestStep{ @@ -272,11 +277,12 @@ func TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2DomainNameDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSAPIGatewayV2DomainNameConfigMututalTlsAuthentication(rootDomain, domain, rName), + Config: testAccAWSAPIGatewayV2DomainNameConfigMututalTlsAuthenticationNoObjectVersion(rootDomain, domain, rName, "apigateway-domain-name-truststore-1.pem"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAPIGatewayV2DomainNameExists(resourceName, &v), testAccMatchResourceAttrRegionalARNNoAccount(resourceName, "arn", "apigateway", regexp.MustCompile(`/domainnames/.+`)), @@ -288,13 +294,31 @@ func TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "domain_name_configuration.0.security_policy", "TLS_1_2"), resource.TestCheckResourceAttrSet(resourceName, "domain_name_configuration.0.target_domain_name"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.#", "1"), - resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_uri", fmt.Sprintf("s3://%s/%s.1", rName, rName)), + resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_uri", fmt.Sprintf("s3://%s/%s", rName, rName)), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_version", ""), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { - Config: testAccAWSAPIGatewayV2DomainNameConfigMututalTlsAuthenticationUpdated(rootDomain, domain, rName), + Config: testAccAWSAPIGatewayV2DomainNameConfigMututalTlsAuthenticationObjectVersion(rootDomain, domain, rName, "apigateway-domain-name-truststore-2.pem"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSAPIGatewayV2DomainNameExists(resourceName, &v), + testAccMatchResourceAttrRegionalARNNoAccount(resourceName, "arn", "apigateway", regexp.MustCompile(`/domainnames/.+`)), + resource.TestCheckResourceAttrPair(resourceName, "domain_name", acmCertificateResourceName, "domain_name"), + resource.TestCheckResourceAttr(resourceName, "domain_name_configuration.#", "1"), + resource.TestCheckResourceAttrPair(resourceName, "domain_name_configuration.0.certificate_arn", acmCertificateResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "domain_name_configuration.0.endpoint_type", "REGIONAL"), + resource.TestCheckResourceAttrSet(resourceName, "domain_name_configuration.0.hosted_zone_id"), + resource.TestCheckResourceAttr(resourceName, "domain_name_configuration.0.security_policy", "TLS_1_2"), + resource.TestCheckResourceAttrSet(resourceName, "domain_name_configuration.0.target_domain_name"), + resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.#", "1"), + resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_uri", fmt.Sprintf("s3://%s/%s", rName, rName)), + resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3BucketObjectResourceName, "version_id"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + ), + }, + { + Config: testAccAWSAPIGatewayV2DomainNameConfigMututalTlsAuthenticationObjectVersion(rootDomain, domain, rName, "apigateway-domain-name-truststore-1.pem"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSAPIGatewayV2DomainNameExists(resourceName, &v), testAccMatchResourceAttrRegionalARNNoAccount(resourceName, "arn", "apigateway", regexp.MustCompile(`/domainnames/.+`)), @@ -306,7 +330,7 @@ func TestAccAWSAPIGatewayV2DomainName_MutualTlsAuthentication(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "domain_name_configuration.0.security_policy", "TLS_1_2"), resource.TestCheckResourceAttrSet(resourceName, "domain_name_configuration.0.target_domain_name"), resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.#", "1"), - resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_uri", fmt.Sprintf("s3://%s/%s.2", rName, rName)), + resource.TestCheckResourceAttr(resourceName, "mutual_tls_authentication.0.truststore_uri", fmt.Sprintf("s3://%s/%s", rName, rName)), resource.TestCheckResourceAttrPair(resourceName, "mutual_tls_authentication.0.truststore_version", s3BucketObjectResourceName, "version_id"), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), @@ -345,12 +369,12 @@ func testAccCheckAWSAPIGatewayV2DomainNameDestroy(s *terraform.State) error { continue } - _, err := conn.GetDomainName(&apigatewayv2.GetDomainNameInput{ - DomainName: aws.String(rs.Primary.ID), - }) - if isAWSErr(err, apigatewayv2.ErrCodeNotFoundException, "") { + _, err := finder.DomainNameByName(conn, rs.Primary.ID) + + if tfresource.NotFound(err) { continue } + if err != nil { return err } @@ -374,14 +398,13 @@ func testAccCheckAWSAPIGatewayV2DomainNameExists(n string, v *apigatewayv2.GetDo conn := testAccProvider.Meta().(*AWSClient).apigatewayv2conn - resp, err := conn.GetDomainName(&apigatewayv2.GetDomainNameInput{ - DomainName: aws.String(rs.Primary.ID), - }) + output, err := finder.DomainNameByName(conn, rs.Primary.ID) + if err != nil { return err } - *v = *resp + *v = *output return nil } @@ -487,7 +510,7 @@ resource "aws_apigatewayv2_domain_name" "test" { `, rName, index)) } -func testAccAWSAPIGatewayV2DomainNameConfigMututalTlsAuthentication(rootDomain, domain, rName string) string { +func testAccAWSAPIGatewayV2DomainNameConfigMututalTlsAuthenticationNoObjectVersion(rootDomain, domain, rName, pemFileName string) string { return composeConfig( testAccAWSAPIGatewayV2DomainNameConfigPublicCert(rootDomain, domain), fmt.Sprintf(` @@ -499,8 +522,8 @@ resource "aws_s3_bucket" "test" { resource "aws_s3_bucket_object" "test" { bucket = aws_s3_bucket.test.id - key = "%[1]s.1" - source = "test-fixtures/apigateway-domain-name-truststore-1.pem" + key = %[1]q + source = "test-fixtures/%[2]s" } resource "aws_apigatewayv2_domain_name" "test" { @@ -516,10 +539,10 @@ resource "aws_apigatewayv2_domain_name" "test" { truststore_uri = "s3://${aws_s3_bucket_object.test.bucket}/${aws_s3_bucket_object.test.key}" } } -`, rName)) +`, rName, pemFileName)) } -func testAccAWSAPIGatewayV2DomainNameConfigMututalTlsAuthenticationUpdated(rootDomain, domain, rName string) string { +func testAccAWSAPIGatewayV2DomainNameConfigMututalTlsAuthenticationObjectVersion(rootDomain, domain, rName, pemFileName string) string { return composeConfig( testAccAWSAPIGatewayV2DomainNameConfigPublicCert(rootDomain, domain), fmt.Sprintf(` @@ -535,8 +558,8 @@ resource "aws_s3_bucket" "test" { resource "aws_s3_bucket_object" "test" { bucket = aws_s3_bucket.test.id - key = "%[1]s.2" - source = "test-fixtures/apigateway-domain-name-truststore-2.pem" + key = %[1]q + source = "test-fixtures/%[2]s" } resource "aws_apigatewayv2_domain_name" "test" { @@ -553,7 +576,7 @@ resource "aws_apigatewayv2_domain_name" "test" { truststore_version = aws_s3_bucket_object.test.version_id } } -`, rName)) +`, rName, pemFileName)) } func testAccAWSAPIGatewayV2DomainNameConfigMututalTlsAuthenticationMissing(rootDomain, domain string) string { diff --git a/aws/resource_aws_apigatewayv2_integration_response_test.go b/aws/resource_aws_apigatewayv2_integration_response_test.go index ce62dc29e718..cb30a074f0f3 100644 --- a/aws/resource_aws_apigatewayv2_integration_response_test.go +++ b/aws/resource_aws_apigatewayv2_integration_response_test.go @@ -20,6 +20,7 @@ func TestAccAWSAPIGatewayV2IntegrationResponse_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationResponseDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSAPIGatewayV2IntegrationResponse_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationResponseDestroy, Steps: []resource.TestStep{ @@ -76,6 +78,7 @@ func TestAccAWSAPIGatewayV2IntegrationResponse_AllAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationResponseDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_apigatewayv2_integration_test.go b/aws/resource_aws_apigatewayv2_integration_test.go index 2b0248cc96dc..f2fe1425aabb 100644 --- a/aws/resource_aws_apigatewayv2_integration_test.go +++ b/aws/resource_aws_apigatewayv2_integration_test.go @@ -19,6 +19,7 @@ func TestAccAWSAPIGatewayV2Integration_basicWebSocket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationDestroy, Steps: []resource.TestStep{ @@ -64,6 +65,7 @@ func TestAccAWSAPIGatewayV2Integration_basicHttp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationDestroy, Steps: []resource.TestStep{ @@ -109,6 +111,7 @@ func TestAccAWSAPIGatewayV2Integration_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationDestroy, Steps: []resource.TestStep{ @@ -132,6 +135,7 @@ func TestAccAWSAPIGatewayV2Integration_DataMappingHttp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationDestroy, Steps: []resource.TestStep{ @@ -222,6 +226,7 @@ func TestAccAWSAPIGatewayV2Integration_IntegrationTypeHttp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationDestroy, Steps: []resource.TestStep{ @@ -298,6 +303,7 @@ func TestAccAWSAPIGatewayV2Integration_LambdaWebSocket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationDestroy, Steps: []resource.TestStep{ @@ -343,6 +349,7 @@ func TestAccAWSAPIGatewayV2Integration_LambdaHttp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationDestroy, Steps: []resource.TestStep{ @@ -388,6 +395,7 @@ func TestAccAWSAPIGatewayV2Integration_VpcLinkWebSocket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationDestroy, Steps: []resource.TestStep{ @@ -435,6 +443,7 @@ func TestAccAWSAPIGatewayV2Integration_VpcLinkHttp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationDestroy, Steps: []resource.TestStep{ @@ -515,6 +524,7 @@ func TestAccAWSAPIGatewayV2Integration_AwsServiceIntegration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2IntegrationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_apigatewayv2_model_test.go b/aws/resource_aws_apigatewayv2_model_test.go index 9b8a7ab48bba..2b8bf791adab 100644 --- a/aws/resource_aws_apigatewayv2_model_test.go +++ b/aws/resource_aws_apigatewayv2_model_test.go @@ -33,6 +33,7 @@ func TestAccAWSAPIGatewayV2Model_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ModelDestroy, Steps: []resource.TestStep{ @@ -77,6 +78,7 @@ func TestAccAWSAPIGatewayV2Model_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ModelDestroy, Steps: []resource.TestStep{ @@ -128,6 +130,7 @@ func TestAccAWSAPIGatewayV2Model_AllAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2ModelDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_apigatewayv2_route_response_test.go b/aws/resource_aws_apigatewayv2_route_response_test.go index 2f35d9debc03..d2f47aea3b02 100644 --- a/aws/resource_aws_apigatewayv2_route_response_test.go +++ b/aws/resource_aws_apigatewayv2_route_response_test.go @@ -21,6 +21,7 @@ func TestAccAWSAPIGatewayV2RouteResponse_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2RouteResponseDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSAPIGatewayV2RouteResponse_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2RouteResponseDestroy, Steps: []resource.TestStep{ @@ -78,6 +80,7 @@ func TestAccAWSAPIGatewayV2RouteResponse_Model(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2RouteResponseDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_apigatewayv2_route_test.go b/aws/resource_aws_apigatewayv2_route_test.go index e1a136c535c2..9fdf09aa95a4 100644 --- a/aws/resource_aws_apigatewayv2_route_test.go +++ b/aws/resource_aws_apigatewayv2_route_test.go @@ -20,6 +20,7 @@ func TestAccAWSAPIGatewayV2Route_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2RouteDestroy, Steps: []resource.TestStep{ @@ -56,6 +57,7 @@ func TestAccAWSAPIGatewayV2Route_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2RouteDestroy, Steps: []resource.TestStep{ @@ -80,6 +82,7 @@ func TestAccAWSAPIGatewayV2Route_Authorizer(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2RouteDestroy, Steps: []resource.TestStep{ @@ -134,6 +137,7 @@ func TestAccAWSAPIGatewayV2Route_JwtAuthorization(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2RouteDestroy, Steps: []resource.TestStep{ @@ -189,6 +193,7 @@ func TestAccAWSAPIGatewayV2Route_Model(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2RouteDestroy, Steps: []resource.TestStep{ @@ -226,6 +231,7 @@ func TestAccAWSAPIGatewayV2Route_SimpleAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2RouteDestroy, Steps: []resource.TestStep{ @@ -294,6 +300,7 @@ func TestAccAWSAPIGatewayV2Route_Target(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2RouteDestroy, Steps: []resource.TestStep{ @@ -330,6 +337,7 @@ func TestAccAWSAPIGatewayV2Route_UpdateRouteKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2RouteDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_apigatewayv2_stage_test.go b/aws/resource_aws_apigatewayv2_stage_test.go index 5e725e00e6b9..a8fe7785224e 100644 --- a/aws/resource_aws_apigatewayv2_stage_test.go +++ b/aws/resource_aws_apigatewayv2_stage_test.go @@ -20,6 +20,7 @@ func TestAccAWSAPIGatewayV2Stage_basicWebSocket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -65,6 +66,7 @@ func TestAccAWSAPIGatewayV2Stage_basicHttp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -110,6 +112,7 @@ func TestAccAWSAPIGatewayV2Stage_defaultHttpStage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -155,6 +158,7 @@ func TestAccAWSAPIGatewayV2Stage_autoDeployHttp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -226,6 +230,7 @@ func TestAccAWSAPIGatewayV2Stage_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -250,6 +255,7 @@ func TestAccAWSAPIGatewayV2Stage_AccessLogSettings(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSAPIGatewayAccountCloudWatchRoleArn(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -321,6 +327,7 @@ func TestAccAWSAPIGatewayV2Stage_ClientCertificateIdAndDescription(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -390,6 +397,7 @@ func TestAccAWSAPIGatewayV2Stage_DefaultRouteSettingsWebSocket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSAPIGatewayAccountCloudWatchRoleArn(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -480,6 +488,7 @@ func TestAccAWSAPIGatewayV2Stage_DefaultRouteSettingsHttp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -571,6 +580,7 @@ func TestAccAWSAPIGatewayV2Stage_Deployment(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -616,6 +626,7 @@ func TestAccAWSAPIGatewayV2Stage_RouteSettingsWebSocket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSAPIGatewayAccountCloudWatchRoleArn(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -743,6 +754,7 @@ func TestAccAWSAPIGatewayV2Stage_RouteSettingsHttp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -847,6 +859,7 @@ func TestAccAWSAPIGatewayV2Stage_RouteSettingsHttp_WithRoute(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -930,6 +943,7 @@ func TestAccAWSAPIGatewayV2Stage_StageVariables(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ @@ -998,6 +1012,7 @@ func TestAccAWSAPIGatewayV2Stage_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2StageDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_apigatewayv2_vpc_link_test.go b/aws/resource_aws_apigatewayv2_vpc_link_test.go index 2aee38728d03..dc36f90dcc5b 100644 --- a/aws/resource_aws_apigatewayv2_vpc_link_test.go +++ b/aws/resource_aws_apigatewayv2_vpc_link_test.go @@ -85,6 +85,7 @@ func TestAccAWSAPIGatewayV2VpcLink_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2VpcLinkDestroy, Steps: []resource.TestStep{ @@ -126,6 +127,7 @@ func TestAccAWSAPIGatewayV2VpcLink_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2VpcLinkDestroy, Steps: []resource.TestStep{ @@ -148,6 +150,7 @@ func TestAccAWSAPIGatewayV2VpcLink_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, apigatewayv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAPIGatewayV2VpcLinkDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_app_cookie_stickiness_policy.go b/aws/resource_aws_app_cookie_stickiness_policy.go index 71be5ef28785..846e83040425 100644 --- a/aws/resource_aws_app_cookie_stickiness_policy.go +++ b/aws/resource_aws_app_cookie_stickiness_policy.go @@ -132,7 +132,7 @@ func resourceAwsAppCookieStickinessPolicyRead(d *schema.ResourceData, meta inter // cookie expiration, in these descriptions. policyDesc := getResp.PolicyDescriptions[0] cookieAttr := policyDesc.PolicyAttributeDescriptions[0] - if *cookieAttr.AttributeName != "CookieName" { + if aws.StringValue(cookieAttr.AttributeName) != "CookieName" { return fmt.Errorf("Unable to find cookie Name.") } @@ -168,12 +168,12 @@ func resourceAwsELBSticknessPolicyAssigned(policyName, lbName, lbPort string, el lb := describeResp.LoadBalancerDescriptions[0] assigned := false for _, listener := range lb.ListenerDescriptions { - if lbPort != strconv.Itoa(int(*listener.Listener.LoadBalancerPort)) { + if listener == nil || listener.Listener == nil || lbPort != strconv.Itoa(int(aws.Int64Value(listener.Listener.LoadBalancerPort))) { continue } for _, name := range listener.PolicyNames { - if policyName == *name { + if policyName == aws.StringValue(name) { assigned = true break } diff --git a/aws/resource_aws_app_cookie_stickiness_policy_test.go b/aws/resource_aws_app_cookie_stickiness_policy_test.go index 146d55858cae..38460d4b50fc 100644 --- a/aws/resource_aws_app_cookie_stickiness_policy_test.go +++ b/aws/resource_aws_app_cookie_stickiness_policy_test.go @@ -17,6 +17,7 @@ func TestAccAWSAppCookieStickinessPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppCookieStickinessPolicyDestroy, Steps: []resource.TestStep{ @@ -54,6 +55,7 @@ func TestAccAWSAppCookieStickinessPolicy_disappears_ELB(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppCookieStickinessPolicyDestroy, Steps: []resource.TestStep{ @@ -132,6 +134,7 @@ func TestAccAWSAppCookieStickinessPolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppCookieStickinessPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appautoscaling_policy.go b/aws/resource_aws_appautoscaling_policy.go index fdcb9d5e7006..4142fcd6e578 100644 --- a/aws/resource_aws_appautoscaling_policy.go +++ b/aws/resource_aws_appautoscaling_policy.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsAppautoscalingPolicy() *schema.Resource { @@ -209,7 +210,7 @@ func resourceAwsAppautoscalingPolicyCreate(d *schema.ResourceData, meta interfac log.Printf("[DEBUG] ApplicationAutoScaling PutScalingPolicy: %#v", params) var resp *applicationautoscaling.PutScalingPolicyOutput - err = resource.Retry(2*time.Minute, func() *resource.RetryError { + err = resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error resp, err = conn.PutScalingPolicy(¶ms) if err != nil { @@ -301,7 +302,7 @@ func resourceAwsAppautoscalingPolicyUpdate(d *schema.ResourceData, meta interfac } log.Printf("[DEBUG] Application Autoscaling Update Scaling Policy: %#v", params) - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := conn.PutScalingPolicy(¶ms) if err != nil { if isAWSErr(err, applicationautoscaling.ErrCodeFailedResourceAccessException, "") { @@ -341,7 +342,7 @@ func resourceAwsAppautoscalingPolicyDelete(d *schema.ResourceData, meta interfac ServiceNamespace: aws.String(d.Get("service_namespace").(string)), } log.Printf("[DEBUG] Deleting Application AutoScaling Policy opts: %#v", params) - err = resource.Retry(2*time.Minute, func() *resource.RetryError { + err = resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err = conn.DeleteScalingPolicy(¶ms) if isAWSErr(err, applicationautoscaling.ErrCodeFailedResourceAccessException, "") { @@ -705,22 +706,29 @@ func flattenTargetTrackingScalingPolicyConfiguration(cfg *applicationautoscaling } m := make(map[string]interface{}) - m["target_value"] = *cfg.TargetValue - if cfg.DisableScaleIn != nil { - m["disable_scale_in"] = *cfg.DisableScaleIn + if v := cfg.CustomizedMetricSpecification; v != nil { + m["customized_metric_specification"] = flattenCustomizedMetricSpecification(v) } - if cfg.ScaleInCooldown != nil { - m["scale_in_cooldown"] = *cfg.ScaleInCooldown + + if v := cfg.DisableScaleIn; v != nil { + m["disable_scale_in"] = aws.BoolValue(v) } - if cfg.ScaleOutCooldown != nil { - m["scale_out_cooldown"] = *cfg.ScaleOutCooldown + + if v := cfg.PredefinedMetricSpecification; v != nil { + m["predefined_metric_specification"] = flattenPredefinedMetricSpecification(v) } - if cfg.CustomizedMetricSpecification != nil { - m["customized_metric_specification"] = flattenCustomizedMetricSpecification(cfg.CustomizedMetricSpecification) + + if v := cfg.ScaleInCooldown; v != nil { + m["scale_in_cooldown"] = aws.Int64Value(v) } - if cfg.PredefinedMetricSpecification != nil { - m["predefined_metric_specification"] = flattenPredefinedMetricSpecification(cfg.PredefinedMetricSpecification) + + if v := cfg.ScaleOutCooldown; v != nil { + m["scale_out_cooldown"] = aws.Int64Value(v) + } + + if v := cfg.TargetValue; v != nil { + m["target_value"] = aws.Float64Value(v) } return []interface{}{m} @@ -731,29 +739,49 @@ func flattenCustomizedMetricSpecification(cfg *applicationautoscaling.Customized return []interface{}{} } - m := map[string]interface{}{ - "metric_name": *cfg.MetricName, - "namespace": *cfg.Namespace, - "statistic": *cfg.Statistic, - } + m := map[string]interface{}{} - if len(cfg.Dimensions) > 0 { + if v := cfg.Dimensions; len(v) > 0 { m["dimensions"] = flattenMetricDimensions(cfg.Dimensions) } - if cfg.Unit != nil { - m["unit"] = *cfg.Unit + if v := cfg.MetricName; v != nil { + m["metric_name"] = aws.StringValue(v) + } + + if v := cfg.Namespace; v != nil { + m["namespace"] = aws.StringValue(v) } + + if v := cfg.Statistic; v != nil { + m["statistic"] = aws.StringValue(v) + } + + if v := cfg.Unit; v != nil { + m["unit"] = aws.StringValue(v) + } + return []interface{}{m} } func flattenMetricDimensions(ds []*applicationautoscaling.MetricDimension) []interface{} { l := make([]interface{}, len(ds)) for i, d := range ds { - l[i] = map[string]interface{}{ - "name": *d.Name, - "value": *d.Value, + if ds == nil { + continue + } + + m := map[string]interface{}{} + + if v := d.Name; v != nil { + m["name"] = aws.StringValue(v) + } + + if v := d.Value; v != nil { + m["value"] = aws.StringValue(v) } + + l[i] = m } return l } @@ -762,11 +790,16 @@ func flattenPredefinedMetricSpecification(cfg *applicationautoscaling.Predefined if cfg == nil { return []interface{}{} } - m := map[string]interface{}{ - "predefined_metric_type": *cfg.PredefinedMetricType, + + m := map[string]interface{}{} + + if v := cfg.PredefinedMetricType; v != nil { + m["predefined_metric_type"] = aws.StringValue(v) } - if cfg.ResourceLabel != nil { - m["resource_label"] = *cfg.ResourceLabel + + if v := cfg.ResourceLabel; v != nil { + m["resource_label"] = aws.StringValue(v) } + return []interface{}{m} } diff --git a/aws/resource_aws_appautoscaling_policy_test.go b/aws/resource_aws_appautoscaling_policy_test.go index 98c76ee2f656..6d038ab12631 100644 --- a/aws/resource_aws_appautoscaling_policy_test.go +++ b/aws/resource_aws_appautoscaling_policy_test.go @@ -85,6 +85,7 @@ func TestAccAWSAppautoScalingPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -124,6 +125,7 @@ func TestAccAWSAppautoScalingPolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -147,6 +149,7 @@ func TestAccAWSAppautoScalingPolicy_scaleOutAndIn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -227,6 +230,7 @@ func TestAccAWSAppautoScalingPolicy_spotFleetRequest(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -258,6 +262,7 @@ func TestAccAWSAppautoScalingPolicy_dynamodb_table(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -289,6 +294,7 @@ func TestAccAWSAppautoScalingPolicy_dynamodb_index(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -322,6 +328,7 @@ func TestAccAWSAppautoScalingPolicy_multiplePoliciesSameName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -354,6 +361,7 @@ func TestAccAWSAppautoScalingPolicy_multiplePoliciesSameResource(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -398,6 +406,7 @@ func TestAccAWSAppautoScalingPolicy_ResourceId_ForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appautoscaling_scheduled_action_test.go b/aws/resource_aws_appautoscaling_scheduled_action_test.go index e0258c69fee1..dc3750652277 100644 --- a/aws/resource_aws_appautoscaling_scheduled_action_test.go +++ b/aws/resource_aws_appautoscaling_scheduled_action_test.go @@ -25,6 +25,7 @@ func TestAccAWSAppautoscalingScheduledAction_DynamoDB(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -78,6 +79,7 @@ func TestAccAWSAppautoscalingScheduledAction_ECS(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -110,6 +112,7 @@ func TestAccAWSAppautoscalingScheduledAction_EMR(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -141,6 +144,7 @@ func TestAccAWSAppautoscalingScheduledAction_Name_Duplicate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -165,6 +169,7 @@ func TestAccAWSAppautoscalingScheduledAction_SpotFleet(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -201,6 +206,7 @@ func TestAccAWSAppautoscalingScheduledAction_Schedule_AtExpression_Timezone(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -235,6 +241,7 @@ func TestAccAWSAppautoscalingScheduledAction_Schedule_CronExpression_basic(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -272,6 +279,7 @@ func TestAccAWSAppautoscalingScheduledAction_Schedule_CronExpression_Timezone(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -313,6 +321,7 @@ func TestAccAWSAppautoscalingScheduledAction_Schedule_CronExpression_StartEndTim resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -365,6 +374,7 @@ func TestAccAWSAppautoscalingScheduledAction_Schedule_RateExpression_basic(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -402,6 +412,7 @@ func TestAccAWSAppautoscalingScheduledAction_Schedule_RateExpression_Timezone(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -436,6 +447,7 @@ func TestAccAWSAppautoscalingScheduledAction_MinCapacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ @@ -490,6 +502,7 @@ func TestAccAWSAppautoscalingScheduledAction_MaxCapacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppautoscalingScheduledActionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appautoscaling_target.go b/aws/resource_aws_appautoscaling_target.go index 6cfbf04a9def..b82bbfca54ea 100644 --- a/aws/resource_aws_appautoscaling_target.go +++ b/aws/resource_aws_appautoscaling_target.go @@ -10,6 +10,7 @@ import ( "github.com/aws/aws-sdk-go/service/applicationautoscaling" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsAppautoscalingTarget() *schema.Resource { @@ -72,7 +73,7 @@ func resourceAwsAppautoscalingTargetPut(d *schema.ResourceData, meta interface{} log.Printf("[DEBUG] Application autoscaling target create configuration %s", targetOpts) var err error - err = resource.Retry(1*time.Minute, func() *resource.RetryError { + err = resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err = conn.RegisterScalableTarget(&targetOpts) if err != nil { @@ -191,7 +192,11 @@ func getAwsAppautoscalingTarget(resourceId, namespace, dimension string, } for idx, tgt := range describeTargets.ScalableTargets { - if *tgt.ResourceId == resourceId && *tgt.ScalableDimension == dimension { + if tgt == nil { + continue + } + + if aws.StringValue(tgt.ResourceId) == resourceId && aws.StringValue(tgt.ScalableDimension) == dimension { return describeTargets.ScalableTargets[idx], nil } } diff --git a/aws/resource_aws_appautoscaling_target_test.go b/aws/resource_aws_appautoscaling_target_test.go index b02e26048553..e1146bf059d0 100644 --- a/aws/resource_aws_appautoscaling_target_test.go +++ b/aws/resource_aws_appautoscaling_target_test.go @@ -20,6 +20,7 @@ func TestAccAWSAppautoScalingTarget_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), IDRefreshName: "aws_appautoscaling_target.bar", Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingTargetDestroy, @@ -60,6 +61,7 @@ func TestAccAWSAppautoScalingTarget_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingTargetDestroy, Steps: []resource.TestStep{ @@ -81,6 +83,7 @@ func TestAccAWSAppautoScalingTarget_spotFleetRequest(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), IDRefreshName: "aws_appautoscaling_target.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingTargetDestroy, @@ -109,6 +112,7 @@ func TestAccAWSAppautoScalingTarget_emrCluster(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingTargetDestroy, Steps: []resource.TestStep{ @@ -139,6 +143,7 @@ func TestAccAWSAppautoScalingTarget_multipleTargets(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingTargetDestroy, Steps: []resource.TestStep{ @@ -172,6 +177,7 @@ func TestAccAWSAppautoScalingTarget_optionalRoleArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, applicationautoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAppautoscalingTargetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appmesh_gateway_route_test.go b/aws/resource_aws_appmesh_gateway_route_test.go index 726370caa3c2..ec09973f1276 100644 --- a/aws/resource_aws_appmesh_gateway_route_test.go +++ b/aws/resource_aws_appmesh_gateway_route_test.go @@ -109,6 +109,7 @@ func testAccAwsAppmeshGatewayRoute_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshGatewayRouteDestroy, Steps: []resource.TestStep{ @@ -155,6 +156,7 @@ func testAccAwsAppmeshGatewayRoute_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshGatewayRouteDestroy, Steps: []resource.TestStep{ @@ -181,6 +183,7 @@ func testAccAwsAppmeshGatewayRoute_GrpcRoute(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshGatewayRouteDestroy, Steps: []resource.TestStep{ @@ -253,6 +256,7 @@ func testAccAwsAppmeshGatewayRoute_HttpRoute(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshGatewayRouteDestroy, Steps: []resource.TestStep{ @@ -325,6 +329,7 @@ func testAccAwsAppmeshGatewayRoute_Http2Route(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshGatewayRouteDestroy, Steps: []resource.TestStep{ @@ -395,6 +400,7 @@ func testAccAwsAppmeshGatewayRoute_Tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshGatewayRouteDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appmesh_mesh_test.go b/aws/resource_aws_appmesh_mesh_test.go index 565ac4d36306..5e48070cbcf4 100644 --- a/aws/resource_aws_appmesh_mesh_test.go +++ b/aws/resource_aws_appmesh_mesh_test.go @@ -73,6 +73,7 @@ func testAccAwsAppmeshMesh_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshMeshDestroy, Steps: []resource.TestStep{ @@ -104,6 +105,7 @@ func testAccAwsAppmeshMesh_egressFilter(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshMeshDestroy, Steps: []resource.TestStep{ @@ -143,6 +145,7 @@ func testAccAwsAppmeshMesh_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshMeshDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appmesh_route_test.go b/aws/resource_aws_appmesh_route_test.go index 19750749a3a0..aa49282bfb21 100644 --- a/aws/resource_aws_appmesh_route_test.go +++ b/aws/resource_aws_appmesh_route_test.go @@ -110,6 +110,7 @@ func testAccAwsAppmeshRoute_grpcRoute(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -281,6 +282,7 @@ func testAccAwsAppmeshRoute_grpcRouteTimeout(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -379,6 +381,7 @@ func testAccAwsAppmeshRoute_grpcRouteEmptyMatch(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -431,6 +434,7 @@ func testAccAwsAppmeshRoute_http2Route(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -547,6 +551,7 @@ func testAccAwsAppmeshRoute_http2RouteTimeout(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -649,6 +654,7 @@ func testAccAwsAppmeshRoute_httpRoute(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -759,6 +765,7 @@ func testAccAwsAppmeshRoute_httpRouteTimeout(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -853,6 +860,7 @@ func testAccAwsAppmeshRoute_tcpRoute(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -946,6 +954,7 @@ func testAccAwsAppmeshRoute_tcpRouteTimeout(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -1024,6 +1033,7 @@ func testAccAwsAppmeshRoute_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -1073,6 +1083,7 @@ func testAccAwsAppmeshRoute_httpHeader(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -1173,6 +1184,7 @@ func testAccAwsAppmeshRoute_routePriority(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ @@ -1255,6 +1267,7 @@ func testAccAwsAppmeshRoute_httpRetryPolicy(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshRouteDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appmesh_virtual_gateway_test.go b/aws/resource_aws_appmesh_virtual_gateway_test.go index 7d54900b1036..6fb95bf6e925 100644 --- a/aws/resource_aws_appmesh_virtual_gateway_test.go +++ b/aws/resource_aws_appmesh_virtual_gateway_test.go @@ -94,6 +94,7 @@ func testAccAwsAppmeshVirtualGateway_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualGatewayDestroy, Steps: []resource.TestStep{ @@ -138,6 +139,7 @@ func testAccAwsAppmeshVirtualGateway_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualGatewayDestroy, Steps: []resource.TestStep{ @@ -161,6 +163,7 @@ func testAccAwsAppmeshVirtualGateway_BackendDefaults(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualGatewayDestroy, Steps: []resource.TestStep{ @@ -249,6 +252,7 @@ func testAccAwsAppmeshVirtualGateway_ListenerConnectionPool(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualGatewayDestroy, Steps: []resource.TestStep{ @@ -325,6 +329,7 @@ func testAccAwsAppmeshVirtualGateway_ListenerHealthChecks(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualGatewayDestroy, Steps: []resource.TestStep{ @@ -409,6 +414,7 @@ func testAccAwsAppmeshVirtualGateway_ListenerTls(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualGatewayDestroy, Steps: []resource.TestStep{ @@ -508,6 +514,7 @@ func testAccAwsAppmeshVirtualGateway_Logging(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualGatewayDestroy, Steps: []resource.TestStep{ @@ -579,6 +586,7 @@ func testAccAwsAppmeshVirtualGateway_Tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualGatewayDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appmesh_virtual_node_test.go b/aws/resource_aws_appmesh_virtual_node_test.go index 0fc1783a87bc..3460e7ebcaed 100644 --- a/aws/resource_aws_appmesh_virtual_node_test.go +++ b/aws/resource_aws_appmesh_virtual_node_test.go @@ -93,6 +93,7 @@ func testAccAwsAppmeshVirtualNode_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -133,6 +134,7 @@ func testAccAwsAppmeshVirtualNode_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -158,6 +160,7 @@ func testAccAwsAppmeshVirtualNode_backendClientPolicyAcm(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -237,6 +240,7 @@ func testAccAwsAppmeshVirtualNode_backendClientPolicyFile(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -343,6 +347,7 @@ func testAccAwsAppmeshVirtualNode_backendDefaults(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -426,6 +431,7 @@ func testAccAwsAppmeshVirtualNode_cloudMapServiceDiscovery(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -477,6 +483,7 @@ func testAccAwsAppmeshVirtualNode_listenerConnectionPool(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -565,6 +572,7 @@ func testAccAwsAppmeshVirtualNode_listenerHealthChecks(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -672,6 +680,7 @@ func testAccAwsAppmeshVirtualNode_listenerOutlierDetection(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -765,6 +774,7 @@ func testAccAwsAppmeshVirtualNode_listenerTimeout(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -862,6 +872,7 @@ func testAccAwsAppmeshVirtualNode_listenerTls(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -982,6 +993,7 @@ func testAccAwsAppmeshVirtualNode_logging(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ @@ -1030,6 +1042,7 @@ func testAccAwsAppmeshVirtualNode_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualNodeDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appmesh_virtual_router_test.go b/aws/resource_aws_appmesh_virtual_router_test.go index 78c5208cfa64..bf48c0eb6e7b 100644 --- a/aws/resource_aws_appmesh_virtual_router_test.go +++ b/aws/resource_aws_appmesh_virtual_router_test.go @@ -89,6 +89,7 @@ func testAccAwsAppmeshVirtualRouter_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualRouterDestroy, Steps: []resource.TestStep{ @@ -142,6 +143,7 @@ func testAccAwsAppmeshVirtualRouter_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualRouterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appmesh_virtual_service_test.go b/aws/resource_aws_appmesh_virtual_service_test.go index e9828a5f1357..93b17aa8fb4c 100644 --- a/aws/resource_aws_appmesh_virtual_service_test.go +++ b/aws/resource_aws_appmesh_virtual_service_test.go @@ -88,6 +88,7 @@ func testAccAwsAppmeshVirtualService_virtualNode(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualServiceDestroy, Steps: []resource.TestStep{ @@ -141,6 +142,7 @@ func testAccAwsAppmeshVirtualService_virtualRouter(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualServiceDestroy, Steps: []resource.TestStep{ @@ -187,6 +189,7 @@ func testAccAwsAppmeshVirtualService_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appmesh.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appmesh.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAppmeshVirtualServiceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appsync_api_key_test.go b/aws/resource_aws_appsync_api_key_test.go index e571323db296..b2594f1e15e2 100644 --- a/aws/resource_aws_appsync_api_key_test.go +++ b/aws/resource_aws_appsync_api_key_test.go @@ -21,6 +21,7 @@ func TestAccAWSAppsyncApiKey_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncApiKeyDestroy, Steps: []resource.TestStep{ @@ -49,6 +50,7 @@ func TestAccAWSAppsyncApiKey_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncApiKeyDestroy, Steps: []resource.TestStep{ @@ -84,6 +86,7 @@ func TestAccAWSAppsyncApiKey_Expires(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncApiKeyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appsync_datasource_test.go b/aws/resource_aws_appsync_datasource_test.go index a10eb4f6663e..ac28cec1a207 100644 --- a/aws/resource_aws_appsync_datasource_test.go +++ b/aws/resource_aws_appsync_datasource_test.go @@ -18,6 +18,7 @@ func TestAccAwsAppsyncDatasource_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAwsAppsyncDatasource_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ @@ -82,6 +84,7 @@ func TestAccAwsAppsyncDatasource_DynamoDBConfig_Region(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ @@ -116,6 +119,7 @@ func TestAccAwsAppsyncDatasource_DynamoDBConfig_UseCallerCredentials(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ @@ -150,6 +154,7 @@ func TestAccAwsAppsyncDatasource_ElasticsearchConfig_Region(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ @@ -184,6 +189,7 @@ func TestAccAwsAppsyncDatasource_HTTPConfig_Endpoint(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ @@ -220,6 +226,7 @@ func TestAccAwsAppsyncDatasource_Type(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ @@ -249,6 +256,7 @@ func TestAccAwsAppsyncDatasource_Type_DynamoDB(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ @@ -279,6 +287,7 @@ func TestAccAwsAppsyncDatasource_Type_Elasticsearch(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ @@ -308,6 +317,7 @@ func TestAccAwsAppsyncDatasource_Type_HTTP(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ @@ -337,6 +347,7 @@ func TestAccAwsAppsyncDatasource_Type_Lambda(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ @@ -365,6 +376,7 @@ func TestAccAwsAppsyncDatasource_Type_None(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncDatasourceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appsync_function_test.go b/aws/resource_aws_appsync_function_test.go index 3a34bc2f27a2..6ef84803fab1 100644 --- a/aws/resource_aws_appsync_function_test.go +++ b/aws/resource_aws_appsync_function_test.go @@ -21,6 +21,7 @@ func TestAccAwsAppsyncFunction_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncFunctionDestroy, Steps: []resource.TestStep{ @@ -59,6 +60,7 @@ func TestAccAwsAppsyncFunction_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncFunctionDestroy, Steps: []resource.TestStep{ @@ -93,6 +95,7 @@ func TestAccAwsAppsyncFunction_responseMappingTemplate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncFunctionDestroy, Steps: []resource.TestStep{ @@ -119,6 +122,7 @@ func TestAccAwsAppsyncFunction_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncFunctionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appsync_graphql_api_test.go b/aws/resource_aws_appsync_graphql_api_test.go index d3fc44785f30..dfb5bb443120 100644 --- a/aws/resource_aws_appsync_graphql_api_test.go +++ b/aws/resource_aws_appsync_graphql_api_test.go @@ -71,6 +71,7 @@ func TestAccAWSAppsyncGraphqlApi_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -107,6 +108,7 @@ func TestAccAWSAppsyncGraphqlApi_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -129,6 +131,7 @@ func TestAccAWSAppsyncGraphqlApi_Schema(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -173,6 +176,7 @@ func TestAccAWSAppsyncGraphqlApi_AuthenticationType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -206,6 +210,7 @@ func TestAccAWSAppsyncGraphqlApi_AuthenticationType_APIKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -234,6 +239,7 @@ func TestAccAWSAppsyncGraphqlApi_AuthenticationType_AWSIAM(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -263,6 +269,7 @@ func TestAccAWSAppsyncGraphqlApi_AuthenticationType_AmazonCognitoUserPools(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -293,6 +300,7 @@ func TestAccAWSAppsyncGraphqlApi_AuthenticationType_OpenIDConnect(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -322,6 +330,7 @@ func TestAccAWSAppsyncGraphqlApi_LogConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -352,6 +361,7 @@ func TestAccAWSAppsyncGraphqlApi_LogConfig_FieldLogLevel(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -402,6 +412,7 @@ func TestAccAWSAppsyncGraphqlApi_LogConfig_ExcludeVerboseContent(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -442,6 +453,7 @@ func TestAccAWSAppsyncGraphqlApi_OpenIDConnectConfig_AuthTTL(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -481,6 +493,7 @@ func TestAccAWSAppsyncGraphqlApi_OpenIDConnectConfig_ClientID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -520,6 +533,7 @@ func TestAccAWSAppsyncGraphqlApi_OpenIDConnectConfig_IatTTL(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -559,6 +573,7 @@ func TestAccAWSAppsyncGraphqlApi_OpenIDConnectConfig_Issuer(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -597,6 +612,7 @@ func TestAccAWSAppsyncGraphqlApi_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -626,6 +642,7 @@ func TestAccAWSAppsyncGraphqlApi_UserPoolConfig_AwsRegion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -668,6 +685,7 @@ func TestAccAWSAppsyncGraphqlApi_UserPoolConfig_DefaultAction(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -709,6 +727,7 @@ func TestAccAWSAppsyncGraphqlApi_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -749,6 +768,7 @@ func TestAccAWSAppsyncGraphqlApi_AdditionalAuthentication_APIKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -781,6 +801,7 @@ func TestAccAWSAppsyncGraphqlApi_AdditionalAuthentication_AWSIAM(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -814,6 +835,7 @@ func TestAccAWSAppsyncGraphqlApi_AdditionalAuthentication_CognitoUserPools(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -847,6 +869,7 @@ func TestAccAWSAppsyncGraphqlApi_AdditionalAuthentication_OpenIDConnect(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -881,6 +904,7 @@ func TestAccAWSAppsyncGraphqlApi_AdditionalAuthentication_Multiple(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ @@ -921,6 +945,7 @@ func TestAccAWSAppsyncGraphqlApi_XrayEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncGraphqlApiDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_appsync_resolver.go b/aws/resource_aws_appsync_resolver.go index fd16d129dbf1..98e91b1a4a4e 100644 --- a/aws/resource_aws_appsync_resolver.go +++ b/aws/resource_aws_appsync_resolver.go @@ -316,7 +316,7 @@ func flattenAppsyncCachingConfig(c *appsync.CachingConfig) []interface{} { return nil } - if len(c.CachingKeys) == 0 && *(c.Ttl) == 0 { + if len(c.CachingKeys) == 0 && aws.Int64Value(c.Ttl) == 0 { return nil } diff --git a/aws/resource_aws_appsync_resolver_test.go b/aws/resource_aws_appsync_resolver_test.go index cff425f1a610..55b57c934a4c 100644 --- a/aws/resource_aws_appsync_resolver_test.go +++ b/aws/resource_aws_appsync_resolver_test.go @@ -19,6 +19,7 @@ func TestAccAwsAppsyncResolver_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncResolverDestroy, Steps: []resource.TestStep{ @@ -49,6 +50,7 @@ func TestAccAwsAppsyncResolver_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncResolverDestroy, Steps: []resource.TestStep{ @@ -72,6 +74,7 @@ func TestAccAwsAppsyncResolver_DataSource(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncResolverDestroy, Steps: []resource.TestStep{ @@ -105,6 +108,7 @@ func TestAccAwsAppsyncResolver_RequestTemplate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncResolverDestroy, Steps: []resource.TestStep{ @@ -138,6 +142,7 @@ func TestAccAwsAppsyncResolver_ResponseTemplate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncResolverDestroy, Steps: []resource.TestStep{ @@ -171,6 +176,7 @@ func TestAccAwsAppsyncResolver_multipleResolvers(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncResolverDestroy, Steps: []resource.TestStep{ @@ -200,6 +206,7 @@ func TestAccAwsAppsyncResolver_PipelineConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncResolverDestroy, Steps: []resource.TestStep{ @@ -227,6 +234,7 @@ func TestAccAwsAppsyncResolver_CachingConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(appsync.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, appsync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAppsyncResolverDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_athena_database.go b/aws/resource_aws_athena_database.go index c2f3f389e073..001fa4598561 100644 --- a/aws/resource_aws_athena_database.go +++ b/aws/resource_aws_athena_database.go @@ -177,7 +177,11 @@ func executeAndExpectMatchingRow(qeid string, dbName string, conn *athena.Athena } for _, row := range rs.Rows { for _, datum := range row.Data { - if *datum.VarCharValue == dbName { + if datum == nil { + continue + } + + if aws.StringValue(datum.VarCharValue) == dbName { return nil } } @@ -229,12 +233,18 @@ func queryExecutionStateRefreshFunc(qeid string, conn *athena.Athena) resource.S if err != nil { return nil, "failed", err } + + if out == nil || out.QueryExecution == nil || out.QueryExecution.Status == nil { + return nil, "", nil + } + status := out.QueryExecution.Status - if *status.State == athena.QueryExecutionStateFailed && - status.StateChangeReason != nil { - err = fmt.Errorf("reason: %s", *status.StateChangeReason) + + if aws.StringValue(status.State) == athena.QueryExecutionStateFailed && status.StateChangeReason != nil { + err = fmt.Errorf("reason: %s", aws.StringValue(status.StateChangeReason)) } - return out, *out.QueryExecution.Status.State, err + + return out, aws.StringValue(out.QueryExecution.Status.State), err } } @@ -242,7 +252,7 @@ func flattenAthenaResultSet(rs *athena.ResultSet) string { ss := make([]string, 0) for _, row := range rs.Rows { for _, datum := range row.Data { - ss = append(ss, *datum.VarCharValue) + ss = append(ss, aws.StringValue(datum.VarCharValue)) } } return strings.Join(ss, "\n") diff --git a/aws/resource_aws_athena_database_test.go b/aws/resource_aws_athena_database_test.go index fc945bbdfb16..13cde42b0bf5 100644 --- a/aws/resource_aws_athena_database_test.go +++ b/aws/resource_aws_athena_database_test.go @@ -18,6 +18,7 @@ func TestAccAWSAthenaDatabase_basic(t *testing.T) { dbName := acctest.RandString(8) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaDatabaseDestroy, Steps: []resource.TestStep{ @@ -36,6 +37,7 @@ func TestAccAWSAthenaDatabase_encryption(t *testing.T) { dbName := acctest.RandString(8) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaDatabaseDestroy, Steps: []resource.TestStep{ @@ -55,6 +57,7 @@ func TestAccAWSAthenaDatabase_nameStartsWithUnderscore(t *testing.T) { dbName := "_" + acctest.RandString(8) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaDatabaseDestroy, Steps: []resource.TestStep{ @@ -74,6 +77,7 @@ func TestAccAWSAthenaDatabase_nameCantHaveUppercase(t *testing.T) { dbName := "A" + acctest.RandString(8) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaDatabaseDestroy, Steps: []resource.TestStep{ @@ -90,6 +94,7 @@ func TestAccAWSAthenaDatabase_destroyFailsIfTablesExist(t *testing.T) { dbName := acctest.RandString(8) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaDatabaseDestroy, Steps: []resource.TestStep{ @@ -111,6 +116,7 @@ func TestAccAWSAthenaDatabase_forceDestroyAlwaysSucceeds(t *testing.T) { dbName := acctest.RandString(8) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaDatabaseDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_athena_named_query_test.go b/aws/resource_aws_athena_named_query_test.go index 44d86ca50bfb..208439bac1d2 100644 --- a/aws/resource_aws_athena_named_query_test.go +++ b/aws/resource_aws_athena_named_query_test.go @@ -16,6 +16,7 @@ func TestAccAWSAthenaNamedQuery_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaNamedQueryDestroy, Steps: []resource.TestStep{ @@ -39,6 +40,7 @@ func TestAccAWSAthenaNamedQuery_withWorkGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaNamedQueryDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_athena_workgroup_test.go b/aws/resource_aws_athena_workgroup_test.go index d6128fd5fd94..7a9f6c2c7aa8 100644 --- a/aws/resource_aws_athena_workgroup_test.go +++ b/aws/resource_aws_athena_workgroup_test.go @@ -18,6 +18,7 @@ func TestAccAWSAthenaWorkGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSAthenaWorkGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -74,6 +76,7 @@ func TestAccAWSAthenaWorkGroup_Configuration_BytesScannedCutoffPerQuery(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -110,6 +113,7 @@ func TestAccAWSAthenaWorkGroup_Configuration_EnforceWorkgroupConfiguration(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -146,6 +150,7 @@ func TestAccAWSAthenaWorkGroup_Configuration_PublishCloudWatchMetricsEnabled(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -182,6 +187,7 @@ func TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_EncryptionConfi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -214,6 +220,7 @@ func TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_EncryptionConfi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -256,6 +263,7 @@ func TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_OutputLocation( resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -296,6 +304,7 @@ func TestAccAWSAthenaWorkGroup_Configuration_ResultConfiguration_OutputLocation_ resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -336,6 +345,7 @@ func TestAccAWSAthenaWorkGroup_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -370,6 +380,7 @@ func TestAccAWSAthenaWorkGroup_State(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -414,6 +425,7 @@ func TestAccAWSAthenaWorkGroup_ForceDestroy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ @@ -442,6 +454,7 @@ func TestAccAWSAthenaWorkGroup_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, athena.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAthenaWorkGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_autoscaling_attachment.go b/aws/resource_aws_autoscaling_attachment.go index f15e1abde087..9648d86f5724 100644 --- a/aws/resource_aws_autoscaling_attachment.go +++ b/aws/resource_aws_autoscaling_attachment.go @@ -93,7 +93,7 @@ func resourceAwsAutoscalingAttachmentRead(d *schema.ResourceData, meta interface if v, ok := d.GetOk("elb"); ok { found := false for _, i := range asg.LoadBalancerNames { - if v.(string) == *i { + if v.(string) == aws.StringValue(i) { d.Set("elb", v.(string)) found = true break @@ -109,7 +109,7 @@ func resourceAwsAutoscalingAttachmentRead(d *schema.ResourceData, meta interface if v, ok := d.GetOk("alb_target_group_arn"); ok { found := false for _, i := range asg.TargetGroupARNs { - if v.(string) == *i { + if v.(string) == aws.StringValue(i) { d.Set("alb_target_group_arn", v.(string)) found = true break diff --git a/aws/resource_aws_autoscaling_attachment_test.go b/aws/resource_aws_autoscaling_attachment_test.go index a954d9576c67..7c5c63b21108 100644 --- a/aws/resource_aws_autoscaling_attachment_test.go +++ b/aws/resource_aws_autoscaling_attachment_test.go @@ -17,6 +17,7 @@ func TestAccAWSAutoscalingAttachment_elb(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutocalingAttachmentDestroy, Steps: []resource.TestStep{ @@ -60,6 +61,7 @@ func TestAccAWSAutoscalingAttachment_albTargetGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutocalingAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_autoscaling_group.go b/aws/resource_aws_autoscaling_group.go index fe0d98e4930b..2bc6b442d98d 100644 --- a/aws/resource_aws_autoscaling_group.go +++ b/aws/resource_aws_autoscaling_group.go @@ -26,6 +26,7 @@ import ( "github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/autoscaling/waiter" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) const ( @@ -735,7 +736,7 @@ func resourceAwsAutoscalingGroupCreate(d *schema.ResourceData, meta interface{}) log.Printf("[DEBUG] Auto Scaling Group create configuration: %#v", createOpts) // Retry for IAM eventual consistency - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := conn.CreateAutoScalingGroup(&createOpts) // ValidationError: You must use a valid fully-formed launch template. Value (tf-acc-test-6643732652421074386) for parameter iamInstanceProfile.name is invalid. Invalid IAM Instance Profile name @@ -1304,7 +1305,7 @@ func resourceAwsAutoscalingGroupDelete(d *schema.ResourceData, meta interface{}) log.Printf("[WARN] Auto Scaling Group (%s) not found, removing from state", d.Id()) return nil } - if len(g.Instances) > 0 || *g.DesiredCapacity > 0 { + if len(g.Instances) > 0 || aws.Int64Value(g.DesiredCapacity) > 0 { if err := resourceAwsAutoscalingGroupDrain(d, meta); err != nil { return err } @@ -1388,7 +1389,11 @@ func getAwsAutoscalingGroup(asgName string, conn *autoscaling.AutoScaling) (*aut // Search for the Auto Scaling Group for idx, asc := range describeGroups.AutoScalingGroups { - if *asc.AutoScalingGroupName == asgName { + if asc == nil { + continue + } + + if aws.StringValue(asc.AutoScalingGroupName) == asgName { return describeGroups.AutoScalingGroups[idx], nil } } @@ -1571,17 +1576,17 @@ func getELBInstanceStates(g *autoscaling.Group, meta interface{}) (map[string]ma elbconn := meta.(*AWSClient).elbconn for _, lbName := range g.LoadBalancerNames { - lbInstanceStates[*lbName] = make(map[string]string) + lbInstanceStates[aws.StringValue(lbName)] = make(map[string]string) opts := &elb.DescribeInstanceHealthInput{LoadBalancerName: lbName} r, err := elbconn.DescribeInstanceHealth(opts) if err != nil { return nil, err } for _, is := range r.InstanceStates { - if is.InstanceId == nil || is.State == nil { + if is == nil || is.InstanceId == nil || is.State == nil { continue } - lbInstanceStates[*lbName][*is.InstanceId] = *is.State + lbInstanceStates[aws.StringValue(lbName)][aws.StringValue(is.InstanceId)] = aws.StringValue(is.State) } } @@ -1600,17 +1605,17 @@ func getTargetGroupInstanceStates(g *autoscaling.Group, meta interface{}) (map[s elbv2conn := meta.(*AWSClient).elbv2conn for _, targetGroupARN := range g.TargetGroupARNs { - targetInstanceStates[*targetGroupARN] = make(map[string]string) + targetInstanceStates[aws.StringValue(targetGroupARN)] = make(map[string]string) opts := &elbv2.DescribeTargetHealthInput{TargetGroupArn: targetGroupARN} r, err := elbv2conn.DescribeTargetHealth(opts) if err != nil { return nil, err } for _, desc := range r.TargetHealthDescriptions { - if desc.Target == nil || desc.Target.Id == nil || desc.TargetHealth == nil || desc.TargetHealth.State == nil { + if desc == nil || desc.Target == nil || desc.Target.Id == nil || desc.TargetHealth == nil || desc.TargetHealth.State == nil { continue } - targetInstanceStates[*targetGroupARN][*desc.Target.Id] = *desc.TargetHealth.State + targetInstanceStates[aws.StringValue(targetGroupARN)][aws.StringValue(desc.Target.Id)] = aws.StringValue(desc.TargetHealth.State) } } diff --git a/aws/resource_aws_autoscaling_group_test.go b/aws/resource_aws_autoscaling_group_test.go index 121dcd95a2c3..a2bdcbf09c19 100644 --- a/aws/resource_aws_autoscaling_group_test.go +++ b/aws/resource_aws_autoscaling_group_test.go @@ -87,6 +87,7 @@ func TestAccAWSAutoScalingGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -176,6 +177,7 @@ func TestAccAWSAutoScalingGroup_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -211,6 +213,7 @@ func TestAccAWSAutoScalingGroup_autoGeneratedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -244,6 +247,7 @@ func TestAccAWSAutoScalingGroup_autoGeneratedName(t *testing.T) { func TestAccAWSAutoScalingGroup_terminationPolicies(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -318,6 +322,7 @@ func TestAccAWSAutoScalingGroup_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -381,6 +386,7 @@ func TestAccAWSAutoScalingGroup_VpcUpdates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -430,6 +436,7 @@ func TestAccAWSAutoScalingGroup_WithLoadBalancer(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -464,6 +471,7 @@ func TestAccAWSAutoScalingGroup_WithLoadBalancer_ToTargetGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -543,6 +551,7 @@ func TestAccAWSAutoScalingGroup_withPlacementGroup(t *testing.T) { randName := fmt.Sprintf("tf-test-%s", acctest.RandString(5)) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -577,6 +586,7 @@ func TestAccAWSAutoScalingGroup_enablingMetrics(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -620,6 +630,7 @@ func TestAccAWSAutoScalingGroup_suspendingProcesses(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -670,6 +681,7 @@ func TestAccAWSAutoScalingGroup_withMetrics(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -712,6 +724,7 @@ func TestAccAWSAutoScalingGroup_serviceLinkedRoleARN(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -746,6 +759,7 @@ func TestAccAWSAutoScalingGroup_MaxInstanceLifetime(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -812,6 +826,7 @@ func TestAccAWSAutoScalingGroup_ALB_TargetGroups(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -872,6 +887,7 @@ func TestAccAWSAutoScalingGroup_TargetGroupArns(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -921,6 +937,7 @@ func TestAccAWSAutoScalingGroup_initialLifecycleHook(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -963,6 +980,7 @@ func TestAccAWSAutoScalingGroup_ALB_TargetGroups_ELBCapacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -998,6 +1016,7 @@ func TestAccAWSAutoScalingGroup_InstanceRefresh_Basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1049,6 +1068,7 @@ func TestAccAWSAutoScalingGroup_InstanceRefresh_Start(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1089,6 +1109,7 @@ func TestAccAWSAutoScalingGroup_InstanceRefresh_Triggers(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1383,6 +1404,7 @@ func TestAccAWSAutoScalingGroup_classicVpcZoneIdentifier(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1416,6 +1438,7 @@ func TestAccAWSAutoScalingGroup_launchTemplate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1450,6 +1473,7 @@ func TestAccAWSAutoScalingGroup_launchTemplate_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1529,6 +1553,7 @@ func TestAccAWSAutoScalingGroup_LaunchTemplate_IAMInstanceProfile(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1564,6 +1589,7 @@ func TestAccAWSAutoScalingGroup_LoadBalancers(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1613,6 +1639,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1656,6 +1683,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_CapacityRebalance(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1700,6 +1728,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDem resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1737,6 +1766,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDem resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1793,6 +1823,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_Updat resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1853,6 +1884,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_OnDem resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1899,6 +1931,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotA resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1936,6 +1969,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotI resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -1982,6 +2016,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_InstancesDistribution_SpotM resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -2037,6 +2072,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTempla resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -2075,6 +2111,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_LaunchTempla resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -2123,6 +2160,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_Ins resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -2174,6 +2212,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_Ins resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -2215,6 +2254,7 @@ func TestAccAWSAutoScalingGroup_MixedInstancesPolicy_LaunchTemplate_Override_Wei resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ @@ -2256,6 +2296,7 @@ func TestAccAWSAutoScalingGroup_launchTempPartitionNum(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoScalingGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_autoscaling_lifecycle_hook.go b/aws/resource_aws_autoscaling_lifecycle_hook.go index 1e9ac0cf2a29..9249ef9b5b4d 100644 --- a/aws/resource_aws_autoscaling_lifecycle_hook.go +++ b/aws/resource_aws_autoscaling_lifecycle_hook.go @@ -195,7 +195,11 @@ func getAwsAutoscalingLifecycleHook(d *schema.ResourceData, meta interface{}) (* // find lifecycle hooks name := d.Get("name") for idx, sp := range resp.LifecycleHooks { - if *sp.LifecycleHookName == name { + if sp == nil { + continue + } + + if aws.StringValue(sp.LifecycleHookName) == name { return resp.LifecycleHooks[idx], nil } } diff --git a/aws/resource_aws_autoscaling_lifecycle_hook_test.go b/aws/resource_aws_autoscaling_lifecycle_hook_test.go index bbd99ceb5423..384167f7c220 100644 --- a/aws/resource_aws_autoscaling_lifecycle_hook_test.go +++ b/aws/resource_aws_autoscaling_lifecycle_hook_test.go @@ -16,6 +16,7 @@ func TestAccAWSAutoscalingLifecycleHook_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingLifecycleHookDestroy, Steps: []resource.TestStep{ @@ -44,6 +45,7 @@ func TestAccAWSAutoscalingLifecycleHook_omitDefaultResult(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingLifecycleHookDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_autoscaling_notification.go b/aws/resource_aws_autoscaling_notification.go index 2868fb2ce510..5e706df6ec24 100644 --- a/aws/resource_aws_autoscaling_notification.go +++ b/aws/resource_aws_autoscaling_notification.go @@ -83,9 +83,13 @@ func resourceAwsAutoscalingNotificationRead(d *schema.ResourceData, meta interfa } for _, n := range resp.NotificationConfigurations { - if *n.TopicARN == topic { - gRaw[*n.AutoScalingGroupName] = true - nRaw[*n.NotificationType] = true + if n == nil { + continue + } + + if aws.StringValue(n.TopicARN) == topic { + gRaw[aws.StringValue(n.AutoScalingGroupName)] = true + nRaw[aws.StringValue(n.NotificationType)] = true } } return true // return false to stop paging diff --git a/aws/resource_aws_autoscaling_notification_test.go b/aws/resource_aws_autoscaling_notification_test.go index d1a462a0d108..cc716434969f 100644 --- a/aws/resource_aws_autoscaling_notification_test.go +++ b/aws/resource_aws_autoscaling_notification_test.go @@ -19,6 +19,7 @@ func TestAccAWSASGNotification_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckASGNDestroy, Steps: []resource.TestStep{ @@ -40,6 +41,7 @@ func TestAccAWSASGNotification_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckASGNDestroy, Steps: []resource.TestStep{ @@ -69,6 +71,7 @@ func TestAccAWSASGNotification_Pagination(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckASGNDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_autoscaling_policy.go b/aws/resource_aws_autoscaling_policy.go index b1fbcc3b1b7d..3b55f7b5bb4d 100644 --- a/aws/resource_aws_autoscaling_policy.go +++ b/aws/resource_aws_autoscaling_policy.go @@ -404,7 +404,11 @@ func getAwsAutoscalingPolicy(d *schema.ResourceData, meta interface{}) (*autosca // find scaling policy name := d.Get("name") for idx, sp := range resp.ScalingPolicies { - if *sp.PolicyName == name { + if sp == nil { + continue + } + + if aws.StringValue(sp.PolicyName) == name { return resp.ScalingPolicies[idx], nil } } @@ -484,31 +488,31 @@ func flattenTargetTrackingConfiguration(config *autoscaling.TargetTrackingConfig } result := map[string]interface{}{} - result["disable_scale_in"] = *config.DisableScaleIn - result["target_value"] = *config.TargetValue + result["disable_scale_in"] = aws.BoolValue(config.DisableScaleIn) + result["target_value"] = aws.Float64Value(config.TargetValue) if config.PredefinedMetricSpecification != nil { spec := map[string]interface{}{} - spec["predefined_metric_type"] = *config.PredefinedMetricSpecification.PredefinedMetricType + spec["predefined_metric_type"] = aws.StringValue(config.PredefinedMetricSpecification.PredefinedMetricType) if config.PredefinedMetricSpecification.ResourceLabel != nil { - spec["resource_label"] = *config.PredefinedMetricSpecification.ResourceLabel + spec["resource_label"] = aws.StringValue(config.PredefinedMetricSpecification.ResourceLabel) } result["predefined_metric_specification"] = []map[string]interface{}{spec} } if config.CustomizedMetricSpecification != nil { spec := map[string]interface{}{} - spec["metric_name"] = *config.CustomizedMetricSpecification.MetricName - spec["namespace"] = *config.CustomizedMetricSpecification.Namespace - spec["statistic"] = *config.CustomizedMetricSpecification.Statistic + spec["metric_name"] = aws.StringValue(config.CustomizedMetricSpecification.MetricName) + spec["namespace"] = aws.StringValue(config.CustomizedMetricSpecification.Namespace) + spec["statistic"] = aws.StringValue(config.CustomizedMetricSpecification.Statistic) if config.CustomizedMetricSpecification.Unit != nil { - spec["unit"] = *config.CustomizedMetricSpecification.Unit + spec["unit"] = aws.StringValue(config.CustomizedMetricSpecification.Unit) } if config.CustomizedMetricSpecification.Dimensions != nil { dimSpec := make([]interface{}, len(config.CustomizedMetricSpecification.Dimensions)) for i := range dimSpec { dim := map[string]interface{}{} rawDim := config.CustomizedMetricSpecification.Dimensions[i] - dim["name"] = *rawDim.Name - dim["value"] = *rawDim.Value + dim["name"] = aws.StringValue(rawDim.Name) + dim["value"] = aws.StringValue(rawDim.Value) dimSpec[i] = dim } spec["metric_dimension"] = dimSpec diff --git a/aws/resource_aws_autoscaling_policy_test.go b/aws/resource_aws_autoscaling_policy_test.go index 306b26b3b1af..c8f795f66548 100644 --- a/aws/resource_aws_autoscaling_policy_test.go +++ b/aws/resource_aws_autoscaling_policy_test.go @@ -24,6 +24,7 @@ func TestAccAWSAutoscalingPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -111,6 +112,7 @@ func TestAccAWSAutoscalingPolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -172,6 +174,7 @@ func TestAccAWSAutoscalingPolicy_SimpleScalingStepAdjustment(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -200,6 +203,7 @@ func TestAccAWSAutoscalingPolicy_TargetTrack_Predefined(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -226,6 +230,7 @@ func TestAccAWSAutoscalingPolicy_TargetTrack_Custom(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingPolicyDestroy, Steps: []resource.TestStep{ @@ -254,6 +259,7 @@ func TestAccAWSAutoscalingPolicy_zerovalue(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_autoscaling_schedule.go b/aws/resource_aws_autoscaling_schedule.go index d57fb39a02dd..0131045e3b4f 100644 --- a/aws/resource_aws_autoscaling_schedule.go +++ b/aws/resource_aws_autoscaling_schedule.go @@ -236,7 +236,7 @@ func resourceAwsASGScheduledActionRetrieve(d *schema.ResourceData, meta interfac } if len(actions.ScheduledUpdateGroupActions) != 1 || - *actions.ScheduledUpdateGroupActions[0].ScheduledActionName != d.Id() { + aws.StringValue(actions.ScheduledUpdateGroupActions[0].ScheduledActionName) != d.Id() { return nil, false, nil } diff --git a/aws/resource_aws_autoscaling_schedule_test.go b/aws/resource_aws_autoscaling_schedule_test.go index 998491428b5c..7bf5d59c8906 100644 --- a/aws/resource_aws_autoscaling_schedule_test.go +++ b/aws/resource_aws_autoscaling_schedule_test.go @@ -25,6 +25,7 @@ func TestAccAWSAutoscalingSchedule_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingScheduleDestroy, Steps: []resource.TestStep{ @@ -59,6 +60,7 @@ func TestAccAWSAutoscalingSchedule_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingScheduleDestroy, Steps: []resource.TestStep{ @@ -97,6 +99,7 @@ func TestAccAWSAutoscalingSchedule_recurrence(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingScheduleDestroy, Steps: []resource.TestStep{ @@ -130,6 +133,7 @@ func TestAccAWSAutoscalingSchedule_zeroValues(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingScheduleDestroy, Steps: []resource.TestStep{ @@ -162,6 +166,7 @@ func TestAccAWSAutoscalingSchedule_negativeOne(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscaling.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAutoscalingScheduleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_autoscalingplans_scaling_plan_test.go b/aws/resource_aws_autoscalingplans_scaling_plan_test.go index 2c24fd1ffbd5..c03b02e7b3f1 100644 --- a/aws/resource_aws_autoscalingplans_scaling_plan_test.go +++ b/aws/resource_aws_autoscalingplans_scaling_plan_test.go @@ -78,6 +78,7 @@ func TestAccAwsAutoScalingPlansScalingPlan_basicDynamicScaling(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscalingplans.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAutoScalingPlansScalingPlanDestroy, Steps: []resource.TestStep{ @@ -129,6 +130,7 @@ func TestAccAwsAutoScalingPlansScalingPlan_basicPredictiveScaling(t *testing.T) testAccPreCheck(t) testAccPreCheckIamServiceLinkedRole(t, "/aws-service-role/autoscaling-plans") }, + ErrorCheck: testAccErrorCheck(t, autoscalingplans.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAutoScalingPlansScalingPlanDestroy, Steps: []resource.TestStep{ @@ -184,6 +186,7 @@ func TestAccAwsAutoScalingPlansScalingPlan_basicUpdate(t *testing.T) { testAccPreCheck(t) testAccPreCheckIamServiceLinkedRole(t, "/aws-service-role/autoscaling-plans") }, + ErrorCheck: testAccErrorCheck(t, autoscalingplans.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAutoScalingPlansScalingPlanDestroy, Steps: []resource.TestStep{ @@ -261,6 +264,7 @@ func TestAccAwsAutoScalingPlansScalingPlan_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, autoscalingplans.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAutoScalingPlansScalingPlanDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_backup_global_settings_test.go b/aws/resource_aws_backup_global_settings_test.go index bca27e840865..ad15741fe5e0 100644 --- a/aws/resource_aws_backup_global_settings_test.go +++ b/aws/resource_aws_backup_global_settings_test.go @@ -18,6 +18,7 @@ func TestAccAwsBackupGlobalSettings_basic(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_backup_plan_test.go b/aws/resource_aws_backup_plan_test.go index 5ccd41b4ab57..1ae97622b955 100644 --- a/aws/resource_aws_backup_plan_test.go +++ b/aws/resource_aws_backup_plan_test.go @@ -20,6 +20,7 @@ func TestAccAwsBackupPlan_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupPlanDestroy, Steps: []resource.TestStep{ @@ -56,6 +57,7 @@ func TestAccAwsBackupPlan_withTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupPlanDestroy, Steps: []resource.TestStep{ @@ -111,6 +113,7 @@ func TestAccAwsBackupPlan_withRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupPlanDestroy, Steps: []resource.TestStep{ @@ -193,6 +196,7 @@ func TestAccAwsBackupPlan_withLifecycle(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupPlanDestroy, Steps: []resource.TestStep{ @@ -264,6 +268,7 @@ func TestAccAwsBackupPlan_withRecoveryPointTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupPlanDestroy, Steps: []resource.TestStep{ @@ -336,6 +341,7 @@ func TestAccAwsBackupPlan_Rule_CopyAction_SameRegion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupPlanDestroy, Steps: []resource.TestStep{ @@ -398,6 +404,7 @@ func TestAccAwsBackupPlan_Rule_CopyAction_NoLifecycle(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupPlanDestroy, Steps: []resource.TestStep{ @@ -458,6 +465,7 @@ func TestAccAwsBackupPlan_Rule_CopyAction_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupPlanDestroy, Steps: []resource.TestStep{ @@ -497,6 +505,7 @@ func TestAccAwsBackupPlan_Rule_CopyAction_CrossRegion(t *testing.T) { testAccPreCheckAWSBackup(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsBackupPlanDestroy, Steps: []resource.TestStep{ @@ -532,6 +541,7 @@ func TestAccAwsBackupPlan_AdvancedBackupSetting(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupPlanDestroy, Steps: []resource.TestStep{ @@ -577,6 +587,7 @@ func TestAccAwsBackupPlan_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupPlanDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_backup_region_settings_test.go b/aws/resource_aws_backup_region_settings_test.go index c6a2cda56f1f..9ccee4284aed 100644 --- a/aws/resource_aws_backup_region_settings_test.go +++ b/aws/resource_aws_backup_region_settings_test.go @@ -21,6 +21,7 @@ func TestAccAwsBackupRegionSettings_basic(t *testing.T) { testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_backup_selection.go b/aws/resource_aws_backup_selection.go index 483ddf0d8bd6..3aa4358e6451 100644 --- a/aws/resource_aws_backup_selection.go +++ b/aws/resource_aws_backup_selection.go @@ -5,13 +5,13 @@ import ( "log" "regexp" "strings" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/backup" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsBackupSelection() *schema.Resource { @@ -98,7 +98,7 @@ func resourceAwsBackupSelectionCreate(d *schema.ResourceData, meta interface{}) // Retry for IAM eventual consistency var output *backup.CreateBackupSelectionOutput - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error output, err = conn.CreateBackupSelection(input) diff --git a/aws/resource_aws_backup_selection_test.go b/aws/resource_aws_backup_selection_test.go index 9d6c72f5a2c3..9fba2e814e93 100644 --- a/aws/resource_aws_backup_selection_test.go +++ b/aws/resource_aws_backup_selection_test.go @@ -18,6 +18,7 @@ func TestAccAwsBackupSelection_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupSelectionDestroy, Steps: []resource.TestStep{ @@ -44,6 +45,7 @@ func TestAccAwsBackupSelection_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupSelectionDestroy, Steps: []resource.TestStep{ @@ -67,6 +69,7 @@ func TestAccAwsBackupSelection_disappears_BackupPlan(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupSelectionDestroy, Steps: []resource.TestStep{ @@ -90,6 +93,7 @@ func TestAccAwsBackupSelection_withTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupSelectionDestroy, Steps: []resource.TestStep{ @@ -117,6 +121,7 @@ func TestAccAwsBackupSelection_withResources(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupSelectionDestroy, Steps: []resource.TestStep{ @@ -144,6 +149,7 @@ func TestAccAwsBackupSelection_updateTag(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupSelectionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_backup_vault_notifications_test.go b/aws/resource_aws_backup_vault_notifications_test.go index 78500e920ee4..45c983015f91 100644 --- a/aws/resource_aws_backup_vault_notifications_test.go +++ b/aws/resource_aws_backup_vault_notifications_test.go @@ -77,6 +77,7 @@ func TestAccAwsBackupVaultNotification_basic(t *testing.T) { resourceName := "aws_backup_vault_notifications.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupVaultNotificationDestroy, Steps: []resource.TestStep{ @@ -103,6 +104,7 @@ func TestAccAwsBackupVaultNotification_disappears(t *testing.T) { resourceName := "aws_backup_vault_notifications.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupVaultNotificationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_backup_vault_policy_test.go b/aws/resource_aws_backup_vault_policy_test.go index 9903b751b4ed..4185e4834d7d 100644 --- a/aws/resource_aws_backup_vault_policy_test.go +++ b/aws/resource_aws_backup_vault_policy_test.go @@ -78,6 +78,7 @@ func TestAccAwsBackupVaultPolicy_basic(t *testing.T) { resourceName := "aws_backup_vault_policy.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupVaultPolicyDestroy, Steps: []resource.TestStep{ @@ -111,6 +112,7 @@ func TestAccAwsBackupVaultPolicy_disappears(t *testing.T) { resourceName := "aws_backup_vault_policy.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupVaultPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_backup_vault_test.go b/aws/resource_aws_backup_vault_test.go index 011cf0b9f582..f1c41103dfb0 100644 --- a/aws/resource_aws_backup_vault_test.go +++ b/aws/resource_aws_backup_vault_test.go @@ -18,6 +18,7 @@ func TestAccAwsBackupVault_basic(t *testing.T) { resourceName := "aws_backup_vault.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupVaultDestroy, Steps: []resource.TestStep{ @@ -43,6 +44,7 @@ func TestAccAwsBackupVault_withKmsKey(t *testing.T) { resourceName := "aws_backup_vault.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupVaultDestroy, Steps: []resource.TestStep{ @@ -69,6 +71,7 @@ func TestAccAwsBackupVault_withTags(t *testing.T) { resourceName := "aws_backup_vault.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupVaultDestroy, Steps: []resource.TestStep{ @@ -117,6 +120,7 @@ func TestAccAwsBackupVault_disappears(t *testing.T) { resourceName := "aws_backup_vault.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBackup(t) }, + ErrorCheck: testAccErrorCheck(t, backup.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsBackupVaultDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_batch_compute_environment_test.go b/aws/resource_aws_batch_compute_environment_test.go index 7c2aeb156c76..e133af5641b0 100644 --- a/aws/resource_aws_batch_compute_environment_test.go +++ b/aws/resource_aws_batch_compute_environment_test.go @@ -157,6 +157,7 @@ func TestAccAWSBatchComputeEnvironment_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -178,6 +179,7 @@ func TestAccAWSBatchComputeEnvironment_createEc2(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -197,6 +199,7 @@ func TestAccAWSBatchComputeEnvironment_createWithNamePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -218,6 +221,7 @@ func TestAccAWSBatchComputeEnvironment_createEc2WithTags(t *testing.T) { resourceName := "aws_batch_compute_environment.ec2" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -243,6 +247,7 @@ func TestAccAWSBatchComputeEnvironment_createSpot(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -261,6 +266,7 @@ func TestAccAWSBatchComputeEnvironment_createUnmanaged(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -280,6 +286,7 @@ func TestAccAWSBatchComputeEnvironment_ComputeResources_DesiredVcpus_Computed(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -316,6 +323,7 @@ func TestAccAWSBatchComputeEnvironment_ComputeResources_MinVcpus(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -355,6 +363,7 @@ func TestAccAWSBatchComputeEnvironment_ComputeResources_MaxVcpus(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -394,6 +403,7 @@ func TestAccAWSBatchComputeEnvironment_updateInstanceType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -428,6 +438,7 @@ func TestAccAWSBatchComputeEnvironment_updateComputeEnvironmentName(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -459,6 +470,7 @@ func TestAccAWSBatchComputeEnvironment_createEc2WithoutComputeResources(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -475,6 +487,7 @@ func TestAccAWSBatchComputeEnvironment_createUnmanagedWithComputeResources(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -495,6 +508,7 @@ func TestAccAWSBatchComputeEnvironment_launchTemplate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -525,6 +539,7 @@ func TestAccAWSBatchComputeEnvironment_UpdateLaunchTemplate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -556,6 +571,7 @@ func TestAccAWSBatchComputeEnvironment_createSpotWithAllocationStrategy(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -575,6 +591,7 @@ func TestAccAWSBatchComputeEnvironment_createSpotWithoutBidPercentage(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -592,6 +609,7 @@ func TestAccAWSBatchComputeEnvironment_updateState(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ @@ -624,6 +642,7 @@ func TestAccAWSBatchComputeEnvironment_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchComputeEnvironmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_batch_job_definition.go b/aws/resource_aws_batch_job_definition.go index 43407c7c4555..32c1ca11273e 100644 --- a/aws/resource_aws_batch_job_definition.go +++ b/aws/resource_aws_batch_job_definition.go @@ -236,7 +236,7 @@ func getJobDefinition(conn *batch.Batch, arn string) (*batch.JobDefinition, erro case numJobDefinitions == 0: return nil, nil case numJobDefinitions == 1: - if *resp.JobDefinitions[0].Status == "ACTIVE" { + if aws.StringValue(resp.JobDefinitions[0].Status) == "ACTIVE" { return resp.JobDefinitions[0], nil } return nil, nil diff --git a/aws/resource_aws_batch_job_definition_test.go b/aws/resource_aws_batch_job_definition_test.go index 4ee8e200d9f6..9bbe5eb1a121 100644 --- a/aws/resource_aws_batch_job_definition_test.go +++ b/aws/resource_aws_batch_job_definition_test.go @@ -75,6 +75,7 @@ func TestAccAWSBatchJobDefinition_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchJobDefinitionDestroy, Steps: []resource.TestStep{ @@ -136,6 +137,7 @@ func TestAccAWSBatchJobDefinition_ContainerProperties_Advanced(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchJobDefinitionDestroy, Steps: []resource.TestStep{ @@ -162,6 +164,7 @@ func TestAccAWSBatchJobDefinition_updateForcesNewResource(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchJobDefinitionDestroy, Steps: []resource.TestStep{ @@ -195,6 +198,7 @@ func TestAccAWSBatchJobDefinition_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchJobDefinitionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_batch_job_queue.go b/aws/resource_aws_batch_job_queue.go index 1fc1e51f1e28..924c74404bc4 100644 --- a/aws/resource_aws_batch_job_queue.go +++ b/aws/resource_aws_batch_job_queue.go @@ -91,7 +91,7 @@ func resourceAwsBatchJobQueueCreate(d *schema.ResourceData, meta interface{}) er return fmt.Errorf("Error waiting for JobQueue state to be \"VALID\": %s", err) } - arn := *out.JobQueueArn + arn := aws.StringValue(out.JobQueueArn) log.Printf("[DEBUG] JobQueue created: %s", arn) d.SetId(arn) diff --git a/aws/resource_aws_batch_job_queue_test.go b/aws/resource_aws_batch_job_queue_test.go index e6b0eaec4e37..31d39a2783c4 100644 --- a/aws/resource_aws_batch_job_queue_test.go +++ b/aws/resource_aws_batch_job_queue_test.go @@ -61,6 +61,7 @@ func TestAccAWSBatchJobQueue_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchJobQueueDestroy, Steps: []resource.TestStep{ @@ -92,6 +93,7 @@ func TestAccAWSBatchJobQueue_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLaunchTemplateDestroy, Steps: []resource.TestStep{ @@ -115,6 +117,7 @@ func TestAccAWSBatchJobQueue_ComputeEnvironments_ExternalOrderUpdate(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchJobQueueDestroy, Steps: []resource.TestStep{ @@ -141,6 +144,7 @@ func TestAccAWSBatchJobQueue_Priority(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchJobQueueDestroy, Steps: []resource.TestStep{ @@ -174,6 +178,7 @@ func TestAccAWSBatchJobQueue_State(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchJobQueueDestroy, Steps: []resource.TestStep{ @@ -207,6 +212,7 @@ func TestAccAWSBatchJobQueue_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSBatch(t) }, + ErrorCheck: testAccErrorCheck(t, batch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBatchJobQueueDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_budgets_budget_test.go b/aws/resource_aws_budgets_budget_test.go index 98de8e4de9b5..312145b8d82c 100644 --- a/aws/resource_aws_budgets_budget_test.go +++ b/aws/resource_aws_budgets_budget_test.go @@ -86,6 +86,7 @@ func TestAccAWSBudgetsBudget_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(budgets.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, budgets.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccAWSBudgetsBudgetDestroy, Steps: []resource.TestStep{ @@ -140,6 +141,7 @@ func TestAccAWSBudgetsBudget_prefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(budgets.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, budgets.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccAWSBudgetsBudgetDestroy, Steps: []resource.TestStep{ @@ -203,6 +205,7 @@ func TestAccAWSBudgetsBudget_notification(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(budgets.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, budgets.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccAWSBudgetsBudgetDestroy, Steps: []resource.TestStep{ @@ -285,6 +288,7 @@ func TestAccAWSBudgetsBudget_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(budgets.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, budgets.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccAWSBudgetsBudgetDestroy, Steps: []resource.TestStep{ @@ -502,6 +506,7 @@ func testAccAWSBudgetsBudgetNotificationConfigDefaults() budgets.Notification { ComparisonOperator: aws.String(budgets.ComparisonOperatorGreaterThan), } } + func testAccAWSBudgetsBudgetNotificationConfigUpdate() budgets.Notification { return budgets.Notification{ NotificationType: aws.String(budgets.NotificationTypeForecasted), @@ -513,7 +518,7 @@ func testAccAWSBudgetsBudgetNotificationConfigUpdate() budgets.Notification { func testAccAWSBudgetsBudgetConfig_WithAccountID(budgetConfig budgets.Budget, accountID, costFilterKey string) string { timePeriodStart := budgetConfig.TimePeriod.Start.Format("2006-01-02_15:04") - costFilterValue := *budgetConfig.CostFilters[costFilterKey][0] + costFilterValue := aws.StringValue(budgetConfig.CostFilters[costFilterKey][0]) return fmt.Sprintf(` resource "aws_budgets_budget" "test" { @@ -529,12 +534,12 @@ resource "aws_budgets_budget" "test" { "%s" = "%s" } } -`, accountID, *budgetConfig.BudgetName, *budgetConfig.BudgetType, *budgetConfig.BudgetLimit.Amount, *budgetConfig.BudgetLimit.Unit, timePeriodStart, *budgetConfig.TimeUnit, costFilterKey, costFilterValue) +`, accountID, aws.StringValue(budgetConfig.BudgetName), aws.StringValue(budgetConfig.BudgetType), aws.StringValue(budgetConfig.BudgetLimit.Amount), aws.StringValue(budgetConfig.BudgetLimit.Unit), timePeriodStart, aws.StringValue(budgetConfig.TimeUnit), costFilterKey, costFilterValue) } func testAccAWSBudgetsBudgetConfig_PrefixDefaults(budgetConfig budgets.Budget, costFilterKey string) string { timePeriodStart := budgetConfig.TimePeriod.Start.Format("2006-01-02_15:04") - costFilterValue := *budgetConfig.CostFilters[costFilterKey][0] + costFilterValue := aws.StringValue(budgetConfig.CostFilters[costFilterKey][0]) return fmt.Sprintf(` resource "aws_budgets_budget" "test" { @@ -549,13 +554,13 @@ resource "aws_budgets_budget" "test" { "%s" = "%s" } } -`, *budgetConfig.BudgetName, *budgetConfig.BudgetType, *budgetConfig.BudgetLimit.Amount, *budgetConfig.BudgetLimit.Unit, timePeriodStart, *budgetConfig.TimeUnit, costFilterKey, costFilterValue) +`, aws.StringValue(budgetConfig.BudgetName), aws.StringValue(budgetConfig.BudgetType), aws.StringValue(budgetConfig.BudgetLimit.Amount), aws.StringValue(budgetConfig.BudgetLimit.Unit), timePeriodStart, aws.StringValue(budgetConfig.TimeUnit), costFilterKey, costFilterValue) } func testAccAWSBudgetsBudgetConfig_Prefix(budgetConfig budgets.Budget, costFilterKey string) string { timePeriodStart := budgetConfig.TimePeriod.Start.Format("2006-01-02_15:04") timePeriodEnd := budgetConfig.TimePeriod.End.Format("2006-01-02_15:04") - costFilterValue := *budgetConfig.CostFilters[costFilterKey][0] + costFilterValue := aws.StringValue(budgetConfig.CostFilters[costFilterKey][0]) return fmt.Sprintf(` resource "aws_budgets_budget" "test" { @@ -578,11 +583,12 @@ resource "aws_budgets_budget" "test" { "%s" = "%s" } } -`, *budgetConfig.BudgetName, *budgetConfig.BudgetType, *budgetConfig.BudgetLimit.Amount, *budgetConfig.BudgetLimit.Unit, *budgetConfig.CostTypes.IncludeTax, *budgetConfig.CostTypes.IncludeSubscription, *budgetConfig.CostTypes.UseBlended, timePeriodStart, timePeriodEnd, *budgetConfig.TimeUnit, costFilterKey, costFilterValue) +`, aws.StringValue(budgetConfig.BudgetName), aws.StringValue(budgetConfig.BudgetType), aws.StringValue(budgetConfig.BudgetLimit.Amount), aws.StringValue(budgetConfig.BudgetLimit.Unit), aws.BoolValue(budgetConfig.CostTypes.IncludeTax), aws.BoolValue(budgetConfig.CostTypes.IncludeSubscription), aws.BoolValue(budgetConfig.CostTypes.UseBlended), timePeriodStart, timePeriodEnd, aws.StringValue(budgetConfig.TimeUnit), costFilterKey, costFilterValue) } + func testAccAWSBudgetsBudgetConfig_BasicDefaults(budgetConfig budgets.Budget, costFilterKey string) string { timePeriodStart := budgetConfig.TimePeriod.Start.Format("2006-01-02_15:04") - costFilterValue := *budgetConfig.CostFilters[costFilterKey][0] + costFilterValue := aws.StringValue(budgetConfig.CostFilters[costFilterKey][0]) return fmt.Sprintf(` resource "aws_budgets_budget" "test" { @@ -597,13 +603,13 @@ resource "aws_budgets_budget" "test" { "%s" = "%s" } } -`, *budgetConfig.BudgetName, *budgetConfig.BudgetType, *budgetConfig.BudgetLimit.Amount, *budgetConfig.BudgetLimit.Unit, timePeriodStart, *budgetConfig.TimeUnit, costFilterKey, costFilterValue) +`, aws.StringValue(budgetConfig.BudgetName), aws.StringValue(budgetConfig.BudgetType), aws.StringValue(budgetConfig.BudgetLimit.Amount), aws.StringValue(budgetConfig.BudgetLimit.Unit), timePeriodStart, aws.StringValue(budgetConfig.TimeUnit), costFilterKey, costFilterValue) } func testAccAWSBudgetsBudgetConfig_Basic(budgetConfig budgets.Budget, costFilterKey string) string { timePeriodStart := budgetConfig.TimePeriod.Start.Format("2006-01-02_15:04") timePeriodEnd := budgetConfig.TimePeriod.End.Format("2006-01-02_15:04") - costFilterValue := *budgetConfig.CostFilters[costFilterKey][0] + costFilterValue := aws.StringValue(budgetConfig.CostFilters[costFilterKey][0]) return fmt.Sprintf(` resource "aws_budgets_budget" "test" { @@ -626,7 +632,7 @@ resource "aws_budgets_budget" "test" { "%s" = "%s" } } -`, *budgetConfig.BudgetName, *budgetConfig.BudgetType, *budgetConfig.BudgetLimit.Amount, *budgetConfig.BudgetLimit.Unit, *budgetConfig.CostTypes.IncludeTax, *budgetConfig.CostTypes.IncludeSubscription, *budgetConfig.CostTypes.UseBlended, timePeriodStart, timePeriodEnd, *budgetConfig.TimeUnit, costFilterKey, costFilterValue) +`, aws.StringValue(budgetConfig.BudgetName), aws.StringValue(budgetConfig.BudgetType), aws.StringValue(budgetConfig.BudgetLimit.Amount), aws.StringValue(budgetConfig.BudgetLimit.Unit), aws.BoolValue(budgetConfig.CostTypes.IncludeTax), aws.BoolValue(budgetConfig.CostTypes.IncludeSubscription), aws.BoolValue(budgetConfig.CostTypes.UseBlended), timePeriodStart, timePeriodEnd, aws.StringValue(budgetConfig.TimeUnit), costFilterKey, costFilterValue) } func testAccAWSBudgetsBudgetConfigWithNotification_Basic(budgetConfig budgets.Budget, notifications []budgets.Notification, emails []string, topics []string) string { @@ -659,7 +665,7 @@ resource "aws_budgets_budget" "test" { time_unit = "%s" %s } -`, *budgetConfig.BudgetName, *budgetConfig.BudgetType, *budgetConfig.BudgetLimit.Amount, *budgetConfig.BudgetLimit.Unit, *budgetConfig.CostTypes.IncludeTax, *budgetConfig.CostTypes.IncludeSubscription, *budgetConfig.CostTypes.UseBlended, timePeriodStart, timePeriodEnd, *budgetConfig.TimeUnit, strings.Join(notificationStrings, "\n")) +`, aws.StringValue(budgetConfig.BudgetName), aws.StringValue(budgetConfig.BudgetType), aws.StringValue(budgetConfig.BudgetLimit.Amount), aws.StringValue(budgetConfig.BudgetLimit.Unit), aws.BoolValue(budgetConfig.CostTypes.IncludeTax), aws.BoolValue(budgetConfig.CostTypes.IncludeSubscription), aws.BoolValue(budgetConfig.CostTypes.UseBlended), timePeriodStart, timePeriodEnd, aws.StringValue(budgetConfig.TimeUnit), strings.Join(notificationStrings, "\n")) } @@ -683,5 +689,5 @@ notification { subscriber_sns_topic_arns = [%s] comparison_operator = "%s" } -`, *notification.Threshold, *notification.ThresholdType, *notification.NotificationType, strings.Join(quotedEMails, ","), strings.Join(quotedTopics, ","), *notification.ComparisonOperator) +`, aws.Float64Value(notification.Threshold), aws.StringValue(notification.ThresholdType), aws.StringValue(notification.NotificationType), strings.Join(quotedEMails, ","), strings.Join(quotedTopics, ","), aws.StringValue(notification.ComparisonOperator)) } diff --git a/aws/resource_aws_cloud9_environment_ec2.go b/aws/resource_aws_cloud9_environment_ec2.go index 24ddbdf312af..f6c0be29615c 100644 --- a/aws/resource_aws_cloud9_environment_ec2.go +++ b/aws/resource_aws_cloud9_environment_ec2.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsCloud9EnvironmentEc2() *schema.Resource { @@ -91,7 +92,7 @@ func resourceAwsCloud9EnvironmentEc2Create(d *schema.ResourceData, meta interfac } var out *cloud9.CreateEnvironmentEC2Output - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error out, err = conn.CreateEnvironmentEC2(params) if err != nil { @@ -129,13 +130,13 @@ func resourceAwsCloud9EnvironmentEc2Create(d *schema.ResourceData, meta interfac return 42, "", err } - status := *out.Status - var sErr error + status := aws.StringValue(out.Status) + if status == cloud9.EnvironmentStatusError && out.Message != nil { - sErr = fmt.Errorf("Reason: %s", *out.Message) + return out, status, fmt.Errorf("Reason: %s", aws.StringValue(out.Message)) } - return out, status, sErr + return out, status, nil }, } _, err = stateConf.WaitForState() diff --git a/aws/resource_aws_cloud9_environment_ec2_test.go b/aws/resource_aws_cloud9_environment_ec2_test.go index 2d60717ebec4..de8e3d6c532a 100644 --- a/aws/resource_aws_cloud9_environment_ec2_test.go +++ b/aws/resource_aws_cloud9_environment_ec2_test.go @@ -22,6 +22,7 @@ func TestAccAWSCloud9EnvironmentEc2_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloud9.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloud9.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloud9EnvironmentEc2Destroy, Steps: []resource.TestStep{ @@ -69,6 +70,7 @@ func TestAccAWSCloud9EnvironmentEc2_allFields(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloud9.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloud9.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloud9EnvironmentEc2Destroy, Steps: []resource.TestStep{ @@ -112,6 +114,7 @@ func TestAccAWSCloud9EnvironmentEc2_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloud9.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloud9.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloud9EnvironmentEc2Destroy, Steps: []resource.TestStep{ @@ -158,6 +161,7 @@ func TestAccAWSCloud9EnvironmentEc2_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloud9.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloud9.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloud9EnvironmentEc2Destroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudformation_stack_set_instance_test.go b/aws/resource_aws_cloudformation_stack_set_instance_test.go index 928dc49d710c..3bbb9f6bafcb 100644 --- a/aws/resource_aws_cloudformation_stack_set_instance_test.go +++ b/aws/resource_aws_cloudformation_stack_set_instance_test.go @@ -105,6 +105,7 @@ func TestAccAWSCloudFormationStackSetInstance_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetInstanceDestroy, Steps: []resource.TestStep{ @@ -139,6 +140,7 @@ func TestAccAWSCloudFormationStackSetInstance_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetInstanceDestroy, Steps: []resource.TestStep{ @@ -163,6 +165,7 @@ func TestAccAWSCloudFormationStackSetInstance_disappears_StackSet(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetInstanceDestroy, Steps: []resource.TestStep{ @@ -187,6 +190,7 @@ func TestAccAWSCloudFormationStackSetInstance_ParameterOverrides(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetInstanceDestroy, Steps: []resource.TestStep{ @@ -250,6 +254,7 @@ func TestAccAWSCloudFormationStackSetInstance_RetainStack(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetInstanceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudformation_stack_set_test.go b/aws/resource_aws_cloudformation_stack_set_test.go index 3264ce8b4187..bcdfc59ffd0d 100644 --- a/aws/resource_aws_cloudformation_stack_set_test.go +++ b/aws/resource_aws_cloudformation_stack_set_test.go @@ -77,6 +77,7 @@ func TestAccAWSCloudFormationStackSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ @@ -116,6 +117,7 @@ func TestAccAWSCloudFormationStackSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ @@ -140,6 +142,7 @@ func TestAccAWSCloudFormationStackSet_AdministrationRoleArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ @@ -177,6 +180,7 @@ func TestAccAWSCloudFormationStackSet_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ @@ -214,6 +218,7 @@ func TestAccAWSCloudFormationStackSet_ExecutionRoleName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ @@ -252,6 +257,7 @@ func TestAccAWSCloudFormationStackSet_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ @@ -305,6 +311,7 @@ func TestAccAWSCloudFormationStackSet_Parameters(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ @@ -364,6 +371,7 @@ func TestAccAWSCloudFormationStackSet_Parameters_Default(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ @@ -415,6 +423,7 @@ func TestAccAWSCloudFormationStackSet_Parameters_NoEcho(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ @@ -454,6 +463,7 @@ func TestAccAWSCloudFormationStackSet_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ @@ -509,6 +519,7 @@ func TestAccAWSCloudFormationStackSet_TemplateBody(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ @@ -546,6 +557,7 @@ func TestAccAWSCloudFormationStackSet_TemplateUrl(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCloudFormationStackSet(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationStackSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudformation_stack_test.go b/aws/resource_aws_cloudformation_stack_test.go index d94ae9406052..e967b8ca8d2f 100644 --- a/aws/resource_aws_cloudformation_stack_test.go +++ b/aws/resource_aws_cloudformation_stack_test.go @@ -82,6 +82,7 @@ func TestAccAWSCloudFormationStack_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -107,6 +108,7 @@ func TestAccAWSCloudFormationStack_CreationFailure_DoNothing(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -123,6 +125,7 @@ func TestAccAWSCloudFormationStack_CreationFailure_Delete(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -139,6 +142,7 @@ func TestAccAWSCloudFormationStack_CreationFailure_Rollback(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -160,6 +164,7 @@ func TestAccAWSCloudFormationStack_UpdateFailure(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -184,6 +189,7 @@ func TestAccAWSCloudFormationStack_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -206,6 +212,7 @@ func TestAccAWSCloudFormationStack_yaml(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -231,6 +238,7 @@ func TestAccAWSCloudFormationStack_defaultParams(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -258,6 +266,7 @@ func TestAccAWSCloudFormationStack_allAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -318,6 +327,7 @@ func TestAccAWSCloudFormationStack_withParams(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -355,6 +365,7 @@ func TestAccAWSCloudFormationStack_withUrl_withParams(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -387,6 +398,7 @@ func TestAccAWSCloudFormationStack_withUrl_withParams_withYaml(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -414,6 +426,7 @@ func TestAccAWSCloudFormationStack_withUrl_withParams_noUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -445,6 +458,7 @@ func TestAccAWSCloudFormationStack_withTransform(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudfront_cache_policy_test.go b/aws/resource_aws_cloudfront_cache_policy_test.go index 6c3649ca202e..5b1a6d9c03ac 100644 --- a/aws/resource_aws_cloudfront_cache_policy_test.go +++ b/aws/resource_aws_cloudfront_cache_policy_test.go @@ -15,6 +15,7 @@ func TestAccAWSCloudFrontCachePolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ @@ -49,6 +50,7 @@ func TestAccAWSCloudFrontCachePolicy_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ @@ -98,6 +100,7 @@ func TestAccAWSCloudFrontCachePolicy_noneBehavior(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudfront_distribution.go b/aws/resource_aws_cloudfront_distribution.go index 961a9ed6f23e..00c1d947908a 100644 --- a/aws/resource_aws_cloudfront_distribution.go +++ b/aws/resource_aws_cloudfront_distribution.go @@ -80,7 +80,6 @@ func resourceAwsCloudFrontDistribution() *schema.Resource { Type: schema.TypeList, Optional: true, MaxItems: 1, - Computed: true, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "cookies": { @@ -257,7 +256,6 @@ func resourceAwsCloudFrontDistribution() *schema.Resource { "forwarded_values": { Type: schema.TypeList, Optional: true, - Computed: true, MaxItems: 1, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ diff --git a/aws/resource_aws_cloudfront_distribution_test.go b/aws/resource_aws_cloudfront_distribution_test.go index b0d1cf3c1baa..4a89668ea73e 100644 --- a/aws/resource_aws_cloudfront_distribution_test.go +++ b/aws/resource_aws_cloudfront_distribution_test.go @@ -50,9 +50,9 @@ func testSweepCloudFrontDistributions(region string) error { } for _, distributionSummary := range distributionSummaries { - distributionID := *distributionSummary.Id + distributionID := aws.StringValue(distributionSummary.Id) - if *distributionSummary.Enabled { + if aws.BoolValue(distributionSummary.Enabled) { log.Printf("[WARN] Skipping deletion of enabled CloudFront Distribution: %s", distributionID) continue } @@ -82,6 +82,7 @@ func TestAccAWSCloudFrontDistribution_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -105,9 +106,10 @@ func TestAccAWSCloudFrontDistribution_disappears(t *testing.T) { func TestAccAWSCloudFrontDistribution_S3Origin(t *testing.T) { var distribution cloudfront.Distribution ri := acctest.RandInt() - testConfig := fmt.Sprintf(testAccAWSCloudFrontDistributionS3Config, ri, originBucket, logBucket, testAccAWSCloudFrontDistributionRetainConfig()) + testConfig := testAccAWSCloudFrontDistributionS3Config(ri) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -138,11 +140,12 @@ func TestAccAWSCloudFrontDistribution_S3Origin(t *testing.T) { func TestAccAWSCloudFrontDistribution_S3OriginWithTags(t *testing.T) { var distribution cloudfront.Distribution ri := acctest.RandInt() - preConfig := fmt.Sprintf(testAccAWSCloudFrontDistributionS3ConfigWithTags, ri, originBucket, logBucket, testAccAWSCloudFrontDistributionRetainConfig()) - postConfig := fmt.Sprintf(testAccAWSCloudFrontDistributionS3ConfigWithTagsUpdated, ri, originBucket, logBucket, testAccAWSCloudFrontDistributionRetainConfig()) + preConfig := testAccAWSCloudFrontDistributionS3ConfigWithTags(ri) + postConfig := testAccAWSCloudFrontDistributionS3ConfigWithTagsUpdated(ri) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -188,13 +191,16 @@ func TestAccAWSCloudFrontDistribution_S3OriginWithTags(t *testing.T) { // TF_TEST_CLOUDFRONT_RETAIN environment variable. func TestAccAWSCloudFrontDistribution_customOrigin(t *testing.T) { var distribution cloudfront.Distribution + rInt := acctest.RandInt() + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionCustomConfig, + Config: testAccAWSCloudFrontDistributionCustomConfig(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckCloudFrontDistributionExists("aws_cloudfront_distribution.custom_distribution", &distribution), ), @@ -213,13 +219,16 @@ func TestAccAWSCloudFrontDistribution_customOrigin(t *testing.T) { } func TestAccAWSCloudFrontDistribution_originPolicyDefault(t *testing.T) { + rInt := acctest.RandInt() + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionOriginRequestPolicyConfigDefault, + Config: testAccAWSCloudFrontDistributionOriginRequestPolicyConfigDefault(rInt), Check: resource.ComposeTestCheckFunc( resource.TestMatchResourceAttr("aws_cloudfront_distribution.custom_distribution", "default_cache_behavior.0.origin_request_policy_id", regexp.MustCompile("[A-z0-9]+")), ), @@ -238,13 +247,16 @@ func TestAccAWSCloudFrontDistribution_originPolicyDefault(t *testing.T) { } func TestAccAWSCloudFrontDistribution_originPolicyOrdered(t *testing.T) { + rInt := acctest.RandInt() + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionOriginRequestPolicyConfigOrdered, + Config: testAccAWSCloudFrontDistributionOriginRequestPolicyConfigOrdered(rInt), Check: resource.ComposeTestCheckFunc( resource.TestMatchResourceAttr("aws_cloudfront_distribution.custom_distribution", "ordered_cache_behavior.0.origin_request_policy_id", regexp.MustCompile("[A-z0-9]+")), ), @@ -270,13 +282,16 @@ func TestAccAWSCloudFrontDistribution_originPolicyOrdered(t *testing.T) { func TestAccAWSCloudFrontDistribution_multiOrigin(t *testing.T) { var distribution cloudfront.Distribution resourceName := "aws_cloudfront_distribution.multi_origin_distribution" + rInt := acctest.RandInt() + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionMultiOriginConfig, + Config: testAccAWSCloudFrontDistributionMultiOriginConfig(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckCloudFrontDistributionExists(resourceName, &distribution), resource.TestCheckResourceAttr(resourceName, "ordered_cache_behavior.#", "2"), @@ -306,13 +321,16 @@ func TestAccAWSCloudFrontDistribution_multiOrigin(t *testing.T) { func TestAccAWSCloudFrontDistribution_orderedCacheBehavior(t *testing.T) { var distribution cloudfront.Distribution resourceName := "aws_cloudfront_distribution.main" + rInt := acctest.RandInt() + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionOrderedCacheBehavior, + Config: testAccAWSCloudFrontDistributionOrderedCacheBehavior(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckCloudFrontDistributionExists(resourceName, &distribution), resource.TestCheckResourceAttr(resourceName, "ordered_cache_behavior.#", "2"), @@ -338,13 +356,16 @@ func TestAccAWSCloudFrontDistribution_orderedCacheBehavior(t *testing.T) { func TestAccAWSCloudFrontDistribution_orderedCacheBehaviorCachePolicy(t *testing.T) { var distribution cloudfront.Distribution resourceName := "aws_cloudfront_distribution.main" + rInt := acctest.RandInt() + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionOrderedCacheBehaviorCachePolicy, + Config: testAccAWSCloudFrontDistributionOrderedCacheBehaviorCachePolicy(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckCloudFrontDistributionExists(resourceName, &distribution), resource.TestCheckResourceAttr(resourceName, "ordered_cache_behavior.0.path_pattern", "images2/*.jpg"), @@ -364,14 +385,41 @@ func TestAccAWSCloudFrontDistribution_orderedCacheBehaviorCachePolicy(t *testing }) } +func TestAccAWSCloudFrontDistribution_forwardedValuesToCachePolicy(t *testing.T) { + var distribution cloudfront.Distribution + rInt := acctest.RandInt() + resourceName := "aws_cloudfront_distribution.main" + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckCloudFrontDistributionDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSCloudFrontDistributionOrderedCacheBehavior(rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckCloudFrontDistributionExists(resourceName, &distribution), + ), + }, + { + Config: testAccAWSCloudFrontDistributionOrderedCacheBehaviorCachePolicy(rInt), + Check: resource.ComposeTestCheckFunc( + testAccCheckCloudFrontDistributionExists(resourceName, &distribution), + ), + }, + }, + }) +} + func TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionConfig_Origin_EmptyDomainName, + Config: testAccAWSCloudFrontDistributionConfig_Origin_EmptyDomainName(), ExpectError: regexp.MustCompile(`domain_name must not be empty`), }, }, @@ -381,11 +429,12 @@ func TestAccAWSCloudFrontDistribution_Origin_EmptyDomainName(t *testing.T) { func TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionConfig_Origin_EmptyOriginID, + Config: testAccAWSCloudFrontDistributionConfig_Origin_EmptyOriginID(), ExpectError: regexp.MustCompile(`origin_id must not be empty`), }, }, @@ -400,13 +449,16 @@ func TestAccAWSCloudFrontDistribution_Origin_EmptyOriginID(t *testing.T) { func TestAccAWSCloudFrontDistribution_noOptionalItemsConfig(t *testing.T) { var distribution cloudfront.Distribution resourceName := "aws_cloudfront_distribution.no_optional_items" + rInt := acctest.RandInt() + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionNoOptionalItemsConfig, + Config: testAccAWSCloudFrontDistributionNoOptionalItemsConfig(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckCloudFrontDistributionExists(resourceName, &distribution), resource.TestCheckResourceAttr(resourceName, "aliases.#", "0"), @@ -480,13 +532,16 @@ func TestAccAWSCloudFrontDistribution_noOptionalItemsConfig(t *testing.T) { // TF_TEST_CLOUDFRONT_RETAIN environment variable. func TestAccAWSCloudFrontDistribution_HTTP11Config(t *testing.T) { var distribution cloudfront.Distribution + rInt := acctest.RandInt() + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionHTTP11Config, + Config: testAccAWSCloudFrontDistributionHTTP11Config(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckCloudFrontDistributionExists("aws_cloudfront_distribution.http_1_1", &distribution), ), @@ -506,13 +561,16 @@ func TestAccAWSCloudFrontDistribution_HTTP11Config(t *testing.T) { func TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig(t *testing.T) { var distribution cloudfront.Distribution + rInt := acctest.RandInt() + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionIsIPV6EnabledConfig, + Config: testAccAWSCloudFrontDistributionIsIPV6EnabledConfig(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckCloudFrontDistributionExists("aws_cloudfront_distribution.is_ipv6_enabled", &distribution), resource.TestCheckResourceAttr( @@ -534,13 +592,16 @@ func TestAccAWSCloudFrontDistribution_IsIPV6EnabledConfig(t *testing.T) { func TestAccAWSCloudFrontDistribution_noCustomErrorResponseConfig(t *testing.T) { var distribution cloudfront.Distribution + rInt := acctest.RandInt() + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSCloudFrontDistributionNoCustomErroResponseInfo, + Config: testAccAWSCloudFrontDistributionNoCustomErroResponseInfo(rInt), Check: resource.ComposeTestCheckFunc( testAccCheckCloudFrontDistributionExists("aws_cloudfront_distribution.no_custom_error_responses", &distribution), ), @@ -565,6 +626,7 @@ func TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Cooki resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -608,6 +670,7 @@ func TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_ForwardedValues_Heade resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -649,6 +712,7 @@ func TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_TrustedSigners(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -685,6 +749,7 @@ func TestAccAWSCloudFrontDistribution_DefaultCacheBehavior_RealtimeLogConfigArn( resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -718,6 +783,7 @@ func TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_RealtimeLogConfigArn( resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -748,6 +814,7 @@ func TestAccAWSCloudFrontDistribution_Enabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -789,6 +856,7 @@ func TestAccAWSCloudFrontDistribution_RetainOnDelete(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -819,6 +887,7 @@ func TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Cooki resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -862,6 +931,7 @@ func TestAccAWSCloudFrontDistribution_OrderedCacheBehavior_ForwardedValues_Heade resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -903,6 +973,7 @@ func TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -934,6 +1005,7 @@ func TestAccAWSCloudFrontDistribution_ViewerCertificate_AcmCertificateArn_Confli resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -963,6 +1035,7 @@ func TestAccAWSCloudFrontDistribution_WaitForDeployment(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -1203,9 +1276,10 @@ func TestAccAWSCloudFrontDistribution_OriginGroups(t *testing.T) { var distribution cloudfront.Distribution resourceName := "aws_cloudfront_distribution.failover_distribution" ri := acctest.RandInt() - testConfig := fmt.Sprintf(testAccAWSCloudFrontDistributionOriginGroupsConfig, ri, originBucket, backupBucket, testAccAWSCloudFrontDistributionRetainConfig()) + testConfig := testAccAWSCloudFrontDistributionOriginGroupsConfig(ri) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontDistributionDestroy, Steps: []resource.TestStep{ @@ -1248,22 +1322,21 @@ resource "aws_s3_bucket" "s3_backup_bucket_origin" { var logBucket = ` resource "aws_s3_bucket" "s3_bucket_logs" { - bucket = "mylogs.${var.rand_id}" - acl = "public-read" + acl = "public-read" + bucket = "mylogs.${var.rand_id}" + force_destroy = true } ` -var testAccAWSCloudFrontDistributionS3Config = ` +func testAccAWSCloudFrontDistributionS3Config(rInt int) string { + return composeConfig( + originBucket, + logBucket, + fmt.Sprintf(` variable rand_id { default = %d } -# origin bucket -%s - -# log bucket -%s - resource "aws_cloudfront_distribution" "s3_distribution" { origin { domain_name = "${aws_s3_bucket.s3_bucket_origin.id}.s3.amazonaws.com" @@ -1313,19 +1386,18 @@ resource "aws_cloudfront_distribution" "s3_distribution" { %s } -` +`, rInt, testAccAWSCloudFrontDistributionRetainConfig())) +} -var testAccAWSCloudFrontDistributionS3ConfigWithTags = ` +func testAccAWSCloudFrontDistributionS3ConfigWithTags(rInt int) string { + return composeConfig( + originBucket, + logBucket, + fmt.Sprintf(` variable rand_id { default = %d } -# origin bucket -%s - -# log bucket -%s - resource "aws_cloudfront_distribution" "s3_distribution" { origin { domain_name = "${aws_s3_bucket.s3_bucket_origin.id}.s3.amazonaws.com" @@ -1374,19 +1446,18 @@ resource "aws_cloudfront_distribution" "s3_distribution" { %s } -` +`, rInt, testAccAWSCloudFrontDistributionRetainConfig())) +} -var testAccAWSCloudFrontDistributionS3ConfigWithTagsUpdated = ` +func testAccAWSCloudFrontDistributionS3ConfigWithTagsUpdated(rInt int) string { + return composeConfig( + originBucket, + logBucket, + fmt.Sprintf(` variable rand_id { default = %d } -# origin bucket -%s - -# log bucket -%s - resource "aws_cloudfront_distribution" "s3_distribution" { origin { domain_name = "${aws_s3_bucket.s3_bucket_origin.id}.s3.amazonaws.com" @@ -1434,16 +1505,17 @@ resource "aws_cloudfront_distribution" "s3_distribution" { %s } -` +`, rInt, testAccAWSCloudFrontDistributionRetainConfig())) +} -var testAccAWSCloudFrontDistributionCustomConfig = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionCustomConfig(rInt int) string { + return composeConfig( + logBucket, + fmt.Sprintf(` variable rand_id { default = %d } -# log bucket -%s - resource "aws_cloudfront_distribution" "custom_distribution" { origin { domain_name = "www.example.com" @@ -1504,16 +1576,17 @@ resource "aws_cloudfront_distribution" "custom_distribution" { %s } -`, acctest.RandInt(), logBucket, testAccAWSCloudFrontDistributionRetainConfig()) +`, rInt, testAccAWSCloudFrontDistributionRetainConfig())) +} -var testAccAWSCloudFrontDistributionOriginRequestPolicyConfigDefault = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionOriginRequestPolicyConfigDefault(rInt int) string { + return composeConfig( + logBucket, + fmt.Sprintf(` variable rand_id { default = %[1]d } -# log bucket -%[2]s - resource "aws_cloudfront_cache_policy" "example" { name = "test-policy%[1]d" comment = "test comment" @@ -1614,17 +1687,20 @@ resource "aws_cloudfront_distribution" "custom_distribution" { viewer_certificate { cloudfront_default_certificate = true } + + %[2]s +} +`, rInt, testAccAWSCloudFrontDistributionRetainConfig())) } -`, acctest.RandInt(), logBucket, testAccAWSCloudFrontDistributionRetainConfig()) -var testAccAWSCloudFrontDistributionOriginRequestPolicyConfigOrdered = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionOriginRequestPolicyConfigOrdered(rInt int) string { + return composeConfig( + logBucket, + fmt.Sprintf(` variable rand_id { default = %[1]d } -# log bucket -%[2]s - resource "aws_cloudfront_cache_policy" "example" { name = "test-policy%[1]d" comment = "test comment" @@ -1738,20 +1814,21 @@ resource "aws_cloudfront_distribution" "custom_distribution" { viewer_certificate { cloudfront_default_certificate = true } + + %[2]s +} +`, rInt, testAccAWSCloudFrontDistributionRetainConfig())) } -`, acctest.RandInt(), logBucket, testAccAWSCloudFrontDistributionRetainConfig()) -var testAccAWSCloudFrontDistributionMultiOriginConfig = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionMultiOriginConfig(rInt int) string { + return composeConfig( + originBucket, + logBucket, + fmt.Sprintf(` variable rand_id { default = %d } -# origin bucket -%s - -# log bucket -%s - resource "aws_cloudfront_distribution" "multi_origin_distribution" { origin { domain_name = "${aws_s3_bucket.s3_bucket_origin.id}.s3.amazonaws.com" @@ -1862,9 +1939,11 @@ resource "aws_cloudfront_distribution" "multi_origin_distribution" { %s } -`, acctest.RandInt(), originBucket, logBucket, testAccAWSCloudFrontDistributionRetainConfig()) +`, rInt, testAccAWSCloudFrontDistributionRetainConfig())) +} -var testAccAWSCloudFrontDistributionNoCustomErroResponseInfo = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionNoCustomErroResponseInfo(rInt int) string { + return fmt.Sprintf(` variable rand_id { default = %d } @@ -1923,9 +2002,11 @@ resource "aws_cloudfront_distribution" "no_custom_error_responses" { %s } -`, acctest.RandInt(), testAccAWSCloudFrontDistributionRetainConfig()) +`, rInt, testAccAWSCloudFrontDistributionRetainConfig()) +} -var testAccAWSCloudFrontDistributionNoOptionalItemsConfig = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionNoOptionalItemsConfig(rInt int) string { + return fmt.Sprintf(` variable rand_id { default = %d } @@ -1975,9 +2056,11 @@ resource "aws_cloudfront_distribution" "no_optional_items" { %s } -`, acctest.RandInt(), testAccAWSCloudFrontDistributionRetainConfig()) +`, rInt, testAccAWSCloudFrontDistributionRetainConfig()) +} -var testAccAWSCloudFrontDistributionConfig_Origin_EmptyDomainName = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionConfig_Origin_EmptyDomainName() string { + return fmt.Sprintf(` resource "aws_cloudfront_distribution" "Origin_EmptyDomainName" { origin { domain_name = "" @@ -2024,8 +2107,10 @@ resource "aws_cloudfront_distribution" "Origin_EmptyDomainName" { %s } `, testAccAWSCloudFrontDistributionRetainConfig()) +} -var testAccAWSCloudFrontDistributionConfig_Origin_EmptyOriginID = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionConfig_Origin_EmptyOriginID() string { + return fmt.Sprintf(` resource "aws_cloudfront_distribution" "Origin_EmptyOriginID" { origin { domain_name = "www.example.com" @@ -2072,8 +2157,10 @@ resource "aws_cloudfront_distribution" "Origin_EmptyOriginID" { %s } `, testAccAWSCloudFrontDistributionRetainConfig()) +} -var testAccAWSCloudFrontDistributionHTTP11Config = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionHTTP11Config(rInt int) string { + return fmt.Sprintf(` variable rand_id { default = %d } @@ -2129,9 +2216,11 @@ resource "aws_cloudfront_distribution" "http_1_1" { %s } -`, acctest.RandInt(), testAccAWSCloudFrontDistributionRetainConfig()) +`, rInt, testAccAWSCloudFrontDistributionRetainConfig()) +} -var testAccAWSCloudFrontDistributionIsIPV6EnabledConfig = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionIsIPV6EnabledConfig(rInt int) string { + return fmt.Sprintf(` variable rand_id { default = %d } @@ -2188,9 +2277,11 @@ resource "aws_cloudfront_distribution" "is_ipv6_enabled" { %s } -`, acctest.RandInt(), testAccAWSCloudFrontDistributionRetainConfig()) +`, rInt, testAccAWSCloudFrontDistributionRetainConfig()) +} -var testAccAWSCloudFrontDistributionOrderedCacheBehavior = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionOrderedCacheBehavior(rInt int) string { + return fmt.Sprintf(` variable rand_id { default = %d } @@ -2285,9 +2376,11 @@ resource "aws_cloudfront_distribution" "main" { %s } -`, acctest.RandInt(), testAccAWSCloudFrontDistributionRetainConfig()) +`, rInt, testAccAWSCloudFrontDistributionRetainConfig()) +} -var testAccAWSCloudFrontDistributionOrderedCacheBehaviorCachePolicy = fmt.Sprintf(` +func testAccAWSCloudFrontDistributionOrderedCacheBehaviorCachePolicy(rInt int) string { + return fmt.Sprintf(` variable rand_id { default = %d } @@ -2368,18 +2461,17 @@ resource "aws_cloudfront_cache_policy" "cache_policy" { } } } +`, rInt, testAccAWSCloudFrontDistributionRetainConfig()) +} -`, acctest.RandInt(), testAccAWSCloudFrontDistributionRetainConfig()) - -var testAccAWSCloudFrontDistributionOriginGroupsConfig = ` +func testAccAWSCloudFrontDistributionOriginGroupsConfig(rInt int) string { + return composeConfig( + originBucket, + backupBucket, + fmt.Sprintf(` variable rand_id { default = %d } -# origin bucket -%s - -# backup bucket -%s resource "aws_cloudfront_distribution" "failover_distribution" { origin { @@ -2438,7 +2530,8 @@ resource "aws_cloudfront_distribution" "failover_distribution" { } %s } -` +`, rInt, testAccAWSCloudFrontDistributionRetainConfig())) +} func testAccAWSCloudFrontDistributionConfigDefaultCacheBehaviorForwardedValuesCookiesWhitelistedNamesUnordered2(retainOnDelete bool) string { return fmt.Sprintf(` diff --git a/aws/resource_aws_cloudfront_origin_access_identity_test.go b/aws/resource_aws_cloudfront_origin_access_identity_test.go index 3758e1e363c6..1982989b008c 100644 --- a/aws/resource_aws_cloudfront_origin_access_identity_test.go +++ b/aws/resource_aws_cloudfront_origin_access_identity_test.go @@ -17,6 +17,7 @@ func TestAccAWSCloudFrontOriginAccessIdentity_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontOriginAccessIdentityDestroy, Steps: []resource.TestStep{ @@ -47,6 +48,7 @@ func TestAccAWSCloudFrontOriginAccessIdentity_noComment(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontOriginAccessIdentityDestroy, Steps: []resource.TestStep{ @@ -76,6 +78,7 @@ func TestAccAWSCloudFrontOriginAccessIdentity_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontOriginAccessIdentityDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudfront_origin_request_policy.go b/aws/resource_aws_cloudfront_origin_request_policy.go index 0b5b295302ac..b04e490b9c30 100644 --- a/aws/resource_aws_cloudfront_origin_request_policy.go +++ b/aws/resource_aws_cloudfront_origin_request_policy.go @@ -1,6 +1,7 @@ package aws import ( + "fmt" "log" "github.com/aws/aws-sdk-go/aws" @@ -154,11 +155,16 @@ func resourceAwsCloudFrontOriginRequestPolicyRead(d *schema.ResourceData, meta i } if err != nil { - return err + return fmt.Errorf("error reading CloudFront Origin Request Policy (%s): %w", d.Id(), err) + } + + if resp == nil || resp.OriginRequestPolicy == nil || resp.OriginRequestPolicy.OriginRequestPolicyConfig == nil { + return fmt.Errorf("error reading CloudFront Origin Request Policy (%s): empty response", d.Id()) } + d.Set("etag", aws.StringValue(resp.ETag)) - originRequestPolicy := *resp.OriginRequestPolicy.OriginRequestPolicyConfig + originRequestPolicy := resp.OriginRequestPolicy.OriginRequestPolicyConfig d.Set("comment", aws.StringValue(originRequestPolicy.Comment)) d.Set("name", aws.StringValue(originRequestPolicy.Name)) d.Set("cookies_config", flattenCloudFrontOriginRequestPolicyCookiesConfig(originRequestPolicy.CookiesConfig)) diff --git a/aws/resource_aws_cloudfront_origin_request_policy_test.go b/aws/resource_aws_cloudfront_origin_request_policy_test.go index e9bf7d1619f5..52d22bfcd295 100644 --- a/aws/resource_aws_cloudfront_origin_request_policy_test.go +++ b/aws/resource_aws_cloudfront_origin_request_policy_test.go @@ -15,6 +15,7 @@ func TestAccAWSCloudFrontOriginRequestPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ @@ -46,6 +47,7 @@ func TestAccAWSCloudFrontOriginRequestPolicy_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ @@ -87,6 +89,7 @@ func TestAccAWSCloudFrontOriginRequestPolicy_noneBehavior(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudfront_public_key_test.go b/aws/resource_aws_cloudfront_public_key_test.go index 3b6a7c4304ba..fbc0751551d1 100644 --- a/aws/resource_aws_cloudfront_public_key_test.go +++ b/aws/resource_aws_cloudfront_public_key_test.go @@ -18,6 +18,7 @@ func TestAccAWSCloudFrontPublicKey_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ @@ -45,6 +46,7 @@ func TestAccAWSCloudFrontPublicKey_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ @@ -66,6 +68,7 @@ func TestAccAWSCloudFrontPublicKey_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ @@ -94,6 +97,7 @@ func TestAccAWSCloudFrontPublicKey_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontPublicKeyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudfront_realtime_log_config_test.go b/aws/resource_aws_cloudfront_realtime_log_config_test.go index 2bcb92202b2c..c5ec70269697 100644 --- a/aws/resource_aws_cloudfront_realtime_log_config_test.go +++ b/aws/resource_aws_cloudfront_realtime_log_config_test.go @@ -79,6 +79,7 @@ func TestAccAWSCloudFrontRealtimeLogConfig_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontRealtimeLogConfigDestroy, Steps: []resource.TestStep{ @@ -116,6 +117,7 @@ func TestAccAWSCloudFrontRealtimeLogConfig_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontRealtimeLogConfigDestroy, Steps: []resource.TestStep{ @@ -144,6 +146,7 @@ func TestAccAWSCloudFrontRealtimeLogConfig_updates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, cloudfront.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudFrontRealtimeLogConfigDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudhsm2_cluster_test.go b/aws/resource_aws_cloudhsm2_cluster_test.go index 9f4c257d6471..4621e71c4787 100644 --- a/aws/resource_aws_cloudhsm2_cluster_test.go +++ b/aws/resource_aws_cloudhsm2_cluster_test.go @@ -88,6 +88,7 @@ func TestAccAWSCloudHsmV2Cluster_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudhsmv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudHsmV2ClusterDestroy, Steps: []resource.TestStep{ @@ -117,6 +118,7 @@ func TestAccAWSCloudHsmV2Cluster_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudhsmv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudHsmV2ClusterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudhsm2_hsm_test.go b/aws/resource_aws_cloudhsm2_hsm_test.go index 83e1a18ecb1c..6302fd19835c 100644 --- a/aws/resource_aws_cloudhsm2_hsm_test.go +++ b/aws/resource_aws_cloudhsm2_hsm_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/cloudhsmv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -13,6 +14,7 @@ import ( func TestAccAWSCloudHsmV2Hsm_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudhsmv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudHsmV2HsmDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudtrail.go b/aws/resource_aws_cloudtrail.go index 292cdbdc5cd5..c7ead9cd092a 100644 --- a/aws/resource_aws_cloudtrail.go +++ b/aws/resource_aws_cloudtrail.go @@ -3,7 +3,6 @@ package aws import ( "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/cloudtrail" @@ -11,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsCloudTrail() *schema.Resource { @@ -192,7 +192,7 @@ func resourceAwsCloudTrailCreate(d *schema.ResourceData, meta interface{}) error } var t *cloudtrail.CreateTrailOutput - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error t, err = conn.CreateTrail(&input) if err != nil { @@ -259,7 +259,7 @@ func resourceAwsCloudTrailRead(d *schema.ResourceData, meta interface{}) error { // you're looking for is not found. Instead, it's simply not in the list. var trail *cloudtrail.Trail for _, c := range resp.TrailList { - if d.Id() == *c.Name { + if d.Id() == aws.StringValue(c.Name) { trail = c } } @@ -377,7 +377,7 @@ func resourceAwsCloudTrailUpdate(d *schema.ResourceData, meta interface{}) error log.Printf("[DEBUG] Updating CloudTrail: %s", input) var t *cloudtrail.UpdateTrailOutput - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error t, err = conn.UpdateTrail(&input) if err != nil { @@ -566,8 +566,8 @@ func flattenAwsCloudTrailEventSelector(configured []*cloudtrail.EventSelector) [ for _, raw := range configured { item := make(map[string]interface{}) - item["read_write_type"] = *raw.ReadWriteType - item["include_management_events"] = *raw.IncludeManagementEvents + item["read_write_type"] = aws.StringValue(raw.ReadWriteType) + item["include_management_events"] = aws.BoolValue(raw.IncludeManagementEvents) item["data_resource"] = flattenAwsCloudTrailEventSelectorDataResource(raw.DataResources) eventSelectors = append(eventSelectors, item) @@ -581,7 +581,7 @@ func flattenAwsCloudTrailEventSelectorDataResource(configured []*cloudtrail.Data for _, raw := range configured { item := make(map[string]interface{}) - item["type"] = *raw.Type + item["type"] = aws.StringValue(raw.Type) item["values"] = flattenStringList(raw.Values) dataResources = append(dataResources, item) diff --git a/aws/resource_aws_cloudtrail_test.go b/aws/resource_aws_cloudtrail_test.go index b1aadab0d9f8..08fdc51353c2 100644 --- a/aws/resource_aws_cloudtrail_test.go +++ b/aws/resource_aws_cloudtrail_test.go @@ -127,6 +127,7 @@ func testAccAWSCloudTrail_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudtrail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudTrailDestroy, Steps: []resource.TestStep{ @@ -166,6 +167,7 @@ func testAccAWSCloudTrail_cloudwatch(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudtrail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudTrailDestroy, Steps: []resource.TestStep{ @@ -201,6 +203,7 @@ func testAccAWSCloudTrail_enable_logging(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudtrail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudTrailDestroy, Steps: []resource.TestStep{ @@ -249,6 +252,7 @@ func testAccAWSCloudTrail_is_multi_region(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudtrail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudTrailDestroy, Steps: []resource.TestStep{ @@ -295,6 +299,7 @@ func testAccAWSCloudTrail_is_organization(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudtrail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudTrailDestroy, Steps: []resource.TestStep{ @@ -332,6 +337,7 @@ func testAccAWSCloudTrail_logValidation(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudtrail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudTrailDestroy, Steps: []resource.TestStep{ @@ -373,6 +379,7 @@ func testAccAWSCloudTrail_kmsKey(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudtrail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudTrailDestroy, Steps: []resource.TestStep{ @@ -404,6 +411,7 @@ func testAccAWSCloudTrail_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudtrail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudTrailDestroy, Steps: []resource.TestStep{ @@ -458,6 +466,7 @@ func testAccAWSCloudTrail_include_global_service_events(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudtrail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudTrailDestroy, Steps: []resource.TestStep{ @@ -483,6 +492,7 @@ func testAccAWSCloudTrail_event_selector(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudtrail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudTrailDestroy, Steps: []resource.TestStep{ @@ -551,6 +561,7 @@ func testAccAWSCloudTrail_insight_selector(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudtrail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudTrailDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_composite_alarm_test.go b/aws/resource_aws_cloudwatch_composite_alarm_test.go index baf9bd788add..dd9e508f157e 100644 --- a/aws/resource_aws_cloudwatch_composite_alarm_test.go +++ b/aws/resource_aws_cloudwatch_composite_alarm_test.go @@ -89,6 +89,7 @@ func TestAccAwsCloudWatchCompositeAlarm_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsCloudWatchCompositeAlarmDestroy, Steps: []resource.TestStep{ @@ -122,6 +123,7 @@ func TestAccAwsCloudWatchCompositeAlarm_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsCloudWatchCompositeAlarmDestroy, Steps: []resource.TestStep{ @@ -143,6 +145,7 @@ func TestAccAwsCloudWatchCompositeAlarm_actionsEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsCloudWatchCompositeAlarmDestroy, Steps: []resource.TestStep{ @@ -180,6 +183,7 @@ func TestAccAwsCloudWatchCompositeAlarm_alarmActions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsCloudWatchCompositeAlarmDestroy, Steps: []resource.TestStep{ @@ -229,6 +233,7 @@ func TestAccAwsCloudWatchCompositeAlarm_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsCloudWatchCompositeAlarmDestroy, Steps: []resource.TestStep{ @@ -266,6 +271,7 @@ func TestAccAwsCloudWatchCompositeAlarm_insufficientDataActions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsCloudWatchCompositeAlarmDestroy, Steps: []resource.TestStep{ @@ -315,6 +321,7 @@ func TestAccAwsCloudWatchCompositeAlarm_okActions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsCloudWatchCompositeAlarmDestroy, Steps: []resource.TestStep{ @@ -364,6 +371,7 @@ func TestAccAwsCloudWatchCompositeAlarm_allActions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsCloudWatchCompositeAlarmDestroy, Steps: []resource.TestStep{ @@ -405,6 +413,7 @@ func TestAccAwsCloudWatchCompositeAlarm_updateAlarmRule(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsCloudWatchCompositeAlarmDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_dashboard_test.go b/aws/resource_aws_cloudwatch_dashboard_test.go index 5aff6e6d411a..7380e35335d5 100644 --- a/aws/resource_aws_cloudwatch_dashboard_test.go +++ b/aws/resource_aws_cloudwatch_dashboard_test.go @@ -21,6 +21,7 @@ func TestAccAWSCloudWatchDashboard_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchDashboardDestroy, Steps: []resource.TestStep{ @@ -47,6 +48,7 @@ func TestAccAWSCloudWatchDashboard_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchDashboardDestroy, Steps: []resource.TestStep{ @@ -82,6 +84,7 @@ func TestAccAWSCloudWatchDashboard_updateName(t *testing.T) { rInt2 := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchDashboardDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_event_archive_test.go b/aws/resource_aws_cloudwatch_event_archive_test.go index 685577b496c0..214edcfadcd1 100644 --- a/aws/resource_aws_cloudwatch_event_archive_test.go +++ b/aws/resource_aws_cloudwatch_event_archive_test.go @@ -6,6 +6,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/cloudwatchevents" events "github.com/aws/aws-sdk-go/service/cloudwatchevents" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -77,6 +78,7 @@ func TestAccAWSCloudWatchEventArchive_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventArchiveDestroy, Steps: []resource.TestStep{ @@ -107,6 +109,7 @@ func TestAccAWSCloudWatchEventArchive_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventArchiveDestroy, Steps: []resource.TestStep{ @@ -136,6 +139,7 @@ func TestAccAWSCloudWatchEventArchive_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventArchiveDestroy, Steps: []resource.TestStep{ @@ -207,6 +211,7 @@ func TestAccAWSCloudWatchEventArchive_retentionSetOnCreation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventArchiveDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_event_bus_test.go b/aws/resource_aws_cloudwatch_event_bus_test.go index bd8a52601f0f..741833dce10f 100644 --- a/aws/resource_aws_cloudwatch_event_bus_test.go +++ b/aws/resource_aws_cloudwatch_event_bus_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/cloudwatchevents" events "github.com/aws/aws-sdk-go/service/cloudwatchevents" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -81,6 +82,7 @@ func TestAccAWSCloudWatchEventBus_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventBusDestroy, Steps: []resource.TestStep{ @@ -129,6 +131,7 @@ func TestAccAWSCloudWatchEventBus_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventBusDestroy, Steps: []resource.TestStep{ @@ -179,6 +182,7 @@ func TestAccAWSCloudWatchEventBus_tags(t *testing.T) { func TestAccAWSCloudWatchEventBus_default(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventBusDestroy, Steps: []resource.TestStep{ @@ -198,6 +202,7 @@ func TestAccAWSCloudWatchEventBus_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventBusDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_event_permission_test.go b/aws/resource_aws_cloudwatch_event_permission_test.go index 5e1471f2076f..153309ab0383 100644 --- a/aws/resource_aws_cloudwatch_event_permission_test.go +++ b/aws/resource_aws_cloudwatch_event_permission_test.go @@ -9,6 +9,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/cloudwatchevents" events "github.com/aws/aws-sdk-go/service/cloudwatchevents" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -75,6 +76,7 @@ func TestAccAWSCloudWatchEventPermission_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudWatchEventPermissionDestroy, Steps: []resource.TestStep{ @@ -146,6 +148,7 @@ func TestAccAWSCloudWatchEventPermission_EventBusName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudWatchEventPermissionDestroy, Steps: []resource.TestStep{ @@ -176,6 +179,7 @@ func TestAccAWSCloudWatchEventPermission_Action(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudWatchEventPermissionDestroy, Steps: []resource.TestStep{ @@ -217,6 +221,7 @@ func TestAccAWSCloudWatchEventPermission_Condition(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudWatchEventPermissionDestroy, Steps: []resource.TestStep{ @@ -259,6 +264,7 @@ func TestAccAWSCloudWatchEventPermission_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudWatchEventPermissionDestroy, Steps: []resource.TestStep{ @@ -292,6 +298,7 @@ func TestAccAWSCloudWatchEventPermission_Disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudWatchEventPermissionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_event_rule_test.go b/aws/resource_aws_cloudwatch_event_rule_test.go index ca0768b38e8b..2a9944073bea 100644 --- a/aws/resource_aws_cloudwatch_event_rule_test.go +++ b/aws/resource_aws_cloudwatch_event_rule_test.go @@ -7,6 +7,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/cloudwatchevents" events "github.com/aws/aws-sdk-go/service/cloudwatchevents" "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" @@ -84,6 +85,7 @@ func TestAccAWSCloudWatchEventRule_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventRuleDestroy, Steps: []resource.TestStep{ @@ -154,6 +156,7 @@ func TestAccAWSCloudWatchEventRule_EventBusName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventRuleDestroy, Steps: []resource.TestStep{ @@ -203,6 +206,7 @@ func TestAccAWSCloudWatchEventRule_role(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventRuleDestroy, Steps: []resource.TestStep{ @@ -230,6 +234,7 @@ func TestAccAWSCloudWatchEventRule_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventRuleDestroy, Steps: []resource.TestStep{ @@ -265,6 +270,7 @@ func TestAccAWSCloudWatchEventRule_pattern(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventRuleDestroy, Steps: []resource.TestStep{ @@ -301,6 +307,7 @@ func TestAccAWSCloudWatchEventRule_ScheduleAndPattern(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventRuleDestroy, Steps: []resource.TestStep{ @@ -329,6 +336,7 @@ func TestAccAWSCloudWatchEventRule_NamePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventRuleDestroy, Steps: []resource.TestStep{ @@ -355,6 +363,7 @@ func TestAccAWSCloudWatchEventRule_Name_Generated(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventRuleDestroy, Steps: []resource.TestStep{ @@ -382,6 +391,7 @@ func TestAccAWSCloudWatchEventRule_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventRuleDestroy, Steps: []resource.TestStep{ @@ -433,6 +443,7 @@ func TestAccAWSCloudWatchEventRule_IsEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_event_target_test.go b/aws/resource_aws_cloudwatch_event_target_test.go index f258ded59aa3..3599a5bb708d 100644 --- a/aws/resource_aws_cloudwatch_event_target_test.go +++ b/aws/resource_aws_cloudwatch_event_target_test.go @@ -9,6 +9,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/cloudwatchevents" events "github.com/aws/aws-sdk-go/service/cloudwatchevents" "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" @@ -118,6 +119,7 @@ func TestAccAWSCloudWatchEventTarget_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -184,6 +186,7 @@ func TestAccAWSCloudWatchEventTarget_EventBusName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -225,6 +228,7 @@ func TestAccAWSCloudWatchEventTarget_GeneratedTargetId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -259,6 +263,7 @@ func TestAccAWSCloudWatchEventTarget_RetryPolicy_DeadLetterConfig(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -291,6 +296,7 @@ func TestAccAWSCloudWatchEventTarget_full(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -326,6 +332,7 @@ func TestAccAWSCloudWatchEventTarget_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -348,6 +355,7 @@ func TestAccAWSCloudWatchEventTarget_ssmDocument(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -380,6 +388,7 @@ func TestAccAWSCloudWatchEventTarget_ecs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -413,6 +422,7 @@ func TestAccAWSCloudWatchEventTarget_ecsWithBlankTaskCount(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -442,6 +452,7 @@ func TestAccAWSCloudWatchEventTarget_batch(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -471,6 +482,7 @@ func TestAccAWSCloudWatchEventTarget_kinesis(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -498,6 +510,7 @@ func TestAccAWSCloudWatchEventTarget_sqs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -563,6 +576,7 @@ func TestAccAWSCloudWatchEventTarget_input_transformer(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ @@ -598,6 +612,7 @@ func TestAccAWSCloudWatchEventTarget_inputTransformerJsonString(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchevents.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchEventTargetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_log_destination.go b/aws/resource_aws_cloudwatch_log_destination.go index 6f32e9b10f20..e986fe0e6a66 100644 --- a/aws/resource_aws_cloudwatch_log_destination.go +++ b/aws/resource_aws_cloudwatch_log_destination.go @@ -139,7 +139,7 @@ func lookupCloudWatchLogDestination(conn *cloudwatchlogs.CloudWatchLogs, } for _, destination := range resp.Destinations { - if *destination.DestinationName == name { + if aws.StringValue(destination.DestinationName) == name { return destination, true, nil } } diff --git a/aws/resource_aws_cloudwatch_log_destination_policy_test.go b/aws/resource_aws_cloudwatch_log_destination_policy_test.go index 91f661dc540c..5a968c503d38 100644 --- a/aws/resource_aws_cloudwatch_log_destination_policy_test.go +++ b/aws/resource_aws_cloudwatch_log_destination_policy_test.go @@ -17,6 +17,7 @@ func TestAccAWSCloudwatchLogDestinationPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudwatchLogDestinationPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_log_destination_test.go b/aws/resource_aws_cloudwatch_log_destination_test.go index 5b8348a21796..899b84048b51 100644 --- a/aws/resource_aws_cloudwatch_log_destination_test.go +++ b/aws/resource_aws_cloudwatch_log_destination_test.go @@ -20,6 +20,7 @@ func TestAccAWSCloudwatchLogDestination_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudwatchLogDestinationDestroy, Steps: []resource.TestStep{ @@ -49,6 +50,7 @@ func TestAccAWSCloudwatchLogDestination_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudwatchLogDestinationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_log_group_test.go b/aws/resource_aws_cloudwatch_log_group_test.go index 463eb570179c..4665d617c9f8 100644 --- a/aws/resource_aws_cloudwatch_log_group_test.go +++ b/aws/resource_aws_cloudwatch_log_group_test.go @@ -101,6 +101,7 @@ func TestAccAWSCloudWatchLogGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogGroupDestroy, Steps: []resource.TestStep{ @@ -130,6 +131,7 @@ func TestAccAWSCloudWatchLogGroup_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogGroupDestroy, Steps: []resource.TestStep{ @@ -157,6 +159,7 @@ func TestAccAWSCloudWatchLogGroup_namePrefix_retention(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogGroupDestroy, Steps: []resource.TestStep{ @@ -192,6 +195,7 @@ func TestAccAWSCloudWatchLogGroup_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogGroupDestroy, Steps: []resource.TestStep{ @@ -218,6 +222,7 @@ func TestAccAWSCloudWatchLogGroup_retentionPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogGroupDestroy, Steps: []resource.TestStep{ @@ -252,6 +257,7 @@ func TestAccAWSCloudWatchLogGroup_multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogGroupDestroy, Steps: []resource.TestStep{ @@ -283,6 +289,7 @@ func TestAccAWSCloudWatchLogGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogGroupDestroy, Steps: []resource.TestStep{ @@ -305,6 +312,7 @@ func TestAccAWSCloudWatchLogGroup_tagging(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogGroupDestroy, Steps: []resource.TestStep{ @@ -367,6 +375,7 @@ func TestAccAWSCloudWatchLogGroup_kmsKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_log_metric_filter.go b/aws/resource_aws_cloudwatch_log_metric_filter.go index fdef50cd8fab..74aa7ef1b85b 100644 --- a/aws/resource_aws_cloudwatch_log_metric_filter.go +++ b/aws/resource_aws_cloudwatch_log_metric_filter.go @@ -170,7 +170,7 @@ func lookupCloudWatchLogMetricFilter(conn *cloudwatchlogs.CloudWatchLogs, } for _, mf := range resp.MetricFilters { - if *mf.FilterName == name { + if aws.StringValue(mf.FilterName) == name { return mf, nil } } diff --git a/aws/resource_aws_cloudwatch_log_metric_filter_test.go b/aws/resource_aws_cloudwatch_log_metric_filter_test.go index f5acf3565a3d..53a9274a0d2e 100644 --- a/aws/resource_aws_cloudwatch_log_metric_filter_test.go +++ b/aws/resource_aws_cloudwatch_log_metric_filter_test.go @@ -18,6 +18,7 @@ func TestAccAWSCloudWatchLogMetricFilter_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogMetricFilterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_log_resource_policy.go b/aws/resource_aws_cloudwatch_log_resource_policy.go index a089b9459e37..863b9af13886 100644 --- a/aws/resource_aws_cloudwatch_log_resource_policy.go +++ b/aws/resource_aws_cloudwatch_log_resource_policy.go @@ -104,7 +104,7 @@ func lookupCloudWatchLogResourcePolicy(conn *cloudwatchlogs.CloudWatchLogs, } for _, resourcePolicy := range resp.ResourcePolicies { - if *resourcePolicy.PolicyName == name { + if aws.StringValue(resourcePolicy.PolicyName) == name { return resourcePolicy, true, nil } } diff --git a/aws/resource_aws_cloudwatch_log_resource_policy_test.go b/aws/resource_aws_cloudwatch_log_resource_policy_test.go index 81155feb4faa..3d1725382a45 100644 --- a/aws/resource_aws_cloudwatch_log_resource_policy_test.go +++ b/aws/resource_aws_cloudwatch_log_resource_policy_test.go @@ -69,6 +69,7 @@ func TestAccAWSCloudWatchLogResourcePolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudWatchLogResourcePolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_log_stream.go b/aws/resource_aws_cloudwatch_log_stream.go index 90d9504f13eb..55b205e90b25 100644 --- a/aws/resource_aws_cloudwatch_log_stream.go +++ b/aws/resource_aws_cloudwatch_log_stream.go @@ -149,7 +149,7 @@ func lookupCloudWatchLogStream(conn *cloudwatchlogs.CloudWatchLogs, } for _, ls := range resp.LogStreams { - if *ls.LogStreamName == name { + if aws.StringValue(ls.LogStreamName) == name { return ls, true, nil } } diff --git a/aws/resource_aws_cloudwatch_log_stream_test.go b/aws/resource_aws_cloudwatch_log_stream_test.go index 9a914e7691bd..fe564dcd20e0 100644 --- a/aws/resource_aws_cloudwatch_log_stream_test.go +++ b/aws/resource_aws_cloudwatch_log_stream_test.go @@ -17,6 +17,7 @@ func TestAccAWSCloudWatchLogStream_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogStreamDestroy, Steps: []resource.TestStep{ @@ -43,6 +44,7 @@ func TestAccAWSCloudWatchLogStream_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogStreamDestroy, Steps: []resource.TestStep{ @@ -67,6 +69,7 @@ func TestAccAWSCloudWatchLogStream_disappears_LogGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchLogStreamDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_log_subscription_filter_test.go b/aws/resource_aws_cloudwatch_log_subscription_filter_test.go index e828f3dbdaa7..14f9b54c8cd6 100644 --- a/aws/resource_aws_cloudwatch_log_subscription_filter_test.go +++ b/aws/resource_aws_cloudwatch_log_subscription_filter_test.go @@ -21,6 +21,7 @@ func TestAccAWSCloudwatchLogSubscriptionFilter_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudwatchLogSubscriptionFilterDestroy, Steps: []resource.TestStep{ @@ -53,6 +54,7 @@ func TestAccAWSCloudwatchLogSubscriptionFilter_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudwatchLogSubscriptionFilterDestroy, Steps: []resource.TestStep{ @@ -78,6 +80,7 @@ func TestAccAWSCloudwatchLogSubscriptionFilter_disappears_LogGroup(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudwatchLogSubscriptionFilterDestroy, Steps: []resource.TestStep{ @@ -103,6 +106,7 @@ func TestAccAWSCloudwatchLogSubscriptionFilter_DestinationArn_KinesisDataFirehos resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudwatchLogSubscriptionFilterDestroy, Steps: []resource.TestStep{ @@ -132,6 +136,7 @@ func TestAccAWSCloudwatchLogSubscriptionFilter_DestinationArn_KinesisStream(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudwatchLogSubscriptionFilterDestroy, Steps: []resource.TestStep{ @@ -160,6 +165,7 @@ func TestAccAWSCloudwatchLogSubscriptionFilter_Distribution(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudwatchLogSubscriptionFilterDestroy, Steps: []resource.TestStep{ @@ -197,6 +203,7 @@ func TestAccAWSCloudwatchLogSubscriptionFilter_RoleArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatchlogs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCloudwatchLogSubscriptionFilterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cloudwatch_metric_alarm.go b/aws/resource_aws_cloudwatch_metric_alarm.go index b332886541bd..001bf7600adf 100644 --- a/aws/resource_aws_cloudwatch_metric_alarm.go +++ b/aws/resource_aws_cloudwatch_metric_alarm.go @@ -307,7 +307,7 @@ func resourceAwsCloudWatchMetricAlarmRead(d *schema.ResourceData, meta interface if err := d.Set("alarm_actions", flattenStringSet(resp.AlarmActions)); err != nil { log.Printf("[WARN] Error setting Alarm Actions: %s", err) } - arn := *resp.AlarmArn + arn := aws.StringValue(resp.AlarmArn) d.Set("alarm_description", resp.AlarmDescription) d.Set("alarm_name", resp.AlarmName) d.Set("arn", arn) @@ -578,7 +578,7 @@ func getAwsCloudWatchMetricAlarm(d *schema.ResourceData, meta interface{}) (*clo func flattenDimensions(dims []*cloudwatch.Dimension) map[string]interface{} { flatDims := make(map[string]interface{}) for _, d := range dims { - flatDims[*d.Name] = *d.Value + flatDims[aws.StringValue(d.Name)] = aws.StringValue(d.Value) } return flatDims } diff --git a/aws/resource_aws_cloudwatch_metric_alarm_test.go b/aws/resource_aws_cloudwatch_metric_alarm_test.go index 8874be19457c..e706a43b02f0 100644 --- a/aws/resource_aws_cloudwatch_metric_alarm_test.go +++ b/aws/resource_aws_cloudwatch_metric_alarm_test.go @@ -19,6 +19,7 @@ func TestAccAWSCloudWatchMetricAlarm_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ @@ -49,6 +50,7 @@ func TestAccAWSCloudWatchMetricAlarm_AlarmActions_EC2Automate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ @@ -96,6 +98,7 @@ func TestAccAWSCloudWatchMetricAlarm_AlarmActions_SNSTopic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ @@ -122,6 +125,7 @@ func TestAccAWSCloudWatchMetricAlarm_AlarmActions_SWFAction(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ @@ -148,6 +152,7 @@ func TestAccAWSCloudWatchMetricAlarm_datapointsToAlarm(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ @@ -169,6 +174,7 @@ func TestAccAWSCloudWatchMetricAlarm_treatMissingData(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ @@ -197,6 +203,7 @@ func TestAccAWSCloudWatchMetricAlarm_evaluateLowSampleCountPercentiles(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ @@ -225,6 +232,7 @@ func TestAccAWSCloudWatchMetricAlarm_extendedStatistic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ @@ -246,6 +254,7 @@ func TestAccAWSCloudWatchMetricAlarm_expression(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ @@ -301,6 +310,7 @@ func TestAccAWSCloudWatchMetricAlarm_missingStatistic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ @@ -319,6 +329,7 @@ func TestAccAWSCloudWatchMetricAlarm_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ @@ -363,6 +374,7 @@ func TestAccAWSCloudWatchMetricAlarm_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchMetricAlarmDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codeartifact_domain_permissions_policy_test.go b/aws/resource_aws_codeartifact_domain_permissions_policy_test.go index a156f6c7bea6..d325a16737cb 100644 --- a/aws/resource_aws_codeartifact_domain_permissions_policy_test.go +++ b/aws/resource_aws_codeartifact_domain_permissions_policy_test.go @@ -18,6 +18,7 @@ func TestAccAWSCodeArtifactDomainPermissionsPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactDomainPermissionsDestroy, Steps: []resource.TestStep{ @@ -57,6 +58,7 @@ func TestAccAWSCodeArtifactDomainPermissionsPolicy_owner(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactDomainPermissionsDestroy, Steps: []resource.TestStep{ @@ -85,6 +87,7 @@ func TestAccAWSCodeArtifactDomainPermissionsPolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactDomainPermissionsDestroy, Steps: []resource.TestStep{ @@ -106,6 +109,7 @@ func TestAccAWSCodeArtifactDomainPermissionsPolicy_disappears_domain(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactDomainPermissionsDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codeartifact_domain_test.go b/aws/resource_aws_codeartifact_domain_test.go index 2ef97e4a6454..6deacf0c0b3d 100644 --- a/aws/resource_aws_codeartifact_domain_test.go +++ b/aws/resource_aws_codeartifact_domain_test.go @@ -73,6 +73,7 @@ func TestAccAWSCodeArtifactDomain_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactDomainDestroy, Steps: []resource.TestStep{ @@ -105,6 +106,7 @@ func TestAccAWSCodeArtifactDomain_defaultencryptionkey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck("codeartifact", t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactDomainDestroy, Steps: []resource.TestStep{ @@ -136,6 +138,7 @@ func TestAccAWSCodeArtifactDomain_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck("codeartifact", t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactDomainDestroy, Steps: []resource.TestStep{ @@ -178,6 +181,7 @@ func TestAccAWSCodeArtifactDomain_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactDomainDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codeartifact_repository_permissions_policy_test.go b/aws/resource_aws_codeartifact_repository_permissions_policy_test.go index 75f4fb233f49..ea0f6de39ead 100644 --- a/aws/resource_aws_codeartifact_repository_permissions_policy_test.go +++ b/aws/resource_aws_codeartifact_repository_permissions_policy_test.go @@ -18,6 +18,7 @@ func TestAccAWSCodeArtifactRepositoryPermissionsPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactRepositoryPermissionsDestroy, Steps: []resource.TestStep{ @@ -57,6 +58,7 @@ func TestAccAWSCodeArtifactRepositoryPermissionsPolicy_owner(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactRepositoryPermissionsDestroy, Steps: []resource.TestStep{ @@ -85,6 +87,7 @@ func TestAccAWSCodeArtifactRepositoryPermissionsPolicy_disappears(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactRepositoryPermissionsDestroy, Steps: []resource.TestStep{ @@ -106,6 +109,7 @@ func TestAccAWSCodeArtifactRepositoryPermissionsPolicy_disappears_domain(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactRepositoryPermissionsDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codeartifact_repository_test.go b/aws/resource_aws_codeartifact_repository_test.go index be24628e9d79..29f5fcfec1d8 100644 --- a/aws/resource_aws_codeartifact_repository_test.go +++ b/aws/resource_aws_codeartifact_repository_test.go @@ -74,6 +74,7 @@ func TestAccAWSCodeArtifactRepository_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactRepositoryDestroy, Steps: []resource.TestStep{ @@ -107,6 +108,7 @@ func TestAccAWSCodeArtifactRepository_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck("codeartifact", t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactRepositoryDestroy, Steps: []resource.TestStep{ @@ -150,6 +152,7 @@ func TestAccAWSCodeArtifactRepository_owner(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactRepositoryDestroy, Steps: []resource.TestStep{ @@ -182,6 +185,7 @@ func TestAccAWSCodeArtifactRepository_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactRepositoryDestroy, Steps: []resource.TestStep{ @@ -214,6 +218,7 @@ func TestAccAWSCodeArtifactRepository_upstreams(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactRepositoryDestroy, Steps: []resource.TestStep{ @@ -257,6 +262,7 @@ func TestAccAWSCodeArtifactRepository_externalConnection(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactRepositoryDestroy, Steps: []resource.TestStep{ @@ -295,12 +301,14 @@ func TestAccAWSCodeArtifactRepository_externalConnection(t *testing.T) { }, }) } + func TestAccAWSCodeArtifactRepository_disappears(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_codeartifact_repository.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codeartifact.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codeartifact.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeArtifactRepositoryDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codebuild_project.go b/aws/resource_aws_codebuild_project.go index 36e2630d4edf..ea7bdb8d66c0 100644 --- a/aws/resource_aws_codebuild_project.go +++ b/aws/resource_aws_codebuild_project.go @@ -16,6 +16,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsCodeBuildProject() *schema.Resource { @@ -402,9 +403,10 @@ func resourceAwsCodeBuildProject() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "resource": { - Type: schema.TypeString, - Sensitive: true, - Optional: true, + Type: schema.TypeString, + Sensitive: true, + Optional: true, + Deprecated: "Use the aws_codebuild_source_credential resource instead", }, "type": { Type: schema.TypeString, @@ -412,9 +414,11 @@ func resourceAwsCodeBuildProject() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{ codebuild.SourceAuthTypeOauth, }, false), + Deprecated: "Use the aws_codebuild_source_credential resource instead", }, }, }, + Deprecated: "Use the aws_codebuild_source_credential resource instead", }, "buildspec": { Type: schema.TypeString, @@ -486,9 +490,10 @@ func resourceAwsCodeBuildProject() *schema.Resource { Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "resource": { - Type: schema.TypeString, - Sensitive: true, - Optional: true, + Type: schema.TypeString, + Sensitive: true, + Optional: true, + Deprecated: "Use the aws_codebuild_source_credential resource instead", }, "type": { Type: schema.TypeString, @@ -496,9 +501,11 @@ func resourceAwsCodeBuildProject() *schema.Resource { ValidateFunc: validation.StringInSlice([]string{ codebuild.SourceAuthTypeOauth, }, false), + Deprecated: "Use the aws_codebuild_source_credential resource instead", }, }, }, + Deprecated: "Use the aws_codebuild_source_credential resource instead", }, "buildspec": { Type: schema.TypeString, @@ -1226,7 +1233,7 @@ func resourceAwsCodeBuildProjectUpdate(d *schema.ResourceData, meta interface{}) params.Tags = keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().CodebuildTags() // Handle IAM eventual consistency - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error _, err = conn.UpdateProject(params) diff --git a/aws/resource_aws_codebuild_project_test.go b/aws/resource_aws_codebuild_project_test.go index 873c60516b95..384bb416f818 100644 --- a/aws/resource_aws_codebuild_project_test.go +++ b/aws/resource_aws_codebuild_project_test.go @@ -46,6 +46,7 @@ func TestAccAWSCodeBuildProject_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -99,6 +100,7 @@ func TestAccAWSCodeBuildProject_BadgeEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -126,6 +128,7 @@ func TestAccAWSCodeBuildProject_BuildTimeout(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -159,6 +162,7 @@ func TestAccAWSCodeBuildProject_QueuedTimeout(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -192,6 +196,7 @@ func TestAccAWSCodeBuildProject_Cache(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -266,6 +271,7 @@ func TestAccAWSCodeBuildProject_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -299,6 +305,7 @@ func TestAccAWSCodeBuildProject_SourceVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -320,6 +327,7 @@ func TestAccAWSCodeBuildProject_EncryptionKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -346,6 +354,7 @@ func TestAccAWSCodeBuildProject_Environment_EnvironmentVariable(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -394,6 +403,7 @@ func TestAccAWSCodeBuildProject_Environment_EnvironmentVariable_Type(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -437,6 +447,7 @@ func TestAccAWSCodeBuildProject_Environment_EnvironmentVariable_Value(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -486,6 +497,7 @@ func TestAccAWSCodeBuildProject_Environment_Certificate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -512,6 +524,7 @@ func TestAccAWSCodeBuildProject_LogsConfig_CloudWatchLogs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -557,6 +570,7 @@ func TestAccAWSCodeBuildProject_LogsConfig_S3Logs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -594,38 +608,6 @@ func TestAccAWSCodeBuildProject_LogsConfig_S3Logs(t *testing.T) { }) } -func TestAccAWSCodeBuildProject_Source_Auth(t *testing.T) { - var project codebuild.Project - rName := acctest.RandomWithPrefix("tf-acc-test") - resourceName := "aws_codebuild_project.test" - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, - Providers: testAccProviders, - CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAWSCodeBuildProjectConfig_Source_Auth(rName, "FAKERESOURCE1", "INVALID"), - ExpectError: regexp.MustCompile(`expected source.0.auth.0.type to be one of`), - }, - { - Config: testAccAWSCodeBuildProjectConfig_Source_Auth(rName, "FAKERESOURCE1", "OAUTH"), - Check: resource.ComposeTestCheckFunc( - testAccCheckAWSCodeBuildProjectExists(resourceName, &project), - resource.TestCheckResourceAttr(resourceName, "source.0.auth.#", "1"), - resource.TestCheckResourceAttr(resourceName, "source.0.auth.0.resource", "FAKERESOURCE1"), - resource.TestCheckResourceAttr(resourceName, "source.0.auth.0.type", "OAUTH"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func TestAccAWSCodeBuildProject_Source_GitCloneDepth(t *testing.T) { var project codebuild.Project rName := acctest.RandomWithPrefix("tf-acc-test") @@ -633,6 +615,7 @@ func TestAccAWSCodeBuildProject_Source_GitCloneDepth(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -666,6 +649,7 @@ func TestAccAWSCodeBuildProject_Source_GitSubmodulesConfig_CodeCommit(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -701,6 +685,7 @@ func TestAccAWSCodeBuildProject_Source_GitSubmodulesConfig_GitHub(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -732,6 +717,7 @@ func TestAccAWSCodeBuildProject_Source_GitSubmodulesConfig_GitHubEnterprise(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -763,6 +749,7 @@ func TestAccAWSCodeBuildProject_SecondarySources_GitSubmodulesConfig_CodeCommit( resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -814,6 +801,7 @@ func TestAccAWSCodeBuildProject_SecondarySources_GitSubmodulesConfig_GitHub(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -845,6 +833,7 @@ func TestAccAWSCodeBuildProject_SecondarySources_GitSubmodulesConfig_GitHubEnter resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -876,6 +865,7 @@ func TestAccAWSCodeBuildProject_Source_InsecureSSL(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -909,6 +899,7 @@ func TestAccAWSCodeBuildProject_Source_ReportBuildStatus_Bitbucket(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -942,6 +933,7 @@ func TestAccAWSCodeBuildProject_Source_ReportBuildStatus_GitHub(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -975,6 +967,7 @@ func TestAccAWSCodeBuildProject_Source_ReportBuildStatus_GitHubEnterprise(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1008,6 +1001,7 @@ func TestAccAWSCodeBuildProject_Source_Type_Bitbucket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1034,6 +1028,7 @@ func TestAccAWSCodeBuildProject_Source_Type_CodeCommit(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1060,6 +1055,7 @@ func TestAccAWSCodeBuildProject_Source_Type_CodePipeline(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1086,6 +1082,7 @@ func TestAccAWSCodeBuildProject_Source_Type_GitHubEnterprise(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1112,6 +1109,7 @@ func TestAccAWSCodeBuildProject_Source_Type_S3(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1144,6 +1142,7 @@ phases: resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1175,6 +1174,7 @@ phases: resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1197,6 +1197,7 @@ func TestAccAWSCodeBuildProject_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1234,6 +1235,7 @@ func TestAccAWSCodeBuildProject_VpcConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1280,6 +1282,7 @@ func TestAccAWSCodeBuildProject_WindowsServer2019Container(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1312,6 +1315,7 @@ func TestAccAWSCodeBuildProject_ARMContainer(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1341,6 +1345,7 @@ func TestAccAWSCodeBuildProject_Artifacts_ArtifactIdentifier(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1377,6 +1382,7 @@ func TestAccAWSCodeBuildProject_Artifacts_EncryptionDisabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1414,6 +1420,7 @@ func TestAccAWSCodeBuildProject_Artifacts_Location(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1453,6 +1460,7 @@ func TestAccAWSCodeBuildProject_Artifacts_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1488,6 +1496,7 @@ func TestAccAWSCodeBuildProject_Artifacts_NamespaceType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1524,6 +1533,7 @@ func TestAccAWSCodeBuildProject_Artifacts_OverrideArtifactName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1559,6 +1569,7 @@ func TestAccAWSCodeBuildProject_Artifacts_Packaging(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1594,6 +1605,7 @@ func TestAccAWSCodeBuildProject_Artifacts_Path(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1633,6 +1645,7 @@ func TestAccAWSCodeBuildProject_Artifacts_Type(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1669,6 +1682,7 @@ func TestAccAWSCodeBuildProject_SecondaryArtifacts(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1699,6 +1713,7 @@ func TestAccAWSCodeBuildProject_SecondaryArtifacts_ArtifactIdentifier(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1739,6 +1754,7 @@ func TestAccAWSCodeBuildProject_SecondaryArtifacts_OverrideArtifactName(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1779,6 +1795,7 @@ func TestAccAWSCodeBuildProject_SecondaryArtifacts_EncryptionDisabled(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1820,6 +1837,7 @@ func TestAccAWSCodeBuildProject_SecondaryArtifacts_Location(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1865,6 +1883,7 @@ func TestAccAWSCodeBuildProject_SecondaryArtifacts_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1904,6 +1923,7 @@ func TestAccAWSCodeBuildProject_SecondaryArtifacts_NamespaceType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1943,6 +1963,7 @@ func TestAccAWSCodeBuildProject_SecondaryArtifacts_Packaging(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -1985,6 +2006,7 @@ func TestAccAWSCodeBuildProject_SecondaryArtifacts_Path(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -2025,6 +2047,7 @@ func TestAccAWSCodeBuildProject_SecondaryArtifacts_Type(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -2054,6 +2077,7 @@ func TestAccAWSCodeBuildProject_SecondarySources_CodeCommit(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -2107,6 +2131,7 @@ func TestAccAWSCodeBuildProject_Environment_RegistryCredential(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildProjectDestroy, Steps: []resource.TestStep{ @@ -2835,35 +2860,6 @@ resource "aws_codebuild_project" "test" { `, rName, status, location, encryptionDisabled)) } -func testAccAWSCodeBuildProjectConfig_Source_Auth(rName, authResource, authType string) string { - return composeConfig(testAccAWSCodeBuildProjectConfig_Base_ServiceRole(rName), fmt.Sprintf(` -resource "aws_codebuild_project" "test" { - name = "%s" - service_role = aws_iam_role.test.arn - - artifacts { - type = "NO_ARTIFACTS" - } - - environment { - compute_type = "BUILD_GENERAL1_SMALL" - image = "2" - type = "LINUX_CONTAINER" - } - - source { - type = "GITHUB" - location = "https://github.com/hashicorp/packer.git" - - auth { - resource = "%s" - type = "%s" - } - } -} -`, rName, authResource, authType)) -} - func testAccAWSCodeBuildProjectConfig_Source_GitCloneDepth(rName string, gitCloneDepth int) string { return composeConfig(testAccAWSCodeBuildProjectConfig_Base_ServiceRole(rName), fmt.Sprintf(` resource "aws_codebuild_project" "test" { diff --git a/aws/resource_aws_codebuild_report_group_test.go b/aws/resource_aws_codebuild_report_group_test.go index 625eb14ab4cc..4568b615dd1e 100644 --- a/aws/resource_aws_codebuild_report_group_test.go +++ b/aws/resource_aws_codebuild_report_group_test.go @@ -75,6 +75,7 @@ func TestAccAWSCodeBuildReportGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuildReportGroup(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildReportGroupDestroy, Steps: []resource.TestStep{ @@ -106,6 +107,7 @@ func TestAccAWSCodeBuildReportGroup_export_s3(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuildReportGroup(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildReportGroupDestroy, Steps: []resource.TestStep{ @@ -155,6 +157,7 @@ func TestAccAWSCodeBuildReportGroup_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuildReportGroup(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildReportGroupDestroy, Steps: []resource.TestStep{ @@ -200,6 +203,7 @@ func TestAccAWSCodeBuildReportGroup_deleteReports(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuildReportGroup(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildReportGroupDestroy, Steps: []resource.TestStep{ @@ -227,6 +231,7 @@ func TestAccAWSCodeBuildReportGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuildReportGroup(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildReportGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codebuild_source_credential_test.go b/aws/resource_aws_codebuild_source_credential_test.go index 21acacb66ba7..c2ff3856c68d 100644 --- a/aws/resource_aws_codebuild_source_credential_test.go +++ b/aws/resource_aws_codebuild_source_credential_test.go @@ -19,6 +19,7 @@ func TestAccAWSCodeBuildSourceCredential_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildSourceCredentialDestroy, Steps: []resource.TestStep{ @@ -57,6 +58,7 @@ func TestAccAWSCodeBuildSourceCredential_BasicAuth(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildSourceCredentialDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codebuild_webhook_test.go b/aws/resource_aws_codebuild_webhook_test.go index 43183e663b05..df0f89a63835 100644 --- a/aws/resource_aws_codebuild_webhook_test.go +++ b/aws/resource_aws_codebuild_webhook_test.go @@ -20,6 +20,7 @@ func TestAccAWSCodeBuildWebhook_Bitbucket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildWebhookDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func TestAccAWSCodeBuildWebhook_GitHub(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildWebhookDestroy, Steps: []resource.TestStep{ @@ -82,6 +84,7 @@ func TestAccAWSCodeBuildWebhook_GitHubEnterprise(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildWebhookDestroy, Steps: []resource.TestStep{ @@ -130,6 +133,7 @@ func TestAccAWSCodeBuildWebhook_BranchFilter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildWebhookDestroy, Steps: []resource.TestStep{ @@ -164,6 +168,7 @@ func TestAccAWSCodeBuildWebhook_FilterGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCodeBuild(t) }, + ErrorCheck: testAccErrorCheck(t, codebuild.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeBuildWebhookDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codecommit_repository_test.go b/aws/resource_aws_codecommit_repository_test.go index e7f73ea43903..5c10c7fa05f5 100644 --- a/aws/resource_aws_codecommit_repository_test.go +++ b/aws/resource_aws_codecommit_repository_test.go @@ -18,6 +18,7 @@ func TestAccAWSCodeCommitRepository_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codecommit.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCodeCommitRepositoryDestroy, Steps: []resource.TestStep{ @@ -42,6 +43,7 @@ func TestAccAWSCodeCommitRepository_withChanges(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codecommit.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCodeCommitRepositoryDestroy, Steps: []resource.TestStep{ @@ -76,6 +78,7 @@ func TestAccAWSCodeCommitRepository_create_default_branch(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codecommit.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCodeCommitRepositoryDestroy, Steps: []resource.TestStep{ @@ -103,6 +106,7 @@ func TestAccAWSCodeCommitRepository_create_and_update_default_branch(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codecommit.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCodeCommitRepositoryDestroy, Steps: []resource.TestStep{ @@ -137,6 +141,7 @@ func TestAccAWSCodeCommitRepository_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codecommit.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckCodeCommitRepositoryDestroy, diff --git a/aws/resource_aws_codecommit_trigger_test.go b/aws/resource_aws_codecommit_trigger_test.go index f43d30fefb84..a0085d77d542 100644 --- a/aws/resource_aws_codecommit_trigger_test.go +++ b/aws/resource_aws_codecommit_trigger_test.go @@ -18,6 +18,7 @@ func TestAccAWSCodeCommitTrigger_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codecommit.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCodeCommitTriggerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codedeploy_app_test.go b/aws/resource_aws_codedeploy_app_test.go index 2d635f84ba89..61db3b4c1416 100644 --- a/aws/resource_aws_codedeploy_app_test.go +++ b/aws/resource_aws_codedeploy_app_test.go @@ -19,6 +19,7 @@ func TestAccAWSCodeDeployApp_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployAppDestroy, Steps: []resource.TestStep{ @@ -54,6 +55,7 @@ func TestAccAWSCodeDeployApp_computePlatform(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployAppDestroy, Steps: []resource.TestStep{ @@ -83,6 +85,7 @@ func TestAccAWSCodeDeployApp_computePlatform_ECS(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployAppDestroy, Steps: []resource.TestStep{ @@ -109,6 +112,7 @@ func TestAccAWSCodeDeployApp_computePlatform_Lambda(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployAppDestroy, Steps: []resource.TestStep{ @@ -136,6 +140,7 @@ func TestAccAWSCodeDeployApp_name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployAppDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codedeploy_deployment_config_test.go b/aws/resource_aws_codedeploy_deployment_config_test.go index 3221eaecf987..6ea846fbf90b 100644 --- a/aws/resource_aws_codedeploy_deployment_config_test.go +++ b/aws/resource_aws_codedeploy_deployment_config_test.go @@ -19,6 +19,7 @@ func TestAccAWSCodeDeployDeploymentConfig_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentConfigDestroy, Steps: []resource.TestStep{ @@ -47,6 +48,7 @@ func TestAccAWSCodeDeployDeploymentConfig_fleetPercent(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentConfigDestroy, Steps: []resource.TestStep{ @@ -89,6 +91,7 @@ func TestAccAWSCodeDeployDeploymentConfig_hostCount(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentConfigDestroy, Steps: []resource.TestStep{ @@ -131,6 +134,7 @@ func TestAccAWSCodeDeployDeploymentConfig_trafficCanary(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentConfigDestroy, Steps: []resource.TestStep{ @@ -179,6 +183,7 @@ func TestAccAWSCodeDeployDeploymentConfig_trafficLinear(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentConfigDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codedeploy_deployment_group.go b/aws/resource_aws_codedeploy_deployment_group.go index 274741c735cd..e105f1ff3c6b 100644 --- a/aws/resource_aws_codedeploy_deployment_group.go +++ b/aws/resource_aws_codedeploy_deployment_group.go @@ -1107,14 +1107,14 @@ func ec2TagFiltersToMap(list []*codedeploy.EC2TagFilter) []map[string]interface{ result := make([]map[string]interface{}, 0, len(list)) for _, tf := range list { l := make(map[string]interface{}) - if tf.Key != nil && *tf.Key != "" { - l["key"] = *tf.Key + if v := tf.Key; aws.StringValue(v) != "" { + l["key"] = aws.StringValue(v) } - if tf.Value != nil && *tf.Value != "" { - l["value"] = *tf.Value + if v := tf.Value; aws.StringValue(v) != "" { + l["value"] = aws.StringValue(v) } - if tf.Type != nil && *tf.Type != "" { - l["type"] = *tf.Type + if v := tf.Type; aws.StringValue(v) != "" { + l["type"] = aws.StringValue(v) } result = append(result, l) } @@ -1126,14 +1126,14 @@ func onPremisesTagFiltersToMap(list []*codedeploy.TagFilter) []map[string]string result := make([]map[string]string, 0, len(list)) for _, tf := range list { l := make(map[string]string) - if tf.Key != nil && *tf.Key != "" { - l["key"] = *tf.Key + if v := tf.Key; aws.StringValue(v) != "" { + l["key"] = aws.StringValue(v) } - if tf.Value != nil && *tf.Value != "" { - l["value"] = *tf.Value + if v := tf.Value; aws.StringValue(v) != "" { + l["value"] = aws.StringValue(v) } - if tf.Type != nil && *tf.Type != "" { - l["type"] = *tf.Type + if v := tf.Type; aws.StringValue(v) != "" { + l["type"] = aws.StringValue(v) } result = append(result, l) } @@ -1168,8 +1168,8 @@ func triggerConfigsToMap(list []*codedeploy.TriggerConfig) []map[string]interfac for _, tc := range list { item := make(map[string]interface{}) item["trigger_events"] = flattenStringSet(tc.TriggerEvents) - item["trigger_name"] = *tc.TriggerName - item["trigger_target_arn"] = *tc.TriggerTargetArn + item["trigger_name"] = aws.StringValue(tc.TriggerName) + item["trigger_target_arn"] = aws.StringValue(tc.TriggerTargetArn) result = append(result, item) } return result @@ -1184,7 +1184,7 @@ func autoRollbackConfigToMap(config *codedeploy.AutoRollbackConfiguration) []map // otherwise empty configurations will be created if config != nil && (*config.Enabled || len(config.Events) > 0) { item := make(map[string]interface{}) - item["enabled"] = *config.Enabled + item["enabled"] = aws.BoolValue(config.Enabled) item["events"] = flattenStringSet(config.Events) result = append(result, item) } @@ -1207,8 +1207,8 @@ func alarmConfigToMap(config *codedeploy.AlarmConfiguration) []map[string]interf item := make(map[string]interface{}) item["alarms"] = flattenStringSet(names) - item["enabled"] = *config.Enabled - item["ignore_poll_alarm_failure"] = *config.IgnorePollAlarmFailure + item["enabled"] = aws.BoolValue(config.Enabled) + item["ignore_poll_alarm_failure"] = aws.BoolValue(config.IgnorePollAlarmFailure) result = append(result, item) } @@ -1311,11 +1311,11 @@ func flattenDeploymentStyle(style *codedeploy.DeploymentStyle) []map[string]inte } item := make(map[string]interface{}) - if style.DeploymentOption != nil { - item["deployment_option"] = *style.DeploymentOption + if v := style.DeploymentOption; v != nil { + item["deployment_option"] = aws.StringValue(v) } - if style.DeploymentType != nil { - item["deployment_type"] = *style.DeploymentType + if v := style.DeploymentType; v != nil { + item["deployment_type"] = aws.StringValue(v) } result := make([]map[string]interface{}, 0, 1) @@ -1351,11 +1351,11 @@ func flattenBlueGreenDeploymentConfig(config *codedeploy.BlueGreenDeploymentConf a := make([]map[string]interface{}, 0) deploymentReadyOption := make(map[string]interface{}) - if config.DeploymentReadyOption.ActionOnTimeout != nil { - deploymentReadyOption["action_on_timeout"] = *config.DeploymentReadyOption.ActionOnTimeout + if v := config.DeploymentReadyOption.ActionOnTimeout; v != nil { + deploymentReadyOption["action_on_timeout"] = aws.StringValue(v) } - if config.DeploymentReadyOption.WaitTimeInMinutes != nil { - deploymentReadyOption["wait_time_in_minutes"] = *config.DeploymentReadyOption.WaitTimeInMinutes + if v := config.DeploymentReadyOption.WaitTimeInMinutes; v != nil { + deploymentReadyOption["wait_time_in_minutes"] = aws.Int64Value(v) } m["deployment_ready_option"] = append(a, deploymentReadyOption) @@ -1365,8 +1365,8 @@ func flattenBlueGreenDeploymentConfig(config *codedeploy.BlueGreenDeploymentConf b := make([]map[string]interface{}, 0) greenFleetProvisioningOption := make(map[string]interface{}) - if config.GreenFleetProvisioningOption.Action != nil { - greenFleetProvisioningOption["action"] = *config.GreenFleetProvisioningOption.Action + if v := config.GreenFleetProvisioningOption.Action; v != nil { + greenFleetProvisioningOption["action"] = aws.StringValue(v) } m["green_fleet_provisioning_option"] = append(b, greenFleetProvisioningOption) @@ -1376,11 +1376,11 @@ func flattenBlueGreenDeploymentConfig(config *codedeploy.BlueGreenDeploymentConf c := make([]map[string]interface{}, 0) blueInstanceTerminationOption := make(map[string]interface{}) - if config.TerminateBlueInstancesOnDeploymentSuccess.Action != nil { - blueInstanceTerminationOption["action"] = *config.TerminateBlueInstancesOnDeploymentSuccess.Action + if v := config.TerminateBlueInstancesOnDeploymentSuccess.Action; v != nil { + blueInstanceTerminationOption["action"] = aws.StringValue(v) } - if config.TerminateBlueInstancesOnDeploymentSuccess.TerminationWaitTimeInMinutes != nil { - blueInstanceTerminationOption["termination_wait_time_in_minutes"] = *config.TerminateBlueInstancesOnDeploymentSuccess.TerminationWaitTimeInMinutes + if v := config.TerminateBlueInstancesOnDeploymentSuccess.TerminationWaitTimeInMinutes; v != nil { + blueInstanceTerminationOption["termination_wait_time_in_minutes"] = aws.Int64Value(v) } m["terminate_blue_instances_on_deployment_success"] = append(c, blueInstanceTerminationOption) diff --git a/aws/resource_aws_codedeploy_deployment_group_test.go b/aws/resource_aws_codedeploy_deployment_group_test.go index d5bae308bdbb..e91633029dbe 100644 --- a/aws/resource_aws_codedeploy_deployment_group_test.go +++ b/aws/resource_aws_codedeploy_deployment_group_test.go @@ -25,6 +25,7 @@ func TestAccAWSCodeDeployDeploymentGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -92,6 +93,7 @@ func TestAccAWSCodeDeployDeploymentGroup_basic_tagSet(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -162,6 +164,7 @@ func TestAccAWSCodeDeployDeploymentGroup_onPremiseTag(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -201,6 +204,7 @@ func TestAccAWSCodeDeployDeploymentGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -223,6 +227,7 @@ func TestAccAWSCodeDeployDeploymentGroup_triggerConfiguration_basic(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -270,6 +275,7 @@ func TestAccAWSCodeDeployDeploymentGroup_triggerConfiguration_multiple(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -329,6 +335,7 @@ func TestAccAWSCodeDeployDeploymentGroup_autoRollbackConfiguration_create(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -362,6 +369,7 @@ func TestAccAWSCodeDeployDeploymentGroup_autoRollbackConfiguration_update(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -409,6 +417,7 @@ func TestAccAWSCodeDeployDeploymentGroup_autoRollbackConfiguration_delete(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -450,6 +459,7 @@ func TestAccAWSCodeDeployDeploymentGroup_autoRollbackConfiguration_disable(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -496,6 +506,7 @@ func TestAccAWSCodeDeployDeploymentGroup_alarmConfiguration_create(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -531,6 +542,7 @@ func TestAccAWSCodeDeployDeploymentGroup_alarmConfiguration_update(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -582,6 +594,7 @@ func TestAccAWSCodeDeployDeploymentGroup_alarmConfiguration_delete(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -625,6 +638,7 @@ func TestAccAWSCodeDeployDeploymentGroup_alarmConfiguration_disable(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -676,6 +690,7 @@ func TestAccAWSCodeDeployDeploymentGroup_deploymentStyle_default(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -708,6 +723,7 @@ func TestAccAWSCodeDeployDeploymentGroup_deploymentStyle_create(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -748,6 +764,7 @@ func TestAccAWSCodeDeployDeploymentGroup_deploymentStyle_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -793,6 +810,7 @@ func TestAccAWSCodeDeployDeploymentGroup_deploymentStyle_delete(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -837,6 +855,7 @@ func TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_create(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -870,6 +889,7 @@ func TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -916,6 +936,7 @@ func TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_delete(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -957,6 +978,7 @@ func TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_targetGroupInfo_create resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -991,6 +1013,7 @@ func TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_targetGroupInfo_update resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -1037,6 +1060,7 @@ func TestAccAWSCodeDeployDeploymentGroup_loadBalancerInfo_targetGroupInfo_delete resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -1078,6 +1102,7 @@ func TestAccAWSCodeDeployDeploymentGroup_inPlaceDeploymentWithTrafficControl_cre resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -1118,6 +1143,7 @@ func TestAccAWSCodeDeployDeploymentGroup_inPlaceDeploymentWithTrafficControl_upd resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -1192,6 +1218,7 @@ func TestAccAWSCodeDeployDeploymentGroup_blueGreenDeploymentConfiguration_create resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -1246,6 +1273,7 @@ func TestAccAWSCodeDeployDeploymentGroup_blueGreenDeploymentConfiguration_update resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -1312,6 +1340,7 @@ func TestAccAWSCodeDeployDeploymentGroup_blueGreenDeploymentConfiguration_update resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -1392,6 +1421,7 @@ func TestAccAWSCodeDeployDeploymentGroup_blueGreenDeploymentConfiguration_delete resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -1458,6 +1488,7 @@ func TestAccAWSCodeDeployDeploymentGroup_blueGreenDeployment_complete(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ @@ -1564,6 +1595,7 @@ func TestAccAWSCodeDeployDeploymentGroup_ECS_BlueGreen(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, codedeploy.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeDeployDeploymentGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codepipeline.go b/aws/resource_aws_codepipeline.go index bc0ddb3732c8..00101ff30fdd 100644 --- a/aws/resource_aws_codepipeline.go +++ b/aws/resource_aws_codepipeline.go @@ -348,7 +348,7 @@ func expandAwsCodePipelineActions(a []interface{}) []*codepipeline.ActionDeclara for _, config := range a { data := config.(map[string]interface{}) - conf := expandAwsCodePipelineStageActionConfiguration(data["configuration"].(map[string]interface{})) + conf := stringMapToPointers(data["configuration"].(map[string]interface{})) action := codepipeline.ActionDeclaration{ ActionTypeId: &codepipeline.ActionTypeId{ @@ -406,7 +406,7 @@ func flattenAwsCodePipelineStageActions(si int, actions []*codepipeline.ActionDe "name": aws.StringValue(action.Name), } if action.Configuration != nil { - config := flattenAwsCodePipelineStageActionConfiguration(action.Configuration) + config := aws.StringValueMap(action.Configuration) actionProvider := aws.StringValue(action.ActionTypeId.Provider) if actionProvider == CodePipelineProviderGitHub { @@ -449,23 +449,6 @@ func flattenAwsCodePipelineStageActions(si int, actions []*codepipeline.ActionDe return actionsList } -func expandAwsCodePipelineStageActionConfiguration(config map[string]interface{}) map[string]*string { - m := map[string]*string{} - for k, v := range config { - s := v.(string) - m[k] = &s - } - return m -} - -func flattenAwsCodePipelineStageActionConfiguration(config map[string]*string) map[string]string { - m := map[string]string{} - for k, v := range config { - m[k] = *v - } - return m -} - func expandAwsCodePipelineActionsOutputArtifacts(s []interface{}) []*codepipeline.OutputArtifact { outputArtifacts := []*codepipeline.OutputArtifact{} for _, artifact := range s { @@ -482,7 +465,7 @@ func expandAwsCodePipelineActionsOutputArtifacts(s []interface{}) []*codepipelin func flattenAwsCodePipelineActionsOutputArtifacts(artifacts []*codepipeline.OutputArtifact) []string { values := []string{} for _, artifact := range artifacts { - values = append(values, *artifact.Name) + values = append(values, aws.StringValue(artifact.Name)) } return values } @@ -503,7 +486,7 @@ func expandAwsCodePipelineActionsInputArtifacts(s []interface{}) []*codepipeline func flattenAwsCodePipelineActionsInputArtifacts(artifacts []*codepipeline.InputArtifact) []string { values := []string{} for _, artifact := range artifacts { - values = append(values, *artifact.Name) + values = append(values, aws.StringValue(artifact.Name)) } return values } diff --git a/aws/resource_aws_codepipeline_test.go b/aws/resource_aws_codepipeline_test.go index 70f61c09c135..c94b89af3db6 100644 --- a/aws/resource_aws_codepipeline_test.go +++ b/aws/resource_aws_codepipeline_test.go @@ -27,6 +27,7 @@ func TestAccAWSCodePipeline_basic(t *testing.T) { testAccPreCheckAWSCodePipelineSupported(t) testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -131,6 +132,7 @@ func TestAccAWSCodePipeline_disappears(t *testing.T) { testAccPreCheckAWSCodePipelineSupported(t) testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -157,6 +159,7 @@ func TestAccAWSCodePipeline_emptyStageArtifacts(t *testing.T) { testAccPreCheckAWSCodePipelineSupported(t) testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -198,6 +201,7 @@ func TestAccAWSCodePipeline_deployWithServiceRole(t *testing.T) { testAccPreCheckAWSCodePipelineSupported(t) testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -230,6 +234,7 @@ func TestAccAWSCodePipeline_tags(t *testing.T) { testAccPreCheckAWSCodePipelineSupported(t) testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -288,6 +293,7 @@ func TestAccAWSCodePipeline_multiregion_basic(t *testing.T) { testAccPreCheckAWSCodePipelineSupported(t, testAccGetAlternateRegion()) testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -329,6 +335,7 @@ func TestAccAWSCodePipeline_multiregion_Update(t *testing.T) { testAccPreCheckAWSCodePipelineSupported(t, testAccGetAlternateRegion()) testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -384,6 +391,7 @@ func TestAccAWSCodePipeline_multiregion_ConvertSingleRegion(t *testing.T) { testAccPreCheckAWSCodePipelineSupported(t, testAccGetAlternateRegion()) testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -446,6 +454,7 @@ func TestAccAWSCodePipeline_WithNamespace(t *testing.T) { testAccPreCheckAWSCodePipelineSupported(t) testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -478,6 +487,7 @@ func TestAccAWSCodePipeline_WithGitHubv1SourceAction(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSCodePipelineSupported(t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codepipeline_webhook_test.go b/aws/resource_aws_codepipeline_webhook_test.go index 07de47ac9a0c..6358fa7874f4 100644 --- a/aws/resource_aws_codepipeline_webhook_test.go +++ b/aws/resource_aws_codepipeline_webhook_test.go @@ -26,6 +26,7 @@ func TestAccAWSCodePipelineWebhook_basic(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSCodePipelineSupported(t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -60,6 +61,7 @@ func TestAccAWSCodePipelineWebhook_ipAuth(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSCodePipelineSupported(t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -94,6 +96,7 @@ func TestAccAWSCodePipelineWebhook_unauthenticated(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSCodePipelineSupported(t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -126,6 +129,7 @@ func TestAccAWSCodePipelineWebhook_tags(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSCodePipelineSupported(t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ @@ -189,6 +193,7 @@ func TestAccAWSCodePipelineWebhook_UpdateAuthenticationConfiguration_SecretToken testAccPreCheck(t) testAccPreCheckAWSCodePipelineSupported(t) }, + ErrorCheck: testAccErrorCheck(t, codepipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodePipelineDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codestarconnections_connection.go b/aws/resource_aws_codestarconnections_connection.go index ce2fe09db252..1d58920cc974 100644 --- a/aws/resource_aws_codestarconnections_connection.go +++ b/aws/resource_aws_codestarconnections_connection.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/codestarconnections/finder" ) func resourceAwsCodeStarConnectionsConnection() *schema.Resource { @@ -77,9 +78,7 @@ func resourceAwsCodeStarConnectionsConnectionRead(d *schema.ResourceData, meta i conn := meta.(*AWSClient).codestarconnectionsconn ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig - resp, err := conn.GetConnection(&codestarconnections.GetConnectionInput{ - ConnectionArn: aws.String(d.Id()), - }) + connection, err := finder.ConnectionByArn(conn, d.Id()) if tfawserr.ErrCodeEquals(err, codestarconnections.ErrCodeResourceNotFoundException) { log.Printf("[WARN] CodeStar connection (%s) not found, removing from state", d.Id()) d.SetId("") @@ -89,16 +88,16 @@ func resourceAwsCodeStarConnectionsConnectionRead(d *schema.ResourceData, meta i return fmt.Errorf("error reading CodeStar connection: %w", err) } - if resp == nil || resp.Connection == nil { + if connection == nil { return fmt.Errorf("error reading CodeStar connection (%s): empty response", d.Id()) } - arn := aws.StringValue(resp.Connection.ConnectionArn) + arn := aws.StringValue(connection.ConnectionArn) d.SetId(arn) - d.Set("arn", resp.Connection.ConnectionArn) - d.Set("name", resp.Connection.ConnectionName) - d.Set("connection_status", resp.Connection.ConnectionStatus) - d.Set("provider_type", resp.Connection.ProviderType) + d.Set("arn", connection.ConnectionArn) + d.Set("connection_status", connection.ConnectionStatus) + d.Set("name", connection.ConnectionName) + d.Set("provider_type", connection.ProviderType) tags, err := keyvaluetags.CodestarconnectionsListTags(conn, arn) diff --git a/aws/resource_aws_codestarconnections_connection_test.go b/aws/resource_aws_codestarconnections_connection_test.go index 4d2826584fd7..09f93ac269ae 100644 --- a/aws/resource_aws_codestarconnections_connection_test.go +++ b/aws/resource_aws_codestarconnections_connection_test.go @@ -20,6 +20,7 @@ func TestAccAWSCodeStarConnectionsConnection_Basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codestarconnections.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeStarConnectionsConnectionDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSCodeStarConnectionsConnection_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codestarconnections.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeStarConnectionsConnectionDestroy, Steps: []resource.TestStep{ @@ -72,6 +74,7 @@ func TestAccAWSCodeStarConnectionsConnection_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codestarconnections.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codestarconnections.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeStarConnectionsConnectionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_codestarnotifications_notification_rule_test.go b/aws/resource_aws_codestarnotifications_notification_rule_test.go index 789d04d09c80..5765409bae0d 100644 --- a/aws/resource_aws_codestarnotifications_notification_rule_test.go +++ b/aws/resource_aws_codestarnotifications_notification_rule_test.go @@ -18,6 +18,7 @@ func TestAccAWSCodeStarNotificationsNotificationRule_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codestarnotifications.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codestarnotifications.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeStarNotificationsNotificationRuleDestroy, Steps: []resource.TestStep{ @@ -48,6 +49,7 @@ func TestAccAWSCodeStarNotificationsNotificationRule_Status(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codestarnotifications.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codestarnotifications.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeStarNotificationsNotificationRuleDestroy, Steps: []resource.TestStep{ @@ -84,6 +86,7 @@ func TestAccAWSCodeStarNotificationsNotificationRule_Targets(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codestarnotifications.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codestarnotifications.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeStarNotificationsNotificationRuleDestroy, Steps: []resource.TestStep{ @@ -120,6 +123,7 @@ func TestAccAWSCodeStarNotificationsNotificationRule_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codestarnotifications.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codestarnotifications.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeStarNotificationsNotificationRuleDestroy, Steps: []resource.TestStep{ @@ -162,6 +166,7 @@ func TestAccAWSCodeStarNotificationsNotificationRule_EventTypeIds(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(codestarnotifications.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, codestarnotifications.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCodeStarNotificationsNotificationRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cognito_identity_pool_roles_attachment_test.go b/aws/resource_aws_cognito_identity_pool_roles_attachment_test.go index af012f813e58..1ebbdf00ed2d 100644 --- a/aws/resource_aws_cognito_identity_pool_roles_attachment_test.go +++ b/aws/resource_aws_cognito_identity_pool_roles_attachment_test.go @@ -20,6 +20,7 @@ func TestAccAWSCognitoIdentityPoolRolesAttachment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolRolesAttachmentDestroy, Steps: []resource.TestStep{ @@ -54,6 +55,7 @@ func TestAccAWSCognitoIdentityPoolRolesAttachment_roleMappings(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolRolesAttachmentDestroy, Steps: []resource.TestStep{ @@ -108,6 +110,7 @@ func TestAccAWSCognitoIdentityPoolRolesAttachment_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolRolesAttachmentDestroy, Steps: []resource.TestStep{ @@ -128,6 +131,7 @@ func TestAccAWSCognitoIdentityPoolRolesAttachment_roleMappingsWithAmbiguousRoleR resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolRolesAttachmentDestroy, Steps: []resource.TestStep{ @@ -144,6 +148,7 @@ func TestAccAWSCognitoIdentityPoolRolesAttachment_roleMappingsWithRulesTypeError resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolRolesAttachmentDestroy, Steps: []resource.TestStep{ @@ -160,6 +165,7 @@ func TestAccAWSCognitoIdentityPoolRolesAttachment_roleMappingsWithTokenTypeError resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolRolesAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cognito_identity_pool_test.go b/aws/resource_aws_cognito_identity_pool_test.go index 22029caf6266..fe4bb43c7853 100644 --- a/aws/resource_aws_cognito_identity_pool_test.go +++ b/aws/resource_aws_cognito_identity_pool_test.go @@ -21,6 +21,7 @@ func TestAccAWSCognitoIdentityPool_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy, Steps: []resource.TestStep{ @@ -55,6 +56,7 @@ func TestAccAWSCognitoIdentityPool_supportedLoginProviders(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy, Steps: []resource.TestStep{ @@ -97,6 +99,7 @@ func TestAccAWSCognitoIdentityPool_openidConnectProviderArns(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy, Steps: []resource.TestStep{ @@ -138,6 +141,7 @@ func TestAccAWSCognitoIdentityPool_samlProviderArns(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy, Steps: []resource.TestStep{ @@ -180,6 +184,7 @@ func TestAccAWSCognitoIdentityPool_cognitoIdentityProviders(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy, Steps: []resource.TestStep{ @@ -234,6 +239,7 @@ func TestAccAWSCognitoIdentityPool_addingNewProviderKeepsOldProvider(t *testing. resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy, Steps: []resource.TestStep{ @@ -278,6 +284,7 @@ func TestAccAWSCognitoIdentityPool_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentity(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentity.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityPoolDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cognito_identity_provider_test.go b/aws/resource_aws_cognito_identity_provider_test.go index 1c7b1ad326b6..599f58824bfb 100644 --- a/aws/resource_aws_cognito_identity_provider_test.go +++ b/aws/resource_aws_cognito_identity_provider_test.go @@ -18,6 +18,7 @@ func TestAccAWSCognitoIdentityProvider_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoIdentityProviderDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cognito_resource_server_test.go b/aws/resource_aws_cognito_resource_server_test.go index 0cc3312a5760..b52813634ca5 100644 --- a/aws/resource_aws_cognito_resource_server_test.go +++ b/aws/resource_aws_cognito_resource_server_test.go @@ -22,6 +22,7 @@ func TestAccAWSCognitoResourceServer_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoResourceServerDestroy, Steps: []resource.TestStep{ @@ -63,6 +64,7 @@ func TestAccAWSCognitoResourceServer_scope(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoResourceServerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cognito_user_group_test.go b/aws/resource_aws_cognito_user_group_test.go index 545d19a071bb..140496f4135d 100644 --- a/aws/resource_aws_cognito_user_group_test.go +++ b/aws/resource_aws_cognito_user_group_test.go @@ -21,6 +21,7 @@ func TestAccAWSCognitoUserGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserGroupDestroy, Steps: []resource.TestStep{ @@ -55,6 +56,7 @@ func TestAccAWSCognitoUserGroup_complex(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserGroupDestroy, Steps: []resource.TestStep{ @@ -93,6 +95,7 @@ func TestAccAWSCognitoUserGroup_RoleArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cognito_user_pool.go b/aws/resource_aws_cognito_user_pool.go index d4c62a7f92ff..87a63e637f5d 100644 --- a/aws/resource_aws_cognito_user_pool.go +++ b/aws/resource_aws_cognito_user_pool.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsCognitoUserPool() *schema.Resource { @@ -692,7 +693,7 @@ func resourceAwsCognitoUserPoolCreate(d *schema.ResourceData, meta interface{}) // IAM roles & policies can take some time to propagate and be attached // to the User Pool var resp *cognitoidentityprovider.CreateUserPoolOutput - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error resp, err = conn.CreateUserPool(params) if isAWSErr(err, cognitoidentityprovider.ErrCodeInvalidSmsRoleTrustRelationshipException, "Role does not have a trust relationship allowing Cognito to assume the role") { @@ -735,7 +736,7 @@ func resourceAwsCognitoUserPoolCreate(d *schema.ResourceData, meta interface{}) } // IAM Roles and Policies can take some time to propagate - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := conn.SetUserPoolMfaConfig(input) if isAWSErr(err, cognitoidentityprovider.ErrCodeInvalidSmsRoleTrustRelationshipException, "Role does not have a trust relationship allowing Cognito to assume the role") { @@ -923,7 +924,7 @@ func resourceAwsCognitoUserPoolUpdate(d *schema.ResourceData, meta interface{}) } // IAM Roles and Policies can take some time to propagate - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := conn.SetUserPoolMfaConfig(input) if isAWSErr(err, cognitoidentityprovider.ErrCodeInvalidSmsRoleTrustRelationshipException, "Role does not have a trust relationship allowing Cognito to assume the role") { @@ -1124,7 +1125,7 @@ func resourceAwsCognitoUserPoolUpdate(d *schema.ResourceData, meta interface{}) // IAM roles & policies can take some time to propagate and be attached // to the User Pool. - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error _, err = conn.UpdateUserPool(params) if isAWSErr(err, cognitoidentityprovider.ErrCodeInvalidSmsRoleTrustRelationshipException, "Role does not have a trust relationship allowing Cognito to assume the role") { diff --git a/aws/resource_aws_cognito_user_pool_client_test.go b/aws/resource_aws_cognito_user_pool_client_test.go index c6f90a14c5a4..20b0d914838a 100644 --- a/aws/resource_aws_cognito_user_pool_client_test.go +++ b/aws/resource_aws_cognito_user_pool_client_test.go @@ -20,6 +20,7 @@ func TestAccAWSCognitoUserPoolClient_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func TestAccAWSCognitoUserPoolClient_refreshTokenValidity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy, Steps: []resource.TestStep{ @@ -85,6 +87,7 @@ func TestAccAWSCognitoUserPoolClient_accessTokenValidity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy, Steps: []resource.TestStep{ @@ -119,6 +122,7 @@ func TestAccAWSCognitoUserPoolClient_idTokenValidity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy, Steps: []resource.TestStep{ @@ -153,6 +157,7 @@ func TestAccAWSCognitoUserPoolClient_tokenValidityUnits(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy, Steps: []resource.TestStep{ @@ -193,6 +198,7 @@ func TestAccAWSCognitoUserPoolClient_tokenValidityUnitsWTokenValidity(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy, Steps: []resource.TestStep{ @@ -235,6 +241,7 @@ func TestAccAWSCognitoUserPoolClient_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy, Steps: []resource.TestStep{ @@ -270,6 +277,7 @@ func TestAccAWSCognitoUserPoolClient_allFields(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy, Steps: []resource.TestStep{ @@ -326,6 +334,7 @@ func TestAccAWSCognitoUserPoolClient_allFieldsUpdatingOneField(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy, Steps: []resource.TestStep{ @@ -475,6 +484,7 @@ func TestAccAWSCognitoUserPoolClient_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy, Steps: []resource.TestStep{ @@ -498,6 +508,7 @@ func TestAccAWSCognitoUserPoolClient_disappears_userPool(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolClientDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cognito_user_pool_domain_test.go b/aws/resource_aws_cognito_user_pool_domain_test.go index 11c4d6149eb2..b8251e280b8e 100644 --- a/aws/resource_aws_cognito_user_pool_domain_test.go +++ b/aws/resource_aws_cognito_user_pool_domain_test.go @@ -79,6 +79,7 @@ func TestAccAWSCognitoUserPoolDomain_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDomainDestroy, Steps: []resource.TestStep{ @@ -114,6 +115,7 @@ func TestAccAWSCognitoUserPoolDomain_custom(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckCognitoUserPoolCustomDomain(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSCognitoUserPoolDomainDestroy, Steps: []resource.TestStep{ @@ -147,6 +149,7 @@ func TestAccAWSCognitoUserPoolDomain_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDomainDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cognito_user_pool_test.go b/aws/resource_aws_cognito_user_pool_test.go index 1b0aa2d60974..ef0f3f728cfd 100644 --- a/aws/resource_aws_cognito_user_pool_test.go +++ b/aws/resource_aws_cognito_user_pool_test.go @@ -74,6 +74,7 @@ func TestAccAWSCognitoUserPool_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -107,6 +108,7 @@ func TestAccAWSCognitoUserPool_recovery(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -152,6 +154,7 @@ func TestAccAWSCognitoUserPool_withAdminCreateUserConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -190,6 +193,7 @@ func TestAccAWSCognitoUserPool_withAdminCreateUserConfigurationAndPasswordPolicy resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -254,6 +258,7 @@ func TestAccAWSCognitoUserPool_withDeviceConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -291,6 +296,7 @@ func TestAccAWSCognitoUserPool_withEmailVerificationMessage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -325,6 +331,7 @@ func TestAccAWSCognitoUserPool_MfaConfiguration_SmsConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -372,6 +379,7 @@ func TestAccAWSCognitoUserPool_MfaConfiguration_SmsConfigurationAndSoftwareToken resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -421,6 +429,7 @@ func TestAccAWSCognitoUserPool_MfaConfiguration_SmsConfigurationToSoftwareTokenM resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -458,6 +467,7 @@ func TestAccAWSCognitoUserPool_MfaConfiguration_SoftwareTokenMfaConfiguration(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -503,6 +513,7 @@ func TestAccAWSCognitoUserPool_MfaConfiguration_SoftwareTokenMfaConfigurationToS resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -542,6 +553,7 @@ func TestAccAWSCognitoUserPool_SmsAuthenticationMessage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -575,6 +587,7 @@ func TestAccAWSCognitoUserPool_SmsConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -619,6 +632,7 @@ func TestAccAWSCognitoUserPool_SmsConfiguration_ExternalId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -656,6 +670,7 @@ func TestAccAWSCognitoUserPool_SmsConfiguration_SnsCallerArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -694,6 +709,7 @@ func TestAccAWSCognitoUserPool_SmsVerificationMessage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -726,6 +742,7 @@ func TestAccAWSCognitoUserPool_withEmailConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -761,6 +778,7 @@ func TestAccAWSCognitoUserPool_withEmailConfigurationSource(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -785,6 +803,7 @@ func TestAccAWSCognitoUserPool_withTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -827,6 +846,7 @@ func TestAccAWSCognitoUserPool_withAliasAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -864,6 +884,7 @@ func TestAccAWSCognitoUserPool_withPasswordPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -907,6 +928,7 @@ func TestAccAWSCognitoUserPool_withUsernameConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -941,6 +963,7 @@ func TestAccAWSCognitoUserPool_withLambdaConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -992,6 +1015,7 @@ func TestAccAWSCognitoUserPool_withSchemaAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -1081,6 +1105,7 @@ func TestAccAWSCognitoUserPool_withVerificationMessageTemplate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -1138,6 +1163,7 @@ func TestAccAWSCognitoUserPool_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ @@ -1222,6 +1248,7 @@ func TestAccAWSCognitoUserPool_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cognito_user_pool_ui_customization_test.go b/aws/resource_aws_cognito_user_pool_ui_customization_test.go index 03c5611633a7..fb4ca1fea75e 100644 --- a/aws/resource_aws_cognito_user_pool_ui_customization_test.go +++ b/aws/resource_aws_cognito_user_pool_ui_customization_test.go @@ -23,6 +23,7 @@ func TestAccAWSCognitoUserPoolUICustomization_AllClients_CSS(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolUICustomizationDestroy, Steps: []resource.TestStep{ @@ -72,6 +73,7 @@ func TestAccAWSCognitoUserPoolUICustomization_AllClients_Disappears(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolUICustomizationDestroy, Steps: []resource.TestStep{ @@ -97,6 +99,7 @@ func TestAccAWSCognitoUserPoolUICustomization_AllClients_ImageFile(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolUICustomizationDestroy, Steps: []resource.TestStep{ @@ -149,6 +152,7 @@ func TestAccAWSCognitoUserPoolUICustomization_AllClients_CSSAndImageFile(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolUICustomizationDestroy, Steps: []resource.TestStep{ @@ -215,6 +219,7 @@ func TestAccAWSCognitoUserPoolUICustomization_Client_CSS(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolUICustomizationDestroy, Steps: []resource.TestStep{ @@ -264,6 +269,7 @@ func TestAccAWSCognitoUserPoolUICustomization_Client_Disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSCognitoIdentityProvider(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolUICustomizationDestroy, Steps: []resource.TestStep{ @@ -290,6 +296,7 @@ func TestAccAWSCognitoUserPoolUICustomization_Client_Image(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolUICustomizationDestroy, Steps: []resource.TestStep{ @@ -344,6 +351,7 @@ func TestAccAWSCognitoUserPoolUICustomization_ClientAndAll_CSS(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolUICustomizationDestroy, Steps: []resource.TestStep{ @@ -415,6 +423,7 @@ func TestAccAWSCognitoUserPoolUICustomization_UpdateClientToAll_CSS(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolUICustomizationDestroy, Steps: []resource.TestStep{ @@ -453,6 +462,7 @@ func TestAccAWSCognitoUserPoolUICustomization_UpdateAllToClient_CSS(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cognitoidentityprovider.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCognitoUserPoolUICustomizationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_config_aggregate_authorization_test.go b/aws/resource_aws_config_aggregate_authorization_test.go index 7c6675c2e37b..bf34a2fd2ed3 100644 --- a/aws/resource_aws_config_aggregate_authorization_test.go +++ b/aws/resource_aws_config_aggregate_authorization_test.go @@ -64,6 +64,7 @@ func TestAccAWSConfigAggregateAuthorization_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSConfigAggregateAuthorizationDestroy, Steps: []resource.TestStep{ @@ -90,6 +91,7 @@ func TestAccAWSConfigAggregateAuthorization_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSConfigAggregateAuthorizationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_config_config_rule.go b/aws/resource_aws_config_config_rule.go index bb0e37e1df7c..603dcc3ce340 100644 --- a/aws/resource_aws_config_config_rule.go +++ b/aws/resource_aws_config_config_rule.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsConfigConfigRule() *schema.Resource { @@ -166,7 +167,7 @@ func resourceAwsConfigConfigRulePut(d *schema.ResourceData, meta interface{}) er Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().ConfigserviceTags(), } log.Printf("[DEBUG] Creating AWSConfig config rule: %s", input) - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := conn.PutConfigRule(&input) if err != nil { if awsErr, ok := err.(awserr.Error); ok { diff --git a/aws/resource_aws_config_config_rule_test.go b/aws/resource_aws_config_config_rule_test.go index d3eae39a2e36..eb8bd4580f16 100644 --- a/aws/resource_aws_config_config_rule_test.go +++ b/aws/resource_aws_config_config_rule_test.go @@ -19,6 +19,7 @@ func testAccConfigConfigRule_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigConfigRuleDestroy, Steps: []resource.TestStep{ @@ -44,6 +45,7 @@ func testAccConfigConfigRule_ownerAws(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigConfigRuleDestroy, Steps: []resource.TestStep{ @@ -80,6 +82,7 @@ func testAccConfigConfigRule_customlambda(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigConfigRuleDestroy, Steps: []resource.TestStep{ @@ -117,6 +120,7 @@ func testAccConfigConfigRule_importAws(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigConfigRuleDestroy, Steps: []resource.TestStep{ @@ -141,6 +145,7 @@ func testAccConfigConfigRule_importLambda(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigConfigRuleDestroy, Steps: []resource.TestStep{ @@ -164,6 +169,7 @@ func testAccConfigConfigRule_Scope_TagKey(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigConfigRuleDestroy, Steps: []resource.TestStep{ @@ -194,6 +200,7 @@ func testAccConfigConfigRule_Scope_TagKey_Empty(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigConfigRuleDestroy, Steps: []resource.TestStep{ @@ -214,6 +221,7 @@ func testAccConfigConfigRule_Scope_TagValue(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigConfigRuleDestroy, Steps: []resource.TestStep{ @@ -244,6 +252,7 @@ func testAccConfigConfigRule_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigConfigRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_config_configuration_aggregator.go b/aws/resource_aws_config_configuration_aggregator.go index 71afa91648f4..4561acec6fe8 100644 --- a/aws/resource_aws_config_configuration_aggregator.go +++ b/aws/resource_aws_config_configuration_aggregator.go @@ -4,7 +4,6 @@ import ( "context" "fmt" "log" - "strings" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/configservice" @@ -115,35 +114,33 @@ func resourceAwsConfigConfigurationAggregator() *schema.Resource { func resourceAwsConfigConfigurationAggregatorPut(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).configconn - name := d.Get("name").(string) - req := &configservice.PutConfigurationAggregatorInput{ - ConfigurationAggregatorName: aws.String(name), + ConfigurationAggregatorName: aws.String(d.Get("name").(string)), Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().ConfigserviceTags(), } - account_aggregation_sources := d.Get("account_aggregation_source").([]interface{}) - if len(account_aggregation_sources) > 0 { - req.AccountAggregationSources = expandConfigAccountAggregationSources(account_aggregation_sources) + if v, ok := d.GetOk("account_aggregation_source"); ok && len(v.([]interface{})) > 0 { + req.AccountAggregationSources = expandConfigAccountAggregationSources(v.([]interface{})) } - organization_aggregation_sources := d.Get("organization_aggregation_source").([]interface{}) - if len(organization_aggregation_sources) > 0 { - req.OrganizationAggregationSource = expandConfigOrganizationAggregationSource(organization_aggregation_sources[0].(map[string]interface{})) + if v, ok := d.GetOk("organization_aggregation_source"); ok && len(v.([]interface{})) > 0 { + req.OrganizationAggregationSource = expandConfigOrganizationAggregationSource(v.([]interface{})[0].(map[string]interface{})) } - _, err := conn.PutConfigurationAggregator(req) + resp, err := conn.PutConfigurationAggregator(req) if err != nil { - return fmt.Errorf("Error creating aggregator: %s", err) + return fmt.Errorf("error creating aggregator: %w", err) } - d.SetId(strings.ToLower(name)) + configAgg := resp.ConfigurationAggregator + d.SetId(aws.StringValue(configAgg.ConfigurationAggregatorName)) if !d.IsNewResource() && d.HasChange("tags") { o, n := d.GetChange("tags") - if err := keyvaluetags.ConfigserviceUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { - return fmt.Errorf("error updating Config Configuration Aggregator (%s) tags: %s", d.Get("arn").(string), err) + arn := aws.StringValue(configAgg.ConfigurationAggregatorArn) + if err := keyvaluetags.ConfigserviceUpdateTags(conn, arn, o, n); err != nil { + return fmt.Errorf("error updating Config Configuration Aggregator (%s) tags: %w", arn, err) } } @@ -175,7 +172,8 @@ func resourceAwsConfigConfigurationAggregatorRead(d *schema.ResourceData, meta i } aggregator := res.ConfigurationAggregators[0] - d.Set("arn", aggregator.ConfigurationAggregatorArn) + arn := aws.StringValue(aggregator.ConfigurationAggregatorArn) + d.Set("arn", arn) d.Set("name", aggregator.ConfigurationAggregatorName) if err := d.Set("account_aggregation_source", flattenConfigAccountAggregationSources(aggregator.AccountAggregationSources)); err != nil { @@ -186,14 +184,14 @@ func resourceAwsConfigConfigurationAggregatorRead(d *schema.ResourceData, meta i return fmt.Errorf("error setting organization_aggregation_source: %s", err) } - tags, err := keyvaluetags.ConfigserviceListTags(conn, d.Get("arn").(string)) + tags, err := keyvaluetags.ConfigserviceListTags(conn, arn) if err != nil { - return fmt.Errorf("error listing tags for Config Configuration Aggregator (%s): %s", d.Get("arn").(string), err) + return fmt.Errorf("error listing tags for Config Configuration Aggregator (%s): %w", arn, err) } if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + return fmt.Errorf("error setting tags: %w", err) } return nil @@ -206,10 +204,14 @@ func resourceAwsConfigConfigurationAggregatorDelete(d *schema.ResourceData, meta ConfigurationAggregatorName: aws.String(d.Id()), } _, err := conn.DeleteConfigurationAggregator(req) + + if isAWSErr(err, configservice.ErrCodeNoSuchConfigurationAggregatorException, "") { + return nil + } + if err != nil { - return err + return fmt.Errorf("error deleting Config Configuration Aggregator (%s): %w", d.Id(), err) } - d.SetId("") return nil } diff --git a/aws/resource_aws_config_configuration_aggregator_test.go b/aws/resource_aws_config_configuration_aggregator_test.go index db238e97c15c..a7efa74d30e7 100644 --- a/aws/resource_aws_config_configuration_aggregator_test.go +++ b/aws/resource_aws_config_configuration_aggregator_test.go @@ -3,6 +3,7 @@ package aws import ( "fmt" "log" + "regexp" "testing" "github.com/aws/aws-sdk-go/aws" @@ -49,7 +50,8 @@ func testSweepConfigConfigurationAggregators(region string) error { }) if err != nil { - return fmt.Errorf("Error deleting config configuration aggregator %s: %s", *agg.ConfigurationAggregatorName, err) + return fmt.Errorf("error deleting config configuration aggregator %s: %w", + aws.StringValue(agg.ConfigurationAggregatorName), err) } } @@ -58,11 +60,13 @@ func testSweepConfigConfigurationAggregators(region string) error { func TestAccAWSConfigConfigurationAggregator_account(t *testing.T) { var ca configservice.ConfigurationAggregator - rName := acctest.RandomWithPrefix("tf-acc-test") - resourceName := "aws_config_configuration_aggregator.example" + //Name is upper case on purpose to test https://github.com/terraform-providers/terraform-provider-aws/issues/8432 + rName := acctest.RandomWithPrefix("Tf-acc-test") + resourceName := "aws_config_configuration_aggregator.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSConfigConfigurationAggregatorDestroy, Steps: []resource.TestStep{ @@ -72,11 +76,13 @@ func TestAccAWSConfigConfigurationAggregator_account(t *testing.T) { testAccCheckAWSConfigConfigurationAggregatorExists(resourceName, &ca), testAccCheckAWSConfigConfigurationAggregatorName(resourceName, rName, &ca), resource.TestCheckResourceAttr(resourceName, "name", rName), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "config", regexp.MustCompile(`config-aggregator/config-aggregator-.+`)), resource.TestCheckResourceAttr(resourceName, "account_aggregation_source.#", "1"), resource.TestCheckResourceAttr(resourceName, "account_aggregation_source.0.account_ids.#", "1"), testAccCheckResourceAttrAccountID(resourceName, "account_aggregation_source.0.account_ids.0"), resource.TestCheckResourceAttr(resourceName, "account_aggregation_source.0.regions.#", "1"), resource.TestCheckResourceAttrPair(resourceName, "account_aggregation_source.0.regions.0", "data.aws_region.current", "name"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { @@ -91,10 +97,11 @@ func TestAccAWSConfigConfigurationAggregator_account(t *testing.T) { func TestAccAWSConfigConfigurationAggregator_organization(t *testing.T) { var ca configservice.ConfigurationAggregator rName := acctest.RandomWithPrefix("tf-acc-test") - resourceName := "aws_config_configuration_aggregator.example" + resourceName := "aws_config_configuration_aggregator.test" - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSConfigConfigurationAggregatorDestroy, Steps: []resource.TestStep{ @@ -105,7 +112,7 @@ func TestAccAWSConfigConfigurationAggregator_organization(t *testing.T) { testAccCheckAWSConfigConfigurationAggregatorName(resourceName, rName, &ca), resource.TestCheckResourceAttr(resourceName, "name", rName), resource.TestCheckResourceAttr(resourceName, "organization_aggregation_source.#", "1"), - resource.TestCheckResourceAttrPair(resourceName, "organization_aggregation_source.0.role_arn", "aws_iam_role.r", "arn"), + resource.TestCheckResourceAttrPair(resourceName, "organization_aggregation_source.0.role_arn", "aws_iam_role.test", "arn"), resource.TestCheckResourceAttr(resourceName, "organization_aggregation_source.0.all_regions", "true"), ), }, @@ -120,10 +127,11 @@ func TestAccAWSConfigConfigurationAggregator_organization(t *testing.T) { func TestAccAWSConfigConfigurationAggregator_switch(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") - resourceName := "aws_config_configuration_aggregator.example" + resourceName := "aws_config_configuration_aggregator.test" - resource.ParallelTest(t, resource.TestCase{ + resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSConfigConfigurationAggregatorDestroy, Steps: []resource.TestStep{ @@ -148,33 +156,31 @@ func TestAccAWSConfigConfigurationAggregator_switch(t *testing.T) { func TestAccAWSConfigConfigurationAggregator_tags(t *testing.T) { var ca configservice.ConfigurationAggregator rName := acctest.RandomWithPrefix("tf-acc-test") - resourceName := "aws_config_configuration_aggregator.example" + resourceName := "aws_config_configuration_aggregator.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSConfigConfigurationAggregatorDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSConfigConfigurationAggregatorConfig_tags(rName, "foo", "bar", "fizz", "buzz"), + Config: testAccAWSConfigConfigurationAggregatorConfigTags1(rName, "key1", "value1"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSConfigConfigurationAggregatorExists(resourceName, &ca), testAccCheckAWSConfigConfigurationAggregatorName(resourceName, rName, &ca), - resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), - resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar"), - resource.TestCheckResourceAttr(resourceName, "tags.fizz", "buzz"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), ), }, { - Config: testAccAWSConfigConfigurationAggregatorConfig_tags(rName, "foo", "bar2", "fizz2", "buzz2"), + Config: testAccAWSConfigConfigurationAggregatorConfigTags2(rName, "key1", "value1updated", "key2", "value2"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSConfigConfigurationAggregatorExists(resourceName, &ca), testAccCheckAWSConfigConfigurationAggregatorName(resourceName, rName, &ca), - resource.TestCheckResourceAttr(resourceName, "tags.%", "3"), - resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), - resource.TestCheckResourceAttr(resourceName, "tags.foo", "bar2"), - resource.TestCheckResourceAttr(resourceName, "tags.fizz2", "buzz2"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), ), }, { @@ -183,12 +189,36 @@ func TestAccAWSConfigConfigurationAggregator_tags(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccAWSConfigConfigurationAggregatorConfig_account(rName), + Config: testAccAWSConfigConfigurationAggregatorConfigTags1(rName, "key2", "value2"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSConfigConfigurationAggregatorExists(resourceName, &ca), testAccCheckAWSConfigConfigurationAggregatorName(resourceName, rName, &ca), - resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + }, + }) +} + +func TestAccAWSConfigConfigurationAggregator_disappears(t *testing.T) { + var ca configservice.ConfigurationAggregator + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_config_configuration_aggregator.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSConfigConfigurationAggregatorDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSConfigConfigurationAggregatorConfig_account(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSConfigConfigurationAggregatorExists(resourceName, &ca), + testAccCheckResourceDisappears(testAccProvider, resourceAwsConfigConfigurationAggregator(), resourceName), ), + ExpectNonEmptyPlan: true, }, }, }) @@ -200,8 +230,8 @@ func testAccCheckAWSConfigConfigurationAggregatorName(n, desired string, obj *co if !ok { return fmt.Errorf("Not found: %s", n) } - if rs.Primary.Attributes["name"] != *obj.ConfigurationAggregatorName { - return fmt.Errorf("Expected name: %q, given: %q", desired, *obj.ConfigurationAggregatorName) + if rs.Primary.Attributes["name"] != aws.StringValue(obj.ConfigurationAggregatorName) { + return fmt.Errorf("expected name: %q, given: %q", desired, aws.StringValue(obj.ConfigurationAggregatorName)) } return nil } @@ -250,7 +280,7 @@ func testAccCheckAWSConfigConfigurationAggregatorDestroy(s *terraform.State) err if err == nil { if len(resp.ConfigurationAggregators) != 0 && - *resp.ConfigurationAggregators[0].ConfigurationAggregatorName == rs.Primary.Attributes["name"] { + aws.StringValue(resp.ConfigurationAggregators[0].ConfigurationAggregatorName) == rs.Primary.Attributes["name"] { return fmt.Errorf("config configuration aggregator still exists: %s", rs.Primary.Attributes["name"]) } } @@ -261,40 +291,41 @@ func testAccCheckAWSConfigConfigurationAggregatorDestroy(s *terraform.State) err func testAccAWSConfigConfigurationAggregatorConfig_account(rName string) string { return fmt.Sprintf(` +data "aws_caller_identity" "current" {} + data "aws_region" "current" {} -resource "aws_config_configuration_aggregator" "example" { - name = %q +resource "aws_config_configuration_aggregator" "test" { + name = %[1]q account_aggregation_source { account_ids = [data.aws_caller_identity.current.account_id] regions = [data.aws_region.current.name] } } - -data "aws_caller_identity" "current" { -} `, rName) } func testAccAWSConfigConfigurationAggregatorConfig_organization(rName string) string { return fmt.Sprintf(` -resource "aws_organizations_organization" "test" {} +resource "aws_organizations_organization" "test" { + aws_service_access_principals = ["config.${data.aws_partition.current.dns_suffix}"] +} -resource "aws_config_configuration_aggregator" "example" { - depends_on = [aws_iam_role_policy_attachment.example] +resource "aws_config_configuration_aggregator" "test" { + depends_on = [aws_iam_role_policy_attachment.test, aws_organizations_organization.test] name = %[1]q organization_aggregation_source { all_regions = true - role_arn = aws_iam_role.example.arn + role_arn = aws_iam_role.test.arn } } data "aws_partition" "current" {} -resource "aws_iam_role" "example" { +resource "aws_iam_role" "test" { name = %[1]q assume_role_policy = < 0 { - item["static_value"] = *value.StaticValue.Values[0] + if v := value.StaticValue; v != nil && len(v.Values) > 0 { + item["static_value"] = aws.StringValue(v.Values[0]) } items = append(items, item) diff --git a/aws/resource_aws_config_remediation_configuration_test.go b/aws/resource_aws_config_remediation_configuration_test.go index f5a1e044af49..c651ddc54c24 100644 --- a/aws/resource_aws_config_remediation_configuration_test.go +++ b/aws/resource_aws_config_remediation_configuration_test.go @@ -21,6 +21,7 @@ func testAccConfigRemediationConfiguration_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigRemediationConfigurationDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func testAccConfigRemediationConfiguration_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigRemediationConfigurationDestroy, Steps: []resource.TestStep{ @@ -79,6 +81,7 @@ func testAccConfigRemediationConfiguration_recreates(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigRemediationConfigurationDestroy, Steps: []resource.TestStep{ @@ -113,6 +116,7 @@ func testAccConfigRemediationConfiguration_updates(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, configservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckConfigRemediationConfigurationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_cur_report_definition.go b/aws/resource_aws_cur_report_definition.go index 7be3a23fc90f..badfcbb53245 100644 --- a/aws/resource_aws_cur_report_definition.go +++ b/aws/resource_aws_cur_report_definition.go @@ -172,7 +172,7 @@ func resourceAwsCurReportDefinitionCreate(d *schema.ResourceData, meta interface func resourceAwsCurReportDefinitionRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).costandusagereportconn - reportName := *aws.String(d.Id()) + reportName := d.Id() matchingReportDefinition, err := describeCurReportDefinition(conn, reportName) if err != nil { diff --git a/aws/resource_aws_cur_report_definition_test.go b/aws/resource_aws_cur_report_definition_test.go index bb1d8e77aae3..8675269b9d58 100644 --- a/aws/resource_aws_cur_report_definition_test.go +++ b/aws/resource_aws_cur_report_definition_test.go @@ -19,6 +19,7 @@ func TestAccAwsCurReportDefinition_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) }, + ErrorCheck: testAccErrorCheck(t, costandusagereportservice.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy, Steps: []resource.TestStep{ @@ -54,6 +55,7 @@ func TestAccAwsCurReportDefinition_textOrCsv(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) }, + ErrorCheck: testAccErrorCheck(t, costandusagereportservice.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy, Steps: []resource.TestStep{ @@ -92,6 +94,7 @@ func TestAccAwsCurReportDefinition_parquet(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) }, + ErrorCheck: testAccErrorCheck(t, costandusagereportservice.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy, Steps: []resource.TestStep{ @@ -129,6 +132,7 @@ func TestAccAwsCurReportDefinition_athena(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) }, + ErrorCheck: testAccErrorCheck(t, costandusagereportservice.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy, Steps: []resource.TestStep{ @@ -167,6 +171,7 @@ func TestAccAwsCurReportDefinition_refresh(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) }, + ErrorCheck: testAccErrorCheck(t, costandusagereportservice.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy, Steps: []resource.TestStep{ @@ -205,6 +210,7 @@ func TestAccAwsCurReportDefinition_overwrite(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckCur(t) }, + ErrorCheck: testAccErrorCheck(t, costandusagereportservice.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsCurReportDefinitionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_customer_gateway_test.go b/aws/resource_aws_customer_gateway_test.go index 10f81b09ae1c..6ed7e1f06a9d 100644 --- a/aws/resource_aws_customer_gateway_test.go +++ b/aws/resource_aws_customer_gateway_test.go @@ -20,6 +20,7 @@ func TestAccAWSCustomerGateway_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckCustomerGatewayDestroy, @@ -55,6 +56,7 @@ func TestAccAWSCustomerGateway_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckCustomerGatewayDestroy, @@ -97,6 +99,7 @@ func TestAccAWSCustomerGateway_similarAlreadyExists(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckCustomerGatewayDestroy, @@ -127,6 +130,7 @@ func TestAccAWSCustomerGateway_deviceName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckCustomerGatewayDestroy, @@ -157,6 +161,7 @@ func TestAccAWSCustomerGateway_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckCustomerGatewayDestroy, Steps: []resource.TestStep{ @@ -179,6 +184,7 @@ func TestAccAWSCustomerGateway_4ByteAsn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckCustomerGatewayDestroy, diff --git a/aws/resource_aws_datapipeline_pipeline_test.go b/aws/resource_aws_datapipeline_pipeline_test.go index 2e1de55d551f..d9690aeb4ace 100644 --- a/aws/resource_aws_datapipeline_pipeline_test.go +++ b/aws/resource_aws_datapipeline_pipeline_test.go @@ -19,6 +19,7 @@ func TestAccAWSDataPipelinePipeline_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataPipeline(t) }, + ErrorCheck: testAccErrorCheck(t, datapipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataPipelinePipelineDestroy, Steps: []resource.TestStep{ @@ -53,6 +54,7 @@ func TestAccAWSDataPipelinePipeline_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataPipeline(t) }, + ErrorCheck: testAccErrorCheck(t, datapipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataPipelinePipelineDestroy, Steps: []resource.TestStep{ @@ -87,6 +89,7 @@ func TestAccAWSDataPipelinePipeline_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataPipeline(t) }, + ErrorCheck: testAccErrorCheck(t, datapipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataPipelinePipelineDestroy, Steps: []resource.TestStep{ @@ -109,6 +112,7 @@ func TestAccAWSDataPipelinePipeline_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataPipeline(t) }, + ErrorCheck: testAccErrorCheck(t, datapipeline.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataPipelinePipelineDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_datasync_agent_test.go b/aws/resource_aws_datasync_agent_test.go index 0672d4e0c36c..8ea500980331 100644 --- a/aws/resource_aws_datasync_agent_test.go +++ b/aws/resource_aws_datasync_agent_test.go @@ -81,6 +81,7 @@ func TestAccAWSDataSyncAgent_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncAgentDestroy, Steps: []resource.TestStep{ @@ -109,6 +110,7 @@ func TestAccAWSDataSyncAgent_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncAgentDestroy, Steps: []resource.TestStep{ @@ -132,6 +134,7 @@ func TestAccAWSDataSyncAgent_AgentName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncAgentDestroy, Steps: []resource.TestStep{ @@ -165,6 +168,7 @@ func TestAccAWSDataSyncAgent_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncAgentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_datasync_location_efs_test.go b/aws/resource_aws_datasync_location_efs_test.go index 1f65592faee3..750f65af240e 100644 --- a/aws/resource_aws_datasync_location_efs_test.go +++ b/aws/resource_aws_datasync_location_efs_test.go @@ -86,6 +86,7 @@ func TestAccAWSDataSyncLocationEfs_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationEfsDestroy, Steps: []resource.TestStep{ @@ -119,6 +120,7 @@ func TestAccAWSDataSyncLocationEfs_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationEfsDestroy, Steps: []resource.TestStep{ @@ -140,6 +142,7 @@ func TestAccAWSDataSyncLocationEfs_Subdirectory(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationEfsDestroy, Steps: []resource.TestStep{ @@ -166,6 +169,7 @@ func TestAccAWSDataSyncLocationEfs_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationEfsDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_datasync_location_fsx_windows_file_system_test.go b/aws/resource_aws_datasync_location_fsx_windows_file_system_test.go index 2b517e4379be..64e48bba911a 100644 --- a/aws/resource_aws_datasync_location_fsx_windows_file_system_test.go +++ b/aws/resource_aws_datasync_location_fsx_windows_file_system_test.go @@ -89,6 +89,7 @@ func TestAccAWSDataSyncLocationFsxWindows_basic(t *testing.T) { testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationFsxWindowsDestroy, Steps: []resource.TestStep{ @@ -125,6 +126,7 @@ func TestAccAWSDataSyncLocationFsxWindows_disappears(t *testing.T) { testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationFsxWindowsDestroy, Steps: []resource.TestStep{ @@ -150,6 +152,7 @@ func TestAccAWSDataSyncLocationFsxWindows_subdirectory(t *testing.T) { testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationFsxWindowsDestroy, Steps: []resource.TestStep{ @@ -181,6 +184,7 @@ func TestAccAWSDataSyncLocationFsxWindows_tags(t *testing.T) { testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationFsxWindowsDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_datasync_location_nfs_test.go b/aws/resource_aws_datasync_location_nfs_test.go index 3c89be8cadda..008d61096703 100644 --- a/aws/resource_aws_datasync_location_nfs_test.go +++ b/aws/resource_aws_datasync_location_nfs_test.go @@ -86,6 +86,7 @@ func TestAccAWSDataSyncLocationNfs_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationNfsDestroy, Steps: []resource.TestStep{ @@ -119,6 +120,7 @@ func TestAccAWSDataSyncLocationNfs_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationNfsDestroy, Steps: []resource.TestStep{ @@ -141,6 +143,7 @@ func TestAccAWSDataSyncLocationNfs_AgentARNs_Multple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationNfsDestroy, Steps: []resource.TestStep{ @@ -169,6 +172,7 @@ func TestAccAWSDataSyncLocationNfs_Subdirectory(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationNfsDestroy, Steps: []resource.TestStep{ @@ -196,6 +200,7 @@ func TestAccAWSDataSyncLocationNfs_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationNfsDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_datasync_location_s3.go b/aws/resource_aws_datasync_location_s3.go index 68a348abf6ce..472fdc34d8e6 100644 --- a/aws/resource_aws_datasync_location_s3.go +++ b/aws/resource_aws_datasync_location_s3.go @@ -4,7 +4,6 @@ import ( "fmt" "log" "strings" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/datasync" @@ -12,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsDataSyncLocationS3() *schema.Resource { @@ -88,7 +88,7 @@ func resourceAwsDataSyncLocationS3Create(d *schema.ResourceData, meta interface{ log.Printf("[DEBUG] Creating DataSync Location S3: %s", input) var output *datasync.CreateLocationS3Output - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error output, err = conn.CreateLocationS3(input) diff --git a/aws/resource_aws_datasync_location_s3_test.go b/aws/resource_aws_datasync_location_s3_test.go index ddb77535d38f..27a528b3205f 100644 --- a/aws/resource_aws_datasync_location_s3_test.go +++ b/aws/resource_aws_datasync_location_s3_test.go @@ -88,6 +88,7 @@ func TestAccAWSDataSyncLocationS3_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationS3Destroy, Steps: []resource.TestStep{ @@ -121,6 +122,7 @@ func TestAccAWSDataSyncLocationS3_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationS3Destroy, Steps: []resource.TestStep{ @@ -143,6 +145,7 @@ func TestAccAWSDataSyncLocationS3_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationS3Destroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_datasync_location_smb_test.go b/aws/resource_aws_datasync_location_smb_test.go index afc337201425..6e56e2c9c611 100644 --- a/aws/resource_aws_datasync_location_smb_test.go +++ b/aws/resource_aws_datasync_location_smb_test.go @@ -87,6 +87,7 @@ func TestAccAWSDataSyncLocationSmb_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationSmbDestroy, Steps: []resource.TestStep{ @@ -121,6 +122,7 @@ func TestAccAWSDataSyncLocationSmb_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationSmbDestroy, Steps: []resource.TestStep{ @@ -143,6 +145,7 @@ func TestAccAWSDataSyncLocationSmb_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncLocationSmbDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_datasync_task_test.go b/aws/resource_aws_datasync_task_test.go index c18418539d9a..e789c0c20cb1 100644 --- a/aws/resource_aws_datasync_task_test.go +++ b/aws/resource_aws_datasync_task_test.go @@ -84,6 +84,7 @@ func TestAccAWSDataSyncTask_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ @@ -125,6 +126,7 @@ func TestAccAWSDataSyncTask_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ @@ -147,6 +149,7 @@ func TestAccAWSDataSyncTask_CloudWatchLogGroupARN(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ @@ -173,6 +176,7 @@ func TestAccAWSDataSyncTask_DefaultSyncOptions_AtimeMtime(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ @@ -211,6 +215,7 @@ func TestAccAWSDataSyncTask_DefaultSyncOptions_BytesPerSecond(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ @@ -247,6 +252,7 @@ func TestAccAWSDataSyncTask_DefaultSyncOptions_Gid(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ @@ -283,6 +289,7 @@ func TestAccAWSDataSyncTask_DefaultSyncOptions_PosixPermissions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ @@ -319,6 +326,7 @@ func TestAccAWSDataSyncTask_DefaultSyncOptions_PreserveDeletedFiles(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ @@ -355,6 +363,7 @@ func TestAccAWSDataSyncTask_DefaultSyncOptions_PreserveDevices(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ @@ -391,6 +400,7 @@ func TestAccAWSDataSyncTask_DefaultSyncOptions_Uid(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ @@ -427,6 +437,7 @@ func TestAccAWSDataSyncTask_DefaultSyncOptions_VerifyMode(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ @@ -473,6 +484,7 @@ func TestAccAWSDataSyncTask_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDataSync(t) }, + ErrorCheck: testAccErrorCheck(t, datasync.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDataSyncTaskDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dax_cluster.go b/aws/resource_aws_dax_cluster.go index dc9cded4b39e..7382a03c3b21 100644 --- a/aws/resource_aws_dax_cluster.go +++ b/aws/resource_aws_dax_cluster.go @@ -14,6 +14,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsDaxCluster() *schema.Resource { @@ -224,7 +225,7 @@ func resourceAwsDaxClusterCreate(d *schema.ResourceData, meta interface{}) error // IAM roles take some time to propagate var resp *dax.CreateClusterOutput - err := resource.Retry(30*time.Second, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error resp, err = conn.CreateCluster(req) if err != nil { diff --git a/aws/resource_aws_dax_cluster_test.go b/aws/resource_aws_dax_cluster_test.go index 44f8969d2380..0b67a671382b 100644 --- a/aws/resource_aws_dax_cluster_test.go +++ b/aws/resource_aws_dax_cluster_test.go @@ -66,6 +66,7 @@ func TestAccAWSDAXCluster_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDax(t) }, + ErrorCheck: testAccErrorCheck(t, dax.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDAXClusterDestroy, Steps: []resource.TestStep{ @@ -119,6 +120,7 @@ func TestAccAWSDAXCluster_resize(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDax(t) }, + ErrorCheck: testAccErrorCheck(t, dax.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDAXClusterDestroy, Steps: []resource.TestStep{ @@ -162,6 +164,7 @@ func TestAccAWSDAXCluster_encryption_disabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDax(t) }, + ErrorCheck: testAccErrorCheck(t, dax.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDAXClusterDestroy, Steps: []resource.TestStep{ @@ -195,6 +198,7 @@ func TestAccAWSDAXCluster_encryption_enabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDax(t) }, + ErrorCheck: testAccErrorCheck(t, dax.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDAXClusterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dax_parameter_group_test.go b/aws/resource_aws_dax_parameter_group_test.go index 3b91cc662959..772f50dc7e0d 100644 --- a/aws/resource_aws_dax_parameter_group_test.go +++ b/aws/resource_aws_dax_parameter_group_test.go @@ -17,6 +17,7 @@ func TestAccAwsDaxParameterGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDax(t) }, + ErrorCheck: testAccErrorCheck(t, dax.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDaxParameterGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dax_subnet_group_test.go b/aws/resource_aws_dax_subnet_group_test.go index 488efe70ad19..e6cf65ffe013 100644 --- a/aws/resource_aws_dax_subnet_group_test.go +++ b/aws/resource_aws_dax_subnet_group_test.go @@ -17,6 +17,7 @@ func TestAccAwsDaxSubnetGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDax(t) }, + ErrorCheck: testAccErrorCheck(t, dax.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDaxSubnetGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_db_cluster_snapshot_test.go b/aws/resource_aws_db_cluster_snapshot_test.go index dbd5c026661c..2ccf3047b3cb 100644 --- a/aws/resource_aws_db_cluster_snapshot_test.go +++ b/aws/resource_aws_db_cluster_snapshot_test.go @@ -81,6 +81,7 @@ func TestAccAWSDBClusterSnapshot_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDbClusterSnapshotDestroy, Steps: []resource.TestStep{ @@ -120,6 +121,7 @@ func TestAccAWSDBClusterSnapshot_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDbClusterSnapshotDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_db_event_subscription_test.go b/aws/resource_aws_db_event_subscription_test.go index c6fa6dcf0821..db381a4b233d 100644 --- a/aws/resource_aws_db_event_subscription_test.go +++ b/aws/resource_aws_db_event_subscription_test.go @@ -86,6 +86,7 @@ func TestAccAWSDBEventSubscription_basicUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBEventSubscriptionDestroy, Steps: []resource.TestStep{ @@ -128,6 +129,7 @@ func TestAccAWSDBEventSubscription_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBEventSubscriptionDestroy, Steps: []resource.TestStep{ @@ -151,6 +153,7 @@ func TestAccAWSDBEventSubscription_withPrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBEventSubscriptionDestroy, Steps: []resource.TestStep{ @@ -176,6 +179,7 @@ func TestAccAWSDBEventSubscription_withSourceIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBEventSubscriptionDestroy, Steps: []resource.TestStep{ @@ -217,6 +221,7 @@ func TestAccAWSDBEventSubscription_categoryUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBEventSubscriptionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_db_instance.go b/aws/resource_aws_db_instance.go index 47cb831d8c0b..58a62640689e 100644 --- a/aws/resource_aws_db_instance.go +++ b/aws/resource_aws_db_instance.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsDbInstance() *schema.Resource { @@ -832,7 +833,7 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error log.Printf("[DEBUG] DB Instance S3 Restore configuration: %#v", opts) var err error // Retry for IAM eventual consistency - err = resource.Retry(2*time.Minute, func() *resource.RetryError { + err = resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err = conn.RestoreDBInstanceFromS3(&opts) if err != nil { if isAWSErr(err, "InvalidParameterValue", "ENHANCED_MONITORING") { @@ -1758,7 +1759,7 @@ func resourceAwsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error if requestUpdate { log.Printf("[DEBUG] DB Instance Modification request: %s", req) - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := conn.ModifyDBInstance(req) // Retry for IAM eventual consistency diff --git a/aws/resource_aws_db_instance_role_association_test.go b/aws/resource_aws_db_instance_role_association_test.go index 98ee389287e6..0dfe53d5a2e1 100644 --- a/aws/resource_aws_db_instance_role_association_test.go +++ b/aws/resource_aws_db_instance_role_association_test.go @@ -20,6 +20,7 @@ func TestAccAWSDbInstanceRoleAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDbInstanceRoleAssociationDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSDbInstanceRoleAssociation_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDbInstanceRoleAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_db_instance_test.go b/aws/resource_aws_db_instance_test.go index 6ba19de785a0..d68ce4d4256d 100644 --- a/aws/resource_aws_db_instance_test.go +++ b/aws/resource_aws_db_instance_test.go @@ -69,6 +69,7 @@ func TestAccAWSDBInstance_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -131,6 +132,7 @@ func TestAccAWSDBInstance_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -152,6 +154,7 @@ func TestAccAWSDBInstance_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -173,6 +176,7 @@ func TestAccAWSDBInstance_kmsKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -206,6 +210,7 @@ func TestAccAWSDBInstance_subnetGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -236,6 +241,7 @@ func TestAccAWSDBInstance_optionGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -257,6 +263,7 @@ func TestAccAWSDBInstance_iamAuth(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -281,6 +288,7 @@ func TestAccAWSDBInstance_AllowMajorVersionUpgrade(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -324,6 +332,7 @@ func TestAccAWSDBInstance_DbSubnetGroupName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -354,6 +363,7 @@ func TestAccAWSDBInstance_DbSubnetGroupName_RamShared(t *testing.T) { testAccAlternateAccountPreCheck(t) testAccOrganizationsEnabledPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -379,6 +389,7 @@ func TestAccAWSDBInstance_DbSubnetGroupName_VpcSecurityGroupIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -402,6 +413,7 @@ func TestAccAWSDBInstance_DeletionProtection(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -440,8 +452,9 @@ func TestAccAWSDBInstance_FinalSnapshotIdentifier(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), + Providers: testAccProviders, // testAccCheckAWSDBInstanceSnapshot verifies a database snapshot is // created, and subsequently deletes it CheckDestroy: testAccCheckAWSDBInstanceSnapshot, @@ -461,6 +474,7 @@ func TestAccAWSDBInstance_FinalSnapshotIdentifier_SkipFinalSnapshot(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceNoSnapshot, Steps: []resource.TestStep{ @@ -482,6 +496,7 @@ func TestAccAWSDBInstance_IsAlreadyBeingDeleted(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -519,6 +534,7 @@ func TestAccAWSDBInstance_MaxAllocatedStorage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -562,6 +578,7 @@ func TestAccAWSDBInstance_Password(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -601,6 +618,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -625,6 +643,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_AllocatedStorage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -650,6 +669,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_AllowMajorVersionUpgrade(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -675,6 +695,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_AutoMinorVersionUpgrade(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -700,6 +721,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_AvailabilityZone(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -724,6 +746,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_BackupRetentionPeriod(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -749,6 +772,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_BackupWindow(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -779,6 +803,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_DbSubnetGroupName(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -810,6 +835,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_DbSubnetGroupName_RamShared(t *testi testAccAlternateAccountPreCheck(t) testAccOrganizationsEnabledPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternateAccountAndAlternateRegion(&providers), CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -839,6 +865,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_DbSubnetGroupName_VpcSecurityGroupId testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -875,6 +902,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_DeletionProtection(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -910,6 +938,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_IamDatabaseAuthenticationEnabled(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -935,6 +964,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_MaintenanceWindow(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -960,6 +990,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_MaxAllocatedStorage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -985,6 +1016,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_Monitoring(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1010,6 +1042,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_MultiAZ(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1035,6 +1068,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_ParameterGroupName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1061,6 +1095,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_Port(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1086,6 +1121,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_VpcSecurityGroupIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1112,6 +1148,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_CACertificateIdentifier(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1137,6 +1174,7 @@ func TestAccAWSDBInstance_S3Import(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1161,6 +1199,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1184,6 +1223,7 @@ func TestAccAWSDBInstance_SnapshotIdentifierRemoved(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1215,6 +1255,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_AllocatedStorage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1242,6 +1283,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_Io1Storage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1269,6 +1311,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_AllowMajorVersionUpgrade(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1296,6 +1339,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_AutoMinorVersionUpgrade(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1323,6 +1367,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_AvailabilityZone(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1349,6 +1394,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_BackupRetentionPeriod(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1376,6 +1422,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_BackupRetentionPeriod_Unset(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1403,6 +1450,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_BackupWindow(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1432,6 +1480,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_DbSubnetGroupName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1467,6 +1516,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_DbSubnetGroupName_RamShared(t *test testAccAlternateAccountPreCheck(t) testAccOrganizationsEnabledPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1497,6 +1547,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_DbSubnetGroupName_VpcSecurityGroupI resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1525,6 +1576,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_DeletionProtection(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1562,6 +1614,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_IamDatabaseAuthenticationEnabled(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1589,6 +1642,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_MaintenanceWindow(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1616,6 +1670,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_MaxAllocatedStorage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1643,6 +1698,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_Monitoring(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1670,6 +1726,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_MultiAZ(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1697,6 +1754,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_MultiAZ_SQLServer(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1724,6 +1782,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_ParameterGroupName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1752,6 +1811,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_Port(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1779,6 +1839,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1811,6 +1872,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_Tags_Unset(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1838,6 +1900,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_VpcSecurityGroupIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1868,6 +1931,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_VpcSecurityGroupIds_Tags(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1892,6 +1956,7 @@ func TestAccAWSDBInstance_MonitoringInterval(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1946,6 +2011,7 @@ func TestAccAWSDBInstance_MonitoringRoleArn_EnabledToDisabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -1986,6 +2052,7 @@ func TestAccAWSDBInstance_MonitoringRoleArn_EnabledToRemoved(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2025,6 +2092,7 @@ func TestAccAWSDBInstance_MonitoringRoleArn_RemovedToEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2066,6 +2134,7 @@ func TestAccAWSDBInstance_separateIopsUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2095,6 +2164,7 @@ func TestAccAWSDBInstance_portUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2125,6 +2195,7 @@ func TestAccAWSDBInstance_MSSQL_TZ(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2161,6 +2232,7 @@ func TestAccAWSDBInstance_MSSQL_Domain(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2196,6 +2268,7 @@ func TestAccAWSDBInstance_MSSQL_DomainSnapshotRestore(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2221,6 +2294,7 @@ func TestAccAWSDBInstance_MySQL_SnapshotRestoreWithEngineVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2242,6 +2316,7 @@ func TestAccAWSDBInstance_MinorVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2262,6 +2337,7 @@ func TestAccAWSDBInstance_ec2Classic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSDBInstanceEc2ClassicDestroy, Steps: []resource.TestStep{ @@ -2282,6 +2358,7 @@ func TestAccAWSDBInstance_cloudwatchLogsExportConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2314,6 +2391,7 @@ func TestAccAWSDBInstance_EnabledCloudwatchLogsExports_MySQL(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2365,6 +2443,7 @@ func TestAccAWSDBInstance_EnabledCloudwatchLogsExports_MSSQL(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2398,6 +2477,7 @@ func TestAccAWSDBInstance_EnabledCloudwatchLogsExports_Oracle(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2432,6 +2512,7 @@ func TestAccAWSDBInstance_EnabledCloudwatchLogsExports_Postgresql(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -2466,6 +2547,7 @@ func TestAccAWSDBInstance_NoDeleteAutomatedBackups(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceAutomatedBackups, Steps: []resource.TestStep{ @@ -2846,6 +2928,7 @@ func TestAccAWSDBInstance_PerformanceInsightsEnabled_DisabledToEnabled(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccRDSPerformanceInsightsDefaultVersionPreCheck(t, "mysql") }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSClusterDestroy, Steps: []resource.TestStep{ @@ -2884,6 +2967,7 @@ func TestAccAWSDBInstance_PerformanceInsightsEnabled_EnabledToDisabled(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccRDSPerformanceInsightsDefaultVersionPreCheck(t, "mysql") }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSClusterDestroy, Steps: []resource.TestStep{ @@ -2923,6 +3007,7 @@ func TestAccAWSDBInstance_PerformanceInsightsKmsKeyId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccRDSPerformanceInsightsDefaultVersionPreCheck(t, "mysql") }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSClusterDestroy, Steps: []resource.TestStep{ @@ -2971,6 +3056,7 @@ func TestAccAWSDBInstance_PerformanceInsightsRetentionPeriod(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccRDSPerformanceInsightsDefaultVersionPreCheck(t, "mysql") }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSClusterDestroy, Steps: []resource.TestStep{ @@ -3014,6 +3100,7 @@ func TestAccAWSDBInstance_ReplicateSourceDb_PerformanceInsightsEnabled(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccRDSPerformanceInsightsDefaultVersionPreCheck(t, "mysql") }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -3044,6 +3131,7 @@ func TestAccAWSDBInstance_SnapshotIdentifier_PerformanceInsightsEnabled(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccRDSPerformanceInsightsDefaultVersionPreCheck(t, "mysql") }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -3070,6 +3158,7 @@ func TestAccAWSDBInstance_CACertificateIdentifier(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -3091,6 +3180,7 @@ func TestAccAWSDBInstance_RestoreToPointInTime_SourceIdentifier(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ @@ -3126,6 +3216,7 @@ func TestAccAWSDBInstance_RestoreToPointInTime_SourceResourceID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBInstanceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_db_option_group.go b/aws/resource_aws_db_option_group.go index 8be2e0e2cc9e..067cbd8a54c2 100644 --- a/aws/resource_aws_db_option_group.go +++ b/aws/resource_aws_db_option_group.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsDbOptionGroup() *schema.Resource { @@ -268,7 +269,7 @@ func resourceAwsDbOptionGroupUpdate(d *schema.ResourceData, meta interface{}) er log.Printf("[DEBUG] Modify DB Option Group: %s", modifyOpts) - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error _, err = rdsconn.ModifyOptionGroup(modifyOpts) diff --git a/aws/resource_aws_db_option_group_test.go b/aws/resource_aws_db_option_group_test.go index 7c12280ecc1b..c5c8f4319606 100644 --- a/aws/resource_aws_db_option_group_test.go +++ b/aws/resource_aws_db_option_group_test.go @@ -77,6 +77,7 @@ func TestAccAWSDBOptionGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -109,6 +110,7 @@ func TestAccAWSDBOptionGroup_timeoutBlock(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -135,6 +137,7 @@ func TestAccAWSDBOptionGroup_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -161,6 +164,7 @@ func TestAccAWSDBOptionGroup_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -187,6 +191,7 @@ func TestAccAWSDBOptionGroupConfig_OptionGroupDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -212,6 +217,7 @@ func TestAccAWSDBOptionGroup_basicDestroyWithInstance(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -234,6 +240,7 @@ func TestAccAWSDBOptionGroup_Option_OptionSettings(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -288,6 +295,7 @@ func TestAccAWSDBOptionGroup_Option_OptionSettings_IAMRole(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -318,6 +326,7 @@ func TestAccAWSDBOptionGroup_sqlServerOptionsUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -355,6 +364,7 @@ func TestAccAWSDBOptionGroup_OracleOptionsUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -399,6 +409,7 @@ func TestAccAWSDBOptionGroup_Option_OptionSettings_MultipleNonDefault(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -432,6 +443,7 @@ func TestAccAWSDBOptionGroup_multipleOptions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -462,6 +474,7 @@ func TestAccAWSDBOptionGroup_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ @@ -508,6 +521,7 @@ func TestAccAWSDBOptionGroup_Tags_WithOptions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBOptionGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_db_parameter_group.go b/aws/resource_aws_db_parameter_group.go index 197f93b3a146..43b1d411813b 100644 --- a/aws/resource_aws_db_parameter_group.go +++ b/aws/resource_aws_db_parameter_group.go @@ -70,11 +70,17 @@ func resourceAwsDbParameterGroup() *schema.Resource { "value": { Type: schema.TypeString, Required: true, + StateFunc: func(v interface{}) string { + return strings.ToLower(v.(string)) + }, }, "apply_method": { Type: schema.TypeString, Optional: true, - Default: "immediate", + StateFunc: func(v interface{}) string { + return strings.ToLower(v.(string)) + }, + Default: "immediate", }, }, }, diff --git a/aws/resource_aws_db_parameter_group_test.go b/aws/resource_aws_db_parameter_group_test.go index 74ff03b9b5e2..9cc0734cb6b6 100644 --- a/aws/resource_aws_db_parameter_group_test.go +++ b/aws/resource_aws_db_parameter_group_test.go @@ -80,6 +80,7 @@ func TestAccAWSDBParameterGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, Steps: []resource.TestStep{ @@ -166,6 +167,23 @@ func TestAccAWSDBParameterGroup_basic(t *testing.T) { }) } +func TestAccAWSDBParameterGroup_caseWithMixedParameters(t *testing.T) { + groupName := fmt.Sprintf("parameter-group-test-terraform-%d", acctest.RandInt()) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSDBParameterGroupConfigCaseWithMixedParameters(groupName), + Check: resource.ComposeTestCheckFunc(), + }, + }, + }) +} + func TestAccAWSDBParameterGroup_limit(t *testing.T) { var v rds.DBParameterGroup resourceName := "aws_db_parameter_group.test" @@ -173,6 +191,7 @@ func TestAccAWSDBParameterGroup_limit(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, Steps: []resource.TestStep{ @@ -286,7 +305,7 @@ func TestAccAWSDBParameterGroup_limit(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "parameter.*", map[string]string{ "name": "event_scheduler", - "value": "ON", + "value": "on", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "parameter.*", map[string]string{ "name": "innodb_buffer_pool_dump_at_shutdown", @@ -322,7 +341,7 @@ func TestAccAWSDBParameterGroup_limit(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "parameter.*", map[string]string{ "name": "log_output", - "value": "FILE", + "value": "file", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "parameter.*", map[string]string{ "name": "max_allowed_packet", @@ -346,7 +365,7 @@ func TestAccAWSDBParameterGroup_limit(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "parameter.*", map[string]string{ "name": "tx_isolation", - "value": "REPEATABLE-READ", + "value": "repeatable-read", }), ), }, @@ -465,7 +484,7 @@ func TestAccAWSDBParameterGroup_limit(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "parameter.*", map[string]string{ "name": "event_scheduler", - "value": "ON", + "value": "on", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "parameter.*", map[string]string{ "name": "innodb_buffer_pool_dump_at_shutdown", @@ -501,7 +520,7 @@ func TestAccAWSDBParameterGroup_limit(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "parameter.*", map[string]string{ "name": "log_output", - "value": "FILE", + "value": "file", }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "parameter.*", map[string]string{ "name": "max_allowed_packet", @@ -525,7 +544,7 @@ func TestAccAWSDBParameterGroup_limit(t *testing.T) { }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "parameter.*", map[string]string{ "name": "tx_isolation", - "value": "REPEATABLE-READ", + "value": "repeatable-read", }), ), }, @@ -540,6 +559,7 @@ func TestAccAWSDBParameterGroup_Disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, Steps: []resource.TestStep{ @@ -560,6 +580,7 @@ func TestAccAWSDBParameterGroup_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, Steps: []resource.TestStep{ @@ -579,6 +600,7 @@ func TestAccAWSDBParameterGroup_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, Steps: []resource.TestStep{ @@ -599,6 +621,7 @@ func TestAccAWSDBParameterGroup_withApplyMethod(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, Steps: []resource.TestStep{ @@ -638,6 +661,7 @@ func TestAccAWSDBParameterGroup_Only(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, Steps: []resource.TestStep{ @@ -666,6 +690,7 @@ func TestAccAWSDBParameterGroup_MatchDefault(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, Steps: []resource.TestStep{ @@ -694,6 +719,7 @@ func TestAccAWSDBParameterGroup_updateParameters(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBParameterGroupDestroy, Steps: []resource.TestStep{ @@ -907,6 +933,51 @@ resource "aws_db_parameter_group" "test" { `, n) } +func testAccAWSDBParameterGroupConfigCaseWithMixedParameters(n string) string { + return composeConfig(testAccAWSDBInstanceConfig_orderableClassMysql(), fmt.Sprintf(` +resource "aws_db_parameter_group" "test" { + name = %[1]q + family = "mysql5.6" + + parameter { + name = "character_set_server" + value = "utf8mb4" + apply_method = "pending-reboot" + } + parameter { + name = "innodb_large_prefix" + value = 1 + apply_method = "pending-reboot" + } + parameter { + name = "innodb_file_format" + value = "Barracuda" + apply_method = "pending-reboot" + } + parameter { + name = "innodb_log_file_size" + value = 2147483648 + apply_method = "pending-reboot" + } + parameter { + name = "sql_mode" + value = "STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" + apply_method = "pending-reboot" + } + parameter { + name = "innodb_log_buffer_size" + value = 268435456 + apply_method = "pending-reboot" + } + parameter { + name = "max_allowed_packet" + value = 268435456 + apply_method = "pending-reboot" + } +} +`, n)) +} + func testAccAWSDBParameterGroupConfigWithApplyMethod(n string) string { return fmt.Sprintf(` resource "aws_db_parameter_group" "test" { diff --git a/aws/resource_aws_db_proxy_default_target_group_test.go b/aws/resource_aws_db_proxy_default_target_group_test.go index 06623fe222e1..2ba4b92b536e 100644 --- a/aws/resource_aws_db_proxy_default_target_group_test.go +++ b/aws/resource_aws_db_proxy_default_target_group_test.go @@ -19,6 +19,7 @@ func TestAccAWSDBProxyDefaultTargetGroup_Basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyTargetGroupDestroy, Steps: []resource.TestStep{ @@ -53,6 +54,7 @@ func TestAccAWSDBProxyDefaultTargetGroup_EmptyConnectionPoolConfig(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyTargetGroupDestroy, Steps: []resource.TestStep{ @@ -87,6 +89,7 @@ func TestAccAWSDBProxyDefaultTargetGroup_ConnectionBorrowTimeout(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyTargetGroupDestroy, Steps: []resource.TestStep{ @@ -120,6 +123,7 @@ func TestAccAWSDBProxyDefaultTargetGroup_InitQuery(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyTargetGroupDestroy, Steps: []resource.TestStep{ @@ -153,6 +157,7 @@ func TestAccAWSDBProxyDefaultTargetGroup_MaxConnectionsPercent(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyTargetGroupDestroy, Steps: []resource.TestStep{ @@ -186,6 +191,7 @@ func TestAccAWSDBProxyDefaultTargetGroup_MaxIdleConnectionsPercent(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyTargetGroupDestroy, Steps: []resource.TestStep{ @@ -220,6 +226,7 @@ func TestAccAWSDBProxyDefaultTargetGroup_SessionPinningFilters(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyTargetGroupDestroy, Steps: []resource.TestStep{ @@ -254,6 +261,7 @@ func TestAccAWSDBProxyDefaultTargetGroup_disappears(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyTargetGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_db_proxy_target_test.go b/aws/resource_aws_db_proxy_target_test.go index 23dc928561bb..3f584bae5294 100644 --- a/aws/resource_aws_db_proxy_target_test.go +++ b/aws/resource_aws_db_proxy_target_test.go @@ -19,6 +19,7 @@ func TestAccAWSDBProxyTarget_Instance(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyTargetDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSDBProxyTarget_Cluster(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyTargetDestroy, Steps: []resource.TestStep{ @@ -81,6 +83,7 @@ func TestAccAWSDBProxyTarget_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyTargetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_db_proxy_test.go b/aws/resource_aws_db_proxy_test.go index 95af3ccef751..ad09d0487b5d 100644 --- a/aws/resource_aws_db_proxy_test.go +++ b/aws/resource_aws_db_proxy_test.go @@ -70,6 +70,7 @@ func TestAccAWSDBProxy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ @@ -112,6 +113,7 @@ func TestAccAWSDBProxy_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ @@ -145,6 +147,7 @@ func TestAccAWSDBProxy_DebugLogging(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ @@ -178,6 +181,7 @@ func TestAccAWSDBProxy_IdleClientTimeout(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ @@ -211,6 +215,7 @@ func TestAccAWSDBProxy_RequireTls(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ @@ -245,6 +250,7 @@ func TestAccAWSDBProxy_RoleArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ @@ -279,6 +285,7 @@ func TestAccAWSDBProxy_VpcSecurityGroupIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ @@ -315,6 +322,7 @@ func TestAccAWSDBProxy_AuthDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ @@ -349,6 +357,7 @@ func TestAccAWSDBProxy_AuthIamAuth(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ @@ -383,6 +392,7 @@ func TestAccAWSDBProxy_AuthSecretArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ @@ -418,6 +428,7 @@ func TestAccAWSDBProxy_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ @@ -450,6 +461,7 @@ func TestAccAWSDBProxy_disappears(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccDBProxyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDBProxyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_db_security_group_test.go b/aws/resource_aws_db_security_group_test.go index a23192e6a369..ff00941815af 100644 --- a/aws/resource_aws_db_security_group_test.go +++ b/aws/resource_aws_db_security_group_test.go @@ -19,6 +19,7 @@ func TestAccAWSDBSecurityGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSDBSecurityGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_db_snapshot_test.go b/aws/resource_aws_db_snapshot_test.go index 2b1d785c5026..568daecd11ae 100644 --- a/aws/resource_aws_db_snapshot_test.go +++ b/aws/resource_aws_db_snapshot_test.go @@ -91,6 +91,7 @@ func TestAccAWSDBSnapshot_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDbSnapshotDestroy, Steps: []resource.TestStep{ @@ -118,6 +119,7 @@ func TestAccAWSDBSnapshot_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDbSnapshotDestroy, Steps: []resource.TestStep{ @@ -162,6 +164,7 @@ func TestAccAWSDBSnapshot_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDbSnapshotDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_db_subnet_group_test.go b/aws/resource_aws_db_subnet_group_test.go index f91556221480..58bde9beef24 100644 --- a/aws/resource_aws_db_subnet_group_test.go +++ b/aws/resource_aws_db_subnet_group_test.go @@ -72,6 +72,7 @@ func TestAccAWSDBSubnetGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDBSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -100,6 +101,7 @@ func TestAccAWSDBSubnetGroup_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDBSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -120,6 +122,7 @@ func TestAccAWSDBSubnetGroup_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDBSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -145,6 +148,7 @@ func TestAccAWSDBSubnetGroup_withUndocumentedCharacters(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDBSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -174,6 +178,7 @@ func TestAccAWSDBSubnetGroup_updateDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, rds.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDBSubnetGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_default_network_acl_test.go b/aws/resource_aws_default_network_acl_test.go index faf3790a45a3..fff3f5708c6a 100644 --- a/aws/resource_aws_default_network_acl_test.go +++ b/aws/resource_aws_default_network_acl_test.go @@ -32,6 +32,7 @@ func TestAccAWSDefaultNetworkAcl_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultNetworkAclDestroy, Steps: []resource.TestStep{ @@ -59,6 +60,7 @@ func TestAccAWSDefaultNetworkAcl_basicIpv6Vpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultNetworkAclDestroy, Steps: []resource.TestStep{ @@ -87,6 +89,7 @@ func TestAccAWSDefaultNetworkAcl_deny_ingress(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultNetworkAclDestroy, Steps: []resource.TestStep{ @@ -112,6 +115,7 @@ func TestAccAWSDefaultNetworkAcl_withIpv6Ingress(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultNetworkAclDestroy, Steps: []resource.TestStep{ @@ -137,6 +141,7 @@ func TestAccAWSDefaultNetworkAcl_SubnetRemoval(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultNetworkAclDestroy, Steps: []resource.TestStep{ @@ -179,6 +184,7 @@ func TestAccAWSDefaultNetworkAcl_SubnetReassign(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultNetworkAclDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_default_route_table.go b/aws/resource_aws_default_route_table.go index c27960876f05..3ee9440552f0 100644 --- a/aws/resource_aws_default_route_table.go +++ b/aws/resource_aws_default_route_table.go @@ -114,6 +114,11 @@ func resourceAwsDefaultRouteTable() *schema.Resource { "tags": tagsSchema(), + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "owner_id": { Type: schema.TypeString, Computed: true, diff --git a/aws/resource_aws_default_route_table_test.go b/aws/resource_aws_default_route_table_test.go index 69a2ec8100bf..054960468abe 100644 --- a/aws/resource_aws_default_route_table_test.go +++ b/aws/resource_aws_default_route_table_test.go @@ -20,6 +20,7 @@ func TestAccAWSDefaultRouteTable_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ @@ -37,6 +38,7 @@ func TestAccAWSDefaultRouteTable_basic(t *testing.T) { Config: testAccDefaultRouteTableConfigBasic(rName), Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "0"), @@ -63,6 +65,7 @@ func TestAccAWSDefaultRouteTable_disappears_Vpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ @@ -88,6 +91,7 @@ func TestAccAWSDefaultRouteTable_Route_ConfigMode(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckDefaultRouteTableDestroy, @@ -97,6 +101,7 @@ func TestAccAWSDefaultRouteTable_Route_ConfigMode(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "1"), @@ -116,6 +121,7 @@ func TestAccAWSDefaultRouteTable_Route_ConfigMode(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), // The route block from the previous step should still be @@ -131,6 +137,7 @@ func TestAccAWSDefaultRouteTable_Route_ConfigMode(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 1), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), // This config uses attribute syntax to set zero routes @@ -155,6 +162,7 @@ func TestAccAWSDefaultRouteTable_swap(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckDefaultRouteTableDestroy, @@ -164,6 +172,7 @@ func TestAccAWSDefaultRouteTable_swap(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "1"), @@ -220,6 +229,7 @@ func TestAccAWSDefaultRouteTable_IPv4_To_TransitGateway(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ @@ -251,6 +261,7 @@ func TestAccAWSDefaultRouteTable_IPv4_To_VpcEndpoint(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID, "elasticloadbalancing"), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ @@ -291,6 +302,7 @@ func TestAccAWSDefaultRouteTable_VpcEndpointAssociation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckDefaultRouteTableDestroy, @@ -321,6 +333,7 @@ func TestAccAWSDefaultRouteTable_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ @@ -363,6 +376,7 @@ func TestAccAWSDefaultRouteTable_ConditionalCidrBlock(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_default_security_group_test.go b/aws/resource_aws_default_security_group_test.go index 4f632e5ff085..40117d58d9e6 100644 --- a/aws/resource_aws_default_security_group_test.go +++ b/aws/resource_aws_default_security_group_test.go @@ -17,6 +17,7 @@ func TestAccAWSDefaultSecurityGroup_Vpc_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultSecurityGroupDestroy, @@ -70,6 +71,7 @@ func TestAccAWSDefaultSecurityGroup_Vpc_empty(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultSecurityGroupDestroy, @@ -98,6 +100,7 @@ func TestAccAWSDefaultSecurityGroup_Classic_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSDefaultSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -149,6 +152,7 @@ func TestAccAWSDefaultSecurityGroup_Classic_empty(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSDefaultSecurityGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_default_subnet_test.go b/aws/resource_aws_default_subnet_test.go index 35bb31ba4d30..28f2e30c7f60 100644 --- a/aws/resource_aws_default_subnet_test.go +++ b/aws/resource_aws_default_subnet_test.go @@ -19,6 +19,7 @@ func TestAccAWSDefaultSubnet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultSubnetDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSDefaultSubnet_publicIp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultSubnetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_default_vpc_dhcp_options_test.go b/aws/resource_aws_default_vpc_dhcp_options_test.go index 74d628007620..51cf6c6c971c 100644 --- a/aws/resource_aws_default_vpc_dhcp_options_test.go +++ b/aws/resource_aws_default_vpc_dhcp_options_test.go @@ -15,6 +15,7 @@ func TestAccAWSDefaultVpcDhcpOptions_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultVpcDhcpOptionsDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_default_vpc_test.go b/aws/resource_aws_default_vpc_test.go index 956179377d9e..80e584277374 100644 --- a/aws/resource_aws_default_vpc_test.go +++ b/aws/resource_aws_default_vpc_test.go @@ -13,6 +13,7 @@ func TestAccAWSDefaultVpc_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDefaultVpcDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_devicefarm_project_test.go b/aws/resource_aws_devicefarm_project_test.go index e6f5e1bd14e3..41844b75407c 100644 --- a/aws/resource_aws_devicefarm_project_test.go +++ b/aws/resource_aws_devicefarm_project_test.go @@ -26,6 +26,7 @@ func TestAccAWSDeviceFarmProject_basic(t *testing.T) { // https://docs.aws.amazon.com/general/latest/gr/devicefarm.html testAccRegionPreCheck(t, endpoints.UsWest2RegionID) }, + ErrorCheck: testAccErrorCheck(t, devicefarm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDeviceFarmProjectDestroy, Steps: []resource.TestStep{ @@ -59,6 +60,7 @@ func TestAccAWSDeviceFarmProject_disappears(t *testing.T) { // https://docs.aws.amazon.com/general/latest/gr/devicefarm.html testAccRegionPreCheck(t, endpoints.UsWest2RegionID) }, + ErrorCheck: testAccErrorCheck(t, devicefarm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDeviceFarmProjectDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_directory_service_conditional_forwarder_test.go b/aws/resource_aws_directory_service_conditional_forwarder_test.go index bfa948a45f9d..93c7f78a06ce 100644 --- a/aws/resource_aws_directory_service_conditional_forwarder_test.go +++ b/aws/resource_aws_directory_service_conditional_forwarder_test.go @@ -17,6 +17,7 @@ func TestAccAWSDirectoryServiceConditionForwarder_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDirectoryService(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDirectoryServiceConditionalForwarderDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_directory_service_directory_test.go b/aws/resource_aws_directory_service_directory_test.go index a3a53bf6f02d..78d9bfaf6463 100644 --- a/aws/resource_aws_directory_service_directory_test.go +++ b/aws/resource_aws_directory_service_directory_test.go @@ -89,6 +89,7 @@ func TestAccAWSDirectoryServiceDirectory_basic(t *testing.T) { testAccPreCheckAWSDirectoryService(t) testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDirectoryServiceDirectoryDestroy, Steps: []resource.TestStep{ @@ -121,6 +122,7 @@ func TestAccAWSDirectoryServiceDirectory_tags(t *testing.T) { testAccPreCheckAWSDirectoryService(t) testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDirectoryServiceDirectoryDestroy, Steps: []resource.TestStep{ @@ -169,6 +171,7 @@ func TestAccAWSDirectoryServiceDirectory_microsoft(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDirectoryService(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDirectoryServiceDirectoryDestroy, Steps: []resource.TestStep{ @@ -197,6 +200,7 @@ func TestAccAWSDirectoryServiceDirectory_microsoftStandard(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDirectoryService(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDirectoryServiceDirectoryDestroy, Steps: []resource.TestStep{ @@ -229,6 +233,7 @@ func TestAccAWSDirectoryServiceDirectory_connector(t *testing.T) { testAccPreCheckAWSDirectoryService(t) testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDirectoryServiceDirectoryDestroy, Steps: []resource.TestStep{ @@ -263,6 +268,7 @@ func TestAccAWSDirectoryServiceDirectory_withAliasAndSso(t *testing.T) { testAccPreCheckAWSDirectoryService(t) testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDirectoryServiceDirectoryDestroy, Steps: []resource.TestStep{ @@ -341,6 +347,7 @@ func TestAccAWSDirectoryServiceDirectory_disappears(t *testing.T) { testAccPreCheckAWSDirectoryService(t) testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDirectoryServiceDirectoryDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_directory_service_log_subscription_test.go b/aws/resource_aws_directory_service_log_subscription_test.go index 858acf5611f9..1ed01c8313e2 100644 --- a/aws/resource_aws_directory_service_log_subscription_test.go +++ b/aws/resource_aws_directory_service_log_subscription_test.go @@ -16,6 +16,7 @@ func TestAccAWSDirectoryServiceLogSubscription_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDirectoryService(t) }, + ErrorCheck: testAccErrorCheck(t, directoryservice.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDirectoryServiceLogSubscriptionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dlm_lifecycle_policy_test.go b/aws/resource_aws_dlm_lifecycle_policy_test.go index 3bcbf7d33396..7542f55bb4eb 100644 --- a/aws/resource_aws_dlm_lifecycle_policy_test.go +++ b/aws/resource_aws_dlm_lifecycle_policy_test.go @@ -18,6 +18,7 @@ func TestAccAWSDlmLifecyclePolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDlm(t) }, + ErrorCheck: testAccErrorCheck(t, dlm.EndpointsID), Providers: testAccProviders, CheckDestroy: dlmLifecyclePolicyDestroy, Steps: []resource.TestStep{ @@ -54,6 +55,7 @@ func TestAccAWSDlmLifecyclePolicy_Full(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDlm(t) }, + ErrorCheck: testAccErrorCheck(t, dlm.EndpointsID), Providers: testAccProviders, CheckDestroy: dlmLifecyclePolicyDestroy, Steps: []resource.TestStep{ @@ -103,6 +105,7 @@ func TestAccAWSDlmLifecyclePolicy_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSDlm(t) }, + ErrorCheck: testAccErrorCheck(t, dlm.EndpointsID), Providers: testAccProviders, CheckDestroy: dlmLifecyclePolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dms_certificate.go b/aws/resource_aws_dms_certificate.go index 1bae78a6b980..1acb17759f7d 100644 --- a/aws/resource_aws_dms_certificate.go +++ b/aws/resource_aws_dms_certificate.go @@ -1,13 +1,16 @@ package aws import ( + "encoding/base64" "fmt" "log" + "regexp" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" dms "github.com/aws/aws-sdk-go/service/databasemigrationservice" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" ) @@ -28,10 +31,15 @@ func resourceAwsDmsCertificate() *schema.Resource { Computed: true, }, "certificate_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validateDmsCertificateId, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.All( + validation.StringLenBetween(1, 255), + validation.StringMatch(regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9-]+$"), "must start with a letter, only contain alphanumeric characters and hyphens"), + validation.StringDoesNotMatch(regexp.MustCompile(`--`), "cannot contain two consecutive hyphens"), + validation.StringDoesNotMatch(regexp.MustCompile(`-$`), "cannot end in a hyphen"), + ), }, "certificate_pem": { Type: schema.TypeString, @@ -52,9 +60,10 @@ func resourceAwsDmsCertificate() *schema.Resource { func resourceAwsDmsCertificateCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).dmsconn + certificateID := d.Get("certificate_id").(string) request := &dms.ImportCertificateInput{ - CertificateIdentifier: aws.String(d.Get("certificate_id").(string)), + CertificateIdentifier: aws.String(certificateID), Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().DatabasemigrationserviceTags(), } @@ -62,27 +71,29 @@ func resourceAwsDmsCertificateCreate(d *schema.ResourceData, meta interface{}) e wallet, walletSet := d.GetOk("certificate_wallet") if !pemSet && !walletSet { - return fmt.Errorf("Must set either certificate_pem and certificate_wallet.") + return fmt.Errorf("Must set either certificate_pem or certificate_wallet for DMS Certificate (%s)", certificateID) } if pemSet && walletSet { - return fmt.Errorf("Cannot set both certificate_pem and certificate_wallet.") + return fmt.Errorf("Cannot set both certificate_pem and certificate_wallet for DMS Certificate (%s)", certificateID) } if pemSet { request.CertificatePem = aws.String(pem.(string)) } if walletSet { - request.CertificateWallet = []byte(wallet.(string)) + certWallet, err := base64.StdEncoding.DecodeString(wallet.(string)) + if err != nil { + return fmt.Errorf("error Base64 decoding certificate_wallet for DMS Certificate (%s): %w", certificateID, err) + } + request.CertificateWallet = certWallet } - log.Println("[DEBUG] DMS import certificate:", request) - _, err := conn.ImportCertificate(request) if err != nil { - return err + return fmt.Errorf("error creating DMS certificate (%s): %w", certificateID, err) } - d.SetId(d.Get("certificate_id").(string)) + d.SetId(certificateID) return resourceAwsDmsCertificateRead(d, meta) } @@ -98,12 +109,24 @@ func resourceAwsDmsCertificateRead(d *schema.ResourceData, meta interface{}) err }, }, }) + + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, dms.ErrCodeResourceNotFoundFault) { + log.Printf("[WARN] DMS Certificate (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + if err != nil { - if dmserr, ok := err.(awserr.Error); ok && dmserr.Code() == "ResourceNotFoundFault" { - d.SetId("") - return nil + return fmt.Errorf("error reading DMS Certificate (%s): %w", d.Id(), err) + } + + if response == nil || len(response.Certificates) == 0 || response.Certificates[0] == nil { + if d.IsNewResource() { + return fmt.Errorf("error reading DMS Certificate (%s): not found", d.Id()) } - return err + log.Printf("[WARN] DMS Certificate (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil } err = resourceAwsDmsCertificateSetState(d, response.Certificates[0]) @@ -146,10 +169,16 @@ func resourceAwsDmsCertificateDelete(d *schema.ResourceData, meta interface{}) e CertificateArn: aws.String(d.Get("certificate_arn").(string)), } - log.Printf("[DEBUG] DMS delete certificate: %#v", request) - _, err := conn.DeleteCertificate(request) - return err + + if err != nil { + if tfawserr.ErrCodeEquals(err, dms.ErrCodeResourceNotFoundFault) { + return nil + } + return fmt.Errorf("error deleting DMS Certificate (%s): %w", d.Id(), err) + } + + return nil } func resourceAwsDmsCertificateSetState(d *schema.ResourceData, cert *dms.Certificate) error { @@ -162,7 +191,7 @@ func resourceAwsDmsCertificateSetState(d *schema.ResourceData, cert *dms.Certifi d.Set("certificate_pem", cert.CertificatePem) } if cert.CertificateWallet != nil && len(cert.CertificateWallet) != 0 { - d.Set("certificate_wallet", string(cert.CertificateWallet)) + d.Set("certificate_wallet", base64Encode(cert.CertificateWallet)) } return nil diff --git a/aws/resource_aws_dms_certificate_test.go b/aws/resource_aws_dms_certificate_test.go index 44a268d7eb56..aae0633cb9dd 100644 --- a/aws/resource_aws_dms_certificate_test.go +++ b/aws/resource_aws_dms_certificate_test.go @@ -6,9 +6,9 @@ import ( "github.com/aws/aws-sdk-go/aws" dms "github.com/aws/aws-sdk-go/service/databasemigrationservice" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -18,13 +18,14 @@ func TestAccAWSDmsCertificate_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, - CheckDestroy: dmsCertificateDestroy, + CheckDestroy: testAccCheckAWSDmsCertificateDestroy, Steps: []resource.TestStep{ { - Config: dmsCertificateConfig(randId), + Config: testAccAWSDmsCertificateConfig(randId), Check: resource.ComposeTestCheckFunc( - checkDmsCertificateExists(resourceName), + testAccAWSDmsCertificateExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "certificate_arn"), ), }, @@ -37,19 +38,68 @@ func TestAccAWSDmsCertificate_basic(t *testing.T) { }) } +func TestAccAWSDmsCertificate_disappears(t *testing.T) { + resourceName := "aws_dms_certificate.dms_certificate" + randId := acctest.RandString(8) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), + Providers: testAccProviders, + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: testAccAWSDmsCertificateConfig(randId), + Check: resource.ComposeTestCheckFunc( + testAccAWSDmsCertificateExists(resourceName), + testAccCheckResourceDisappears(testAccProvider, resourceAwsDmsCertificate(), resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + +func TestAccAWSDmsCertificate_CertificateWallet(t *testing.T) { + resourceName := "aws_dms_certificate.dms_certificate" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDmsCertificateDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSDmsCertificateConfigCertificateWallet(rName), + Check: resource.ComposeTestCheckFunc( + testAccAWSDmsCertificateExists(resourceName), + resource.TestCheckResourceAttrSet(resourceName, "certificate_wallet"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccAWSDmsCertificate_tags(t *testing.T) { resourceName := "aws_dms_certificate.dms_certificate" randId := acctest.RandString(8) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, - CheckDestroy: dmsCertificateDestroy, + CheckDestroy: testAccCheckAWSDmsCertificateDestroy, Steps: []resource.TestStep{ { Config: testAccAWSDmsCertificateConfigTags1(randId, "key1", "value1"), Check: resource.ComposeAggregateTestCheckFunc( - checkDmsCertificateExists(resourceName), + testAccAWSDmsCertificateExists(resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), ), @@ -62,7 +112,7 @@ func TestAccAWSDmsCertificate_tags(t *testing.T) { { Config: testAccAWSDmsCertificateConfigTags2(randId, "key1", "value1updated", "key2", "value2"), Check: resource.ComposeAggregateTestCheckFunc( - checkDmsCertificateExists(resourceName), + testAccAWSDmsCertificateExists(resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), @@ -71,7 +121,7 @@ func TestAccAWSDmsCertificate_tags(t *testing.T) { { Config: testAccAWSDmsCertificateConfigTags1(randId, "key2", "value2"), Check: resource.ComposeAggregateTestCheckFunc( - checkDmsCertificateExists(resourceName), + testAccAWSDmsCertificateExists(resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), ), @@ -80,27 +130,40 @@ func TestAccAWSDmsCertificate_tags(t *testing.T) { }) } -func dmsCertificateDestroy(s *terraform.State) error { +func testAccCheckAWSDmsCertificateDestroy(s *terraform.State) error { for _, rs := range s.RootModule().Resources { if rs.Type != "aws_dms_certificate" { continue } - err := checkDmsCertificateExists(rs.Primary.ID) - if err == nil { - return fmt.Errorf("Found a certificate that was not destroyed: %s", rs.Primary.ID) + conn := testAccProvider.Meta().(*AWSClient).dmsconn + + output, err := conn.DescribeCertificates(&dms.DescribeCertificatesInput{ + Filters: []*dms.Filter{ + { + Name: aws.String("certificate-id"), + Values: []*string{aws.String(rs.Primary.ID)}, + }, + }, + }) + + if tfawserr.ErrCodeEquals(err, dms.ErrCodeResourceNotFoundFault) { + continue + } + + if err != nil { + return fmt.Errorf("error reading DMS Certificate (%s): %w", rs.Primary.ID, err) + } + + if output != nil && len(output.Certificates) != 0 { + return fmt.Errorf("DMS Certificate (%s) still exists", rs.Primary.ID) } } return nil } -func checkDmsCertificateExists(n string) resource.TestCheckFunc { - providers := []*schema.Provider{testAccProvider} - return checkDmsCertificateExistsWithProviders(n, &providers) -} - -func checkDmsCertificateExistsWithProviders(n string, providers *[]*schema.Provider) resource.TestCheckFunc { +func testAccAWSDmsCertificateExists(n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] if !ok { @@ -110,33 +173,31 @@ func checkDmsCertificateExistsWithProviders(n string, providers *[]*schema.Provi if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - for _, provider := range *providers { - // Ignore if Meta is empty, this can happen for validation providers - if provider.Meta() == nil { - continue - } - - conn := provider.Meta().(*AWSClient).dmsconn - _, err := conn.DescribeCertificates(&dms.DescribeCertificatesInput{ - Filters: []*dms.Filter{ - { - Name: aws.String("certificate-id"), - Values: []*string{aws.String(rs.Primary.ID)}, - }, + + conn := testAccProvider.Meta().(*AWSClient).dmsconn + + output, err := conn.DescribeCertificates(&dms.DescribeCertificatesInput{ + Filters: []*dms.Filter{ + { + Name: aws.String("certificate-id"), + Values: []*string{aws.String(rs.Primary.ID)}, }, - }) + }, + }) - if err != nil { - return fmt.Errorf("DMS certificate error: %v", err) - } - return nil + if err != nil { + return fmt.Errorf("error reading DMS Certificate (%s): %w", rs.Primary.ID, err) } - return fmt.Errorf("DMS certificate not found") + if output == nil || len(output.Certificates) == 0 { + return fmt.Errorf("DMS Certificate (%s) not found", rs.Primary.ID) + } + + return nil } } -func dmsCertificateConfig(randId string) string { +func testAccAWSDmsCertificateConfig(randId string) string { return fmt.Sprintf(` resource "aws_dms_certificate" "dms_certificate" { certificate_id = "tf-test-dms-certificate-%[1]s" @@ -145,6 +206,15 @@ resource "aws_dms_certificate" "dms_certificate" { `, randId) } +func testAccAWSDmsCertificateConfigCertificateWallet(rName string) string { + return fmt.Sprintf(` +resource "aws_dms_certificate" "dms_certificate" { + certificate_id = %q + certificate_wallet = filebase64("testdata/service/dms/oracle_wallet_certificate.pem") +} +`, rName) +} + func testAccAWSDmsCertificateConfigTags1(randId, tagKey1, tagValue1 string) string { return fmt.Sprintf(` resource "aws_dms_certificate" "dms_certificate" { diff --git a/aws/resource_aws_dms_endpoint_test.go b/aws/resource_aws_dms_endpoint_test.go index 7902378f534a..79723c311876 100644 --- a/aws/resource_aws_dms_endpoint_test.go +++ b/aws/resource_aws_dms_endpoint_test.go @@ -18,6 +18,7 @@ func TestAccAwsDmsEndpoint_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -57,6 +58,7 @@ func TestAccAwsDmsEndpoint_S3(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -104,6 +106,7 @@ func TestAccAwsDmsEndpoint_S3_ExtraConnectionAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -130,6 +133,7 @@ func TestAccAwsDmsEndpoint_DynamoDb(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -162,6 +166,7 @@ func TestAccAwsDmsEndpoint_Elasticsearch(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -195,6 +200,7 @@ func TestAccAwsDmsEndpoint_Elasticsearch_ExtraConnectionAttributes(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -221,6 +227,7 @@ func TestAccAwsDmsEndpoint_Elasticsearch_ErrorRetryDuration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -258,6 +265,7 @@ func TestAccAwsDmsEndpoint_Elasticsearch_FullLoadErrorPercentage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -299,6 +307,7 @@ func TestAccAwsDmsEndpoint_Kafka_Broker(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -336,6 +345,7 @@ func TestAccAwsDmsEndpoint_Kafka_Topic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -371,6 +381,7 @@ func TestAccAwsDmsEndpoint_Kinesis(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -408,6 +419,7 @@ func TestAccAwsDmsEndpoint_MongoDb(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -437,6 +449,7 @@ func TestAccAwsDmsEndpoint_MongoDb_Update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -481,6 +494,7 @@ func TestAccAwsDmsEndpoint_DocDB(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ @@ -520,6 +534,7 @@ func TestAccAwsDmsEndpoint_Db2(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsEndpointDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dms_event_subscription_test.go b/aws/resource_aws_dms_event_subscription_test.go index 727cc9d61474..67151226c280 100644 --- a/aws/resource_aws_dms_event_subscription_test.go +++ b/aws/resource_aws_dms_event_subscription_test.go @@ -19,6 +19,7 @@ func TestAccAWSDmsEventSubscription_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDmsEventSubscriptionDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSDmsEventSubscription_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDmsEventSubscriptionDestroy, Steps: []resource.TestStep{ @@ -74,6 +76,7 @@ func TestAccAWSDmsEventSubscription_Enabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDmsEventSubscriptionDestroy, Steps: []resource.TestStep{ @@ -114,6 +117,7 @@ func TestAccAWSDmsEventSubscription_EventCategories(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDmsEventSubscriptionDestroy, Steps: []resource.TestStep{ @@ -151,6 +155,7 @@ func TestAccAWSDmsEventSubscription_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDmsEventSubscriptionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dms_replication_instance_test.go b/aws/resource_aws_dms_replication_instance_test.go index 7dc7d6d499c2..3fc3e3922e91 100644 --- a/aws/resource_aws_dms_replication_instance_test.go +++ b/aws/resource_aws_dms_replication_instance_test.go @@ -85,6 +85,7 @@ func TestAccAWSDmsReplicationInstance_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ @@ -123,6 +124,7 @@ func TestAccAWSDmsReplicationInstance_AllocatedStorage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ @@ -156,6 +158,7 @@ func TestAccAWSDmsReplicationInstance_AutoMinorVersionUpgrade(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ @@ -197,6 +200,7 @@ func TestAccAWSDmsReplicationInstance_AvailabilityZone(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ @@ -261,6 +265,7 @@ func TestAccAWSDmsReplicationInstance_EngineVersion(t *testing.T) { ), } }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: testSteps, @@ -274,6 +279,7 @@ func TestAccAWSDmsReplicationInstance_KmsKeyArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ @@ -300,6 +306,7 @@ func TestAccAWSDmsReplicationInstance_MultiAz(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ @@ -340,6 +347,7 @@ func TestAccAWSDmsReplicationInstance_PreferredMaintenanceWindow(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ @@ -373,6 +381,7 @@ func TestAccAWSDmsReplicationInstance_PubliclyAccessible(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ @@ -403,6 +412,7 @@ func TestAccAWSDmsReplicationInstance_ReplicationInstanceClass(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ @@ -437,6 +447,7 @@ func TestAccAWSDmsReplicationInstance_ReplicationSubnetGroupId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ @@ -463,6 +474,7 @@ func TestAccAWSDmsReplicationInstance_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ @@ -507,6 +519,7 @@ func TestAccAWSDmsReplicationInstance_VpcSecurityGroupIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDmsReplicationInstanceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dms_replication_subnet_group_test.go b/aws/resource_aws_dms_replication_subnet_group_test.go index de908478df19..34217467750c 100644 --- a/aws/resource_aws_dms_replication_subnet_group_test.go +++ b/aws/resource_aws_dms_replication_subnet_group_test.go @@ -18,6 +18,7 @@ func TestAccAWSDmsReplicationSubnetGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsReplicationSubnetGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dms_replication_task_test.go b/aws/resource_aws_dms_replication_task_test.go index ae10aa8164ce..62ac0facf4c9 100644 --- a/aws/resource_aws_dms_replication_task_test.go +++ b/aws/resource_aws_dms_replication_task_test.go @@ -17,6 +17,7 @@ func TestAccAWSDmsReplicationTask_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dms.EndpointsID), Providers: testAccProviders, CheckDestroy: dmsReplicationTaskDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_docdb_cluster.go b/aws/resource_aws_docdb_cluster.go index 9170efd0acf2..0fc7936aa541 100644 --- a/aws/resource_aws_docdb_cluster.go +++ b/aws/resource_aws_docdb_cluster.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsDocDBCluster() *schema.Resource { @@ -336,7 +337,7 @@ func resourceAwsDocDBClusterCreate(d *schema.ResourceData, meta interface{}) err } log.Printf("[DEBUG] DocDB Cluster restore from snapshot configuration: %s", opts) - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := conn.RestoreDBClusterFromSnapshot(&opts) if err != nil { if isAWSErr(err, "InvalidParameterValue", "IAM role ARN value is invalid or does not include the required permissions") { @@ -420,7 +421,7 @@ func resourceAwsDocDBClusterCreate(d *schema.ResourceData, meta interface{}) err log.Printf("[DEBUG] DocDB Cluster create options: %s", createOpts) var resp *docdb.CreateDBClusterOutput - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error resp, err = conn.CreateDBCluster(createOpts) if err != nil { diff --git a/aws/resource_aws_docdb_cluster_instance.go b/aws/resource_aws_docdb_cluster_instance.go index ba2fff4205de..0aeb939cab32 100644 --- a/aws/resource_aws_docdb_cluster_instance.go +++ b/aws/resource_aws_docdb_cluster_instance.go @@ -12,6 +12,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsDocDBClusterInstance() *schema.Resource { @@ -208,7 +209,7 @@ func resourceAwsDocDBClusterInstanceCreate(d *schema.ResourceData, meta interfac log.Printf("[DEBUG] Creating DocDB Instance opts: %s", createOpts) var resp *docdb.CreateDBInstanceOutput - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error resp, err = conn.CreateDBInstance(createOpts) if err != nil { @@ -366,7 +367,7 @@ func resourceAwsDocDBClusterInstanceUpdate(d *schema.ResourceData, meta interfac log.Printf("[DEBUG] Send DB Instance Modification request: %#v", requestUpdate) if requestUpdate { log.Printf("[DEBUG] DB Instance Modification request: %#v", req) - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := conn.ModifyDBInstance(req) if err != nil { if isAWSErr(err, "InvalidParameterValue", "IAM role ARN value is invalid or does not include the required permissions") { diff --git a/aws/resource_aws_docdb_cluster_instance_test.go b/aws/resource_aws_docdb_cluster_instance_test.go index c3688900ffd3..2372bb96fd91 100644 --- a/aws/resource_aws_docdb_cluster_instance_test.go +++ b/aws/resource_aws_docdb_cluster_instance_test.go @@ -22,6 +22,7 @@ func TestAccAWSDocDBClusterInstance_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -70,6 +71,7 @@ func TestAccAWSDocDBClusterInstance_az(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -103,6 +105,7 @@ func TestAccAWSDocDBClusterInstance_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -136,6 +139,7 @@ func TestAccAWSDocDBClusterInstance_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -168,6 +172,7 @@ func TestAccAWSDocDBClusterInstance_kmsKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -200,6 +205,7 @@ func TestAccAWSDocDBClusterInstance_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_docdb_cluster_parameter_group_test.go b/aws/resource_aws_docdb_cluster_parameter_group_test.go index 3b4b0f13d869..3c597472c253 100644 --- a/aws/resource_aws_docdb_cluster_parameter_group_test.go +++ b/aws/resource_aws_docdb_cluster_parameter_group_test.go @@ -21,6 +21,7 @@ func TestAccAWSDocDBClusterParameterGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDocDBClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func TestAccAWSDocDBClusterParameterGroup_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDocDBClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -76,6 +78,7 @@ func TestAccAWSDocDBClusterParameterGroup_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDocDBClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -102,6 +105,7 @@ func TestAccAWSDocDBClusterParameterGroup_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDocDBClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -130,6 +134,7 @@ func TestAccAWSDocDBClusterParameterGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDocDBClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -153,6 +158,7 @@ func TestAccAWSDocDBClusterParameterGroup_Parameter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDocDBClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -199,6 +205,7 @@ func TestAccAWSDocDBClusterParameterGroup_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDocDBClusterParameterGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_docdb_cluster_snapshot_test.go b/aws/resource_aws_docdb_cluster_snapshot_test.go index c2d4241c5f7b..9816dff19152 100644 --- a/aws/resource_aws_docdb_cluster_snapshot_test.go +++ b/aws/resource_aws_docdb_cluster_snapshot_test.go @@ -19,6 +19,7 @@ func TestAccAWSDocDBClusterSnapshot_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterSnapshotDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_docdb_cluster_test.go b/aws/resource_aws_docdb_cluster_test.go index 5b8eb89a74d3..7e2b24147d69 100644 --- a/aws/resource_aws_docdb_cluster_test.go +++ b/aws/resource_aws_docdb_cluster_test.go @@ -23,6 +23,7 @@ func TestAccAWSDocDBCluster_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -66,6 +67,7 @@ func TestAccAWSDocDBCluster_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -98,6 +100,7 @@ func TestAccAWSDocDBCluster_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -131,6 +134,7 @@ func TestAccAWSDocDBCluster_takeFinalSnapshot(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterSnapshot(rInt), Steps: []resource.TestStep{ @@ -161,6 +165,7 @@ func TestAccAWSDocDBCluster_takeFinalSnapshot(t *testing.T) { func TestAccAWSDocDBCluster_missingUserNameCausesError(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -178,6 +183,7 @@ func TestAccAWSDocDBCluster_updateTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -219,6 +225,7 @@ func TestAccAWSDocDBCluster_updateCloudwatchLogsExports(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -257,6 +264,7 @@ func TestAccAWSDocDBCluster_kmsKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -288,6 +296,7 @@ func TestAccAWSDocDBCluster_encrypted(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -323,6 +332,7 @@ func TestAccAWSDocDBCluster_backupsUpdate(t *testing.T) { ri := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -373,6 +383,7 @@ func TestAccAWSDocDBCluster_Port(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ @@ -413,6 +424,7 @@ func TestAccAWSDocDBCluster_deleteProtection(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBClusterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_docdb_subnet_group_test.go b/aws/resource_aws_docdb_subnet_group_test.go index e76712840c05..cc76b0b8ae5c 100644 --- a/aws/resource_aws_docdb_subnet_group_test.go +++ b/aws/resource_aws_docdb_subnet_group_test.go @@ -19,6 +19,7 @@ func TestAccAWSDocDBSubnetGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -49,6 +50,7 @@ func TestAccAWSDocDBSubnetGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -70,6 +72,7 @@ func TestAccAWSDocDBSubnetGroup_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -97,6 +100,7 @@ func TestAccAWSDocDBSubnetGroup_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -123,6 +127,7 @@ func TestAccAWSDocDBSubnetGroup_updateDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, docdb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDocDBSubnetGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_bgp_peer_test.go b/aws/resource_aws_dx_bgp_peer_test.go index 50df4947115d..ca33dc9d22af 100644 --- a/aws/resource_aws_dx_bgp_peer_test.go +++ b/aws/resource_aws_dx_bgp_peer_test.go @@ -23,6 +23,7 @@ func TestAccAwsDxBgpPeer_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxBgpPeerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_connection_association_test.go b/aws/resource_aws_dx_connection_association_test.go index 8dc9584bd823..9339889eca3c 100644 --- a/aws/resource_aws_dx_connection_association_test.go +++ b/aws/resource_aws_dx_connection_association_test.go @@ -14,6 +14,7 @@ import ( func TestAccAWSDxConnectionAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxConnectionAssociationDestroy, Steps: []resource.TestStep{ @@ -30,6 +31,7 @@ func TestAccAWSDxConnectionAssociation_basic(t *testing.T) { func TestAccAWSDxConnectionAssociation_multiConns(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxConnectionAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_connection_test.go b/aws/resource_aws_dx_connection_test.go index d134834767ae..e8c52c5bb593 100644 --- a/aws/resource_aws_dx_connection_test.go +++ b/aws/resource_aws_dx_connection_test.go @@ -83,6 +83,7 @@ func TestAccAWSDxConnection_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxConnectionDestroy, Steps: []resource.TestStep{ @@ -111,6 +112,7 @@ func TestAccAWSDxConnection_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxConnectionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_gateway_association_proposal_test.go b/aws/resource_aws_dx_gateway_association_proposal_test.go index 5a8ddf79380c..bf834a4897af 100644 --- a/aws/resource_aws_dx_gateway_association_proposal_test.go +++ b/aws/resource_aws_dx_gateway_association_proposal_test.go @@ -91,6 +91,7 @@ func TestAccAwsDxGatewayAssociationProposal_basicVpnGateway(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxGatewayAssociationProposalDestroy, Steps: []resource.TestStep{ @@ -129,6 +130,7 @@ func TestAccAwsDxGatewayAssociationProposal_basicTransitGateway(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxGatewayAssociationProposalDestroy, Steps: []resource.TestStep{ @@ -167,6 +169,7 @@ func TestAccAwsDxGatewayAssociationProposal_disappears(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxGatewayAssociationProposalDestroy, Steps: []resource.TestStep{ @@ -194,6 +197,7 @@ func TestAccAwsDxGatewayAssociationProposal_AllowedPrefixes(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxGatewayAssociationProposalDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_gateway_association_test.go b/aws/resource_aws_dx_gateway_association_test.go index ee7f28d5e33d..0a4355f702a2 100644 --- a/aws/resource_aws_dx_gateway_association_test.go +++ b/aws/resource_aws_dx_gateway_association_test.go @@ -192,6 +192,7 @@ func TestAccAwsDxGatewayAssociation_V0StateUpgrade(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy, Steps: []resource.TestStep{ @@ -217,6 +218,7 @@ func TestAccAwsDxGatewayAssociation_basicVpnGatewaySingleAccount(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy, Steps: []resource.TestStep{ @@ -259,6 +261,7 @@ func TestAccAwsDxGatewayAssociation_basicVpnGatewayCrossAccount(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy, Steps: []resource.TestStep{ @@ -292,6 +295,7 @@ func TestAccAwsDxGatewayAssociation_basicTransitGatewaySingleAccount(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy, Steps: []resource.TestStep{ @@ -335,6 +339,7 @@ func TestAccAwsDxGatewayAssociation_basicTransitGatewayCrossAccount(t *testing.T testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy, Steps: []resource.TestStep{ @@ -368,6 +373,7 @@ func TestAccAwsDxGatewayAssociation_multiVpnGatewaysSingleAccount(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy, Steps: []resource.TestStep{ @@ -399,6 +405,7 @@ func TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewaySingleAccount(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy, Steps: []resource.TestStep{ @@ -447,6 +454,7 @@ func TestAccAwsDxGatewayAssociation_allowedPrefixesVpnGatewayCrossAccount(t *tes testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy, Steps: []resource.TestStep{ @@ -492,6 +500,7 @@ func TestAccAwsDxGatewayAssociation_recreateProposal(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxGatewayAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_gateway_test.go b/aws/resource_aws_dx_gateway_test.go index 54462b8e1f9a..4809545c4420 100644 --- a/aws/resource_aws_dx_gateway_test.go +++ b/aws/resource_aws_dx_gateway_test.go @@ -119,6 +119,7 @@ func TestAccAwsDxGateway_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxGatewayDestroy, Steps: []resource.TestStep{ @@ -145,6 +146,7 @@ func TestAccAwsDxGateway_complex(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxGatewayDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_hosted_private_virtual_interface_test.go b/aws/resource_aws_dx_hosted_private_virtual_interface_test.go index 733a065a44f9..68d0e58791ea 100644 --- a/aws/resource_aws_dx_hosted_private_virtual_interface_test.go +++ b/aws/resource_aws_dx_hosted_private_virtual_interface_test.go @@ -36,6 +36,7 @@ func TestAccAwsDxHostedPrivateVirtualInterface_basic(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxHostedPrivateVirtualInterfaceDestroy, Steps: []resource.TestStep{ @@ -94,6 +95,7 @@ func TestAccAwsDxHostedPrivateVirtualInterface_AccepterTags(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxHostedPrivateVirtualInterfaceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_hosted_public_virtual_interface_test.go b/aws/resource_aws_dx_hosted_public_virtual_interface_test.go index 4fe2926f1da7..75340a861f98 100644 --- a/aws/resource_aws_dx_hosted_public_virtual_interface_test.go +++ b/aws/resource_aws_dx_hosted_public_virtual_interface_test.go @@ -37,6 +37,7 @@ func TestAccAwsDxHostedPublicVirtualInterface_basic(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxHostedPublicVirtualInterfaceDestroy, Steps: []resource.TestStep{ @@ -97,6 +98,7 @@ func TestAccAwsDxHostedPublicVirtualInterface_AccepterTags(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxHostedPublicVirtualInterfaceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_hosted_transit_virtual_interface_test.go b/aws/resource_aws_dx_hosted_transit_virtual_interface_test.go index cd2ff5978cce..a164976c2093 100644 --- a/aws/resource_aws_dx_hosted_transit_virtual_interface_test.go +++ b/aws/resource_aws_dx_hosted_transit_virtual_interface_test.go @@ -51,6 +51,7 @@ func testAccAwsDxHostedTransitVirtualInterface_basic(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxHostedTransitVirtualInterfaceDestroy, Steps: []resource.TestStep{ @@ -110,6 +111,7 @@ func testAccAwsDxHostedTransitVirtualInterface_accepterTags(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDxHostedTransitVirtualInterfaceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_lag_test.go b/aws/resource_aws_dx_lag_test.go index 82efc88f7618..eb28934f7d1c 100644 --- a/aws/resource_aws_dx_lag_test.go +++ b/aws/resource_aws_dx_lag_test.go @@ -85,6 +85,7 @@ func TestAccAWSDxLag_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxLagDestroy, Steps: []resource.TestStep{ @@ -124,6 +125,7 @@ func TestAccAWSDxLag_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxLagDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_private_virtual_interface_test.go b/aws/resource_aws_dx_private_virtual_interface_test.go index 71a61cf50063..31db597ad7b8 100644 --- a/aws/resource_aws_dx_private_virtual_interface_test.go +++ b/aws/resource_aws_dx_private_virtual_interface_test.go @@ -30,6 +30,7 @@ func TestAccAwsDxPrivateVirtualInterface_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxPrivateVirtualInterfaceDestroy, Steps: []resource.TestStep{ @@ -101,6 +102,7 @@ func TestAccAwsDxPrivateVirtualInterface_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxPrivateVirtualInterfaceDestroy, Steps: []resource.TestStep{ @@ -179,6 +181,7 @@ func TestAccAwsDxPrivateVirtualInterface_DxGateway(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxPrivateVirtualInterfaceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_public_virtual_interface_test.go b/aws/resource_aws_dx_public_virtual_interface_test.go index 47e867b05c71..b7f0cbd0c01c 100644 --- a/aws/resource_aws_dx_public_virtual_interface_test.go +++ b/aws/resource_aws_dx_public_virtual_interface_test.go @@ -35,6 +35,7 @@ func TestAccAwsDxPublicVirtualInterface_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxPublicVirtualInterfaceDestroy, Steps: []resource.TestStep{ @@ -86,6 +87,7 @@ func TestAccAwsDxPublicVirtualInterface_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxPublicVirtualInterfaceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dx_transit_virtual_interface_test.go b/aws/resource_aws_dx_transit_virtual_interface_test.go index 55640330ccd5..76e33c8e8cba 100644 --- a/aws/resource_aws_dx_transit_virtual_interface_test.go +++ b/aws/resource_aws_dx_transit_virtual_interface_test.go @@ -45,6 +45,7 @@ func testAccAwsDxTransitVirtualInterface_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxTransitVirtualInterfaceDestroy, Steps: []resource.TestStep{ @@ -117,6 +118,7 @@ func testAccAwsDxTransitVirtualInterface_Tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, directconnect.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsDxTransitVirtualInterfaceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dynamodb_global_table_test.go b/aws/resource_aws_dynamodb_global_table_test.go index 0ae6d12ba51e..232890430319 100644 --- a/aws/resource_aws_dynamodb_global_table_test.go +++ b/aws/resource_aws_dynamodb_global_table_test.go @@ -25,6 +25,7 @@ func TestAccAWSDynamoDbGlobalTable_basic(t *testing.T) { testAccPreCheckAWSDynamodbGlobalTable(t) testAccDynamoDBGlobalTablePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsDynamoDbGlobalTableDestroy, Steps: []resource.TestStep{ @@ -70,6 +71,7 @@ func TestAccAWSDynamoDbGlobalTable_multipleRegions(t *testing.T) { testAccMultipleRegionPreCheck(t, 2) testAccDynamoDBGlobalTablePreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsDynamoDbGlobalTableDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dynamodb_table_item_test.go b/aws/resource_aws_dynamodb_table_item_test.go index a9454385cbd8..4a49779f1e3b 100644 --- a/aws/resource_aws_dynamodb_table_item_test.go +++ b/aws/resource_aws_dynamodb_table_item_test.go @@ -26,6 +26,7 @@ func TestAccAWSDynamoDbTableItem_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbItemDestroy, Steps: []resource.TestStep{ @@ -60,6 +61,7 @@ func TestAccAWSDynamoDbTableItem_rangeKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbItemDestroy, Steps: []resource.TestStep{ @@ -103,6 +105,7 @@ func TestAccAWSDynamoDbTableItem_withMultipleItems(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbItemDestroy, Steps: []resource.TestStep{ @@ -150,6 +153,7 @@ func TestAccAWSDynamoDbTableItem_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbItemDestroy, Steps: []resource.TestStep{ @@ -197,6 +201,7 @@ func TestAccAWSDynamoDbTableItem_updateWithRangeKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbItemDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_dynamodb_table_test.go b/aws/resource_aws_dynamodb_table_test.go index 18999a85354f..cbe5f3352550 100644 --- a/aws/resource_aws_dynamodb_table_test.go +++ b/aws/resource_aws_dynamodb_table_test.go @@ -349,6 +349,7 @@ func TestAccAWSDynamoDbTable_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -383,6 +384,7 @@ func TestAccAWSDynamoDbTable_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -405,6 +407,7 @@ func TestAccAWSDynamoDbTable_disappears_PayPerRequestWithGSI(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -438,6 +441,7 @@ func TestAccAWSDynamoDbTable_extended(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -511,6 +515,7 @@ func TestAccAWSDynamoDbTable_enablePitr(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -545,6 +550,7 @@ func TestAccAWSDynamoDbTable_BillingMode_PayPerRequestToProvisioned(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -578,6 +584,7 @@ func TestAccAWSDynamoDbTable_BillingMode_ProvisionedToPayPerRequest(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -611,6 +618,7 @@ func TestAccAWSDynamoDbTable_BillingMode_GSI_PayPerRequestToProvisioned(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -644,6 +652,7 @@ func TestAccAWSDynamoDbTable_BillingMode_GSI_ProvisionedToPayPerRequest(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -677,6 +686,7 @@ func TestAccAWSDynamoDbTable_streamSpecification(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -712,6 +722,7 @@ func TestAccAWSDynamoDbTable_streamSpecification(t *testing.T) { func TestAccAWSDynamoDbTable_streamSpecificationValidation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -729,6 +740,7 @@ func TestAccAWSDynamoDbTable_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -757,6 +769,7 @@ func TestAccAWSDynamoDbTable_gsiUpdateCapacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -820,6 +833,7 @@ func TestAccAWSDynamoDbTable_gsiUpdateOtherAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -909,6 +923,7 @@ func TestAccAWSDynamoDbTable_lsiNonKeyAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -943,6 +958,7 @@ func TestAccAWSDynamoDbTable_gsiUpdateNonKeyAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -1035,6 +1051,7 @@ func TestAccAWSDynamoDbTable_gsiUpdateNonKeyAttributes_emptyPlan(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -1078,6 +1095,7 @@ func TestAccAWSDynamoDbTable_Ttl_Enabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -1107,6 +1125,7 @@ func TestAccAWSDynamoDbTable_Ttl_Disabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -1142,6 +1161,7 @@ func TestAccAWSDynamoDbTable_attributeUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -1185,6 +1205,7 @@ func TestAccAWSDynamoDbTable_lsiUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -1214,6 +1235,7 @@ func TestAccAWSDynamoDbTable_attributeUpdateValidation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -1242,6 +1264,7 @@ func TestAccAWSDynamoDbTable_encryption(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -1405,6 +1428,7 @@ func TestAccAWSDynamoDbTable_Replica_Multiple(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 3) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 3), CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ @@ -1450,6 +1474,7 @@ func TestAccAWSDynamoDbTable_Replica_Single(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, dynamodb.EndpointsID), ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 3), // 3 due to shared test configuration CheckDestroy: testAccCheckAWSDynamoDbTableDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ebs_default_kms_key_test.go b/aws/resource_aws_ebs_default_kms_key_test.go index d8a0bfb79782..28c5d0f26f88 100644 --- a/aws/resource_aws_ebs_default_kms_key_test.go +++ b/aws/resource_aws_ebs_default_kms_key_test.go @@ -17,6 +17,7 @@ func TestAccAWSEBSDefaultKmsKey_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEbsDefaultKmsKeyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ebs_encryption_by_default_test.go b/aws/resource_aws_ebs_encryption_by_default_test.go index 4e9fed80f0dc..2439c646caa5 100644 --- a/aws/resource_aws_ebs_encryption_by_default_test.go +++ b/aws/resource_aws_ebs_encryption_by_default_test.go @@ -15,6 +15,7 @@ func TestAccAWSEBSEncryptionByDefault_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEncryptionByDefaultDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ebs_snapshot_copy_test.go b/aws/resource_aws_ebs_snapshot_copy_test.go index d75eccf44527..0038944297da 100644 --- a/aws/resource_aws_ebs_snapshot_copy_test.go +++ b/aws/resource_aws_ebs_snapshot_copy_test.go @@ -18,6 +18,7 @@ func TestAccAWSEbsSnapshotCopy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEbsSnapshotCopyDestroy, Steps: []resource.TestStep{ @@ -39,6 +40,7 @@ func TestAccAWSEbsSnapshotCopy_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEbsSnapshotCopyDestroy, Steps: []resource.TestStep{ @@ -77,6 +79,7 @@ func TestAccAWSEbsSnapshotCopy_withDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEbsSnapshotCopyDestroy, Steps: []resource.TestStep{ @@ -101,6 +104,7 @@ func TestAccAWSEbsSnapshotCopy_withRegions(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckEbsSnapshotCopyDestroy, Steps: []resource.TestStep{ @@ -122,6 +126,7 @@ func TestAccAWSEbsSnapshotCopy_withKms(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEbsSnapshotCopyDestroy, Steps: []resource.TestStep{ @@ -142,6 +147,7 @@ func TestAccAWSEbsSnapshotCopy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEbsSnapshotCopyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ebs_snapshot_test.go b/aws/resource_aws_ebs_snapshot_test.go index dbcc0b4e4805..cbf599bb19dd 100644 --- a/aws/resource_aws_ebs_snapshot_test.go +++ b/aws/resource_aws_ebs_snapshot_test.go @@ -19,6 +19,7 @@ func TestAccAWSEBSSnapshot_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEbsSnapshotDestroy, Steps: []resource.TestStep{ @@ -47,6 +48,7 @@ func TestAccAWSEBSSnapshot_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEbsSnapshotDestroy, Steps: []resource.TestStep{ @@ -91,6 +93,7 @@ func TestAccAWSEBSSnapshot_withDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEbsSnapshotDestroy, Steps: []resource.TestStep{ @@ -118,6 +121,7 @@ func TestAccAWSEBSSnapshot_withKms(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEbsSnapshotDestroy, Steps: []resource.TestStep{ @@ -144,6 +148,7 @@ func TestAccAWSEBSSnapshot_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEbsSnapshotDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_availability_zone_group_test.go b/aws/resource_aws_ec2_availability_zone_group_test.go index 3370c34c29f9..31b3acd9ae8b 100644 --- a/aws/resource_aws_ec2_availability_zone_group_test.go +++ b/aws/resource_aws_ec2_availability_zone_group_test.go @@ -19,6 +19,7 @@ func TestAccAWSEc2AvailabilityZoneGroup_OptInStatus(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2AvailabilityZoneGroup(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_capacity_reservation_test.go b/aws/resource_aws_ec2_capacity_reservation_test.go index 3a64e9d51077..099a58407966 100644 --- a/aws/resource_aws_ec2_capacity_reservation_test.go +++ b/aws/resource_aws_ec2_capacity_reservation_test.go @@ -71,6 +71,7 @@ func TestAccAWSEc2CapacityReservation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2CapacityReservation(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2CapacityReservationDestroy, Steps: []resource.TestStep{ @@ -108,6 +109,7 @@ func TestAccAWSEc2CapacityReservation_ebsOptimized(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2CapacityReservation(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2CapacityReservationDestroy, Steps: []resource.TestStep{ @@ -135,6 +137,7 @@ func TestAccAWSEc2CapacityReservation_endDate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2CapacityReservation(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2CapacityReservationDestroy, Steps: []resource.TestStep{ @@ -170,6 +173,7 @@ func TestAccAWSEc2CapacityReservation_endDateType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2CapacityReservation(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2CapacityReservationDestroy, Steps: []resource.TestStep{ @@ -210,6 +214,7 @@ func TestAccAWSEc2CapacityReservation_ephemeralStorage(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2CapacityReservation(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2CapacityReservationDestroy, Steps: []resource.TestStep{ @@ -235,6 +240,7 @@ func TestAccAWSEc2CapacityReservation_instanceCount(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2CapacityReservation(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2CapacityReservationDestroy, Steps: []resource.TestStep{ @@ -267,6 +273,7 @@ func TestAccAWSEc2CapacityReservation_instanceMatchCriteria(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2CapacityReservation(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2CapacityReservationDestroy, Steps: []resource.TestStep{ @@ -292,6 +299,7 @@ func TestAccAWSEc2CapacityReservation_instanceType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2CapacityReservation(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2CapacityReservationDestroy, Steps: []resource.TestStep{ @@ -324,6 +332,7 @@ func TestAccAWSEc2CapacityReservation_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2CapacityReservation(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2CapacityReservationDestroy, Steps: []resource.TestStep{ @@ -367,6 +376,7 @@ func TestAccAWSEc2CapacityReservation_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2CapacityReservation(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2CapacityReservationDestroy, Steps: []resource.TestStep{ @@ -390,6 +400,7 @@ func TestAccAWSEc2CapacityReservation_tenancy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2CapacityReservation(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2CapacityReservationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_carrier_gateway.go b/aws/resource_aws_ec2_carrier_gateway.go index 85285aaa417d..07c1b7f67d27 100644 --- a/aws/resource_aws_ec2_carrier_gateway.go +++ b/aws/resource_aws_ec2_carrier_gateway.go @@ -99,7 +99,7 @@ func resourceAwsEc2CarrierGatewayRead(d *schema.ResourceData, meta interface{}) Partition: meta.(*AWSClient).partition, Service: ec2.ServiceName, Region: meta.(*AWSClient).region, - AccountID: meta.(*AWSClient).accountid, + AccountID: aws.StringValue(carrierGateway.OwnerId), Resource: fmt.Sprintf("carrier-gateway/%s", d.Id()), }.String() d.Set("arn", arn) diff --git a/aws/resource_aws_ec2_carrier_gateway_test.go b/aws/resource_aws_ec2_carrier_gateway_test.go index 56d1e6daab35..9665241f6dc6 100644 --- a/aws/resource_aws_ec2_carrier_gateway_test.go +++ b/aws/resource_aws_ec2_carrier_gateway_test.go @@ -74,6 +74,7 @@ func TestAccAWSEc2CarrierGateway_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWavelengthZoneAvailable(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckEc2CarrierGatewayDestroy, @@ -104,6 +105,7 @@ func TestAccAWSEc2CarrierGateway_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWavelengthZoneAvailable(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckEc2CarrierGatewayDestroy, @@ -127,6 +129,7 @@ func TestAccAWSEc2CarrierGateway_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWavelengthZoneAvailable(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckEc2CarrierGatewayDestroy, diff --git a/aws/resource_aws_ec2_client_vpn_authorization_rule_test.go b/aws/resource_aws_ec2_client_vpn_authorization_rule_test.go index 5b2a3a5346a8..f96d1b1011d6 100644 --- a/aws/resource_aws_ec2_client_vpn_authorization_rule_test.go +++ b/aws/resource_aws_ec2_client_vpn_authorization_rule_test.go @@ -21,6 +21,7 @@ func testAccAwsEc2ClientVpnAuthorizationRule_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnAuthorizationRuleDestroy, Steps: []resource.TestStep{ @@ -65,6 +66,7 @@ func testAccAwsEc2ClientVpnAuthorizationRule_groups(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnAuthorizationRuleDestroy, Steps: []resource.TestStep{ @@ -135,6 +137,7 @@ func testAccAwsEc2ClientVpnAuthorizationRule_Subnets(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnAuthorizationRuleDestroy, Steps: []resource.TestStep{ @@ -177,6 +180,7 @@ func testAccAwsEc2ClientVpnAuthorizationRule_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnAuthorizationRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_client_vpn_endpoint_test.go b/aws/resource_aws_ec2_client_vpn_endpoint_test.go index 1ef30b67f68d..e53927e69402 100644 --- a/aws/resource_aws_ec2_client_vpn_endpoint_test.go +++ b/aws/resource_aws_ec2_client_vpn_endpoint_test.go @@ -101,9 +101,10 @@ func TestAccAwsEc2ClientVpn_serial(t *testing.T) { "disappears": testAccAwsEc2ClientVpnAuthorizationRule_disappears, }, "NetworkAssociation": { - "basic": testAccAwsEc2ClientVpnNetworkAssociation_basic, - "disappears": testAccAwsEc2ClientVpnNetworkAssociation_disappears, - "securityGroups": testAccAwsEc2ClientVpnNetworkAssociation_securityGroups, + "basic": testAccAwsEc2ClientVpnNetworkAssociation_basic, + "multipleSubnets": testAccAwsEc2ClientVpnNetworkAssociation_multipleSubnets, + "disappears": testAccAwsEc2ClientVpnNetworkAssociation_disappears, + "securityGroups": testAccAwsEc2ClientVpnNetworkAssociation_securityGroups, }, "Route": { "basic": testAccAwsEc2ClientVpnRoute_basic, @@ -136,6 +137,7 @@ func testAccAwsEc2ClientVpnEndpoint_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnEndpointDestroy, Steps: []resource.TestStep{ @@ -165,6 +167,7 @@ func testAccAwsEc2ClientVpnEndpoint_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnEndpointDestroy, Steps: []resource.TestStep{ @@ -187,6 +190,7 @@ func testAccAwsEc2ClientVpnEndpoint_msAD(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnEndpointDestroy, Steps: []resource.TestStep{ @@ -214,6 +218,7 @@ func testAccAwsEc2ClientVpnEndpoint_mutualAuthAndMsAD(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnEndpointDestroy, Steps: []resource.TestStep{ @@ -242,6 +247,7 @@ func testAccAwsEc2ClientVpnEndpoint_federated(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckClientVPNSyncronize(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnEndpointDestroy, Steps: []resource.TestStep{ @@ -271,6 +277,7 @@ func testAccAwsEc2ClientVpnEndpoint_withLogGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnEndpointDestroy, Steps: []resource.TestStep{ @@ -306,6 +313,7 @@ func testAccAwsEc2ClientVpnEndpoint_withDNSServers(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnEndpointDestroy, Steps: []resource.TestStep{ @@ -332,6 +340,7 @@ func testAccAwsEc2ClientVpnEndpoint_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnEndpointDestroy, Steps: []resource.TestStep{ @@ -374,6 +383,7 @@ func testAccAwsEc2ClientVpnEndpoint_splitTunnel(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnEndpointDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_client_vpn_network_association_test.go b/aws/resource_aws_ec2_client_vpn_network_association_test.go index 55035fc4dbf5..48b825064c65 100644 --- a/aws/resource_aws_ec2_client_vpn_network_association_test.go +++ b/aws/resource_aws_ec2_client_vpn_network_association_test.go @@ -104,6 +104,7 @@ func testAccAwsEc2ClientVpnNetworkAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnNetworkAssociationDestroy, Steps: []resource.TestStep{ @@ -131,6 +132,54 @@ func testAccAwsEc2ClientVpnNetworkAssociation_basic(t *testing.T) { }) } +func testAccAwsEc2ClientVpnNetworkAssociation_multipleSubnets(t *testing.T) { + var assoc ec2.TargetNetwork + var group ec2.SecurityGroup + rStr := acctest.RandString(5) + resourceNames := []string{"aws_ec2_client_vpn_network_association.test", "aws_ec2_client_vpn_network_association.test2"} + endpointResourceName := "aws_ec2_client_vpn_endpoint.test" + subnetResourceNames := []string{"aws_subnet.test", "aws_subnet.test2"} + vpcResourceName := "aws_vpc.test" + defaultSecurityGroupResourceName := "aws_default_security_group.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsEc2ClientVpnNetworkAssociationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccEc2ClientVpnNetworkAssociationConfigMultipleSubnets(rStr), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsEc2ClientVpnNetworkAssociationExists(resourceNames[0], &assoc), + resource.TestMatchResourceAttr(resourceNames[0], "association_id", regexp.MustCompile("^cvpn-assoc-[a-z0-9]+$")), + resource.TestMatchResourceAttr(resourceNames[1], "association_id", regexp.MustCompile("^cvpn-assoc-[a-z0-9]+$")), + resource.TestCheckResourceAttrPair(resourceNames[0], "id", resourceNames[0], "association_id"), + resource.TestCheckResourceAttrPair(resourceNames[0], "client_vpn_endpoint_id", endpointResourceName, "id"), + resource.TestCheckResourceAttrPair(resourceNames[0], "subnet_id", subnetResourceNames[0], "id"), + resource.TestCheckResourceAttrPair(resourceNames[1], "subnet_id", subnetResourceNames[1], "id"), + testAccCheckAWSDefaultSecurityGroupExists(defaultSecurityGroupResourceName, &group), + resource.TestCheckResourceAttr(resourceNames[0], "security_groups.#", "1"), + testAccCheckAwsEc2ClientVpnNetworkAssociationSecurityGroupID(resourceNames[0], "security_groups.*", &group), + resource.TestCheckResourceAttrPair(resourceNames[0], "vpc_id", vpcResourceName, "id"), + ), + }, + { + ResourceName: resourceNames[0], + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccAwsEc2ClientVpnNetworkAssociationImportStateIdFunc(resourceNames[0]), + }, + { + ResourceName: resourceNames[1], + ImportState: true, + ImportStateVerify: true, + ImportStateIdFunc: testAccAwsEc2ClientVpnNetworkAssociationImportStateIdFunc(resourceNames[1]), + }, + }, + }) +} + func testAccAwsEc2ClientVpnNetworkAssociation_disappears(t *testing.T) { var assoc ec2.TargetNetwork rStr := acctest.RandString(5) @@ -138,6 +187,7 @@ func testAccAwsEc2ClientVpnNetworkAssociation_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnNetworkAssociationDestroy, Steps: []resource.TestStep{ @@ -163,6 +213,7 @@ func testAccAwsEc2ClientVpnNetworkAssociation_securityGroups(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckClientVPNSyncronize(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnNetworkAssociationDestroy, Steps: []resource.TestStep{ @@ -296,6 +347,38 @@ resource "aws_ec2_client_vpn_endpoint" "test" { `, rName)) } +func testAccEc2ClientVpnNetworkAssociationConfigMultipleSubnets(rName string) string { + return composeConfig( + testAccEc2ClientVpnNetworkAssociationVpcBase(rName), + testAccEc2ClientVpnNetworkAssociationAcmCertificateBase(), + fmt.Sprintf(` +resource "aws_ec2_client_vpn_network_association" "test" { + client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.test.id + subnet_id = aws_subnet.test.id +} + +resource "aws_ec2_client_vpn_network_association" "test2" { + client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.test.id + subnet_id = aws_subnet.test2.id +} + +resource "aws_ec2_client_vpn_endpoint" "test" { + description = "terraform-testacc-clientvpn-%[1]s" + server_certificate_arn = aws_acm_certificate.test.arn + client_cidr_block = "10.0.0.0/16" + + authentication_options { + type = "certificate-authentication" + root_certificate_chain_arn = aws_acm_certificate.test.arn + } + + connection_log_options { + enabled = false + } +} +`, rName)) +} + func testAccEc2ClientVpnNetworkAssociationTwoSecurityGroups(rName string) string { return composeConfig( testAccEc2ClientVpnNetworkAssociationVpcBase(rName), @@ -400,6 +483,17 @@ resource "aws_subnet" "test" { Name = "tf-acc-subnet-%[1]s" } } + +resource "aws_subnet" "test2" { + availability_zone = data.aws_availability_zones.available.names[1] + cidr_block = cidrsubnet(aws_vpc.test.cidr_block, 8, 1) + vpc_id = aws_vpc.test.id + map_public_ip_on_launch = true + + tags = { + Name = "tf-acc-subnet-%[1]s-2" + } +} `, rName)) } diff --git a/aws/resource_aws_ec2_client_vpn_route_test.go b/aws/resource_aws_ec2_client_vpn_route_test.go index dfd37835c299..587881400c31 100644 --- a/aws/resource_aws_ec2_client_vpn_route_test.go +++ b/aws/resource_aws_ec2_client_vpn_route_test.go @@ -22,6 +22,7 @@ func testAccAwsEc2ClientVpnRoute_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnRouteDestroy, Steps: []resource.TestStep{ @@ -56,6 +57,7 @@ func testAccAwsEc2ClientVpnRoute_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnRouteDestroy, Steps: []resource.TestStep{ @@ -85,6 +87,7 @@ func testAccAwsEc2ClientVpnRoute_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheckClientVPNSyncronize(t); testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ClientVpnRouteDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_fleet_test.go b/aws/resource_aws_ec2_fleet_test.go index b4cc6346e287..59641b90445a 100644 --- a/aws/resource_aws_ec2_fleet_test.go +++ b/aws/resource_aws_ec2_fleet_test.go @@ -22,6 +22,7 @@ func TestAccAWSEc2Fleet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -68,6 +69,7 @@ func TestAccAWSEc2Fleet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -90,6 +92,7 @@ func TestAccAWSEc2Fleet_ExcessCapacityTerminationPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -127,6 +130,7 @@ func TestAccAWSEc2Fleet_LaunchTemplateConfig_LaunchTemplateSpecification_LaunchT resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -170,6 +174,7 @@ func TestAccAWSEc2Fleet_LaunchTemplateConfig_LaunchTemplateSpecification_LaunchT resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -213,6 +218,7 @@ func TestAccAWSEc2Fleet_LaunchTemplateConfig_LaunchTemplateSpecification_Version resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -261,6 +267,7 @@ func TestAccAWSEc2Fleet_LaunchTemplateConfig_Override_AvailabilityZone(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -300,6 +307,7 @@ func TestAccAWSEc2Fleet_LaunchTemplateConfig_Override_InstanceType(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -341,6 +349,7 @@ func TestAccAWSEc2Fleet_LaunchTemplateConfig_Override_MaxPrice(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -380,6 +389,7 @@ func TestAccAWSEc2Fleet_LaunchTemplateConfig_Override_Priority(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -419,6 +429,7 @@ func TestAccAWSEc2Fleet_LaunchTemplateConfig_Override_Priority_Multiple(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -462,6 +473,7 @@ func TestAccAWSEc2Fleet_LaunchTemplateConfig_Override_SubnetId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -501,6 +513,7 @@ func TestAccAWSEc2Fleet_LaunchTemplateConfig_Override_WeightedCapacity(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -540,6 +553,7 @@ func TestAccAWSEc2Fleet_LaunchTemplateConfig_Override_WeightedCapacity_Multiple( resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -581,6 +595,7 @@ func TestAccAWSEc2Fleet_OnDemandOptions_AllocationStrategy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -618,6 +633,7 @@ func TestAccAWSEc2Fleet_ReplaceUnhealthyInstances(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -653,6 +669,7 @@ func TestAccAWSEc2Fleet_SpotOptions_AllocationStrategy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -690,6 +707,7 @@ func TestAccAWSEc2Fleet_SpotOptions_CapacityRebalance(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -719,6 +737,7 @@ func TestAccAWSEc2Fleet_SpotOptions_InstanceInterruptionBehavior(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -756,6 +775,7 @@ func TestAccAWSEc2Fleet_SpotOptions_InstancePoolsToUseCount(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -793,6 +813,7 @@ func TestAccAWSEc2Fleet_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -829,6 +850,7 @@ func TestAccAWSEc2Fleet_TargetCapacitySpecification_DefaultTargetCapacityType(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -860,6 +882,7 @@ func TestAccAWSEc2Fleet_TargetCapacitySpecification_DefaultTargetCapacityType_On resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -888,6 +911,7 @@ func TestAccAWSEc2Fleet_TargetCapacitySpecification_DefaultTargetCapacityType_Sp resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -916,6 +940,7 @@ func TestAccAWSEc2Fleet_TargetCapacitySpecification_TotalTargetCapacity(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -953,6 +978,7 @@ func TestAccAWSEc2Fleet_TerminateInstancesWithExpiration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -988,6 +1014,7 @@ func TestAccAWSEc2Fleet_Type(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ @@ -1025,6 +1052,7 @@ func TestAccAWSEc2Fleet_TemplateMultipleNetworkInterfaces(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2Fleet(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2FleetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_local_gateway_route_table_vpc_association_test.go b/aws/resource_aws_ec2_local_gateway_route_table_vpc_association_test.go index 1c6a8e681c8a..2f06b8772907 100644 --- a/aws/resource_aws_ec2_local_gateway_route_table_vpc_association_test.go +++ b/aws/resource_aws_ec2_local_gateway_route_table_vpc_association_test.go @@ -19,6 +19,7 @@ func TestAccAwsEc2LocalGatewayRouteTableVpcAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2LocalGatewayRouteTableVpcAssociationDestroy, Steps: []resource.TestStep{ @@ -47,6 +48,7 @@ func TestAccAwsEc2LocalGatewayRouteTableVpcAssociation_disappears(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2LocalGatewayRouteTableVpcAssociationDestroy, Steps: []resource.TestStep{ @@ -68,6 +70,7 @@ func TestAccAwsEc2LocalGatewayRouteTableVpcAssociation_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2LocalGatewayRouteTableVpcAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_local_gateway_route_test.go b/aws/resource_aws_ec2_local_gateway_route_test.go index acefe135050d..9839b9870eb4 100644 --- a/aws/resource_aws_ec2_local_gateway_route_test.go +++ b/aws/resource_aws_ec2_local_gateway_route_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -18,6 +19,7 @@ func TestAccAWSEc2LocalGatewayRoute_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2LocalGatewayRouteDestroy, Steps: []resource.TestStep{ @@ -46,6 +48,7 @@ func TestAccAWSEc2LocalGatewayRoute_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2LocalGatewayRouteDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_managed_prefix_list_test.go b/aws/resource_aws_ec2_managed_prefix_list_test.go index 07216393049d..d82cd4ded0d1 100644 --- a/aws/resource_aws_ec2_managed_prefix_list_test.go +++ b/aws/resource_aws_ec2_managed_prefix_list_test.go @@ -20,6 +20,7 @@ func TestAccAwsEc2ManagedPrefixList_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ManagedPrefixListDestroy, Steps: []resource.TestStep{ @@ -53,6 +54,7 @@ func TestAccAwsEc2ManagedPrefixList_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ManagedPrefixListDestroy, Steps: []resource.TestStep{ @@ -74,6 +76,7 @@ func TestAccAwsEc2ManagedPrefixList_AddressFamily_IPv6(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ManagedPrefixListDestroy, Steps: []resource.TestStep{ @@ -100,6 +103,7 @@ func TestAccAwsEc2ManagedPrefixList_Entry(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ManagedPrefixListDestroy, Steps: []resource.TestStep{ @@ -158,6 +162,7 @@ func TestAccAwsEc2ManagedPrefixList_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ManagedPrefixListDestroy, Steps: []resource.TestStep{ @@ -194,6 +199,7 @@ func TestAccAwsEc2ManagedPrefixList_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2ManagedPrefixListDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_tag_test.go b/aws/resource_aws_ec2_tag_test.go index a542e6222fbe..8b379a02ad7e 100644 --- a/aws/resource_aws_ec2_tag_test.go +++ b/aws/resource_aws_ec2_tag_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -16,6 +17,7 @@ func TestAccAWSEc2Tag_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2TagDestroy, Steps: []resource.TestStep{ @@ -42,6 +44,7 @@ func TestAccAWSEc2Tag_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2TagDestroy, Steps: []resource.TestStep{ @@ -63,6 +66,7 @@ func TestAccAWSEc2Tag_Value(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEc2TagDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_traffic_mirror_filter_rule_test.go b/aws/resource_aws_ec2_traffic_mirror_filter_rule_test.go index 274983a3192d..826f7daeb801 100644 --- a/aws/resource_aws_ec2_traffic_mirror_filter_rule_test.go +++ b/aws/resource_aws_ec2_traffic_mirror_filter_rule_test.go @@ -31,6 +31,7 @@ func TestAccAWSEc2TrafficMirrorFilterRule_basic(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorFilterRule(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorFilterRuleDestroy, Steps: []resource.TestStep{ @@ -113,6 +114,7 @@ func TestAccAWSEc2TrafficMirrorFilterRule_disappears(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorFilterRule(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorFilterRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_traffic_mirror_filter_test.go b/aws/resource_aws_ec2_traffic_mirror_filter_test.go index 911e619eb877..824d6dfb6c70 100644 --- a/aws/resource_aws_ec2_traffic_mirror_filter_test.go +++ b/aws/resource_aws_ec2_traffic_mirror_filter_test.go @@ -21,6 +21,7 @@ func TestAccAWSEc2TrafficMirrorFilter_basic(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorFilter(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorFilterDestroy, Steps: []resource.TestStep{ @@ -70,6 +71,7 @@ func TestAccAWSEc2TrafficMirrorFilter_tags(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorFilter(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorFilterDestroy, Steps: []resource.TestStep{ @@ -117,6 +119,7 @@ func TestAccAWSEc2TrafficMirrorFilter_disappears(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorFilter(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorFilterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_traffic_mirror_session.go b/aws/resource_aws_ec2_traffic_mirror_session.go index 631aa1ac6027..fcfa758b01b1 100644 --- a/aws/resource_aws_ec2_traffic_mirror_session.go +++ b/aws/resource_aws_ec2_traffic_mirror_session.go @@ -35,6 +35,10 @@ func resourceAwsEc2TrafficMirrorSession() *schema.Resource { Required: true, ForceNew: true, }, + "owner_id": { + Type: schema.TypeString, + Computed: true, + }, "packet_length": { Type: schema.TypeInt, Optional: true, @@ -217,14 +221,14 @@ func resourceAwsEc2TrafficMirrorSessionRead(d *schema.ResourceData, meta interfa return fmt.Errorf("error setting tags: %s", err) } + d.Set("owner_id", session.OwnerId) arn := arn.ARN{ Partition: meta.(*AWSClient).partition, Service: ec2.ServiceName, Region: meta.(*AWSClient).region, - AccountID: meta.(*AWSClient).accountid, + AccountID: aws.StringValue(session.OwnerId), Resource: fmt.Sprintf("traffic-mirror-session/%s", d.Id()), }.String() - d.Set("arn", arn) return nil diff --git a/aws/resource_aws_ec2_traffic_mirror_session_test.go b/aws/resource_aws_ec2_traffic_mirror_session_test.go index e72729664d44..eda920a28bde 100644 --- a/aws/resource_aws_ec2_traffic_mirror_session_test.go +++ b/aws/resource_aws_ec2_traffic_mirror_session_test.go @@ -27,6 +27,7 @@ func TestAccAWSEc2TrafficMirrorSession_basic(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorSession(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorSessionDestroy, Steps: []resource.TestStep{ @@ -40,6 +41,7 @@ func TestAccAWSEc2TrafficMirrorSession_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "session_number", strconv.Itoa(session)), resource.TestMatchResourceAttr(resourceName, "virtual_network_id", regexp.MustCompile(`\d+`)), resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + testAccCheckResourceAttrAccountID(resourceName, "owner_id"), testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`traffic-mirror-session/tms-.+`)), ), }, @@ -86,6 +88,7 @@ func TestAccAWSEc2TrafficMirrorSession_tags(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorSession(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorSessionDestroy, Steps: []resource.TestStep{ @@ -134,6 +137,7 @@ func TestAccAWSEc2TrafficMirrorSession_disappears(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorSession(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorSessionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_traffic_mirror_target.go b/aws/resource_aws_ec2_traffic_mirror_target.go index b712d3618382..023500b832d3 100644 --- a/aws/resource_aws_ec2_traffic_mirror_target.go +++ b/aws/resource_aws_ec2_traffic_mirror_target.go @@ -21,6 +21,10 @@ func resourceAwsEc2TrafficMirrorTarget() *schema.Resource { State: schema.ImportStatePassthrough, }, Schema: map[string]*schema.Schema{ + "arn": { + Type: schema.TypeString, + Computed: true, + }, "description": { Type: schema.TypeString, Optional: true, @@ -45,11 +49,11 @@ func resourceAwsEc2TrafficMirrorTarget() *schema.Resource { }, ValidateFunc: validateArn, }, - "tags": tagsSchema(), - "arn": { + "owner_id": { Type: schema.TypeString, Computed: true, }, + "tags": tagsSchema(), }, } } @@ -133,11 +137,13 @@ func resourceAwsEc2TrafficMirrorTargetRead(d *schema.ResourceData, meta interfac return fmt.Errorf("error setting tags: %s", err) } + d.Set("owner_id", target.OwnerId) + arn := arn.ARN{ Partition: meta.(*AWSClient).partition, Service: ec2.ServiceName, Region: meta.(*AWSClient).region, - AccountID: meta.(*AWSClient).accountid, + AccountID: aws.StringValue(target.OwnerId), Resource: fmt.Sprintf("traffic-mirror-target/%s", d.Id()), }.String() diff --git a/aws/resource_aws_ec2_traffic_mirror_target_test.go b/aws/resource_aws_ec2_traffic_mirror_target_test.go index 6c39895493d9..cd557cf59bba 100644 --- a/aws/resource_aws_ec2_traffic_mirror_target_test.go +++ b/aws/resource_aws_ec2_traffic_mirror_target_test.go @@ -23,6 +23,7 @@ func TestAccAWSEc2TrafficMirrorTarget_nlb(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorTarget(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorTargetDestroy, Steps: []resource.TestStep{ @@ -30,6 +31,7 @@ func TestAccAWSEc2TrafficMirrorTarget_nlb(t *testing.T) { Config: testAccTrafficMirrorTargetConfigNlb(rName, description), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEc2TrafficMirrorTargetExists(resourceName, &v), + testAccCheckResourceAttrAccountID(resourceName, "owner_id"), testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`traffic-mirror-target/tmt-.+`)), resource.TestCheckResourceAttr(resourceName, "description", description), resource.TestCheckResourceAttrPair(resourceName, "network_load_balancer_arn", "aws_lb.lb", "arn"), @@ -56,6 +58,7 @@ func TestAccAWSEc2TrafficMirrorTarget_eni(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorTarget(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorTargetDestroy, Steps: []resource.TestStep{ @@ -88,6 +91,7 @@ func TestAccAWSEc2TrafficMirrorTarget_tags(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorTarget(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorTargetDestroy, Steps: []resource.TestStep{ @@ -136,6 +140,7 @@ func TestAccAWSEc2TrafficMirrorTarget_disappears(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TrafficMirrorTarget(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TrafficMirrorTargetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_transit_gateway_peering_attachment_accepter_test.go b/aws/resource_aws_ec2_transit_gateway_peering_attachment_accepter_test.go index d1a2cee7aacc..d8f0f835f08f 100644 --- a/aws/resource_aws_ec2_transit_gateway_peering_attachment_accepter_test.go +++ b/aws/resource_aws_ec2_transit_gateway_peering_attachment_accepter_test.go @@ -25,6 +25,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentAccepter_basic_sameAccount(t *t testAccMultipleRegionPreCheck(t, 2) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayPeeringAttachmentDestroy, Steps: []resource.TestStep{ @@ -62,6 +63,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentAccepter_Tags_sameAccount(t *te testAccMultipleRegionPreCheck(t, 2) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayPeeringAttachmentDestroy, Steps: []resource.TestStep{ @@ -112,6 +114,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachmentAccepter_basic_differentAccount testAccAlternateAccountPreCheck(t) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayPeeringAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_transit_gateway_peering_attachment_test.go b/aws/resource_aws_ec2_transit_gateway_peering_attachment_test.go index 8003764130d0..8b5998ca08c3 100644 --- a/aws/resource_aws_ec2_transit_gateway_peering_attachment_test.go +++ b/aws/resource_aws_ec2_transit_gateway_peering_attachment_test.go @@ -93,6 +93,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachment_basic(t *testing.T) { testAccPreCheckAWSEc2TransitGateway(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayPeeringAttachmentDestroy, Steps: []resource.TestStep{ @@ -129,6 +130,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachment_disappears(t *testing.T) { testAccPreCheckAWSEc2TransitGateway(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayPeeringAttachmentDestroy, Steps: []resource.TestStep{ @@ -156,6 +158,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachment_Tags_sameAccount(t *testing.T) testAccPreCheckAWSEc2TransitGateway(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayPeeringAttachmentDestroy, Steps: []resource.TestStep{ @@ -210,6 +213,7 @@ func TestAccAWSEc2TransitGatewayPeeringAttachment_differentAccount(t *testing.T) testAccMultipleRegionPreCheck(t, 2) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayPeeringAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_transit_gateway_prefix_list_reference_test.go b/aws/resource_aws_ec2_transit_gateway_prefix_list_reference_test.go index 21cdfadbfd65..f89af1b89d75 100644 --- a/aws/resource_aws_ec2_transit_gateway_prefix_list_reference_test.go +++ b/aws/resource_aws_ec2_transit_gateway_prefix_list_reference_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -24,6 +25,7 @@ func TestAccAwsEc2TransitGatewayPrefixListReference_basic(t *testing.T) { testAccPreCheckAWSEc2TransitGateway(t) testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2TransitGatewayPrefixListReferenceDestroy, Steps: []resource.TestStep{ @@ -57,6 +59,7 @@ func TestAccAwsEc2TransitGatewayPrefixListReference_disappears(t *testing.T) { testAccPreCheckAWSEc2TransitGateway(t) testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2TransitGatewayPrefixListReferenceDestroy, Steps: []resource.TestStep{ @@ -83,6 +86,7 @@ func TestAccAwsEc2TransitGatewayPrefixListReference_disappears_TransitGateway(t testAccPreCheckAWSEc2TransitGateway(t) testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2TransitGatewayPrefixListReferenceDestroy, Steps: []resource.TestStep{ @@ -110,6 +114,7 @@ func TestAccAwsEc2TransitGatewayPrefixListReference_TransitGatewayAttachmentId(t testAccPreCheckAWSEc2TransitGateway(t) testAccPreCheckEc2ManagedPrefixList(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsEc2TransitGatewayPrefixListReferenceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_transit_gateway_route_table_association_test.go b/aws/resource_aws_ec2_transit_gateway_route_table_association_test.go index 4ef5527f375b..b41d56b79f54 100644 --- a/aws/resource_aws_ec2_transit_gateway_route_table_association_test.go +++ b/aws/resource_aws_ec2_transit_gateway_route_table_association_test.go @@ -17,6 +17,7 @@ func TestAccAWSEc2TransitGatewayRouteTableAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayRouteTableAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_transit_gateway_route_table_propagation_test.go b/aws/resource_aws_ec2_transit_gateway_route_table_propagation_test.go index ef1577bbb2ef..f4bf3cc9e270 100644 --- a/aws/resource_aws_ec2_transit_gateway_route_table_propagation_test.go +++ b/aws/resource_aws_ec2_transit_gateway_route_table_propagation_test.go @@ -17,6 +17,7 @@ func TestAccAWSEc2TransitGatewayRouteTablePropagation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayRouteTablePropagationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_transit_gateway_route_table_test.go b/aws/resource_aws_ec2_transit_gateway_route_table_test.go index 33356d33dcef..959b642e2d4b 100644 --- a/aws/resource_aws_ec2_transit_gateway_route_table_test.go +++ b/aws/resource_aws_ec2_transit_gateway_route_table_test.go @@ -19,6 +19,7 @@ func TestAccAWSEc2TransitGatewayRouteTable_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayRouteTableDestroy, Steps: []resource.TestStep{ @@ -48,6 +49,7 @@ func TestAccAWSEc2TransitGatewayRouteTable_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayRouteTableDestroy, Steps: []resource.TestStep{ @@ -71,6 +73,7 @@ func TestAccAWSEc2TransitGatewayRouteTable_disappears_TransitGateway(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayRouteTableDestroy, Steps: []resource.TestStep{ @@ -93,6 +96,7 @@ func TestAccAWSEc2TransitGatewayRouteTable_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayRouteTableDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_transit_gateway_route_test.go b/aws/resource_aws_ec2_transit_gateway_route_test.go index cb5b9941bc62..b127957c98ef 100644 --- a/aws/resource_aws_ec2_transit_gateway_route_test.go +++ b/aws/resource_aws_ec2_transit_gateway_route_test.go @@ -17,6 +17,7 @@ func TestAccAWSEc2TransitGatewayRoute_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayRouteDestroy, Steps: []resource.TestStep{ @@ -47,6 +48,7 @@ func TestAccAWSEc2TransitGatewayRoute_basic_ipv6(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayRouteDestroy, Steps: []resource.TestStep{ @@ -76,6 +78,7 @@ func TestAccAWSEc2TransitGatewayRoute_blackhole(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayRouteDestroy, Steps: []resource.TestStep{ @@ -106,6 +109,7 @@ func TestAccAWSEc2TransitGatewayRoute_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayRouteDestroy, Steps: []resource.TestStep{ @@ -132,6 +136,7 @@ func TestAccAWSEc2TransitGatewayRoute_disappears_TransitGatewayAttachment(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayRouteDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_transit_gateway_test.go b/aws/resource_aws_ec2_transit_gateway_test.go index 8cd8529a7585..67f1878082ab 100644 --- a/aws/resource_aws_ec2_transit_gateway_test.go +++ b/aws/resource_aws_ec2_transit_gateway_test.go @@ -114,6 +114,7 @@ func TestAccAWSEc2TransitGateway_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -150,6 +151,7 @@ func TestAccAWSEc2TransitGateway_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -171,6 +173,7 @@ func TestAccAWSEc2TransitGateway_AmazonSideASN(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -204,6 +207,7 @@ func TestAccAWSEc2TransitGateway_AutoAcceptSharedAttachments(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -237,6 +241,7 @@ func TestAccAWSEc2TransitGateway_DefaultRouteTableAssociationAndPropagationDisab resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -263,6 +268,7 @@ func TestAccAWSEc2TransitGateway_DefaultRouteTableAssociation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -304,6 +310,7 @@ func TestAccAWSEc2TransitGateway_DefaultRouteTablePropagation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -345,6 +352,7 @@ func TestAccAWSEc2TransitGateway_DnsSupport(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -378,6 +386,7 @@ func TestAccAWSEc2TransitGateway_VpnEcmpSupport(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -411,6 +420,7 @@ func TestAccAWSEc2TransitGateway_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ @@ -444,6 +454,7 @@ func TestAccAWSEc2TransitGateway_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_transit_gateway_vpc_attachment_accepter_test.go b/aws/resource_aws_ec2_transit_gateway_vpc_attachment_accepter_test.go index 8c533cf293d8..23f926cdf8bc 100644 --- a/aws/resource_aws_ec2_transit_gateway_vpc_attachment_accepter_test.go +++ b/aws/resource_aws_ec2_transit_gateway_vpc_attachment_accepter_test.go @@ -26,6 +26,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachmentAccepter_basic(t *testing.T) { testAccAlternateAccountPreCheck(t) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -72,6 +73,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachmentAccepter_Tags(t *testing.T) { testAccAlternateAccountPreCheck(t) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -141,6 +143,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachmentAccepter_TransitGatewayDefaultRoute testAccAlternateAccountPreCheck(t) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ec2_transit_gateway_vpc_attachment_test.go b/aws/resource_aws_ec2_transit_gateway_vpc_attachment_test.go index 47a5799d9d40..7337b2883d51 100644 --- a/aws/resource_aws_ec2_transit_gateway_vpc_attachment_test.go +++ b/aws/resource_aws_ec2_transit_gateway_vpc_attachment_test.go @@ -91,6 +91,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -124,6 +125,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachment_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -145,6 +147,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachment_ApplianceModeSupport(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -186,6 +189,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachment_DnsSupport(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -219,6 +223,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachment_Ipv6Support(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -259,6 +264,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachment_SharedTransitGateway(t *testing.T) testAccAlternateAccountPreCheck(t) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -284,6 +290,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachment_SubnetIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -325,6 +332,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachment_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -372,6 +380,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachment_TransitGatewayDefaultRouteTableAss resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -403,6 +412,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachment_TransitGatewayDefaultRouteTableAss resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ @@ -452,6 +462,7 @@ func TestAccAWSEc2TransitGatewayVpcAttachment_TransitGatewayDefaultRouteTablePro resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEc2TransitGatewayVpcAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ecr_lifecycle_policy_test.go b/aws/resource_aws_ecr_lifecycle_policy_test.go index f76efb10e800..30301a236599 100644 --- a/aws/resource_aws_ecr_lifecycle_policy_test.go +++ b/aws/resource_aws_ecr_lifecycle_policy_test.go @@ -18,6 +18,7 @@ func TestAccAWSEcrLifecyclePolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcrLifecyclePolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ecr_repository_policy.go b/aws/resource_aws_ecr_repository_policy.go index ba7106239013..f5d9e92eef8e 100644 --- a/aws/resource_aws_ecr_repository_policy.go +++ b/aws/resource_aws_ecr_repository_policy.go @@ -3,20 +3,20 @@ package aws import ( "fmt" "log" - "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ecr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsEcrRepositoryPolicy() *schema.Resource { return &schema.Resource{ - Create: resourceAwsEcrRepositoryPolicyCreate, + Create: resourceAwsEcrRepositoryPolicyPut, Read: resourceAwsEcrRepositoryPolicyRead, - Update: resourceAwsEcrRepositoryPolicyUpdate, + Update: resourceAwsEcrRepositoryPolicyPut, Delete: resourceAwsEcrRepositoryPolicyDelete, Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, @@ -31,6 +31,7 @@ func resourceAwsEcrRepositoryPolicy() *schema.Resource { "policy": { Type: schema.TypeString, Required: true, + ValidateFunc: validation.StringIsJSON, DiffSuppressFunc: suppressEquivalentAwsPolicyDiffs, }, "registry_id": { @@ -41,7 +42,7 @@ func resourceAwsEcrRepositoryPolicy() *schema.Resource { } } -func resourceAwsEcrRepositoryPolicyCreate(d *schema.ResourceData, meta interface{}) error { +func resourceAwsEcrRepositoryPolicyPut(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ecrconn input := ecr.SetRepositoryPolicyInput{ @@ -49,15 +50,15 @@ func resourceAwsEcrRepositoryPolicyCreate(d *schema.ResourceData, meta interface PolicyText: aws.String(d.Get("policy").(string)), } - log.Printf("[DEBUG] Creating ECR resository policy: %s", input) + log.Printf("[DEBUG] Creating ECR repository policy: %#v", input) // Retry due to IAM eventual consistency var err error var out *ecr.SetRepositoryPolicyOutput - err = resource.Retry(2*time.Minute, func() *resource.RetryError { + err = resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { out, err = conn.SetRepositoryPolicy(&input) - if isAWSErr(err, "InvalidParameterException", "Invalid repository policy provided") { + if isAWSErr(err, ecr.ErrCodeInvalidParameterException, "Invalid repository policy provided") { return resource.RetryableError(err) } if err != nil { @@ -69,15 +70,12 @@ func resourceAwsEcrRepositoryPolicyCreate(d *schema.ResourceData, meta interface out, err = conn.SetRepositoryPolicy(&input) } if err != nil { - return fmt.Errorf("Error creating ECR Repository Policy: %s", err) + return fmt.Errorf("error creating ECR Repository Policy: %w", err) } - repositoryPolicy := *out + log.Printf("[DEBUG] ECR repository policy created: %s", aws.StringValue(out.RepositoryName)) - log.Printf("[DEBUG] ECR repository policy created: %s", *repositoryPolicy.RepositoryName) - - d.SetId(aws.StringValue(repositoryPolicy.RepositoryName)) - d.Set("registry_id", repositoryPolicy.RegistryId) + d.SetId(aws.StringValue(out.RepositoryName)) return resourceAwsEcrRepositoryPolicyRead(d, meta) } @@ -90,70 +88,20 @@ func resourceAwsEcrRepositoryPolicyRead(d *schema.ResourceData, meta interface{} RepositoryName: aws.String(d.Id()), }) if err != nil { - if ecrerr, ok := err.(awserr.Error); ok { - switch ecrerr.Code() { - case "RepositoryNotFoundException", "RepositoryPolicyNotFoundException": - d.SetId("") - return nil - default: - return err - } + if isAWSErr(err, ecr.ErrCodeRepositoryNotFoundException, "") || + isAWSErr(err, ecr.ErrCodeRepositoryPolicyNotFoundException, "") { + log.Printf("[WARN] ECR Repository Policy %s not found, removing", d.Id()) + d.SetId("") + return nil } return err } log.Printf("[DEBUG] Received repository policy %s", out) - repositoryPolicy := out - - d.SetId(aws.StringValue(repositoryPolicy.RepositoryName)) - d.Set("repository", repositoryPolicy.RepositoryName) - d.Set("registry_id", repositoryPolicy.RegistryId) - d.Set("policy", repositoryPolicy.PolicyText) - - return nil -} - -func resourceAwsEcrRepositoryPolicyUpdate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*AWSClient).ecrconn - - if !d.HasChange("policy") { - return nil - } - - input := ecr.SetRepositoryPolicyInput{ - RepositoryName: aws.String(d.Get("repository").(string)), - RegistryId: aws.String(d.Get("registry_id").(string)), - PolicyText: aws.String(d.Get("policy").(string)), - } - - log.Printf("[DEBUG] Updating ECR resository policy: %s", input) - - // Retry due to IAM eventual consistency - var err error - var out *ecr.SetRepositoryPolicyOutput - err = resource.Retry(2*time.Minute, func() *resource.RetryError { - out, err = conn.SetRepositoryPolicy(&input) - - if isAWSErr(err, "InvalidParameterException", "Invalid repository policy provided") { - return resource.RetryableError(err) - } - if err != nil { - return resource.NonRetryableError(err) - } - return nil - }) - if isResourceTimeoutError(err) { - out, err = conn.SetRepositoryPolicy(&input) - } - if err != nil { - return fmt.Errorf("Error updating ECR Repository Policy: %s", err) - } - - repositoryPolicy := *out - - d.SetId(aws.StringValue(repositoryPolicy.RepositoryName)) - d.Set("registry_id", repositoryPolicy.RegistryId) + d.Set("repository", out.RepositoryName) + d.Set("registry_id", out.RegistryId) + d.Set("policy", out.PolicyText) return nil } @@ -166,13 +114,9 @@ func resourceAwsEcrRepositoryPolicyDelete(d *schema.ResourceData, meta interface RegistryId: aws.String(d.Get("registry_id").(string)), }) if err != nil { - if ecrerr, ok := err.(awserr.Error); ok { - switch ecrerr.Code() { - case "RepositoryNotFoundException", "RepositoryPolicyNotFoundException": - return nil - default: - return err - } + if isAWSErr(err, ecr.ErrCodeRepositoryNotFoundException, "") || + isAWSErr(err, ecr.ErrCodeRepositoryPolicyNotFoundException, "") { + return nil } return err } diff --git a/aws/resource_aws_ecr_repository_policy_test.go b/aws/resource_aws_ecr_repository_policy_test.go index 4bbff0651e70..e04a2559a65f 100644 --- a/aws/resource_aws_ecr_repository_policy_test.go +++ b/aws/resource_aws_ecr_repository_policy_test.go @@ -2,10 +2,10 @@ package aws import ( "fmt" + "regexp" "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ecr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" @@ -13,18 +13,22 @@ import ( ) func TestAccAWSEcrRepositoryPolicy_basic(t *testing.T) { - randString := acctest.RandString(10) - resourceName := "aws_ecr_repository_policy.default" + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecr_repository_policy.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcrRepositoryPolicyDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcrRepositoryPolicy(randString), + Config: testAccAWSEcrRepositoryPolicyConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcrRepositoryPolicyExists(resourceName), + resource.TestCheckResourceAttrPair(resourceName, "repository", "aws_ecr_repository.test", "name"), + resource.TestMatchResourceAttr(resourceName, "policy", regexp.MustCompile(rName)), + testAccCheckResourceAttrAccountID(resourceName, "registry_id"), ), }, { @@ -32,23 +36,36 @@ func TestAccAWSEcrRepositoryPolicy_basic(t *testing.T) { ImportState: true, ImportStateVerify: true, }, + { + Config: testAccAWSEcrRepositoryPolicyConfigUpdated(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEcrRepositoryPolicyExists(resourceName), + resource.TestCheckResourceAttrPair(resourceName, "repository", "aws_ecr_repository.test", "name"), + resource.TestMatchResourceAttr(resourceName, "policy", regexp.MustCompile(rName)), + resource.TestMatchResourceAttr(resourceName, "policy", regexp.MustCompile("ecr:DescribeImages")), + testAccCheckResourceAttrAccountID(resourceName, "registry_id"), + ), + }, }, }) } func TestAccAWSEcrRepositoryPolicy_iam(t *testing.T) { - randString := acctest.RandString(10) - resourceName := "aws_ecr_repository_policy.default" + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecr_repository_policy.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcrRepositoryPolicyDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcrRepositoryPolicyWithIAMRole(randString), + Config: testAccAWSEcrRepositoryPolicyWithIAMRoleConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcrRepositoryPolicyExists(resourceName), + resource.TestMatchResourceAttr(resourceName, "policy", regexp.MustCompile(rName)), + resource.TestMatchResourceAttr(resourceName, "policy", regexp.MustCompile("iam")), ), }, { @@ -60,6 +77,50 @@ func TestAccAWSEcrRepositoryPolicy_iam(t *testing.T) { }) } +func TestAccAWSEcrRepositoryPolicy_disappears(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecr_repository_policy.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecr.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSEcrRepositoryPolicyDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSEcrRepositoryPolicyConfig(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEcrRepositoryPolicyExists(resourceName), + testAccCheckResourceDisappears(testAccProvider, resourceAwsEcrRepositoryPolicy(), resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + +func TestAccAWSEcrRepositoryPolicy_disappears_repository(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecr_repository_policy.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecr.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSEcrRepositoryPolicyDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSEcrRepositoryPolicyConfig(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEcrRepositoryPolicyExists(resourceName), + testAccCheckResourceDisappears(testAccProvider, resourceAwsEcrRepository(), resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + func testAccCheckAWSEcrRepositoryPolicyDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).ecrconn @@ -70,10 +131,11 @@ func testAccCheckAWSEcrRepositoryPolicyDestroy(s *terraform.State) error { _, err := conn.GetRepositoryPolicy(&ecr.GetRepositoryPolicyInput{ RegistryId: aws.String(rs.Primary.Attributes["registry_id"]), - RepositoryName: aws.String(rs.Primary.Attributes["repository"]), + RepositoryName: aws.String(rs.Primary.ID), }) if err != nil { - if ecrerr, ok := err.(awserr.Error); ok && ecrerr.Code() == "RepositoryNotFoundException" { + if isAWSErr(err, ecr.ErrCodeRepositoryNotFoundException, "") || + isAWSErr(err, ecr.ErrCodeRepositoryPolicyNotFoundException, "") { return nil } return err @@ -94,21 +156,21 @@ func testAccCheckAWSEcrRepositoryPolicyExists(name string) resource.TestCheckFun } } -func testAccAWSEcrRepositoryPolicy(randString string) string { +func testAccAWSEcrRepositoryPolicyConfig(rName string) string { return fmt.Sprintf(` -resource "aws_ecr_repository" "foo" { - name = "tf-acc-test-ecr-%s" +resource "aws_ecr_repository" "test" { + name = %[1]q } -resource "aws_ecr_repository_policy" "default" { - repository = aws_ecr_repository.foo.name +resource "aws_ecr_repository_policy" "test" { + repository = aws_ecr_repository.test.name policy = < 0 && v.([]interface{})[0] != nil { + input.DeploymentConfiguration = &ecs.DeploymentConfiguration{} + input.DeploymentConfiguration.DeploymentCircuitBreaker = expandECSDeploymentCircuitBreaker(v.([]interface{})[0].(map[string]interface{})) + } + if v, ok := d.GetOk("cluster"); ok { input.Cluster = aws.String(v.(string)) } @@ -498,45 +525,62 @@ func resourceAwsEcsServiceCreate(d *schema.ResourceData, meta interface{}) error log.Printf("[DEBUG] Creating ECS service: %s", input) // Retry due to AWS IAM & ECS eventual consistency - var out *ecs.CreateServiceOutput - var err error - err = resource.Retry(2*time.Minute, func() *resource.RetryError { - out, err = conn.CreateService(&input) + err := resource.Retry(iamwaiter.PropagationTimeout+waiter.ServiceCreateTimeout, func() *resource.RetryError { + output, err := conn.CreateService(&input) if err != nil { - if isAWSErr(err, ecs.ErrCodeClusterNotFoundException, "") { + if tfawserr.ErrCodeEquals(err, ecs.ErrCodeClusterNotFoundException) { return resource.RetryableError(err) } - if isAWSErr(err, ecs.ErrCodeInvalidParameterException, "Please verify that the ECS service role being passed has the proper permissions.") { + + if tfawserr.ErrMessageContains(err, ecs.ErrCodeInvalidParameterException, "verify that the ECS service role being passed has the proper permissions") { return resource.RetryableError(err) } - if isAWSErr(err, ecs.ErrCodeInvalidParameterException, "does not have an associated load balancer") { + + if tfawserr.ErrMessageContains(err, ecs.ErrCodeInvalidParameterException, "does not have an associated load balancer") { return resource.RetryableError(err) } - if isAWSErr(err, ecs.ErrCodeInvalidParameterException, "Unable to assume the service linked role."+ - " Please verify that the ECS service linked role exists") { + + if tfawserr.ErrMessageContains(err, ecs.ErrCodeInvalidParameterException, "Unable to assume the service linked role") { return resource.RetryableError(err) } - return resource.NonRetryableError(err) + + return resource.NonRetryableError(fmt.Errorf("error waiting for ECS service (%s) creation: %w", d.Get("name").(string), err)) } + log.Printf("[DEBUG] ECS service created: %s", aws.StringValue(output.Service.ServiceArn)) + d.SetId(aws.StringValue(output.Service.ServiceArn)) + return nil }) - if isResourceTimeoutError(err) { - out, err = conn.CreateService(&input) + + if tfresource.TimedOut(err) { + output, err := conn.CreateService(&input) + + if err != nil { + return fmt.Errorf("error creating ECS service: %w", err) + } + + if output == nil || output.Service == nil { + return fmt.Errorf("error creating ECS service: empty response") + } + + log.Printf("[DEBUG] ECS service created: %s", aws.StringValue(output.Service.ServiceArn)) + d.SetId(aws.StringValue(output.Service.ServiceArn)) } + if err != nil { - return fmt.Errorf("%s %q", err, d.Get("name").(string)) + return fmt.Errorf("error creating %s service: %w", d.Get("name").(string), err) } - service := *out.Service - - log.Printf("[DEBUG] ECS service created: %s", aws.StringValue(service.ServiceArn)) - d.SetId(aws.StringValue(service.ServiceArn)) - if d.Get("wait_for_steady_state").(bool) { - if err := waitForSteadyState(conn, d); err != nil { - return err + cluster := "" + if v, ok := d.GetOk("cluster"); ok { + cluster = v.(string) + } + + if err := waiter.ServiceStable(conn, d.Id(), cluster); err != nil { + return fmt.Errorf("error waiting for ECS service (%s) to become ready: %w", d.Id(), err) } } @@ -550,52 +594,33 @@ func resourceAwsEcsServiceRead(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Reading ECS service %s", d.Id()) input := ecs.DescribeServicesInput{ Cluster: aws.String(d.Get("cluster").(string)), - Include: []*string{aws.String(ecs.ServiceFieldTags)}, - Services: []*string{aws.String(d.Id())}, + Include: aws.StringSlice([]string{ecs.ServiceFieldTags}), + Services: aws.StringSlice([]string{d.Id()}), } - var out *ecs.DescribeServicesOutput - err := resource.Retry(2*time.Minute, func() *resource.RetryError { - var err error - out, err = conn.DescribeServices(&input) - if err != nil { - if d.IsNewResource() && isAWSErr(err, ecs.ErrCodeServiceNotFoundException, "") { - return resource.RetryableError(err) - } - return resource.NonRetryableError(err) - } - - if len(out.Services) < 1 { - if d.IsNewResource() { - return resource.RetryableError(fmt.Errorf("ECS service not created yet: %q", d.Id())) - } - log.Printf("[WARN] ECS Service %s not found, removing from state.", d.Id()) - d.SetId("") - return nil - } - - service := out.Services[0] - if d.IsNewResource() && *service.Status == "INACTIVE" { - return resource.RetryableError(fmt.Errorf("ECS service currently INACTIVE: %q", d.Id())) - } + output, err := conn.DescribeServices(&input) + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, ecs.ErrCodeServiceNotFoundException) { + log.Printf("[WARN] ECS service (%s) not found, removing from state", d.Id()) + d.SetId("") return nil - }) - if isResourceTimeoutError(err) { - out, err = conn.DescribeServices(&input) } - if isAWSErr(err, ecs.ErrCodeClusterNotFoundException, "") { + if err != nil { + output, err = waiter.ServiceDescribeReady(conn, d.Id(), d.Get("cluster").(string)) + } + + if tfawserr.ErrCodeEquals(err, ecs.ErrCodeClusterNotFoundException) { log.Printf("[WARN] ECS Service %s parent cluster %s not found, removing from state.", d.Id(), d.Get("cluster").(string)) d.SetId("") return nil } if err != nil { - return fmt.Errorf("Error reading ECS service: %s", err) + return fmt.Errorf("error reading ECS service: %w", err) } - if len(out.Services) < 1 { + if len(output.Services) < 1 { if d.IsNewResource() { return fmt.Errorf("ECS service not created: %q", d.Id()) } @@ -604,11 +629,11 @@ func resourceAwsEcsServiceRead(d *schema.ResourceData, meta interface{}) error { return nil } - service := out.Services[0] + service := output.Services[0] // Status==INACTIVE means deleted service - if *service.Status == "INACTIVE" { - log.Printf("[WARN] Removing ECS service %q because it's INACTIVE", *service.ServiceArn) + if aws.StringValue(service.Status) == "INACTIVE" { + log.Printf("[WARN] Removing ECS service %q because it's INACTIVE", aws.StringValue(service.ServiceArn)) d.SetId("") return nil } @@ -626,7 +651,7 @@ func resourceAwsEcsServiceRead(d *schema.ResourceData, meta interface{}) error { if strings.HasPrefix(d.Get("task_definition").(string), "arn:"+meta.(*AWSClient).partition+":ecs:") { d.Set("task_definition", service.TaskDefinition) } else { - taskDefinition := buildFamilyAndRevisionFromARN(*service.TaskDefinition) + taskDefinition := buildFamilyAndRevisionFromARN(aws.StringValue(service.TaskDefinition)) d.Set("task_definition", taskDefinition) } } @@ -638,12 +663,13 @@ func resourceAwsEcsServiceRead(d *schema.ResourceData, meta interface{}) error { d.Set("enable_ecs_managed_tags", service.EnableECSManagedTags) d.Set("propagate_tags", service.PropagateTags) d.Set("platform_version", service.PlatformVersion) + d.Set("enable_execute_command", service.EnableExecuteCommand) // Save cluster in the same format if strings.HasPrefix(d.Get("cluster").(string), "arn:"+meta.(*AWSClient).partition+":ecs:") { d.Set("cluster", service.ClusterArn) } else { - clusterARN := getNameFromARN(*service.ClusterArn) + clusterARN := getNameFromARN(aws.StringValue(service.ClusterArn)) d.Set("cluster", clusterARN) } @@ -652,7 +678,7 @@ func resourceAwsEcsServiceRead(d *schema.ResourceData, meta interface{}) error { if strings.HasPrefix(d.Get("iam_role").(string), "arn:"+meta.(*AWSClient).partition+":iam:") { d.Set("iam_role", service.RoleArn) } else { - roleARN := getNameFromARN(*service.RoleArn) + roleARN := getNameFromARN(aws.StringValue(service.RoleArn)) d.Set("iam_role", roleARN) } } @@ -660,10 +686,18 @@ func resourceAwsEcsServiceRead(d *schema.ResourceData, meta interface{}) error { if service.DeploymentConfiguration != nil { d.Set("deployment_maximum_percent", service.DeploymentConfiguration.MaximumPercent) d.Set("deployment_minimum_healthy_percent", service.DeploymentConfiguration.MinimumHealthyPercent) + + if service.DeploymentConfiguration.DeploymentCircuitBreaker != nil { + if err := d.Set("deployment_circuit_breaker", []interface{}{flattenECSDeploymentCircuitBreaker(service.DeploymentConfiguration.DeploymentCircuitBreaker)}); err != nil { + return fmt.Errorf("error setting deployment_circuit_break: %w", err) + } + } else { + d.Set("deployment_circuit_breaker", nil) + } } if err := d.Set("deployment_controller", flattenEcsDeploymentController(service.DeploymentController)); err != nil { - return fmt.Errorf("Error setting deployment_controller for (%s): %s", d.Id(), err) + return fmt.Errorf("error setting deployment_controller for (%s): %w", d.Id(), err) } if service.LoadBalancers != nil { @@ -671,11 +705,11 @@ func resourceAwsEcsServiceRead(d *schema.ResourceData, meta interface{}) error { } if err := d.Set("capacity_provider_strategy", flattenEcsCapacityProviderStrategy(service.CapacityProviderStrategy)); err != nil { - return fmt.Errorf("error setting capacity_provider_strategy: %s", err) + return fmt.Errorf("error setting capacity_provider_strategy: %w", err) } if err := d.Set("ordered_placement_strategy", flattenPlacementStrategy(service.PlacementStrategy)); err != nil { - return fmt.Errorf("error setting ordered_placement_strategy: %s", err) + return fmt.Errorf("error setting ordered_placement_strategy: %w", err) } if err := d.Set("placement_constraints", flattenServicePlacementConstraints(service.PlacementConstraints)); err != nil { @@ -683,15 +717,15 @@ func resourceAwsEcsServiceRead(d *schema.ResourceData, meta interface{}) error { } if err := d.Set("network_configuration", flattenEcsNetworkConfiguration(service.NetworkConfiguration)); err != nil { - return fmt.Errorf("Error setting network_configuration for (%s): %s", d.Id(), err) + return fmt.Errorf("error setting network_configuration for (%s): %w", d.Id(), err) } if err := d.Set("service_registries", flattenServiceRegistries(service.ServiceRegistries)); err != nil { - return fmt.Errorf("Error setting service_registries for (%s): %s", d.Id(), err) + return fmt.Errorf("error setting service_registries for (%s): %w", d.Id(), err) } if err := d.Set("tags", keyvaluetags.EcsKeyValueTags(service.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + return fmt.Errorf("error setting tags: %w", err) } return nil @@ -725,6 +759,32 @@ func flattenEcsDeploymentController(deploymentController *ecs.DeploymentControll return []interface{}{m} } +func expandECSDeploymentCircuitBreaker(tfMap map[string]interface{}) *ecs.DeploymentCircuitBreaker { + if tfMap == nil { + return nil + } + + apiObject := &ecs.DeploymentCircuitBreaker{} + + apiObject.Enable = aws.Bool(tfMap["enable"].(bool)) + apiObject.Rollback = aws.Bool(tfMap["rollback"].(bool)) + + return apiObject +} + +func flattenECSDeploymentCircuitBreaker(apiObject *ecs.DeploymentCircuitBreaker) map[string]interface{} { + if apiObject == nil { + return nil + } + + tfMap := map[string]interface{}{} + + tfMap["enable"] = aws.BoolValue(apiObject.Enable) + tfMap["rollback"] = aws.BoolValue(apiObject.Rollback) + + return tfMap +} + func flattenEcsNetworkConfiguration(nc *ecs.NetworkConfiguration) []interface{} { if nc == nil { return nil @@ -735,7 +795,7 @@ func flattenEcsNetworkConfiguration(nc *ecs.NetworkConfiguration) []interface{} result["subnets"] = flattenStringSet(nc.AwsvpcConfiguration.Subnets) if nc.AwsvpcConfiguration.AssignPublicIp != nil { - result["assign_public_ip"] = *nc.AwsvpcConfiguration.AssignPublicIp == ecs.AssignPublicIpEnabled + result["assign_public_ip"] = aws.StringValue(nc.AwsvpcConfiguration.AssignPublicIp) == ecs.AssignPublicIpEnabled } return []interface{}{result} @@ -842,9 +902,9 @@ func flattenServicePlacementConstraints(pcs []*ecs.PlacementConstraint) []map[st results := make([]map[string]interface{}, 0) for _, pc := range pcs { c := make(map[string]interface{}) - c["type"] = *pc.Type + c["type"] = aws.StringValue(pc.Type) if pc.Expression != nil { - c["expression"] = *pc.Expression + c["expression"] = aws.StringValue(pc.Expression) } results = append(results, c) @@ -898,14 +958,14 @@ func flattenPlacementStrategy(pss []*ecs.PlacementStrategy) []interface{} { results := make([]interface{}, 0, len(pss)) for _, ps := range pss { c := make(map[string]interface{}) - c["type"] = *ps.Type + c["type"] = aws.StringValue(ps.Type) if ps.Field != nil { - c["field"] = *ps.Field + c["field"] = aws.StringValue(ps.Field) // for some fields the API requires lowercase for creation but will return uppercase on query - if *ps.Field == "MEMORY" || *ps.Field == "CPU" { - c["field"] = strings.ToLower(*ps.Field) + if aws.StringValue(ps.Field) == "MEMORY" || aws.StringValue(ps.Field) == "CPU" { + c["field"] = strings.ToLower(aws.StringValue(ps.Field)) } } @@ -971,6 +1031,21 @@ func resourceAwsEcsServiceUpdate(d *schema.ResourceData, meta interface{}) error } } + if d.HasChange("deployment_circuit_breaker") { + updateService = true + + if input.DeploymentConfiguration == nil { + input.DeploymentConfiguration = &ecs.DeploymentConfiguration{} + } + + // To remove an existing deployment circuit breaker, specify an empty object. + input.DeploymentConfiguration.DeploymentCircuitBreaker = &ecs.DeploymentCircuitBreaker{} + + if v, ok := d.GetOk("deployment_circuit_breaker"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + input.DeploymentConfiguration.DeploymentCircuitBreaker = expandECSDeploymentCircuitBreaker(v.([]interface{})[0].(map[string]interface{})) + } + } + if d.HasChange("ordered_placement_strategy") { updateService = true // Reference: https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_UpdateService.html#ECS-UpdateService-request-placementStrategy @@ -1030,33 +1105,48 @@ func resourceAwsEcsServiceUpdate(d *schema.ResourceData, meta interface{}) error input.CapacityProviderStrategy = expandEcsCapacityProviderStrategy(d.Get("capacity_provider_strategy").(*schema.Set)) } + if d.HasChange("enable_execute_command") { + updateService = true + input.EnableExecuteCommand = aws.Bool(d.Get("enable_execute_command").(bool)) + } + if updateService { log.Printf("[DEBUG] Updating ECS Service (%s): %s", d.Id(), input) // Retry due to IAM eventual consistency - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout+waiter.ServiceUpdateTimeout, func() *resource.RetryError { _, err := conn.UpdateService(&input) + if err != nil { - if isAWSErr(err, ecs.ErrCodeInvalidParameterException, "Please verify that the ECS service role being passed has the proper permissions.") { + if tfawserr.ErrMessageContains(err, ecs.ErrCodeInvalidParameterException, "verify that the ECS service role being passed has the proper permissions") { return resource.RetryableError(err) } - if isAWSErr(err, ecs.ErrCodeInvalidParameterException, "does not have an associated load balancer") { + + if tfawserr.ErrMessageContains(err, ecs.ErrCodeInvalidParameterException, "does not have an associated load balancer") { return resource.RetryableError(err) } + return resource.NonRetryableError(err) } return nil }) - if isResourceTimeoutError(err) { + + if tfresource.TimedOut(err) { _, err = conn.UpdateService(&input) } + if err != nil { - return fmt.Errorf("Error updating ECS Service (%s): %s", d.Id(), err) + return fmt.Errorf("error updating ECS Service (%s): %w", d.Id(), err) } } if d.Get("wait_for_steady_state").(bool) { - if err := waitForSteadyState(conn, d); err != nil { - return err + cluster := "" + if v, ok := d.GetOk("cluster"); ok { + cluster = v.(string) + } + + if err := waiter.ServiceStable(conn, d.Id(), cluster); err != nil { + return fmt.Errorf("error waiting for ECS service (%s) to become ready: %w", d.Id(), err) } } @@ -1064,7 +1154,7 @@ func resourceAwsEcsServiceUpdate(d *schema.ResourceData, meta interface{}) error o, n := d.GetChange("tags") if err := keyvaluetags.EcsUpdateTags(conn, d.Id(), o, n); err != nil { - return fmt.Errorf("error updating ECS Service (%s) tags: %s", d.Id(), err) + return fmt.Errorf("error updating ECS Service (%s) tags: %w", d.Id(), err) } } @@ -1075,31 +1165,32 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error conn := meta.(*AWSClient).ecsconn // Check if it's not already gone - resp, err := conn.DescribeServices(&ecs.DescribeServicesInput{ - Services: []*string{aws.String(d.Id())}, + output, err := conn.DescribeServices(&ecs.DescribeServicesInput{ + Services: aws.StringSlice([]string{d.Id()}), Cluster: aws.String(d.Get("cluster").(string)), }) + if err != nil { - if isAWSErr(err, ecs.ErrCodeServiceNotFoundException, "") { + if tfawserr.ErrCodeEquals(err, ecs.ErrCodeServiceNotFoundException) { log.Printf("[DEBUG] Removing ECS Service from state, %q is already gone", d.Id()) return nil } return err } - if len(resp.Services) == 0 { + if len(output.Services) == 0 { log.Printf("[DEBUG] Removing ECS Service from state, %q is already gone", d.Id()) return nil } - log.Printf("[DEBUG] ECS service %s is currently %s", d.Id(), *resp.Services[0].Status) + log.Printf("[DEBUG] ECS service %s is currently %s", d.Id(), aws.StringValue(output.Services[0].Status)) - if *resp.Services[0].Status == "INACTIVE" { + if aws.StringValue(output.Services[0].Status) == "INACTIVE" { return nil } // Drain the ECS service - if *resp.Services[0].Status != "DRAINING" && aws.StringValue(resp.Services[0].SchedulingStrategy) != ecs.SchedulingStrategyDaemon { + if aws.StringValue(output.Services[0].Status) != "DRAINING" && aws.StringValue(output.Services[0].SchedulingStrategy) != ecs.SchedulingStrategyDaemon { log.Printf("[DEBUG] Draining ECS service %s", d.Id()) _, err = conn.UpdateService(&ecs.UpdateServiceInput{ Service: aws.String(d.Id()), @@ -1118,46 +1209,34 @@ func resourceAwsEcsServiceDelete(d *schema.ResourceData, meta interface{}) error // Wait until the ECS service is drained err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { log.Printf("[DEBUG] Trying to delete ECS service %s", input) + _, err := conn.DeleteService(&input) + if err != nil { - if isAWSErr(err, ecs.ErrCodeInvalidParameterException, "The service cannot be stopped while deployments are active.") { + if tfawserr.ErrMessageContains(err, ecs.ErrCodeInvalidParameterException, "The service cannot be stopped while deployments are active.") { + return resource.RetryableError(err) + } + + if tfawserr.ErrMessageContains(err, "DependencyViolation", "has a dependent object") { return resource.RetryableError(err) } + return resource.NonRetryableError(err) } + return nil }) + if isResourceTimeoutError(err) { _, err = conn.DeleteService(&input) } - if err != nil { - return fmt.Errorf("Error deleting ECS service: %s", err) - } - - // Wait until it's deleted - wait := resource.StateChangeConf{ - Pending: []string{"ACTIVE", "DRAINING"}, - Target: []string{"INACTIVE"}, - Timeout: 10 * time.Minute, - MinTimeout: 1 * time.Second, - Refresh: func() (interface{}, string, error) { - log.Printf("[DEBUG] Checking if ECS service %s is INACTIVE", d.Id()) - resp, err := conn.DescribeServices(&ecs.DescribeServicesInput{ - Services: []*string{aws.String(d.Id())}, - Cluster: aws.String(d.Get("cluster").(string)), - }) - if err != nil { - return resp, "FAILED", err - } - log.Printf("[DEBUG] ECS service (%s) is currently %q", d.Id(), *resp.Services[0].Status) - return resp, *resp.Services[0].Status, nil - }, + if err != nil { + return fmt.Errorf("error deleting ECS service (%s): %w", d.Id(), err) } - _, err = wait.WaitForState() - if err != nil { - return err + if err := waiter.ServiceInactive(conn, d.Id(), d.Get("cluster").(string)); err != nil { + return fmt.Errorf("error deleting ECS service (%s): %w", d.Id(), err) } log.Printf("[DEBUG] ECS service %s deleted.", d.Id()) @@ -1189,17 +1268,3 @@ func buildFamilyAndRevisionFromARN(arn string) string { func getNameFromARN(arn string) string { return strings.Split(arn, "/")[1] } - -func waitForSteadyState(conn *ecs.ECS, d *schema.ResourceData) error { - input := &ecs.DescribeServicesInput{ - Services: aws.StringSlice([]string{d.Id()}), - } - if v, ok := d.GetOk("cluster"); ok { - input.Cluster = aws.String(v.(string)) - } - - if err := conn.WaitUntilServicesStable(input); err != nil { - return fmt.Errorf("error waiting for service (%s) to reach a steady state: %w", d.Id(), err) - } - return nil -} diff --git a/aws/resource_aws_ecs_service_test.go b/aws/resource_aws_ecs_service_test.go index 291a4509d8a8..f89caae5fc29 100644 --- a/aws/resource_aws_ecs_service_test.go +++ b/aws/resource_aws_ecs_service_test.go @@ -107,32 +107,30 @@ func testSweepEcsServices(region string) error { func TestAccAWSEcsService_withARN(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-arn-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-arn-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-arn-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsService(clusterName, tdName, svcName), + Config: testAccAWSEcsService(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "service_registries.#", "0"), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "scheduling_strategy", "REPLICA"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "service_registries.#", "0"), + resource.TestCheckResourceAttr(resourceName, "scheduling_strategy", "REPLICA"), ), }, { - Config: testAccAWSEcsServiceModified(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceModified(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "service_registries.#", "0"), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "scheduling_strategy", "REPLICA"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "service_registries.#", "0"), + resource.TestCheckResourceAttr(resourceName, "scheduling_strategy", "REPLICA"), ), }, }, @@ -141,24 +139,20 @@ func TestAccAWSEcsService_withARN(t *testing.T) { func TestAccAWSEcsService_basicImport(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-%s", rString) - - resourceName := "aws_ecs_service.jenkins" - importInput := fmt.Sprintf("%s/%s", clusterName, svcName) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" + importInput := fmt.Sprintf("%s/%s", rName, rName) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithFamilyAndRevision(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithFamilyAndRevision(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.jenkins", &service), + testAccCheckAWSEcsServiceExists(resourceName, &service), ), }, // Test existent resource import @@ -173,7 +167,7 @@ func TestAccAWSEcsService_basicImport(t *testing.T) { // Test non-existent resource import { ResourceName: resourceName, - ImportStateId: fmt.Sprintf("%s/nonexistent", clusterName), + ImportStateId: fmt.Sprintf("%s/nonexistent", rName), ImportState: true, ImportStateVerify: false, ExpectError: regexp.MustCompile(`(Please verify the ID is correct|Cannot import non-existent remote object)`), @@ -184,22 +178,20 @@ func TestAccAWSEcsService_basicImport(t *testing.T) { func TestAccAWSEcsService_disappears(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-arn-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-arn-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-arn-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsService(clusterName, tdName, svcName), + Config: testAccAWSEcsService(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service), - testAccCheckAWSEcsServiceDisappears(&service), + testAccCheckAWSEcsServiceExists(resourceName, &service), + testAccCheckResourceDisappears(testAccProvider, resourceAwsEcsService(), resourceName), ), ExpectNonEmptyPlan: true, }, @@ -209,21 +201,19 @@ func TestAccAWSEcsService_disappears(t *testing.T) { func TestAccAWSEcsService_withUnnormalizedPlacementStrategy(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-ups-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-ups-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-ups-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithInterchangeablePlacementStrategy(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithInterchangeablePlacementStrategy(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service), + testAccCheckAWSEcsServiceExists(resourceName, &service), ), }, }, @@ -232,28 +222,25 @@ func TestAccAWSEcsService_withUnnormalizedPlacementStrategy(t *testing.T) { func TestAccAWSEcsService_withCapacityProviderStrategy(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-ups-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-ups-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-ups-%s", rString) - providerName := acctest.RandomWithPrefix("tf-acc-test") + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithCapacityProviderStrategy(providerName, clusterName, tdName, svcName, 1, 0), + Config: testAccAWSEcsServiceWithCapacityProviderStrategy(rName, 1, 0), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service), + testAccCheckAWSEcsServiceExists(resourceName, &service), ), }, { - Config: testAccAWSEcsServiceWithCapacityProviderStrategy(providerName, clusterName, tdName, svcName, 10, 1), + Config: testAccAWSEcsServiceWithCapacityProviderStrategy(rName, 10, 1), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service), + testAccCheckAWSEcsServiceExists(resourceName, &service), ), }, }, @@ -262,23 +249,20 @@ func TestAccAWSEcsService_withCapacityProviderStrategy(t *testing.T) { func TestAccAWSEcsService_withMultipleCapacityProviderStrategies(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-mcps-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-mcps-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-mcps-%s", rString) - sgName := fmt.Sprintf("tf-acc-sg-svc-w-mcps-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithMultipleCapacityProviderStrategies(clusterName, tdName, svcName, sgName), + Config: testAccAWSEcsServiceWithMultipleCapacityProviderStrategies(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "capacity_provider_strategy.#", "2"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "capacity_provider_strategy.#", "2"), ), }, }, @@ -287,28 +271,26 @@ func TestAccAWSEcsService_withMultipleCapacityProviderStrategies(t *testing.T) { func TestAccAWSEcsService_withFamilyAndRevision(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-far-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-far-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-far-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithFamilyAndRevision(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithFamilyAndRevision(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.jenkins", &service), + testAccCheckAWSEcsServiceExists(resourceName, &service), ), }, { - Config: testAccAWSEcsServiceWithFamilyAndRevisionModified(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithFamilyAndRevisionModified(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.jenkins", &service), + testAccCheckAWSEcsServiceExists(resourceName, &service), ), }, }, @@ -318,31 +300,28 @@ func TestAccAWSEcsService_withFamilyAndRevision(t *testing.T) { // Regression for https://github.com/hashicorp/terraform/issues/2427 func TestAccAWSEcsService_withRenamedCluster(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-rc-%s", rString) - uClusterName := fmt.Sprintf("tf-acc-cluster-svc-w-rc-updated-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-rc-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-rc-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithRenamedCluster(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithRenamedCluster(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.ghost", &service), - resource.TestCheckResourceAttrPair("aws_ecs_service.ghost", "cluster", "aws_ecs_cluster.default", "arn"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttrPair(resourceName, "cluster", "aws_ecs_cluster.default", "arn"), ), }, { - Config: testAccAWSEcsServiceWithRenamedCluster(uClusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithRenamedCluster(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.ghost", &service), - resource.TestCheckResourceAttrPair("aws_ecs_service.ghost", "cluster", "aws_ecs_cluster.default", "arn"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttrPair(resourceName, "cluster", "aws_ecs_cluster.default", "arn"), ), }, }, @@ -351,52 +330,39 @@ func TestAccAWSEcsService_withRenamedCluster(t *testing.T) { func TestAccAWSEcsService_healthCheckGracePeriodSeconds(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - vpcNameTag := "terraform-testacc-ecs-service-health-check-grace-period" - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-hcgps-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-hcgps-%s", rString) - roleName := fmt.Sprintf("tf-acc-role-svc-w-hcgps-%s", rString) - policyName := fmt.Sprintf("tf-acc-policy-svc-w-hcgps-%s", rString) - lbName := fmt.Sprintf("tf-acc-lb-svc-w-hcgps-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-hcgps-%s", rString) - - resourceName := "aws_ecs_service.with_alb" + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(vpcNameTag, clusterName, tdName, - roleName, policyName, lbName, svcName, -1), + Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(rName, -1), ExpectError: regexp.MustCompile(`expected health_check_grace_period_seconds to be in the range`), }, { - Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(vpcNameTag, clusterName, tdName, - roleName, policyName, lbName, svcName, math.MaxInt32+1), + Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(rName, math.MaxInt32+1), ExpectError: regexp.MustCompile(`expected health_check_grace_period_seconds to be in the range`), }, { - Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(vpcNameTag, clusterName, tdName, - roleName, policyName, lbName, svcName, 300), + Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(rName, 300), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists(resourceName, &service), resource.TestCheckResourceAttr(resourceName, "health_check_grace_period_seconds", "300"), ), }, { - Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(vpcNameTag, clusterName, tdName, - roleName, policyName, lbName, svcName, 600), + Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(rName, 600), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists(resourceName, &service), resource.TestCheckResourceAttr(resourceName, "health_check_grace_period_seconds", "600"), ), }, { - Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(vpcNameTag, clusterName, tdName, - roleName, policyName, lbName, svcName, math.MaxInt32), + Config: testAccAWSEcsService_healthCheckGracePeriodSeconds(rName, math.MaxInt32), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists(resourceName, &service), resource.TestCheckResourceAttr(resourceName, "health_check_grace_period_seconds", "2147483647"), @@ -408,23 +374,19 @@ func TestAccAWSEcsService_healthCheckGracePeriodSeconds(t *testing.T) { func TestAccAWSEcsService_withIamRole(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-iam-role-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-iam-role-%s", rString) - roleName := fmt.Sprintf("tf-acc-role-svc-w-iam-role-%s", rString) - policyName := fmt.Sprintf("tf-acc-policy-svc-w-iam-role-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-iam-role-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsService_withIamRole(clusterName, tdName, roleName, policyName, svcName), + Config: testAccAWSEcsService_withIamRole(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.ghost", &service), + testAccCheckAWSEcsServiceExists(resourceName, &service), ), }, }, @@ -438,6 +400,7 @@ func TestAccAWSEcsService_withDeploymentController_Type_CodeDeploy(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ @@ -469,6 +432,7 @@ func TestAccAWSEcsService_withDeploymentController_Type_External(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ @@ -494,25 +458,21 @@ func TestAccAWSEcsService_withDeploymentController_Type_External(t *testing.T) { func TestAccAWSEcsService_withDeploymentValues(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-dv-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-dv-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-dv-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithDeploymentValues(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithDeploymentValues(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service), - resource.TestCheckResourceAttr( - "aws_ecs_service.mongo", "deployment_maximum_percent", "200"), - resource.TestCheckResourceAttr( - "aws_ecs_service.mongo", "deployment_minimum_healthy_percent", "100"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "deployment_maximum_percent", "200"), + resource.TestCheckResourceAttr(resourceName, "deployment_minimum_healthy_percent", "100"), ), }, }, @@ -527,6 +487,7 @@ func TestAccAWSEcsService_withDeploymentMinimumZeroMaximumOneHundred(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ @@ -542,32 +503,52 @@ func TestAccAWSEcsService_withDeploymentMinimumZeroMaximumOneHundred(t *testing. }) } +func TestAccAWSEcsService_withDeploymentCircuitBreaker(t *testing.T) { + var service ecs.Service + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSEcsServiceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSEcsServiceConfigDeploymentCircuitBreaker(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "deployment_circuit_breaker.#", "1"), + resource.TestCheckResourceAttr(resourceName, "deployment_circuit_breaker.0.enable", "true"), + resource.TestCheckResourceAttr(resourceName, "deployment_circuit_breaker.0.rollback", "true"), + ), + }, + }, + }) +} + // Regression for https://github.com/hashicorp/terraform/issues/3444 func TestAccAWSEcsService_withLbChanges(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-lbc-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-lbc-%s", rString) - roleName := fmt.Sprintf("tf-acc-role-svc-w-lbc-%s", rString) - policyName := fmt.Sprintf("tf-acc-policy-svc-w-lbc-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-lbc-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsService_withLbChanges(clusterName, tdName, roleName, policyName, svcName), + Config: testAccAWSEcsService_withLbChanges(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.with_lb_changes", &service), + testAccCheckAWSEcsServiceExists(resourceName, &service), ), }, { - Config: testAccAWSEcsService_withLbChanges_modified(clusterName, tdName, roleName, policyName, svcName), + Config: testAccAWSEcsService_withLbChanges_modified(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.with_lb_changes", &service), + testAccCheckAWSEcsServiceExists(resourceName, &service), ), }, }, @@ -577,23 +558,20 @@ func TestAccAWSEcsService_withLbChanges(t *testing.T) { // Regression for https://github.com/hashicorp/terraform/issues/3361 func TestAccAWSEcsService_withEcsClusterName(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-cluster-name-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-cluster-name-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-cluster-name-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithEcsClusterName(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithEcsClusterName(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.jenkins", &service), - resource.TestCheckResourceAttr( - "aws_ecs_service.jenkins", "cluster", clusterName), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "cluster", rName), ), }, }, @@ -602,25 +580,20 @@ func TestAccAWSEcsService_withEcsClusterName(t *testing.T) { func TestAccAWSEcsService_withAlb(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-alb-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-alb-%s", rString) - roleName := fmt.Sprintf("tf-acc-role-svc-w-alb-%s", rString) - policyName := fmt.Sprintf("tf-acc-policy-svc-w-alb-%s", rString) - lbName := fmt.Sprintf("tf-acc-lb-svc-w-alb-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-alb-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithAlb(clusterName, tdName, roleName, policyName, lbName, svcName), + Config: testAccAWSEcsServiceWithAlb(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.with_alb", &service), - resource.TestCheckResourceAttr("aws_ecs_service.with_alb", "load_balancer.#", "1"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "load_balancer.#", "1"), ), }, }, @@ -629,23 +602,20 @@ func TestAccAWSEcsService_withAlb(t *testing.T) { func TestAccAWSEcsService_withMultipleTargetGroups(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-alb-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-alb-%s", rString) - lbName := fmt.Sprintf("tf-acc-lb-svc-w-alb-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-alb-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithMultipleTargetGroups(clusterName, tdName, lbName, svcName), + Config: testAccAWSEcsServiceWithMultipleTargetGroups(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.with_alb", &service), - resource.TestCheckResourceAttr("aws_ecs_service.with_alb", "load_balancer.#", "2"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "load_balancer.#", "2"), ), }, }, @@ -654,27 +624,24 @@ func TestAccAWSEcsService_withMultipleTargetGroups(t *testing.T) { func TestAccAWSEcsService_withForceNewDeployment(t *testing.T) { var service1, service2 ecs.Service - resourceName := "aws_ecs_service.mongo" - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-ps-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-ps-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-ps-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsService(clusterName, tdName, svcName), + Config: testAccAWSEcsService(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists(resourceName, &service1), resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.#", "0"), ), }, { - Config: testAccAWSEcsServiceWithForceNewDeployment(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithForceNewDeployment(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSEcsServiceExists(resourceName, &service2), testAccCheckAWSEcsServiceNotRecreated(&service1, &service2), @@ -689,54 +656,52 @@ func TestAccAWSEcsService_withForceNewDeployment(t *testing.T) { func TestAccAWSEcsService_withPlacementStrategy(t *testing.T) { var service1, service2, service3, service4 ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-ps-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-ps-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-ps-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsService(clusterName, tdName, svcName), + Config: testAccAWSEcsService(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service1), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.#", "0"), + testAccCheckAWSEcsServiceExists(resourceName, &service1), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.#", "0"), ), }, { - Config: testAccAWSEcsServiceWithPlacementStrategy(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithPlacementStrategy(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service2), + testAccCheckAWSEcsServiceExists(resourceName, &service2), testAccCheckAWSEcsServiceNotRecreated(&service1, &service2), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.#", "1"), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.0.type", "binpack"), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.0.field", "memory"), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.#", "1"), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.0.type", "binpack"), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.0.field", "memory"), ), }, { - Config: testAccAWSEcsServiceWithRandomPlacementStrategy(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithRandomPlacementStrategy(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service3), + testAccCheckAWSEcsServiceExists(resourceName, &service3), testAccCheckAWSEcsServiceNotRecreated(&service2, &service3), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.#", "1"), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.0.type", "random"), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.0.field", ""), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.#", "1"), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.0.type", "random"), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.0.field", ""), ), }, { - Config: testAccAWSEcsServiceWithMultiPlacementStrategy(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithMultiPlacementStrategy(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service4), + testAccCheckAWSEcsServiceExists(resourceName, &service4), testAccCheckAWSEcsServiceNotRecreated(&service3, &service4), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.#", "2"), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.0.type", "binpack"), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.0.field", "memory"), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.1.type", "spread"), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "ordered_placement_strategy.1.field", "instanceId"), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.#", "2"), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.0.type", "binpack"), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.0.field", "memory"), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.1.type", "spread"), + resource.TestCheckResourceAttr(resourceName, "ordered_placement_strategy.1.field", "instanceId"), ), }, }, @@ -749,6 +714,7 @@ func TestAccAWSEcsService_withPlacementStrategy_Type_Missing(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ @@ -762,30 +728,28 @@ func TestAccAWSEcsService_withPlacementStrategy_Type_Missing(t *testing.T) { func TestAccAWSEcsService_withPlacementConstraints(t *testing.T) { var service1, service2 ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-pc-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-pc-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-pc-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithPlacementConstraint(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithPlacementConstraint(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service1), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "placement_constraints.#", "1"), + testAccCheckAWSEcsServiceExists(resourceName, &service1), + resource.TestCheckResourceAttr(resourceName, "placement_constraints.#", "1"), ), }, { - Config: testAccAWSEcsServiceWithPlacementConstraintEmptyExpression(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithPlacementConstraintEmptyExpression(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service2), + testAccCheckAWSEcsServiceExists(resourceName, &service2), testAccCheckAWSEcsServiceNotRecreated(&service1, &service2), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "placement_constraints.#", "1"), + resource.TestCheckResourceAttr(resourceName, "placement_constraints.#", "1"), ), }, }, @@ -794,22 +758,20 @@ func TestAccAWSEcsService_withPlacementConstraints(t *testing.T) { func TestAccAWSEcsService_withPlacementConstraints_emptyExpression(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-pc-ee-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-pc-ee-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-pc-ee-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithPlacementConstraintEmptyExpression(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithPlacementConstraintEmptyExpression(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.mongo", &service), - resource.TestCheckResourceAttr("aws_ecs_service.mongo", "placement_constraints.#", "1"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "placement_constraints.#", "1"), ), }, }, @@ -818,42 +780,38 @@ func TestAccAWSEcsService_withPlacementConstraints_emptyExpression(t *testing.T) func TestAccAWSEcsService_withLaunchTypeFargate(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - sg1Name := fmt.Sprintf("tf-acc-sg-1-svc-w-ltf-%s", rString) - sg2Name := fmt.Sprintf("tf-acc-sg-2-svc-w-ltf-%s", rString) - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-ltf-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-ltf-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-ltf-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithLaunchTypeFargate(sg1Name, sg2Name, clusterName, tdName, svcName, "false"), + Config: testAccAWSEcsServiceWithLaunchTypeFargate(rName, false), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.main", &service), - resource.TestCheckResourceAttr("aws_ecs_service.main", "launch_type", "FARGATE"), - resource.TestCheckResourceAttr("aws_ecs_service.main", "network_configuration.0.assign_public_ip", "false"), - resource.TestCheckResourceAttr("aws_ecs_service.main", "network_configuration.0.security_groups.#", "2"), - resource.TestCheckResourceAttr("aws_ecs_service.main", "network_configuration.0.subnets.#", "2"), - resource.TestCheckResourceAttr("aws_ecs_service.main", "platform_version", "LATEST"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "launch_type", "FARGATE"), + resource.TestCheckResourceAttr(resourceName, "network_configuration.0.assign_public_ip", "false"), + resource.TestCheckResourceAttr(resourceName, "network_configuration.0.security_groups.#", "2"), + resource.TestCheckResourceAttr(resourceName, "network_configuration.0.subnets.#", "2"), + resource.TestCheckResourceAttr(resourceName, "platform_version", "LATEST"), ), }, { - Config: testAccAWSEcsServiceWithLaunchTypeFargate(sg1Name, sg2Name, clusterName, tdName, svcName, "true"), + Config: testAccAWSEcsServiceWithLaunchTypeFargate(rName, true), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.main", &service), - resource.TestCheckResourceAttr("aws_ecs_service.main", "network_configuration.0.assign_public_ip", "true"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "network_configuration.0.assign_public_ip", "true"), ), }, { - Config: testAccAWSEcsServiceWithLaunchTypeFargate(sg1Name, sg2Name, clusterName, tdName, svcName, "false"), + Config: testAccAWSEcsServiceWithLaunchTypeFargate(rName, false), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.main", &service), - resource.TestCheckResourceAttr("aws_ecs_service.main", "network_configuration.0.assign_public_ip", "false"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "network_configuration.0.assign_public_ip", "false"), ), }, }, @@ -862,38 +820,34 @@ func TestAccAWSEcsService_withLaunchTypeFargate(t *testing.T) { func TestAccAWSEcsService_withLaunchTypeFargateAndPlatformVersion(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - sg1Name := fmt.Sprintf("tf-acc-sg-1-svc-ltf-w-pv-%s", rString) - sg2Name := fmt.Sprintf("tf-acc-sg-2-svc-ltf-w-pv-%s", rString) - clusterName := fmt.Sprintf("tf-acc-cluster-svc-ltf-w-pv-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-ltf-w-pv-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-ltf-w-pv-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithLaunchTypeFargateAndPlatformVersion(sg1Name, sg2Name, clusterName, tdName, svcName, "1.3.0"), + Config: testAccAWSEcsServiceWithLaunchTypeFargateAndPlatformVersion(rName, "1.3.0"), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.main", &service), - resource.TestCheckResourceAttr("aws_ecs_service.main", "platform_version", "1.3.0"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "platform_version", "1.3.0"), ), }, { - Config: testAccAWSEcsServiceWithLaunchTypeFargateAndPlatformVersion(sg1Name, sg2Name, clusterName, tdName, svcName, "LATEST"), + Config: testAccAWSEcsServiceWithLaunchTypeFargateAndPlatformVersion(rName, "LATEST"), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.main", &service), - resource.TestCheckResourceAttr("aws_ecs_service.main", "platform_version", "LATEST"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "platform_version", "LATEST"), ), }, { - Config: testAccAWSEcsServiceWithLaunchTypeFargateAndPlatformVersion(sg1Name, sg2Name, clusterName, tdName, svcName, "1.4.0"), + Config: testAccAWSEcsServiceWithLaunchTypeFargateAndPlatformVersion(rName, "1.4.0"), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.main", &service), - resource.TestCheckResourceAttr("aws_ecs_service.main", "platform_version", "1.4.0"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "platform_version", "1.4.0"), ), }, }, @@ -902,12 +856,12 @@ func TestAccAWSEcsService_withLaunchTypeFargateAndPlatformVersion(t *testing.T) func TestAccAWSEcsService_withLaunchTypeFargateAndWaitForSteadyState(t *testing.T) { var service ecs.Service + rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_ecs_service.test" - rString := acctest.RandString(8) - rName := fmt.Sprintf("tf-acc-svc-w-ltf-ss-%s", rString) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ @@ -935,13 +889,12 @@ func TestAccAWSEcsService_withLaunchTypeFargateAndWaitForSteadyState(t *testing. func TestAccAWSEcsService_withLaunchTypeFargateAndUpdateWaitForSteadyState(t *testing.T) { var service ecs.Service + rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_ecs_service.test" - rString := acctest.RandString(8) - - rName := fmt.Sprintf("tf-acc-svc-w-ltf-ss-%s", rString) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ @@ -977,35 +930,31 @@ func TestAccAWSEcsService_withLaunchTypeFargateAndUpdateWaitForSteadyState(t *te func TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - sg1Name := fmt.Sprintf("tf-acc-sg-1-svc-w-nc-%s", rString) - sg2Name := fmt.Sprintf("tf-acc-sg-2-svc-w-nc-%s", rString) - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-nc-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-nc-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-nc-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithNetworkConfiguration(sg1Name, sg2Name, clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithNetworkConfiguration(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.main", &service), - resource.TestCheckResourceAttr("aws_ecs_service.main", "network_configuration.0.assign_public_ip", "false"), - resource.TestCheckResourceAttr("aws_ecs_service.main", "network_configuration.0.security_groups.#", "2"), - resource.TestCheckResourceAttr("aws_ecs_service.main", "network_configuration.0.subnets.#", "2"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "network_configuration.0.assign_public_ip", "false"), + resource.TestCheckResourceAttr(resourceName, "network_configuration.0.security_groups.#", "2"), + resource.TestCheckResourceAttr(resourceName, "network_configuration.0.subnets.#", "2"), ), }, { - Config: testAccAWSEcsServiceWithNetworkConfiguration_modified(sg1Name, sg2Name, clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithNetworkConfiguration_modified(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.main", &service), - resource.TestCheckResourceAttr("aws_ecs_service.main", "network_configuration.0.assign_public_ip", "false"), - resource.TestCheckResourceAttr("aws_ecs_service.main", "network_configuration.0.security_groups.#", "1"), - resource.TestCheckResourceAttr("aws_ecs_service.main", "network_configuration.0.subnets.#", "2"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "network_configuration.0.assign_public_ip", "false"), + resource.TestCheckResourceAttr(resourceName, "network_configuration.0.security_groups.#", "1"), + resource.TestCheckResourceAttr(resourceName, "network_configuration.0.subnets.#", "2"), ), }, }, @@ -1014,22 +963,20 @@ func TestAccAWSEcsService_withLaunchTypeEC2AndNetworkConfiguration(t *testing.T) func TestAccAWSEcsService_withDaemonSchedulingStrategy(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-ss-daemon-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-ss-daemon-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-ss-daemon-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithDaemonSchedulingStrategy(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithDaemonSchedulingStrategy(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.ghost", &service), - resource.TestCheckResourceAttr("aws_ecs_service.ghost", "scheduling_strategy", "DAEMON"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "scheduling_strategy", "DAEMON"), ), }, }, @@ -1038,22 +985,20 @@ func TestAccAWSEcsService_withDaemonSchedulingStrategy(t *testing.T) { func TestAccAWSEcsService_withDaemonSchedulingStrategySetDeploymentMinimum(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-ss-daemon-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-ss-daemon-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-ss-daemon-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithDaemonSchedulingStrategySetDeploymentMinimum(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithDaemonSchedulingStrategySetDeploymentMinimum(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.ghost", &service), - resource.TestCheckResourceAttr("aws_ecs_service.ghost", "scheduling_strategy", "DAEMON"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "scheduling_strategy", "DAEMON"), ), }, }, @@ -1062,22 +1007,20 @@ func TestAccAWSEcsService_withDaemonSchedulingStrategySetDeploymentMinimum(t *te func TestAccAWSEcsService_withReplicaSchedulingStrategy(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-ss-replica-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-ss-replica-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-ss-replica-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsServiceWithReplicaSchedulingStrategy(clusterName, tdName, svcName), + Config: testAccAWSEcsServiceWithReplicaSchedulingStrategy(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.ghost", &service), - resource.TestCheckResourceAttr("aws_ecs_service.ghost", "scheduling_strategy", "REPLICA"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "scheduling_strategy", "REPLICA"), ), }, }, @@ -1086,22 +1029,20 @@ func TestAccAWSEcsService_withReplicaSchedulingStrategy(t *testing.T) { func TestAccAWSEcsService_withServiceRegistries(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) - - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-ups-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-ups-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-ups-%s", rString) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicediscovery.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsService_withServiceRegistries(rString, clusterName, tdName, svcName), + Config: testAccAWSEcsService_withServiceRegistries(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.test", &service), - resource.TestCheckResourceAttr("aws_ecs_service.test", "service_registries.#", "1"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "service_registries.#", "1"), ), }, }, @@ -1110,22 +1051,51 @@ func TestAccAWSEcsService_withServiceRegistries(t *testing.T) { func TestAccAWSEcsService_withServiceRegistries_container(t *testing.T) { var service ecs.Service - rString := acctest.RandString(8) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicediscovery.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSEcsServiceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSEcsService_withServiceRegistries_container(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "service_registries.#", "1"), + ), + }, + }, + }) +} - clusterName := fmt.Sprintf("tf-acc-cluster-svc-w-ups-%s", rString) - tdName := fmt.Sprintf("tf-acc-td-svc-w-ups-%s", rString) - svcName := fmt.Sprintf("tf-acc-svc-w-ups-%s", rString) +func TestAccAWSEcsService_withServiceRegistriesChanges(t *testing.T) { + var service ecs.Service + rName := acctest.RandomWithPrefix("tf-acc-test") + serviceDiscoveryName := acctest.RandomWithPrefix("tf-acc-test") + updatedServiceDiscoveryName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicediscovery.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSEcsService_withServiceRegistries_container(rString, clusterName, tdName, svcName), + Config: testAccAWSEcsService_withServiceRegistriesChanges(rName, serviceDiscoveryName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "service_registries.#", "1"), + ), + }, + { + Config: testAccAWSEcsService_withServiceRegistriesChanges(rName, updatedServiceDiscoveryName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSEcsServiceExists("aws_ecs_service.test", &service), - resource.TestCheckResourceAttr("aws_ecs_service.test", "service_registries.#", "1"), + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "service_registries.#", "1"), ), }, }, @@ -1139,6 +1109,7 @@ func TestAccAWSEcsService_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ @@ -1187,6 +1158,7 @@ func TestAccAWSEcsService_ManagedTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ @@ -1209,6 +1181,7 @@ func TestAccAWSEcsService_PropagateTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEcsServiceDestroy, Steps: []resource.TestStep{ @@ -1238,6 +1211,35 @@ func TestAccAWSEcsService_PropagateTags(t *testing.T) { }) } +func TestAccAWSEcsService_ExecuteCommand(t *testing.T) { + var service ecs.Service + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ecs_service.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ecs.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSEcsServiceDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSEcsServiceConfigExecuteCommand(rName, true), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "enable_execute_command", "true"), + ), + }, + { + Config: testAccAWSEcsServiceConfigExecuteCommand(rName, false), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSEcsServiceExists(resourceName, &service), + resource.TestCheckResourceAttr(resourceName, "enable_execute_command", "false"), + ), + }, + }, + }) +} + func testAccCheckAWSEcsServiceDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).ecsconn @@ -1319,47 +1321,6 @@ func testAccCheckAWSEcsServiceExists(name string, service *ecs.Service) resource } } -func testAccCheckAWSEcsServiceDisappears(service *ecs.Service) resource.TestCheckFunc { - return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).ecsconn - - input := &ecs.DeleteServiceInput{ - Cluster: service.ClusterArn, - Service: service.ServiceName, - Force: aws.Bool(true), - } - - _, err := conn.DeleteService(input) - - if err != nil { - return err - } - - // Wait until it's deleted - wait := resource.StateChangeConf{ - Pending: []string{"ACTIVE", "DRAINING"}, - Target: []string{"INACTIVE"}, - Timeout: 10 * time.Minute, - MinTimeout: 1 * time.Second, - Refresh: func() (interface{}, string, error) { - resp, err := conn.DescribeServices(&ecs.DescribeServicesInput{ - Cluster: service.ClusterArn, - Services: []*string{service.ServiceName}, - }) - if err != nil { - return resp, "FAILED", err - } - - return resp, aws.StringValue(resp.Services[0].Status), nil - }, - } - - _, err = wait.WaitForState() - - return err - } -} - func testAccCheckAWSEcsServiceNotRecreated(i, j *ecs.Service) resource.TestCheckFunc { return func(s *terraform.State) error { if !aws.TimeValue(i.CreatedAt).Equal(aws.TimeValue(j.CreatedAt)) { @@ -1370,14 +1331,14 @@ func testAccCheckAWSEcsServiceNotRecreated(i, j *ecs.Service) resource.TestCheck } } -func testAccAWSEcsService(clusterName, tdName, svcName string) string { +func testAccAWSEcsService(rName string) string { return fmt.Sprintf(` resource "aws_ecs_cluster" "default" { - name = "%s" + name = %[1]q } -resource "aws_ecs_task_definition" "mongo" { - family = "%s" +resource "aws_ecs_task_definition" "test" { + family = %[1]q container_definitions = < 0 { return false @@ -386,26 +350,6 @@ func hasEmptyFileSystems(fs *efs.DescribeFileSystemsOutput) bool { return true } -func resourceEfsFileSystemCreateUpdateRefreshFunc(id string, conn *efs.EFS) resource.StateRefreshFunc { - return func() (interface{}, string, error) { - resp, err := conn.DescribeFileSystems(&efs.DescribeFileSystemsInput{ - FileSystemId: aws.String(id), - }) - if err != nil { - return nil, "error", err - } - - if hasEmptyFileSystems(resp) { - return nil, "not-found", fmt.Errorf("EFS file system %q could not be found.", id) - } - - fs := resp.FileSystems[0] - state := aws.StringValue(fs.LifeCycleState) - log.Printf("[DEBUG] current status of %q: %q", id, state) - return fs, state, nil - } -} - func flattenEfsFileSystemLifecyclePolicies(apiObjects []*efs.LifecyclePolicy) []interface{} { var tfList []interface{} @@ -447,3 +391,23 @@ func expandEfsFileSystemLifecyclePolicies(tfList []interface{}) []*efs.Lifecycle return apiObjects } + +func flattenEfsFileSystemSizeInBytes(sizeInBytes *efs.FileSystemSize) []interface{} { + if sizeInBytes == nil { + return []interface{}{} + } + + m := map[string]interface{}{ + "value": aws.Int64Value(sizeInBytes.Value), + } + + if sizeInBytes.ValueInIA != nil { + m["value_in_ia"] = aws.Int64Value(sizeInBytes.ValueInIA) + } + + if sizeInBytes.ValueInStandard != nil { + m["value_in_standard"] = aws.Int64Value(sizeInBytes.ValueInStandard) + } + + return []interface{}{m} +} diff --git a/aws/resource_aws_efs_file_system_policy_test.go b/aws/resource_aws_efs_file_system_policy_test.go index 067c14dffa32..c0059481c4a2 100644 --- a/aws/resource_aws_efs_file_system_policy_test.go +++ b/aws/resource_aws_efs_file_system_policy_test.go @@ -18,6 +18,7 @@ func TestAccAWSEFSFileSystemPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func TestAccAWSEFSFileSystemPolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_efs_file_system_test.go b/aws/resource_aws_efs_file_system_test.go index 250fbe618efc..d91465bd9897 100644 --- a/aws/resource_aws_efs_file_system_test.go +++ b/aws/resource_aws_efs_file_system_test.go @@ -5,11 +5,10 @@ import ( "log" "regexp" "testing" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/efs" - multierror "github.com/hashicorp/go-multierror" + "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -32,8 +31,8 @@ func testSweepEfsFileSystems(region string) error { return fmt.Errorf("error getting client: %s", err) } conn := client.(*AWSClient).efsconn + var sweeperErrs *multierror.Error - var errors error input := &efs.DescribeFileSystemsInput{} err = conn.DescribeFileSystemsPages(input, func(page *efs.DescribeFileSystemsOutput, lastPage bool) bool { for _, filesystem := range page.FileSystems { @@ -41,27 +40,24 @@ func testSweepEfsFileSystems(region string) error { log.Printf("[INFO] Deleting EFS File System: %s", id) - _, err := conn.DeleteFileSystem(&efs.DeleteFileSystemInput{ - FileSystemId: filesystem.FileSystemId, - }) - if err != nil { - errors = multierror.Append(errors, fmt.Errorf("error deleting EFS File System %q: %w", id, err)) - continue - } + r := resourceAwsEfsFileSystem() + d := r.Data(nil) + d.SetId(id) + err := r.Delete(d, client) - err = waitForDeleteEfsFileSystem(conn, id, 10*time.Minute) if err != nil { - errors = multierror.Append(fmt.Errorf("error waiting for EFS File System %q to delete: %w", id, err)) + log.Printf("[ERROR] %s", err) + sweeperErrs = multierror.Append(sweeperErrs, err) continue } } return true }) if err != nil { - errors = multierror.Append(errors, fmt.Errorf("error retrieving EFS File Systems: %w", err)) + sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error retrieving EFS File Systems: %w", err)) } - return errors + return sweeperErrs.ErrorOrNil() } func TestResourceAWSEFSFileSystem_hasEmptyFileSystems(t *testing.T) { @@ -91,6 +87,7 @@ func TestAccAWSEFSFileSystem_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -103,6 +100,12 @@ func TestAccAWSEFSFileSystem_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "throughput_mode", efs.ThroughputModeBursting), testAccCheckEfsFileSystem(resourceName, &desc), testAccCheckEfsFileSystemPerformanceMode(resourceName, "generalPurpose"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "size_in_bytes.#", "1"), + resource.TestCheckResourceAttrSet(resourceName, "size_in_bytes.0.value"), + resource.TestCheckResourceAttrSet(resourceName, "size_in_bytes.0.value_in_ia"), + resource.TestCheckResourceAttrSet(resourceName, "size_in_bytes.0.value_in_standard"), + testAccMatchResourceAttrAccountID(resourceName, "owner_id"), ), }, { @@ -130,6 +133,7 @@ func TestAccAWSEFSFileSystem_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -185,6 +189,7 @@ func TestAccAWSEFSFileSystem_pagedTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -213,6 +218,7 @@ func TestAccAWSEFSFileSystem_kmsKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -239,6 +245,7 @@ func TestAccAWSEFSFileSystem_kmsConfigurationWithoutEncryption(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -256,6 +263,7 @@ func TestAccAWSEFSFileSystem_ProvisionedThroughputInMibps(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -291,6 +299,7 @@ func TestAccAWSEFSFileSystem_ThroughputMode(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -326,6 +335,7 @@ func TestAccAWSEFSFileSystem_lifecyclePolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -372,6 +382,7 @@ func TestAccAWSEFSFileSystem_lifecyclePolicy_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -404,6 +415,7 @@ func TestAccAWSEFSFileSystem_lifecyclePolicy_removal(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -434,10 +446,11 @@ func TestAccAWSEFSFileSystem_lifecyclePolicy_removal(t *testing.T) { func TestAccAWSEFSFileSystem_disappears(t *testing.T) { var desc efs.FileSystemDescription resourceName := "aws_efs_file_system.test" - rName := acctest.RandomWithPrefix("tf-acc-disappears") + rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsFileSystemDestroy, Steps: []resource.TestStep{ @@ -445,7 +458,7 @@ func TestAccAWSEFSFileSystem_disappears(t *testing.T) { Config: testAccAWSEFSFileSystemConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckEfsFileSystem(resourceName, &desc), - testAccCheckEfsFileSystemDisappears(&desc), + testAccCheckResourceDisappears(testAccProvider, resourceAwsEfsFileSystem(), resourceName), ), ExpectNonEmptyPlan: true, }, @@ -508,20 +521,6 @@ func testAccCheckEfsFileSystem(resourceID string, fDesc *efs.FileSystemDescripti } } -func testAccCheckEfsFileSystemDisappears(fDesc *efs.FileSystemDescription) resource.TestCheckFunc { - return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).efsconn - - input := &efs.DeleteFileSystemInput{ - FileSystemId: fDesc.FileSystemId, - } - - _, err := conn.DeleteFileSystem(input) - - return err - } -} - func testAccCheckEfsCreationToken(resourceID string, expectedToken string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[resourceID] diff --git a/aws/resource_aws_efs_mount_target_test.go b/aws/resource_aws_efs_mount_target_test.go index edef6809ef26..28035fdf4a51 100644 --- a/aws/resource_aws_efs_mount_target_test.go +++ b/aws/resource_aws_efs_mount_target_test.go @@ -94,6 +94,7 @@ func TestAccAWSEFSMountTarget_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsMountTargetDestroy, Steps: []resource.TestStep{ @@ -136,6 +137,7 @@ func TestAccAWSEFSMountTarget_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpnGatewayDestroy, Steps: []resource.TestStep{ @@ -157,6 +159,7 @@ func TestAccAWSEFSMountTarget_IpAddress(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsMountTargetDestroy, Steps: []resource.TestStep{ @@ -183,6 +186,7 @@ func TestAccAWSEFSMountTarget_IpAddress_EmptyString(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, efs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEfsMountTargetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_egress_only_internet_gateway_test.go b/aws/resource_aws_egress_only_internet_gateway_test.go index 6c88fe2f6485..f7e1ac932310 100644 --- a/aws/resource_aws_egress_only_internet_gateway_test.go +++ b/aws/resource_aws_egress_only_internet_gateway_test.go @@ -67,6 +67,7 @@ func TestAccAWSEgressOnlyInternetGateway_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEgressOnlyInternetGatewayDestroy, Steps: []resource.TestStep{ @@ -92,6 +93,7 @@ func TestAccAWSEgressOnlyInternetGateway_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEgressOnlyInternetGatewayDestroy, diff --git a/aws/resource_aws_eip_association_test.go b/aws/resource_aws_eip_association_test.go index 7599a705e227..257bfb5918b3 100644 --- a/aws/resource_aws_eip_association_test.go +++ b/aws/resource_aws_eip_association_test.go @@ -17,6 +17,7 @@ func TestAccAWSEIPAssociation_instance(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSEIPAssociationDestroy, Steps: []resource.TestStep{ @@ -42,6 +43,7 @@ func TestAccAWSEIPAssociation_networkInterface(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSEIPAssociationDestroy, Steps: []resource.TestStep{ @@ -67,6 +69,7 @@ func TestAccAWSEIPAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2VPCOnlyPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSEIPAssociationDestroy, Steps: []resource.TestStep{ @@ -96,6 +99,7 @@ func TestAccAWSEIPAssociation_ec2Classic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSEIPAssociationDestroy, Steps: []resource.TestStep{ @@ -125,6 +129,7 @@ func TestAccAWSEIPAssociation_spotInstance(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSEIPAssociationDestroy, Steps: []resource.TestStep{ @@ -153,6 +158,7 @@ func TestAccAWSEIPAssociation_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSEIPAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_eip_test.go b/aws/resource_aws_eip_test.go index 89602e45992f..b45ef8a31fb0 100644 --- a/aws/resource_aws_eip_test.go +++ b/aws/resource_aws_eip_test.go @@ -91,6 +91,7 @@ func TestAccAWSEIP_Ec2Classic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSEIPDestroy, Steps: []resource.TestStep{ @@ -118,6 +119,7 @@ func TestAccAWSEIP_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -146,6 +148,7 @@ func TestAccAWSEIP_instance(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -172,6 +175,7 @@ func TestAccAWSEIP_networkInterface(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -202,6 +206,7 @@ func TestAccAWSEIP_twoEIPsOneNetworkInterface(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -238,6 +243,7 @@ func TestAccAWSEIP_associated_user_private_ip(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -279,6 +285,7 @@ func TestAccAWSEIP_Instance_Reassociate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, Steps: []resource.TestStep{ @@ -305,6 +312,7 @@ func TestAccAWSEIP_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, Steps: []resource.TestStep{ @@ -326,6 +334,7 @@ func TestAccAWSEIP_notAssociated(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -362,6 +371,7 @@ func TestAccAWSEIP_tags_Vpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, Steps: []resource.TestStep{ @@ -400,6 +410,7 @@ func TestAccAWSEIP_tags_Ec2Classic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSEIPDestroy, Steps: []resource.TestStep{ @@ -417,6 +428,7 @@ func TestAccAWSEIP_PublicIpv4Pool_default(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -445,6 +457,7 @@ func TestAccAWSEIP_NetworkBorderGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -474,6 +487,7 @@ func TestAccAWSEIP_CarrierIP(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWavelengthZoneAvailable(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -508,6 +522,7 @@ func TestAccAWSEIP_PublicIpv4Pool_custom(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, @@ -582,6 +597,7 @@ func TestAccAWSEIP_CustomerOwnedIpv4Pool(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSEIPDestroy, diff --git a/aws/resource_aws_eks_cluster.go b/aws/resource_aws_eks_cluster.go index 845a95646f08..6bacbd44ded4 100644 --- a/aws/resource_aws_eks_cluster.go +++ b/aws/resource_aws_eks_cluster.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsEksCluster() *schema.Resource { @@ -250,7 +251,7 @@ func resourceAwsEksClusterCreate(d *schema.ResourceData, meta interface{}) error } log.Printf("[DEBUG] Creating EKS Cluster: %s", input) - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := conn.CreateCluster(input) if err != nil { // InvalidParameterException: roleArn, arn:aws:iam::123456789012:role/XXX, does not exist diff --git a/aws/resource_aws_eks_cluster_test.go b/aws/resource_aws_eks_cluster_test.go index dc1072979f91..991f0df8090f 100644 --- a/aws/resource_aws_eks_cluster_test.go +++ b/aws/resource_aws_eks_cluster_test.go @@ -74,6 +74,7 @@ func TestAccAWSEksCluster_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksClusterDestroy, Steps: []resource.TestStep{ @@ -121,6 +122,7 @@ func TestAccAWSEksCluster_EncryptionConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksClusterDestroy, Steps: []resource.TestStep{ @@ -151,6 +153,7 @@ func TestAccAWSEksCluster_Version(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksClusterDestroy, Steps: []resource.TestStep{ @@ -186,6 +189,7 @@ func TestAccAWSEksCluster_Logging(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksClusterDestroy, Steps: []resource.TestStep{ @@ -232,6 +236,7 @@ func TestAccAWSEksCluster_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksClusterDestroy, Steps: []resource.TestStep{ @@ -277,6 +282,7 @@ func TestAccAWSEksCluster_VpcConfig_SecurityGroupIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksClusterDestroy, Steps: []resource.TestStep{ @@ -305,6 +311,7 @@ func TestAccAWSEksCluster_VpcConfig_EndpointPrivateAccess(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksClusterDestroy, Steps: []resource.TestStep{ @@ -351,6 +358,7 @@ func TestAccAWSEksCluster_VpcConfig_EndpointPublicAccess(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksClusterDestroy, Steps: []resource.TestStep{ @@ -397,6 +405,7 @@ func TestAccAWSEksCluster_VpcConfig_PublicAccessCidrs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksClusterDestroy, Steps: []resource.TestStep{ @@ -433,6 +442,7 @@ func TestAccAWSEksCluster_NetworkConfig_ServiceIpv4Cidr(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksClusterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_eks_fargate_profile_test.go b/aws/resource_aws_eks_fargate_profile_test.go index 38e316b26f82..d01b7b2eed12 100644 --- a/aws/resource_aws_eks_fargate_profile_test.go +++ b/aws/resource_aws_eks_fargate_profile_test.go @@ -87,6 +87,7 @@ func TestAccAWSEksFargateProfile_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t); testAccPreCheckAWSEksFargateProfile(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksFargateProfileDestroy, Steps: []resource.TestStep{ @@ -120,6 +121,7 @@ func TestAccAWSEksFargateProfile_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t); testAccPreCheckAWSEksFargateProfile(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksFargateProfileDestroy, Steps: []resource.TestStep{ @@ -143,6 +145,7 @@ func TestAccAWSEksFargateProfile_Multi_Profile(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t); testAccPreCheckAWSEksFargateProfile(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksFargateProfileDestroy, Steps: []resource.TestStep{ @@ -164,6 +167,7 @@ func TestAccAWSEksFargateProfile_Selector_Labels(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t); testAccPreCheckAWSEksFargateProfile(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksFargateProfileDestroy, Steps: []resource.TestStep{ @@ -189,6 +193,7 @@ func TestAccAWSEksFargateProfile_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t); testAccPreCheckAWSEksFargateProfile(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksFargateProfileDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_eks_node_group_test.go b/aws/resource_aws_eks_node_group_test.go index 33a740430184..be56247e5fa9 100644 --- a/aws/resource_aws_eks_node_group_test.go +++ b/aws/resource_aws_eks_node_group_test.go @@ -86,6 +86,7 @@ func TestAccAWSEksNodeGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -132,6 +133,7 @@ func TestAccAWSEksNodeGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -154,6 +156,7 @@ func TestAccAWSEksNodeGroup_AmiType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -187,6 +190,7 @@ func TestAccAWSEksNodeGroup_CapacityType_Spot(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -213,6 +217,7 @@ func TestAccAWSEksNodeGroup_DiskSize(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -239,6 +244,7 @@ func TestAccAWSEksNodeGroup_ForceUpdateVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -274,6 +280,7 @@ func TestAccAWSEksNodeGroup_InstanceTypes_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -300,6 +307,7 @@ func TestAccAWSEksNodeGroup_InstanceTypes_Single(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -326,6 +334,7 @@ func TestAccAWSEksNodeGroup_Labels(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -372,6 +381,7 @@ func TestAccAWSEksNodeGroup_LaunchTemplate_Id(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -410,6 +420,7 @@ func TestAccAWSEksNodeGroup_LaunchTemplate_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -447,6 +458,7 @@ func TestAccAWSEksNodeGroup_LaunchTemplate_Version(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -484,6 +496,7 @@ func TestAccAWSEksNodeGroup_ReleaseVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -518,6 +531,7 @@ func TestAccAWSEksNodeGroup_RemoteAccess_Ec2SshKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -545,6 +559,7 @@ func TestAccAWSEksNodeGroup_RemoteAccess_SourceSecurityGroupIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -572,6 +587,7 @@ func TestAccAWSEksNodeGroup_ScalingConfig_DesiredSize(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -612,6 +628,7 @@ func TestAccAWSEksNodeGroup_ScalingConfig_MaxSize(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -652,6 +669,7 @@ func TestAccAWSEksNodeGroup_ScalingConfig_MinSize(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -692,6 +710,7 @@ func TestAccAWSEksNodeGroup_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ @@ -738,6 +757,7 @@ func TestAccAWSEksNodeGroup_Version(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksNodeGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elastic_beanstalk_application_test.go b/aws/resource_aws_elastic_beanstalk_application_test.go index 14b37acd5ed7..897c672c39e6 100644 --- a/aws/resource_aws_elastic_beanstalk_application_test.go +++ b/aws/resource_aws_elastic_beanstalk_application_test.go @@ -68,6 +68,7 @@ func TestAccAWSElasticBeanstalkApplication_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkAppDestroy, Steps: []resource.TestStep{ @@ -99,6 +100,7 @@ func TestAccAWSBeanstalkApp_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkAppDestroy, Steps: []resource.TestStep{ @@ -118,6 +120,7 @@ func TestAccAWSBeanstalkApp_appversionlifecycle(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkAppDestroy, Steps: []resource.TestStep{ @@ -178,6 +181,7 @@ func TestAccAWSBeanstalkApp_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkAppDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elastic_beanstalk_application_version_test.go b/aws/resource_aws_elastic_beanstalk_application_version_test.go index df1498f9f7a4..b10eb0b7b1fb 100644 --- a/aws/resource_aws_elastic_beanstalk_application_version_test.go +++ b/aws/resource_aws_elastic_beanstalk_application_version_test.go @@ -18,6 +18,7 @@ func TestAccAWSBeanstalkAppVersion_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckApplicationVersionDestroy, Steps: []resource.TestStep{ @@ -37,6 +38,7 @@ func TestAccAWSBeanstalkAppVersion_duplicateLabels(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckApplicationVersionDestroy, Steps: []resource.TestStep{ @@ -57,6 +59,7 @@ func TestAccAWSBeanstalkAppVersion_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckApplicationVersionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elastic_beanstalk_configuration_template_test.go b/aws/resource_aws_elastic_beanstalk_configuration_template_test.go index d28b5e5a8fec..faa8a1dc7c42 100644 --- a/aws/resource_aws_elastic_beanstalk_configuration_template_test.go +++ b/aws/resource_aws_elastic_beanstalk_configuration_template_test.go @@ -17,6 +17,7 @@ func TestAccAWSBeanstalkConfigurationTemplate_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkConfigurationTemplateDestroy, Steps: []resource.TestStep{ @@ -35,6 +36,7 @@ func TestAccAWSBeanstalkConfigurationTemplate_VPC(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkConfigurationTemplateDestroy, Steps: []resource.TestStep{ @@ -53,6 +55,7 @@ func TestAccAWSBeanstalkConfigurationTemplate_Setting(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkConfigurationTemplateDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elastic_beanstalk_environment_test.go b/aws/resource_aws_elastic_beanstalk_environment_test.go index 0c5b7004024a..d049a7b14b0f 100644 --- a/aws/resource_aws_elastic_beanstalk_environment_test.go +++ b/aws/resource_aws_elastic_beanstalk_environment_test.go @@ -80,6 +80,7 @@ func TestAccAWSBeanstalkEnv_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkEnvDestroy, Steps: []resource.TestStep{ @@ -117,6 +118,7 @@ func TestAccAWSBeanstalkEnv_tier(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkEnvDestroy, Steps: []resource.TestStep{ @@ -150,6 +152,7 @@ func TestAccAWSBeanstalkEnv_cname_prefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkEnvDestroy, Steps: []resource.TestStep{ @@ -181,6 +184,7 @@ func TestAccAWSBeanstalkEnv_config(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkEnvDestroy, Steps: []resource.TestStep{ @@ -227,6 +231,7 @@ func TestAccAWSBeanstalkEnv_resource(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkEnvDestroy, Steps: []resource.TestStep{ @@ -257,6 +262,7 @@ func TestAccAWSBeanstalkEnv_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkEnvDestroy, Steps: []resource.TestStep{ @@ -301,9 +307,8 @@ func TestAccAWSBeanstalkEnv_template_change(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkEnvDestroy, Steps: []resource.TestStep{ @@ -337,6 +342,7 @@ func TestAccAWSBeanstalkEnv_settings_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkEnvDestroy, Steps: []resource.TestStep{ @@ -380,6 +386,7 @@ func TestAccAWSBeanstalkEnv_version_label(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkEnvDestroy, Steps: []resource.TestStep{ @@ -416,6 +423,7 @@ func TestAccAWSBeanstalkEnv_settingWithJsonValue(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkEnvDestroy, Steps: []resource.TestStep{ @@ -446,6 +454,7 @@ func TestAccAWSBeanstalkEnv_platformArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticbeanstalk.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckBeanstalkEnvDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elastic_transcoder_pipeline_test.go b/aws/resource_aws_elastic_transcoder_pipeline_test.go index 3e4991912b83..b94335fb9da9 100644 --- a/aws/resource_aws_elastic_transcoder_pipeline_test.go +++ b/aws/resource_aws_elastic_transcoder_pipeline_test.go @@ -21,6 +21,7 @@ func TestAccAWSElasticTranscoderPipeline_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPipelineDestroy, @@ -49,6 +50,7 @@ func TestAccAWSElasticTranscoderPipeline_kmsKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPipelineDestroy, @@ -77,6 +79,7 @@ func TestAccAWSElasticTranscoderPipeline_notifications(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPipelineDestroy, @@ -147,6 +150,7 @@ func TestAccAWSElasticTranscoderPipeline_withContentConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPipelineDestroy, @@ -180,6 +184,7 @@ func TestAccAWSElasticTranscoderPipeline_withPermissions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPipelineDestroy, @@ -206,6 +211,7 @@ func TestAccAWSElasticTranscoderPipeline_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPipelineDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elastic_transcoder_preset_test.go b/aws/resource_aws_elastic_transcoder_preset_test.go index 815cc164bb89..d5f878bffac3 100644 --- a/aws/resource_aws_elastic_transcoder_preset_test.go +++ b/aws/resource_aws_elastic_transcoder_preset_test.go @@ -18,6 +18,7 @@ func TestAccAWSElasticTranscoderPreset_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPresetDestroy, Steps: []resource.TestStep{ @@ -43,6 +44,7 @@ func TestAccAWSElasticTranscoderPreset_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPresetDestroy, Steps: []resource.TestStep{ @@ -66,6 +68,7 @@ func TestAccAWSElasticTranscoderPreset_AudioCodecOptions_empty(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPresetDestroy, Steps: []resource.TestStep{ @@ -92,6 +95,7 @@ func TestAccAWSElasticTranscoderPreset_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPresetDestroy, Steps: []resource.TestStep{ @@ -119,6 +123,7 @@ func TestAccAWSElasticTranscoderPreset_Full(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPresetDestroy, Steps: []resource.TestStep{ @@ -168,6 +173,7 @@ func TestAccAWSElasticTranscoderPreset_Video_FrameRate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticTranscoder(t) }, + ErrorCheck: testAccErrorCheck(t, elastictranscoder.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckElasticTranscoderPresetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elasticache_cluster_test.go b/aws/resource_aws_elasticache_cluster_test.go index 03090efdb1b8..c0c439999653 100644 --- a/aws/resource_aws_elasticache_cluster_test.go +++ b/aws/resource_aws_elasticache_cluster_test.go @@ -83,6 +83,7 @@ func TestAccAWSElasticacheCluster_Engine_Memcached(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -116,6 +117,7 @@ func TestAccAWSElasticacheCluster_Engine_Redis(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -144,6 +146,7 @@ func TestAccAWSElasticacheCluster_Port_Redis_Default(t *testing.T) { var ec elasticache.CacheCluster resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -166,6 +169,7 @@ func TestAccAWSElasticacheCluster_ParameterGroupName_Default(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -198,6 +202,7 @@ func TestAccAWSElasticacheCluster_Port(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -232,6 +237,7 @@ func TestAccAWSElasticacheCluster_SecurityGroup_Ec2Classic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -255,6 +261,7 @@ func TestAccAWSElasticacheCluster_snapshotsWithUpdates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -285,6 +292,7 @@ func TestAccAWSElasticacheCluster_NumCacheNodes_Decrease(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -313,6 +321,7 @@ func TestAccAWSElasticacheCluster_NumCacheNodes_Increase(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -341,6 +350,7 @@ func TestAccAWSElasticacheCluster_NumCacheNodes_IncreaseWithPreferredAvailabilit resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -367,13 +377,16 @@ func TestAccAWSElasticacheCluster_NumCacheNodes_IncreaseWithPreferredAvailabilit func TestAccAWSElasticacheCluster_vpc(t *testing.T) { var csg elasticache.CacheSubnetGroup var ec elasticache.CacheCluster + rName := acctest.RandomWithPrefix("tf-acc-test") + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSElasticacheClusterInVPCConfig, + Config: testAccAWSElasticacheClusterInVPCConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSElasticacheSubnetGroupExists("aws_elasticache_subnet_group.test", &csg), testAccCheckAWSElasticacheClusterExists("aws_elasticache_cluster.test", &ec), @@ -387,13 +400,16 @@ func TestAccAWSElasticacheCluster_vpc(t *testing.T) { func TestAccAWSElasticacheCluster_multiAZInVpc(t *testing.T) { var csg elasticache.CacheSubnetGroup var ec elasticache.CacheCluster + rName := acctest.RandomWithPrefix("tf-acc-test") + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSElasticacheClusterMultiAZInVPCConfig, + Config: testAccAWSElasticacheClusterMultiAZInVPCConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSElasticacheSubnetGroupExists("aws_elasticache_subnet_group.test", &csg), testAccCheckAWSElasticacheClusterExists("aws_elasticache_cluster.test", &ec), @@ -411,6 +427,7 @@ func TestAccAWSElasticacheCluster_AZMode_Memcached(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -444,6 +461,7 @@ func TestAccAWSElasticacheCluster_AZMode_Redis(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -473,6 +491,7 @@ func TestAccAWSElasticacheCluster_EngineVersion_Memcached(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -510,6 +529,7 @@ func TestAccAWSElasticacheCluster_EngineVersion_Redis(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -547,6 +567,7 @@ func TestAccAWSElasticacheCluster_NodeTypeResize_Memcached(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -576,6 +597,7 @@ func TestAccAWSElasticacheCluster_NodeTypeResize_Redis(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -603,6 +625,7 @@ func TestAccAWSElasticacheCluster_NumCacheNodes_Redis(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -623,6 +646,7 @@ func TestAccAWSElasticacheCluster_ReplicationGroupID_AvailabilityZone(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -647,6 +671,7 @@ func TestAccAWSElasticacheCluster_ReplicationGroupID_SingleReplica(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -675,6 +700,7 @@ func TestAccAWSElasticacheCluster_ReplicationGroupID_MultipleReplica(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -705,6 +731,7 @@ func TestAccAWSElasticacheCluster_Memcached_FinalSnapshot(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -723,6 +750,7 @@ func TestAccAWSElasticacheCluster_Redis_FinalSnapshot(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheClusterDestroy, Steps: []resource.TestStep{ @@ -1022,7 +1050,8 @@ resource "aws_elasticache_cluster" "test" { `, rName, numCacheNodes, strings.Join(preferredAvailabilityZones, ",")) } -var testAccAWSElasticacheClusterInVPCConfig = fmt.Sprintf(` +func testAccAWSElasticacheClusterInVPCConfig(rName string) string { + return fmt.Sprintf(` data "aws_availability_zones" "available" { state = "available" @@ -1051,13 +1080,13 @@ resource "aws_subnet" "test" { } resource "aws_elasticache_subnet_group" "test" { - name = "tf-test-cache-subnet-%03d" + name = %[1]q description = "tf-test-cache-subnet-group-descr" subnet_ids = [aws_subnet.test.id] } resource "aws_security_group" "test" { - name = "tf-test-security-group-%03d" + name = %[1]q description = "tf-test-security-group-descr" vpc_id = aws_vpc.test.id @@ -1073,7 +1102,7 @@ resource "aws_elasticache_cluster" "test" { # Including uppercase letters in this name to ensure # that we correctly handle the fact that the API # normalizes names to lowercase. - cluster_id = "tf-%s" + cluster_id = %[1]q node_type = "cache.t3.small" num_cache_nodes = 1 engine = "redis" @@ -1087,11 +1116,13 @@ resource "aws_elasticache_cluster" "test" { } resource "aws_sns_topic" "test" { - name = "tf-ecache-cluster-test" + name = %[1]q +} +`, rName) } -`, acctest.RandInt(), acctest.RandInt(), acctest.RandString(10)) -var testAccAWSElasticacheClusterMultiAZInVPCConfig = fmt.Sprintf(` +func testAccAWSElasticacheClusterMultiAZInVPCConfig(rName string) string { + return fmt.Sprintf(` data "aws_availability_zones" "available" { state = "available" @@ -1130,7 +1161,7 @@ resource "aws_subnet" "test2" { } resource "aws_elasticache_subnet_group" "test" { - name = "tf-test-cache-subnet-%03d" + name = %[1]q description = "tf-test-cache-subnet-group-descr" subnet_ids = [ aws_subnet.test1.id, @@ -1139,7 +1170,7 @@ resource "aws_elasticache_subnet_group" "test" { } resource "aws_security_group" "test" { - name = "tf-test-security-group-%03d" + name = %[1]q description = "tf-test-security-group-descr" vpc_id = aws_vpc.test.id @@ -1152,7 +1183,7 @@ resource "aws_security_group" "test" { } resource "aws_elasticache_cluster" "test" { - cluster_id = "tf-%s" + cluster_id = %[1]q engine = "memcached" node_type = "cache.t3.small" num_cache_nodes = 2 @@ -1165,7 +1196,8 @@ resource "aws_elasticache_cluster" "test" { data.aws_availability_zones.available.names[1] ] } -`, acctest.RandInt(), acctest.RandInt(), acctest.RandString(10)) +`, rName) +} var testAccAWSElasticacheClusterConfig_RedisDefaultPort = ` resource "aws_security_group" "test" { diff --git a/aws/resource_aws_elasticache_global_replication_group_test.go b/aws/resource_aws_elasticache_global_replication_group_test.go index 304343cd981f..2265971cb0c7 100644 --- a/aws/resource_aws_elasticache_global_replication_group_test.go +++ b/aws/resource_aws_elasticache_global_replication_group_test.go @@ -81,6 +81,7 @@ func TestAccAWSElasticacheGlobalReplicationGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticacheGlobalReplicationGroup(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheGlobalReplicationGroupDestroy, Steps: []resource.TestStep{ @@ -122,6 +123,7 @@ func TestAccAWSElasticacheGlobalReplicationGroup_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticacheGlobalReplicationGroup(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheGlobalReplicationGroupDestroy, Steps: []resource.TestStep{ @@ -156,6 +158,7 @@ func TestAccAWSElasticacheGlobalReplicationGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSElasticacheGlobalReplicationGroup(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheGlobalReplicationGroupDestroy, Steps: []resource.TestStep{ @@ -182,6 +185,7 @@ func TestAccAWSElasticacheGlobalReplicationGroup_MultipleSecondaries(t *testing. testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 3) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 3), CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -206,6 +210,7 @@ func TestAccAWSElasticacheGlobalReplicationGroup_ReplaceSecondary_DifferentRegio testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 3) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 3), CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elasticache_parameter_group_test.go b/aws/resource_aws_elasticache_parameter_group_test.go index afd9d60d3b5a..c498d8d929cf 100644 --- a/aws/resource_aws_elasticache_parameter_group_test.go +++ b/aws/resource_aws_elasticache_parameter_group_test.go @@ -75,6 +75,7 @@ func TestAccAWSElasticacheParameterGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheParameterGroupDestroy, Steps: []resource.TestStep{ @@ -104,6 +105,7 @@ func TestAccAWSElasticacheParameterGroup_addParameter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheParameterGroupDestroy, Steps: []resource.TestStep{ @@ -150,6 +152,7 @@ func TestAccAWSElasticacheParameterGroup_removeAllParameters(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheParameterGroupDestroy, Steps: []resource.TestStep{ @@ -188,6 +191,7 @@ func TestAccAWSElasticacheParameterGroup_removeReservedMemoryParameter_AllParame resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheParameterGroupDestroy, Steps: []resource.TestStep{ @@ -227,6 +231,7 @@ func TestAccAWSElasticacheParameterGroup_removeReservedMemoryParameter_Remaining resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheParameterGroupDestroy, Steps: []resource.TestStep{ @@ -274,6 +279,7 @@ func TestAccAWSElasticacheParameterGroup_switchReservedMemoryParameter(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheParameterGroupDestroy, Steps: []resource.TestStep{ @@ -317,6 +323,7 @@ func TestAccAWSElasticacheParameterGroup_updateReservedMemoryParameter(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheParameterGroupDestroy, Steps: []resource.TestStep{ @@ -359,6 +366,7 @@ func TestAccAWSElasticacheParameterGroup_UppercaseName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheParameterGroupDestroy, Steps: []resource.TestStep{ @@ -385,6 +393,7 @@ func TestAccAWSElasticacheParameterGroup_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheParameterGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elasticache_replication_group.go b/aws/resource_aws_elasticache_replication_group.go index 79d3d7b23ce2..ae54362f0023 100644 --- a/aws/resource_aws_elasticache_replication_group.go +++ b/aws/resource_aws_elasticache_replication_group.go @@ -48,8 +48,8 @@ func resourceAwsElasticacheReplicationGroup() *schema.Resource { "at_rest_encryption_enabled": { Type: schema.TypeBool, Optional: true, - Default: false, ForceNew: true, + Computed: true, }, "auth_token": { Type: schema.TypeString, @@ -263,8 +263,8 @@ func resourceAwsElasticacheReplicationGroup() *schema.Resource { "transit_encryption_enabled": { Type: schema.TypeBool, Optional: true, - Default: false, ForceNew: true, + Computed: true, }, "kms_key_id": { Type: schema.TypeString, diff --git a/aws/resource_aws_elasticache_replication_group_test.go b/aws/resource_aws_elasticache_replication_group_test.go index b855ae7dd625..539c62faaa65 100644 --- a/aws/resource_aws_elasticache_replication_group_test.go +++ b/aws/resource_aws_elasticache_replication_group_test.go @@ -71,6 +71,7 @@ func TestAccAWSElasticacheReplicationGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -109,6 +110,7 @@ func TestAccAWSElasticacheReplicationGroup_Uppercase(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -137,6 +139,7 @@ func TestAccAWSElasticacheReplicationGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -159,6 +162,7 @@ func TestAccAWSElasticacheReplicationGroup_updateDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -203,6 +207,7 @@ func TestAccAWSElasticacheReplicationGroup_updateMaintenanceWindow(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -239,6 +244,7 @@ func TestAccAWSElasticacheReplicationGroup_updateNodeSize(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -282,6 +288,7 @@ func TestAccAWSElasticacheReplicationGroup_updateParameterGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -312,14 +319,16 @@ func TestAccAWSElasticacheReplicationGroup_updateParameterGroup(t *testing.T) { func TestAccAWSElasticacheReplicationGroup_vpc(t *testing.T) { var rg elasticache.ReplicationGroup resourceName := "aws_elasticache_replication_group.test" + rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSElasticacheReplicationGroupInVPCConfig, + Config: testAccAWSElasticacheReplicationGroupInVPCConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSElasticacheReplicationGroupExists(resourceName, &rg), resource.TestCheckResourceAttr(resourceName, "number_cache_clusters", "1"), @@ -343,6 +352,7 @@ func TestAccAWSElasticacheReplicationGroup_multiAzNotInVpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -390,6 +400,7 @@ func TestAccAWSElasticacheReplicationGroup_multiAzInVpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -427,6 +438,7 @@ func TestAccAWSElasticacheReplicationGroup_multiAz_NoAutomaticFailover(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -443,6 +455,7 @@ func TestAccAWSElasticacheReplicationGroup_AutomaticFailover_OneCacheCluster(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -465,6 +478,7 @@ func TestAccAWSElasticacheReplicationGroup_redisClusterInVpc2(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -500,6 +514,7 @@ func TestAccAWSElasticacheReplicationGroup_ClusterMode_Basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -537,6 +552,7 @@ func TestAccAWSElasticacheReplicationGroup_ClusterMode_NonClusteredParameterGrou resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -572,6 +588,7 @@ func TestAccAWSElasticacheReplicationGroup_ClusterMode_UpdateNumNodeGroups_Scale resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -611,6 +628,7 @@ func TestAccAWSElasticacheReplicationGroup_ClusterMode_UpdateNumNodeGroups_Scale resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -651,6 +669,7 @@ func TestAccAWSElasticacheReplicationGroup_ClusterMode_UpdateReplicasPerNodeGrou resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -704,6 +723,7 @@ func TestAccAWSElasticacheReplicationGroup_ClusterMode_UpdateNumNodeGroupsAndRep resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -744,6 +764,7 @@ func TestAccAWSElasticacheReplicationGroup_ClusterMode_UpdateNumNodeGroupsAndRep resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -783,6 +804,7 @@ func TestAccAWSElasticacheReplicationGroup_clusteringAndCacheNodesCausesError(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -801,6 +823,7 @@ func TestAccAWSElasticacheReplicationGroup_enableSnapshotting(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -834,6 +857,7 @@ func TestAccAWSElasticacheReplicationGroup_enableAuthTokenTransitEncryption(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -861,6 +885,7 @@ func TestAccAWSElasticacheReplicationGroup_enableAtRestEncryption(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -885,6 +910,7 @@ func TestAccAWSElasticacheReplicationGroup_useCmkKmsKeyId(t *testing.T) { var rg elasticache.ReplicationGroup resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -906,6 +932,7 @@ func TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_Basic(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -959,6 +986,7 @@ func TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_Failover_AutoFail resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1011,6 +1039,7 @@ func TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_Failover_AutoFail resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1068,6 +1097,7 @@ func TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_MultiAZEnabled(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1122,6 +1152,7 @@ func TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_MemberClusterDisa resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1167,6 +1198,7 @@ func TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_MemberClusterDisa resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1212,6 +1244,7 @@ func TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_MemberClusterDisa resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1257,6 +1290,7 @@ func TestAccAWSElasticacheReplicationGroup_NumberCacheClusters_MemberClusterDisa resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1302,6 +1336,7 @@ func TestAccAWSElasticacheReplicationGroup_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1347,6 +1382,7 @@ func TestAccAWSElasticacheReplicationGroup_FinalSnapshot(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1370,6 +1406,7 @@ func TestAccAWSElasticacheReplicationGroup_Validation_NoNodeType(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 2), CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1390,6 +1427,7 @@ func TestAccAWSElasticacheReplicationGroup_Validation_GlobalReplicationGroupIdAn testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 2), CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1406,12 +1444,14 @@ func TestAccAWSElasticacheReplicationGroup_GlobalReplicationGroupId_Basic(t *tes var rg elasticache.ReplicationGroup rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_elasticache_replication_group.test" + primaryGroupResourceName := "aws_elasticache_replication_group.primary" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 2), CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1420,10 +1460,53 @@ func TestAccAWSElasticacheReplicationGroup_GlobalReplicationGroupId_Basic(t *tes Check: resource.ComposeTestCheckFunc( testAccCheckAWSElasticacheReplicationGroupExists(resourceName, &rg), resource.TestCheckResourceAttrPair(resourceName, "global_replication_group_id", "aws_elasticache_global_replication_group.test", "global_replication_group_id"), - resource.TestCheckResourceAttrPair(resourceName, "node_type", "aws_elasticache_replication_group.primary", "node_type"), - resource.TestCheckResourceAttrPair(resourceName, "engine", "aws_elasticache_replication_group.primary", "engine"), - resource.TestCheckResourceAttrPair(resourceName, "engine_version", "aws_elasticache_replication_group.primary", "engine_version"), - resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", "aws_elasticache_replication_group.primary", "parameter_group_name"), + resource.TestCheckResourceAttrPair(resourceName, "node_type", primaryGroupResourceName, "node_type"), + resource.TestCheckResourceAttrPair(resourceName, "engine", primaryGroupResourceName, "engine"), + resource.TestCheckResourceAttrPair(resourceName, "engine_version", primaryGroupResourceName, "engine_version"), + resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", primaryGroupResourceName, "parameter_group_name"), + ), + }, + { + Config: testAccAWSElasticacheReplicationGroupConfig_GlobalReplicationGroupId_Basic(rName), + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"apply_immediately"}, + }, + }, + }) +} + +func TestAccAWSElasticacheReplicationGroup_GlobalReplicationGroupId_Full(t *testing.T) { + var providers []*schema.Provider + var rg elasticache.ReplicationGroup + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_elasticache_replication_group.test" + primaryGroupResourceName := "aws_elasticache_replication_group.primary" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + testAccMultipleRegionPreCheck(t, 2) + }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), + ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 2), + CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSElasticacheReplicationGroupConfig_GlobalReplicationGroupId_Full(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSElasticacheReplicationGroupExists(resourceName, &rg), + resource.TestCheckResourceAttrPair(resourceName, "global_replication_group_id", "aws_elasticache_global_replication_group.test", "global_replication_group_id"), + resource.TestCheckResourceAttrPair(resourceName, "node_type", primaryGroupResourceName, "node_type"), + resource.TestCheckResourceAttrPair(resourceName, "engine", primaryGroupResourceName, "engine"), + resource.TestCheckResourceAttrPair(resourceName, "engine_version", primaryGroupResourceName, "engine_version"), + resource.TestCheckResourceAttrPair(resourceName, "parameter_group_name", primaryGroupResourceName, "parameter_group_name"), + + resource.TestCheckResourceAttr(resourceName, "port", "16379"), + + resource.TestCheckResourceAttrPair(resourceName, "at_rest_encryption_enabled", primaryGroupResourceName, "at_rest_encryption_enabled"), + resource.TestCheckResourceAttrPair(resourceName, "transit_encryption_enabled", primaryGroupResourceName, "transit_encryption_enabled"), ), }, { @@ -1450,6 +1533,7 @@ func TestAccAWSElasticacheReplicationGroup_GlobalReplicationGroupId_disappears(t testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 2), CheckDestroy: testAccCheckAWSElasticacheReplicationDestroy, Steps: []resource.TestStep{ @@ -1658,7 +1742,8 @@ resource "aws_elasticache_replication_group" "test" { `, rName) } -var testAccAWSElasticacheReplicationGroupInVPCConfig = fmt.Sprintf(` +func testAccAWSElasticacheReplicationGroupInVPCConfig(rName string) string { + return fmt.Sprintf(` data "aws_availability_zones" "available" { state = "available" @@ -1687,13 +1772,13 @@ resource "aws_subnet" "test" { } resource "aws_elasticache_subnet_group" "test" { - name = "tf-test-cache-subnet-%03d" + name = %[1]q description = "tf-test-cache-subnet-group-descr" subnet_ids = [aws_subnet.test.id] } resource "aws_security_group" "test" { - name = "tf-test-security-group-%03d" + name = %[1]q description = "tf-test-security-group-descr" vpc_id = aws_vpc.test.id @@ -1706,7 +1791,7 @@ resource "aws_security_group" "test" { } resource "aws_elasticache_replication_group" "test" { - replication_group_id = "tf-%s" + replication_group_id = %[1]q replication_group_description = "test description" node_type = "cache.t3.small" number_cache_clusters = 1 @@ -1716,7 +1801,8 @@ resource "aws_elasticache_replication_group" "test" { availability_zones = [data.aws_availability_zones.available.names[0]] auto_minor_version_upgrade = false } -`, acctest.RandInt(), acctest.RandInt(), acctest.RandString(10)) +`, rName) +} func testAccAWSElasticacheReplicationGroupConfig_MultiAZNotInVPC_Basic(rName string) string { return fmt.Sprintf(` @@ -2582,6 +2668,53 @@ resource "aws_elasticache_replication_group" "primary" { `, rName)) } +func testAccAWSElasticacheReplicationGroupConfig_GlobalReplicationGroupId_Full(rName string) string { + return composeConfig( + testAccMultipleRegionProviderConfig(2), + testAccElasticacheVpcBaseWithProvider(rName, "test", ProviderNameAws), + testAccElasticacheVpcBaseWithProvider(rName, "primary", ProviderNameAwsAlternate), + fmt.Sprintf(` +resource "aws_elasticache_replication_group" "test" { + replication_group_id = "%[1]s-s" + replication_group_description = "secondary" + global_replication_group_id = aws_elasticache_global_replication_group.test.global_replication_group_id + + subnet_group_name = aws_elasticache_subnet_group.test.name + + number_cache_clusters = 1 + + port = 16379 +} + +resource "aws_elasticache_global_replication_group" "test" { + provider = awsalternate + + global_replication_group_id_suffix = %[1]q + primary_replication_group_id = aws_elasticache_replication_group.primary.id +} + +resource "aws_elasticache_replication_group" "primary" { + provider = awsalternate + + replication_group_id = "%[1]s-p" + replication_group_description = "primary" + + subnet_group_name = aws_elasticache_subnet_group.primary.name + + node_type = "cache.m5.large" + + engine = "redis" + engine_version = "5.0.6" + number_cache_clusters = 1 + + port = 6379 + + at_rest_encryption_enabled = true + transit_encryption_enabled = true +} +`, rName)) +} + func resourceAwsElasticacheReplicationGroupDisableAutomaticFailover(conn *elasticache.ElastiCache, replicationGroupID string, timeout time.Duration) error { return resourceAwsElasticacheReplicationGroupModify(conn, timeout, &elasticache.ModifyReplicationGroupInput{ ReplicationGroupId: aws.String(replicationGroupID), diff --git a/aws/resource_aws_elasticache_security_group_test.go b/aws/resource_aws_elasticache_security_group_test.go index 27cc09cd8b61..323245c96347 100644 --- a/aws/resource_aws_elasticache_security_group_test.go +++ b/aws/resource_aws_elasticache_security_group_test.go @@ -71,6 +71,7 @@ func TestAccAWSElasticacheSecurityGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSElasticacheSecurityGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elasticache_subnet_group_test.go b/aws/resource_aws_elasticache_subnet_group_test.go index adc874995bd7..fed6b5ba1bb1 100644 --- a/aws/resource_aws_elasticache_subnet_group_test.go +++ b/aws/resource_aws_elasticache_subnet_group_test.go @@ -66,6 +66,7 @@ func TestAccAWSElasticacheSubnetGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -95,6 +96,7 @@ func TestAccAWSElasticacheSubnetGroup_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticache.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSElasticacheSubnetGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elasticsearch_domain.go b/aws/resource_aws_elasticsearch_domain.go index 83c38f2bde50..2918414b37dc 100644 --- a/aws/resource_aws_elasticsearch_domain.go +++ b/aws/resource_aws_elasticsearch_domain.go @@ -17,6 +17,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsElasticSearchDomain() *schema.Resource { @@ -551,7 +552,7 @@ func resourceAwsElasticSearchDomainCreate(d *schema.ResourceData, meta interface // IAM Roles can take some time to propagate if set in AccessPolicies and created in the same terraform var out *elasticsearch.CreateElasticsearchDomainOutput - err = resource.Retry(30*time.Second, func() *resource.RetryError { + err = resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error out, err = conn.CreateElasticsearchDomain(&input) if err != nil { diff --git a/aws/resource_aws_elasticsearch_domain_policy_test.go b/aws/resource_aws_elasticsearch_domain_policy_test.go index 9251236993b7..1f57dcd7f6ee 100644 --- a/aws/resource_aws_elasticsearch_domain_policy_test.go +++ b/aws/resource_aws_elasticsearch_domain_policy_test.go @@ -45,6 +45,7 @@ func TestAccAWSElasticSearchDomainPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_elasticsearch_domain_test.go b/aws/resource_aws_elasticsearch_domain_test.go index e86f2fbd6011..287cad2dbc98 100644 --- a/aws/resource_aws_elasticsearch_domain_test.go +++ b/aws/resource_aws_elasticsearch_domain_test.go @@ -110,6 +110,7 @@ func TestAccAWSElasticSearchDomain_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -139,6 +140,7 @@ func TestAccAWSElasticSearchDomain_RequireHTTPS(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -173,6 +175,7 @@ func TestAccAWSElasticSearchDomain_ClusterConfig_ZoneAwarenessConfig(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -231,6 +234,7 @@ func TestAccAWSElasticSearchDomain_warm(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -288,6 +292,7 @@ func TestAccAWSElasticSearchDomain_withDedicatedMaster(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -326,8 +331,9 @@ func TestAccAWSElasticSearchDomain_duplicate(t *testing.T) { resourceName := "aws_elasticsearch_domain.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), + Providers: testAccProviders, CheckDestroy: func(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).esconn _, err := conn.DeleteElasticsearchDomain(&elasticsearch.DeleteElasticsearchDomainInput{ @@ -376,6 +382,7 @@ func TestAccAWSElasticSearchDomain_v23(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -405,6 +412,7 @@ func TestAccAWSElasticSearchDomain_complex(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -432,6 +440,7 @@ func TestAccAWSElasticSearchDomain_vpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -459,6 +468,7 @@ func TestAccAWSElasticSearchDomain_vpc_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -494,6 +504,7 @@ func TestAccAWSElasticSearchDomain_internetToVpcEndpoint(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -526,6 +537,7 @@ func TestAccAWSElasticSearchDomain_AdvancedSecurityOptions_UserDB(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -558,6 +570,7 @@ func TestAccAWSElasticSearchDomain_AdvancedSecurityOptions_IAM(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -590,6 +603,7 @@ func TestAccAWSElasticSearchDomain_AdvancedSecurityOptions_Disabled(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -623,6 +637,7 @@ func TestAccAWSElasticSearchDomain_LogPublishingOptions_IndexSlowLogs(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -654,6 +669,7 @@ func TestAccAWSElasticSearchDomain_LogPublishingOptions_SearchSlowLogs(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -685,6 +701,7 @@ func TestAccAWSElasticSearchDomain_LogPublishingOptions_EsApplicationLogs(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -716,6 +733,7 @@ func TestAccAWSElasticSearchDomain_LogPublishingOptions_AuditLogs(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -753,6 +771,7 @@ func TestAccAWSElasticSearchDomain_CognitoOptionsCreateAndRemove(t *testing.T) { testAccPreCheckAWSCognitoIdentityProvider(t) testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -792,6 +811,7 @@ func TestAccAWSElasticSearchDomain_CognitoOptionsUpdate(t *testing.T) { testAccPreCheckAWSCognitoIdentityProvider(t) testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -827,6 +847,7 @@ func TestAccAWSElasticSearchDomain_policy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -854,6 +875,7 @@ func TestAccAWSElasticSearchDomain_encrypt_at_rest_default_key(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -882,6 +904,7 @@ func TestAccAWSElasticSearchDomain_encrypt_at_rest_specify_key(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -910,6 +933,7 @@ func TestAccAWSElasticSearchDomain_NodeToNodeEncryption(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -938,6 +962,7 @@ func TestAccAWSElasticSearchDomain_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, Steps: []resource.TestStep{ @@ -975,6 +1000,7 @@ func TestAccAWSElasticSearchDomain_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -1011,6 +1037,7 @@ func TestAccAWSElasticSearchDomain_update_volume_type(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -1054,6 +1081,7 @@ func TestAccAWSElasticSearchDomain_WithVolumeType_Missing(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -1088,6 +1116,7 @@ func TestAccAWSElasticSearchDomain_update_version(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckIamServiceLinkedRoleEs(t) }, + ErrorCheck: testAccErrorCheck(t, elasticsearch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckESDomainDestroy, Steps: []resource.TestStep{ @@ -1155,6 +1184,7 @@ func testAccCheckESEBSVolumeSize(ebsVolumeSize int, status *elasticsearch.Elasti return nil } } + func testAccCheckESEBSVolumeEnabled(ebsEnabled bool, status *elasticsearch.ElasticsearchDomainStatus) resource.TestCheckFunc { return func(s *terraform.State) error { conf := status.EBSOptions diff --git a/aws/resource_aws_elb_attachment_test.go b/aws/resource_aws_elb_attachment_test.go index 841ff13894ad..a01656d9e247 100644 --- a/aws/resource_aws_elb_attachment_test.go +++ b/aws/resource_aws_elb_attachment_test.go @@ -16,6 +16,7 @@ func TestAccAWSELBAttachment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -76,6 +77,7 @@ func TestAccAWSELBAttachment_drift(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, diff --git a/aws/resource_aws_elb_test.go b/aws/resource_aws_elb_test.go index 97fdb487ca15..94dfd9c0e733 100644 --- a/aws/resource_aws_elb_test.go +++ b/aws/resource_aws_elb_test.go @@ -70,6 +70,7 @@ func TestAccAWSELB_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -107,6 +108,7 @@ func TestAccAWSELB_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, Steps: []resource.TestStep{ @@ -129,6 +131,7 @@ func TestAccAWSELB_fullCharacterRange(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -151,6 +154,7 @@ func TestAccAWSELB_AccessLogs_enabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -191,6 +195,7 @@ func TestAccAWSELB_AccessLogs_disabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -230,6 +235,7 @@ func TestAccAWSELB_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -252,6 +258,7 @@ func TestAccAWSELB_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -274,6 +281,7 @@ func TestAccAWSELB_generatesNameForZeroValue(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -295,6 +303,7 @@ func TestAccAWSELB_availabilityZones(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -324,6 +333,7 @@ func TestAccAWSELB_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -383,6 +393,7 @@ func TestAccAWSELB_Listener_SSLCertificateID_IAMServerCertificate(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, Steps: []resource.TestStep{ @@ -411,6 +422,7 @@ func TestAccAWSELB_swap_subnets(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -449,6 +461,7 @@ func TestAccAWSELB_InstanceAttaching(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -478,6 +491,7 @@ func TestAccAWSELB_listener(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -605,6 +619,7 @@ func TestAccAWSELB_HealthCheck(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -630,6 +645,7 @@ func TestAccAWSELBUpdate_HealthCheck(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -657,6 +673,7 @@ func TestAccAWSELB_Timeout(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -677,6 +694,7 @@ func TestAccAWSELBUpdate_Timeout(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -702,6 +720,7 @@ func TestAccAWSELB_ConnectionDraining(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -724,6 +743,7 @@ func TestAccAWSELBUpdate_ConnectionDraining(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, @@ -757,6 +777,7 @@ func TestAccAWSELB_SecurityGroups(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSELBDestroy, diff --git a/aws/resource_aws_emr_cluster.go b/aws/resource_aws_emr_cluster.go index 0d171a2d31c0..0b028fa250c9 100644 --- a/aws/resource_aws_emr_cluster.go +++ b/aws/resource_aws_emr_cluster.go @@ -20,6 +20,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsEMRCluster() *schema.Resource { @@ -901,7 +902,7 @@ func resourceAwsEMRClusterCreate(d *schema.ResourceData, meta interface{}) error log.Printf("[DEBUG] EMR Cluster create options: %s", params) var resp *emr.RunJobFlowOutput - err := resource.Retry(30*time.Second, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error resp, err = conn.RunJobFlow(params) if err != nil { diff --git a/aws/resource_aws_emr_cluster_test.go b/aws/resource_aws_emr_cluster_test.go index 44392bbf04aa..9e63cc0db403 100644 --- a/aws/resource_aws_emr_cluster_test.go +++ b/aws/resource_aws_emr_cluster_test.go @@ -84,6 +84,7 @@ func TestAccAWSEMRCluster_basic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -126,6 +127,7 @@ func TestAccAWSEMRCluster_additionalInfo(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -160,6 +162,7 @@ func TestAccAWSEMRCluster_disappears(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -182,6 +185,7 @@ func TestAccAWSEMRCluster_configurationsJson(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -280,6 +284,7 @@ func TestAccAWSEMRCluster_CoreInstanceGroup_AutoscalingPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -330,6 +335,7 @@ func TestAccAWSEMRCluster_CoreInstanceGroup_BidPrice(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -371,6 +377,7 @@ func TestAccAWSEMRCluster_CoreInstanceGroup_InstanceCount(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -421,6 +428,7 @@ func TestAccAWSEMRCluster_CoreInstanceGroup_InstanceType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -462,6 +470,7 @@ func TestAccAWSEMRCluster_CoreInstanceGroup_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -506,6 +515,7 @@ func TestAccAWSEMRCluster_Ec2Attributes_DefaultManagedSecurityGroups(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -546,6 +556,7 @@ func TestAccAWSEMRCluster_Kerberos_ClusterDedicatedKdc(t *testing.T) { password := fmt.Sprintf("NeverKeepPasswordsInPlainText%s!", rName) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -580,6 +591,7 @@ func TestAccAWSEMRCluster_MasterInstanceGroup_BidPrice(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -621,6 +633,7 @@ func TestAccAWSEMRCluster_MasterInstanceGroup_InstanceCount(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -662,6 +675,7 @@ func TestAccAWSEMRCluster_MasterInstanceGroup_InstanceType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -703,6 +717,7 @@ func TestAccAWSEMRCluster_MasterInstanceGroup_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -744,6 +759,7 @@ func TestAccAWSEMRCluster_security_config(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -775,6 +791,7 @@ func TestAccAWSEMRCluster_Step_Basic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -812,6 +829,7 @@ func TestAccAWSEMRCluster_Step_ConfigMode(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -877,6 +895,7 @@ func TestAccAWSEMRCluster_Step_Multiple(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -918,6 +937,7 @@ func TestAccAWSEMRCluster_bootstrap_ordering(t *testing.T) { rName := acctest.RandomWithPrefix("tf-emr-bootstrap") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -1017,6 +1037,7 @@ func TestAccAWSEMRCluster_terminationProtected(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -1073,6 +1094,7 @@ func TestAccAWSEMRCluster_keepJob(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -1104,6 +1126,7 @@ func TestAccAWSEMRCluster_visibleToAllUsers(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -1153,6 +1176,7 @@ func TestAccAWSEMRCluster_s3Logging(t *testing.T) { bucketName := fmt.Sprintf("s3n://%s/", rName) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -1184,6 +1208,7 @@ func TestAccAWSEMRCluster_tags(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -1228,6 +1253,7 @@ func TestAccAWSEMRCluster_root_volume_size(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -1265,6 +1291,7 @@ func TestAccAWSEMRCluster_step_concurrency_level(t *testing.T) { resourceName := "aws_emr_cluster.tf-test-cluster" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -1302,6 +1329,7 @@ func TestAccAWSEMRCluster_ebs_config(t *testing.T) { resourceName := "aws_emr_cluster.tf-test-cluster" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -1334,6 +1362,7 @@ func TestAccAWSEMRCluster_custom_ami_id(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -1365,6 +1394,7 @@ func TestAccAWSEMRCluster_instance_fleet(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ @@ -1387,6 +1417,7 @@ func TestAccAWSEMRCluster_instance_fleet_master_only(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_emr_instance_fleet_test.go b/aws/resource_aws_emr_instance_fleet_test.go index 086cbde4696b..dc047aeb25c1 100644 --- a/aws/resource_aws_emr_instance_fleet_test.go +++ b/aws/resource_aws_emr_instance_fleet_test.go @@ -19,6 +19,7 @@ func TestAccAWSEMRInstanceFleet_basic(t *testing.T) { resourceName := "aws_emr_instance_fleet.task" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceFleetDestroy, Steps: []resource.TestStep{ @@ -46,6 +47,7 @@ func TestAccAWSEMRInstanceFleet_zero_count(t *testing.T) { resourceName := "aws_emr_instance_fleet.task" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceFleetDestroy, Steps: []resource.TestStep{ @@ -81,6 +83,7 @@ func TestAccAWSEMRInstanceFleet_ebsBasic(t *testing.T) { resourceName := "aws_emr_instance_fleet.task" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceFleetDestroy, Steps: []resource.TestStep{ @@ -108,6 +111,7 @@ func TestAccAWSEMRInstanceFleet_full(t *testing.T) { resourceName := "aws_emr_instance_fleet.task" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceFleetDestroy, Steps: []resource.TestStep{ @@ -137,6 +141,7 @@ func TestAccAWSEMRInstanceFleet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceFleetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_emr_instance_group_test.go b/aws/resource_aws_emr_instance_group_test.go index 821f7196d497..c1bb305075c2 100644 --- a/aws/resource_aws_emr_instance_group_test.go +++ b/aws/resource_aws_emr_instance_group_test.go @@ -20,6 +20,7 @@ func TestAccAWSEMRInstanceGroup_basic(t *testing.T) { resourceName := "aws_emr_instance_group.task" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceGroupDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSEMRInstanceGroup_BidPrice(t *testing.T) { resourceName := "aws_emr_instance_group.task" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceGroupDestroy, Steps: []resource.TestStep{ @@ -101,6 +103,7 @@ func TestAccAWSEMRInstanceGroup_ConfigurationsJson(t *testing.T) { resourceName := "aws_emr_instance_group.task" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceGroupDestroy, Steps: []resource.TestStep{ @@ -143,6 +146,7 @@ func TestAccAWSEMRInstanceGroup_AutoScalingPolicy(t *testing.T) { resourceName := "aws_emr_instance_group.task" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceGroupDestroy, Steps: []resource.TestStep{ @@ -187,6 +191,7 @@ func TestAccAWSEMRInstanceGroup_InstanceCount(t *testing.T) { resourceName := "aws_emr_instance_group.task" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceGroupDestroy, Steps: []resource.TestStep{ @@ -219,6 +224,7 @@ func TestAccAWSEMRInstanceGroup_disappears_EmrCluster(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceGroupDestroy, Steps: []resource.TestStep{ @@ -242,6 +248,7 @@ func TestAccAWSEMRInstanceGroup_EbsConfig_EbsOptimized(t *testing.T) { resourceName := "aws_emr_instance_group.task" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEmrInstanceGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_emr_security_configuration_test.go b/aws/resource_aws_emr_security_configuration_test.go index 64dc5fba14ae..f294cbf0d646 100644 --- a/aws/resource_aws_emr_security_configuration_test.go +++ b/aws/resource_aws_emr_security_configuration_test.go @@ -15,6 +15,7 @@ func TestAccAWSEmrSecurityConfiguration_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, emr.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckEmrSecurityConfigurationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_flow_log_test.go b/aws/resource_aws_flow_log_test.go index bcc8abc60586..07f492871109 100644 --- a/aws/resource_aws_flow_log_test.go +++ b/aws/resource_aws_flow_log_test.go @@ -75,6 +75,7 @@ func TestAccAWSFlowLog_VPCID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ @@ -114,6 +115,7 @@ func TestAccAWSFlowLog_LogFormat(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ @@ -148,6 +150,7 @@ func TestAccAWSFlowLog_SubnetID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ @@ -182,6 +185,7 @@ func TestAccAWSFlowLog_LogDestinationType_CloudWatchLogs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ @@ -213,6 +217,7 @@ func TestAccAWSFlowLog_LogDestinationType_S3(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ @@ -240,6 +245,7 @@ func TestAccAWSFlowLog_LogDestinationType_S3_Invalid(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ @@ -258,6 +264,7 @@ func TestAccAWSFlowLog_LogDestinationType_MaxAggregationInterval(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ @@ -285,6 +292,7 @@ func TestAccAWSFlowLog_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ @@ -332,6 +340,7 @@ func TestAccAWSFlowLog_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFlowLogDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_fms_admin_account.go b/aws/resource_aws_fms_admin_account.go index 3e126f6d8244..64fadfdc754f 100644 --- a/aws/resource_aws_fms_admin_account.go +++ b/aws/resource_aws_fms_admin_account.go @@ -56,7 +56,7 @@ func resourceAwsFmsAdminAccountCreate(d *schema.ResourceData, meta interface{}) stateConf := &resource.StateChangeConf{ Target: []string{accountID}, Refresh: associateFmsAdminAccountRefreshFunc(conn, accountID), - Timeout: 1 * time.Minute, + Timeout: 10 * time.Minute, Delay: 10 * time.Second, } diff --git a/aws/resource_aws_fms_admin_account_test.go b/aws/resource_aws_fms_admin_account_test.go index 33c20a62c4dc..4f58317d5d16 100644 --- a/aws/resource_aws_fms_admin_account_test.go +++ b/aws/resource_aws_fms_admin_account_test.go @@ -19,6 +19,7 @@ func TestAccAwsFmsAdminAccount_basic(t *testing.T) { testAccPreCheckFmsAdmin(t) testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, fms.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckFmsAdminAccountDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_fms_policy_test.go b/aws/resource_aws_fms_policy_test.go index 6fc08067a5bc..9a22595bf2b6 100644 --- a/aws/resource_aws_fms_policy_test.go +++ b/aws/resource_aws_fms_policy_test.go @@ -18,6 +18,7 @@ func TestAccAWSFmsPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, fms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsFmsPolicyDestroy, Steps: []resource.TestStep{ @@ -46,6 +47,7 @@ func TestAccAWSFmsPolicy_cloudfrontDistribution(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, fms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsFmsPolicyDestroy, Steps: []resource.TestStep{ @@ -74,6 +76,7 @@ func TestAccAWSFmsPolicy_includeMap(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, fms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsFmsPolicyDestroy, Steps: []resource.TestStep{ @@ -103,6 +106,7 @@ func TestAccAWSFmsPolicy_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, fms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsFmsPolicyDestroy, Steps: []resource.TestStep{ @@ -128,6 +132,7 @@ func TestAccAWSFmsPolicy_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, fms.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsFmsPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_fsx_lustre_file_system_test.go b/aws/resource_aws_fsx_lustre_file_system_test.go index efcc8a09a01b..1d980e4ec4ad 100644 --- a/aws/resource_aws_fsx_lustre_file_system_test.go +++ b/aws/resource_aws_fsx_lustre_file_system_test.go @@ -80,6 +80,7 @@ func TestAccAWSFsxLustreFileSystem_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -123,6 +124,7 @@ func TestAccAWSFsxLustreFileSystem_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -145,6 +147,7 @@ func TestAccAWSFsxLustreFileSystem_ExportPath(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -183,6 +186,7 @@ func TestAccAWSFsxLustreFileSystem_ImportPath(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -219,6 +223,7 @@ func TestAccAWSFsxLustreFileSystem_ImportedFileChunkSize(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -253,6 +258,7 @@ func TestAccAWSFsxLustreFileSystem_SecurityGroupIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -287,6 +293,7 @@ func TestAccAWSFsxLustreFileSystem_StorageCapacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -321,6 +328,7 @@ func TestAccAWSFsxLustreFileSystem_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -367,6 +375,7 @@ func TestAccAWSFsxLustreFileSystem_WeeklyMaintenanceStartTime(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -401,6 +410,7 @@ func TestAccAWSFsxLustreFileSystem_automaticBackupRetentionDays(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -442,6 +452,7 @@ func TestAccAWSFsxLustreFileSystem_dailyAutomaticBackupStartTime(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -476,6 +487,7 @@ func TestAccAWSFsxLustreFileSystem_DeploymentTypePersistent1(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -510,6 +522,7 @@ func TestAccAWSFsxLustreFileSystem_KmsKeyId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -546,6 +559,7 @@ func TestAccAWSFsxLustreFileSystem_DeploymentTypeScratch2(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -574,6 +588,7 @@ func TestAccAWSFsxLustreFileSystem_StorageTypeHddDriveCacheRead(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -601,6 +616,7 @@ func TestAccAWSFsxLustreFileSystem_StorageTypeHddDriveCacheNone(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -628,6 +644,7 @@ func TestAccAWSFsxLustreFileSystem_copyTagsToBackups(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ @@ -655,6 +672,7 @@ func TestAccAWSFsxLustreFileSystem_autoImportPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxLustreFileSystemDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_fsx_windows_file_system_test.go b/aws/resource_aws_fsx_windows_file_system_test.go index 981fb52ba891..d1344158d7f7 100644 --- a/aws/resource_aws_fsx_windows_file_system_test.go +++ b/aws/resource_aws_fsx_windows_file_system_test.go @@ -77,6 +77,7 @@ func TestAccAWSFsxWindowsFileSystem_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -128,6 +129,7 @@ func TestAccAWSFsxWindowsFileSystem_singleAz2(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -175,6 +177,7 @@ func TestAccAWSFsxWindowsFileSystem_storageTypeHdd(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -205,6 +208,7 @@ func TestAccAWSFsxWindowsFileSystem_multiAz(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -251,6 +255,7 @@ func TestAccAWSFsxWindowsFileSystem_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -272,6 +277,7 @@ func TestAccAWSFsxWindowsFileSystem_AutomaticBackupRetentionDays(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -317,6 +323,7 @@ func TestAccAWSFsxWindowsFileSystem_CopyTagsToBackups(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -354,6 +361,7 @@ func TestAccAWSFsxWindowsFileSystem_DailyAutomaticBackupStartTime(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -393,6 +401,7 @@ func TestAccAWSFsxWindowsFileSystem_KmsKeyId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -430,6 +439,7 @@ func TestAccAWSFsxWindowsFileSystem_SecurityGroupIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -467,6 +477,7 @@ func TestAccAWSFsxWindowsFileSystem_SelfManagedActiveDirectory(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -497,6 +508,7 @@ func TestAccAWSFsxWindowsFileSystem_SelfManagedActiveDirectory_Username(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -534,6 +546,7 @@ func TestAccAWSFsxWindowsFileSystem_StorageCapacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -571,6 +584,7 @@ func TestAccAWSFsxWindowsFileSystem_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -620,6 +634,7 @@ func TestAccAWSFsxWindowsFileSystem_ThroughputCapacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ @@ -657,6 +672,7 @@ func TestAccAWSFsxWindowsFileSystem_WeeklyMaintenanceStartTime(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(fsx.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, fsx.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckFsxWindowsFileSystemDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_gamelift_alias_test.go b/aws/resource_aws_gamelift_alias_test.go index f55bbaa2ddf3..e035a8f857fa 100644 --- a/aws/resource_aws_gamelift_alias_test.go +++ b/aws/resource_aws_gamelift_alias_test.go @@ -97,6 +97,7 @@ func TestAccAWSGameliftAlias_basic(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftAliasDestroy, Steps: []resource.TestStep{ @@ -147,6 +148,7 @@ func TestAccAWSGameliftAlias_tags(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftAliasDestroy, Steps: []resource.TestStep{ @@ -220,6 +222,7 @@ func TestAccAWSGameliftAlias_fleetRouting(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftAliasDestroy, Steps: []resource.TestStep{ @@ -261,6 +264,7 @@ func TestAccAWSGameliftAlias_disappears(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftAliasDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_gamelift_build_test.go b/aws/resource_aws_gamelift_build_test.go index f0e727c38a35..6e138f499ee7 100644 --- a/aws/resource_aws_gamelift_build_test.go +++ b/aws/resource_aws_gamelift_build_test.go @@ -90,6 +90,7 @@ func TestAccAWSGameliftBuild_basic(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftBuildDestroy, Steps: []resource.TestStep{ @@ -154,6 +155,7 @@ func TestAccAWSGameliftBuild_tags(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftBuildDestroy, Steps: []resource.TestStep{ @@ -216,6 +218,7 @@ func TestAccAWSGameliftBuild_disappears(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftBuildDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_gamelift_fleet_test.go b/aws/resource_aws_gamelift_fleet_test.go index 00a224a48686..a610038a157c 100644 --- a/aws/resource_aws_gamelift_fleet_test.go +++ b/aws/resource_aws_gamelift_fleet_test.go @@ -266,6 +266,7 @@ func TestAccAWSGameliftFleet_basic(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftFleetDestroy, Steps: []resource.TestStep{ @@ -347,6 +348,7 @@ func TestAccAWSGameliftFleet_tags(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftFleetDestroy, Steps: []resource.TestStep{ @@ -416,6 +418,7 @@ func TestAccAWSGameliftFleet_allFields(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftFleetDestroy, Steps: []resource.TestStep{ @@ -533,6 +536,7 @@ func TestAccAWSGameliftFleet_disappears(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftFleetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_gamelift_game_session_queue_test.go b/aws/resource_aws_gamelift_game_session_queue_test.go index 6a4424997a54..1bb24ecc264b 100644 --- a/aws/resource_aws_gamelift_game_session_queue_test.go +++ b/aws/resource_aws_gamelift_game_session_queue_test.go @@ -98,6 +98,7 @@ func TestAccAWSGameliftGameSessionQueue_basic(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftGameSessionQueueDestroy, Steps: []resource.TestStep{ @@ -161,6 +162,7 @@ func TestAccAWSGameliftGameSessionQueue_tags(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftGameSessionQueueDestroy, Steps: []resource.TestStep{ @@ -221,6 +223,7 @@ func TestAccAWSGameliftGameSessionQueue_disappears(t *testing.T) { testAccPartitionHasServicePreCheck(gamelift.EndpointsID, t) testAccPreCheckAWSGamelift(t) }, + ErrorCheck: testAccErrorCheck(t, gamelift.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGameliftGameSessionQueueDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glacier_vault_lock_test.go b/aws/resource_aws_glacier_vault_lock_test.go index 7dfddaf2e7b6..cd916ec5cba6 100644 --- a/aws/resource_aws_glacier_vault_lock_test.go +++ b/aws/resource_aws_glacier_vault_lock_test.go @@ -19,6 +19,7 @@ func TestAccAWSGlacierVaultLock_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glacier.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlacierVaultLockDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSGlacierVaultLock_CompleteLock(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glacier.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlacierVaultLockDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glacier_vault_test.go b/aws/resource_aws_glacier_vault_test.go index 16261e9e365d..9055e8b55daa 100644 --- a/aws/resource_aws_glacier_vault_test.go +++ b/aws/resource_aws_glacier_vault_test.go @@ -81,6 +81,7 @@ func TestAccAWSGlacierVault_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glacier.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlacierVaultDestroy, Steps: []resource.TestStep{ @@ -112,6 +113,7 @@ func TestAccAWSGlacierVault_notification(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glacier.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlacierVaultDestroy, Steps: []resource.TestStep{ @@ -157,6 +159,7 @@ func TestAccAWSGlacierVault_policy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glacier.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlacierVaultDestroy, Steps: []resource.TestStep{ @@ -201,6 +204,7 @@ func TestAccAWSGlacierVault_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glacier.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlacierVaultDestroy, Steps: []resource.TestStep{ @@ -245,6 +249,7 @@ func TestAccAWSGlacierVault_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glacier.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlacierVaultDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_globalaccelerator_accelerator.go b/aws/resource_aws_globalaccelerator_accelerator.go index e4da133f2456..11fc01c14d28 100644 --- a/aws/resource_aws_globalaccelerator_accelerator.go +++ b/aws/resource_aws_globalaccelerator_accelerator.go @@ -43,7 +43,7 @@ func resourceAwsGlobalAcceleratorAccelerator() *schema.Resource { Type: schema.TypeString, Required: true, ValidateFunc: validation.All( - validation.StringLenBetween(1, 32), + validation.StringLenBetween(1, 255), validation.StringMatch(regexp.MustCompile(`^[0-9A-Za-z-]+$`), "only alphanumeric characters and hyphens are allowed"), validation.StringDoesNotMatch(regexp.MustCompile(`^-`), "cannot start with a hyphen"), validation.StringDoesNotMatch(regexp.MustCompile(`-$`), "cannot end with a hyphen"), diff --git a/aws/resource_aws_globalaccelerator_accelerator_test.go b/aws/resource_aws_globalaccelerator_accelerator_test.go index a100e6001290..c6c0538f8c3a 100644 --- a/aws/resource_aws_globalaccelerator_accelerator_test.go +++ b/aws/resource_aws_globalaccelerator_accelerator_test.go @@ -157,6 +157,7 @@ func TestAccAwsGlobalAcceleratorAccelerator_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorAcceleratorDestroy, Steps: []resource.TestStep{ @@ -195,6 +196,7 @@ func TestAccAwsGlobalAcceleratorAccelerator_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorAcceleratorDestroy, Steps: []resource.TestStep{ @@ -217,6 +219,7 @@ func TestAccAwsGlobalAcceleratorAccelerator_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorAcceleratorDestroy, Steps: []resource.TestStep{ @@ -260,6 +263,7 @@ func TestAccAwsGlobalAcceleratorAccelerator_attributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorAcceleratorDestroy, Steps: []resource.TestStep{ @@ -318,6 +322,7 @@ func TestAccAwsGlobalAcceleratorAccelerator_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorAcceleratorDestroy, Steps: []resource.TestStep{ @@ -439,7 +444,9 @@ resource "aws_globalaccelerator_accelerator" "test" { func testAccGlobalAcceleratorAcceleratorConfigAttributes(rName string, flowLogsEnabled bool, flowLogsPrefix string) string { return fmt.Sprintf(` resource "aws_s3_bucket" "test" { - bucket = %[1]q + acl = "private" + bucket = %[1]q + force_destroy = true } resource "aws_globalaccelerator_accelerator" "test" { diff --git a/aws/resource_aws_globalaccelerator_endpoint_group_test.go b/aws/resource_aws_globalaccelerator_endpoint_group_test.go index 00e0be4bfebd..0dda503b349d 100644 --- a/aws/resource_aws_globalaccelerator_endpoint_group_test.go +++ b/aws/resource_aws_globalaccelerator_endpoint_group_test.go @@ -23,6 +23,7 @@ func TestAccAwsGlobalAcceleratorEndpointGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorEndpointGroupDestroy, Steps: []resource.TestStep{ @@ -59,6 +60,7 @@ func TestAccAwsGlobalAcceleratorEndpointGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorEndpointGroupDestroy, Steps: []resource.TestStep{ @@ -84,6 +86,7 @@ func TestAccAwsGlobalAcceleratorEndpointGroup_ALBEndpoint_ClientIP(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorEndpointGroupDestroy, Steps: []resource.TestStep{ @@ -157,6 +160,7 @@ func TestAccAwsGlobalAcceleratorEndpointGroup_InstanceEndpoint(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorEndpointGroupDestroy, Steps: []resource.TestStep{ @@ -207,6 +211,7 @@ func TestAccAwsGlobalAcceleratorEndpointGroup_MultiRegion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccMultipleRegionPreCheck(t, 2); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckGlobalAcceleratorEndpointGroupDestroy, Steps: []resource.TestStep{ @@ -248,6 +253,7 @@ func TestAccAwsGlobalAcceleratorEndpointGroup_PortOverrides(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorEndpointGroupDestroy, Steps: []resource.TestStep{ @@ -314,6 +320,7 @@ func TestAccAwsGlobalAcceleratorEndpointGroup_TCPHealthCheckProtocol(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorEndpointGroupDestroy, Steps: []resource.TestStep{ @@ -356,6 +363,7 @@ func TestAccAwsGlobalAcceleratorEndpointGroup_Update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorEndpointGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_globalaccelerator_listener.go b/aws/resource_aws_globalaccelerator_listener.go index 05fc81cfb6df..5f9f37078bda 100644 --- a/aws/resource_aws_globalaccelerator_listener.go +++ b/aws/resource_aws_globalaccelerator_listener.go @@ -41,21 +41,15 @@ func resourceAwsGlobalAcceleratorListener() *schema.Resource { ForceNew: true, }, "client_affinity": { - Type: schema.TypeString, - Optional: true, - Default: globalaccelerator.ClientAffinityNone, - ValidateFunc: validation.StringInSlice([]string{ - globalaccelerator.ClientAffinityNone, - globalaccelerator.ClientAffinitySourceIp, - }, false), + Type: schema.TypeString, + Optional: true, + Default: globalaccelerator.ClientAffinityNone, + ValidateFunc: validation.StringInSlice(globalaccelerator.ClientAffinity_Values(), false), }, "protocol": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - globalaccelerator.ProtocolTcp, - globalaccelerator.ProtocolUdp, - }, false), + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(globalaccelerator.Protocol_Values(), false), }, "port_range": { Type: schema.TypeSet, @@ -67,12 +61,12 @@ func resourceAwsGlobalAcceleratorListener() *schema.Resource { "from_port": { Type: schema.TypeInt, Optional: true, - ValidateFunc: validation.IntBetween(0, 65535), + ValidateFunc: validation.IsPortNumber, }, "to_port": { Type: schema.TypeInt, Optional: true, - ValidateFunc: validation.IntBetween(0, 65535), + ValidateFunc: validation.IsPortNumber, }, }, }, @@ -97,7 +91,7 @@ func resourceAwsGlobalAcceleratorListenerCreate(d *schema.ResourceData, meta int resp, err := conn.CreateListener(opts) if err != nil { - return fmt.Errorf("Error creating Global Accelerator listener: %s", err) + return fmt.Errorf("error creating Global Accelerator listener: %w", err) } d.SetId(aws.StringValue(resp.Listener.ListenerArn)) @@ -135,7 +129,7 @@ func resourceAwsGlobalAcceleratorListenerRead(d *schema.ResourceData, meta inter d.Set("client_affinity", listener.ClientAffinity) d.Set("protocol", listener.Protocol) if err := d.Set("port_range", resourceAwsGlobalAcceleratorListenerFlattenPortRanges(listener.PortRanges)); err != nil { - return fmt.Errorf("error setting port_range: %s", err) + return fmt.Errorf("error setting port_range: %w", err) } return nil diff --git a/aws/resource_aws_globalaccelerator_listener_test.go b/aws/resource_aws_globalaccelerator_listener_test.go index abe312d872b0..d1178612c36a 100644 --- a/aws/resource_aws_globalaccelerator_listener_test.go +++ b/aws/resource_aws_globalaccelerator_listener_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/globalaccelerator" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -17,6 +18,7 @@ func TestAccAwsGlobalAcceleratorListener_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorListenerDestroy, Steps: []resource.TestStep{ @@ -48,6 +50,7 @@ func TestAccAwsGlobalAcceleratorListener_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorListenerDestroy, Steps: []resource.TestStep{ @@ -69,6 +72,7 @@ func TestAccAwsGlobalAcceleratorListener_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckGlobalAccelerator(t) }, + ErrorCheck: testAccErrorCheck(t, globalaccelerator.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlobalAcceleratorListenerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_catalog_database_test.go b/aws/resource_aws_glue_catalog_database_test.go index 46388f318b97..08a31c36b8e1 100644 --- a/aws/resource_aws_glue_catalog_database_test.go +++ b/aws/resource_aws_glue_catalog_database_test.go @@ -67,6 +67,7 @@ func TestAccAWSGlueCatalogDatabase_full(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueDatabaseDestroy, Steps: []resource.TestStep{ @@ -119,6 +120,7 @@ func TestAccAWSGlueCatalogDatabase_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueDatabaseDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_catalog_table_test.go b/aws/resource_aws_glue_catalog_table_test.go index 2abbb94bc1d3..10b06abcbaca 100644 --- a/aws/resource_aws_glue_catalog_table_test.go +++ b/aws/resource_aws_glue_catalog_table_test.go @@ -18,6 +18,7 @@ func TestAccAWSGlueCatalogTable_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -48,6 +49,7 @@ func TestAccAWSGlueCatalogTable_columnParameters(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -78,6 +80,7 @@ func TestAccAWSGlueCatalogTable_full(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -141,6 +144,7 @@ func TestAccAWSGlueCatalogTable_update_addValues(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -213,6 +217,7 @@ func TestAccAWSGlueCatalogTable_update_replaceValues(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -326,6 +331,7 @@ func TestAccAWSGlueCatalogTable_StorageDescriptor_EmptyConfigurationBlock(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -346,6 +352,7 @@ func TestAccAWSGlueCatalogTable_StorageDescriptor_SerDeInfo_EmptyConfigurationBl resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -367,6 +374,7 @@ func TestAccAWSGlueCatalogTable_StorageDescriptor_SerDeInfo_UpdateValues(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -407,6 +415,7 @@ func TestAccAWSGlueCatalogTable_StorageDescriptor_SkewedInfo_EmptyConfigurationB resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -428,6 +437,7 @@ func TestAccAWSGlueCatalogTable_StorageDescriptor_schemaReference(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -458,6 +468,7 @@ func TestAccAWSGlueCatalogTable_StorageDescriptor_schemaReferenceArn(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -487,6 +498,7 @@ func TestAccAWSGlueCatalogTable_partitionIndexesSingle(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -517,6 +529,7 @@ func TestAccAWSGlueCatalogTable_partitionIndexesMultiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -550,6 +563,7 @@ func TestAccAWSGlueCatalogTable_disappears_database(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ @@ -572,6 +586,7 @@ func TestAccAWSGlueCatalogTable_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueTableDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_classifier_test.go b/aws/resource_aws_glue_classifier_test.go index 34e88dab803d..ed8026e27bd1 100644 --- a/aws/resource_aws_glue_classifier_test.go +++ b/aws/resource_aws_glue_classifier_test.go @@ -75,6 +75,7 @@ func TestAccAWSGlueClassifier_CsvClassifier(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueClassifierDestroy, Steps: []resource.TestStep{ @@ -129,6 +130,7 @@ func TestAccAWSGlueClassifier_CsvClassifier_quoteSymbol(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueClassifierDestroy, Steps: []resource.TestStep{ @@ -165,6 +167,7 @@ func TestAccAWSGlueClassifier_GrokClassifier(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueClassifierDestroy, Steps: []resource.TestStep{ @@ -213,6 +216,7 @@ func TestAccAWSGlueClassifier_GrokClassifier_CustomPatterns(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueClassifierDestroy, Steps: []resource.TestStep{ @@ -261,6 +265,7 @@ func TestAccAWSGlueClassifier_JsonClassifier(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueClassifierDestroy, Steps: []resource.TestStep{ @@ -305,6 +310,7 @@ func TestAccAWSGlueClassifier_TypeChange(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueClassifierDestroy, Steps: []resource.TestStep{ @@ -373,6 +379,7 @@ func TestAccAWSGlueClassifier_XmlClassifier(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueClassifierDestroy, Steps: []resource.TestStep{ @@ -419,6 +426,7 @@ func TestAccAWSGlueClassifier_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueClassifierDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_connection_test.go b/aws/resource_aws_glue_connection_test.go index 755a4a854134..916a63a79802 100644 --- a/aws/resource_aws_glue_connection_test.go +++ b/aws/resource_aws_glue_connection_test.go @@ -65,6 +65,7 @@ func TestAccAWSGlueConnection_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueConnectionDestroy, Steps: []resource.TestStep{ @@ -98,6 +99,7 @@ func TestAccAWSGlueConnection_MongoDB(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueConnectionDestroy, Steps: []resource.TestStep{ @@ -131,6 +133,7 @@ func TestAccAWSGlueConnection_Kafka(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueConnectionDestroy, Steps: []resource.TestStep{ @@ -162,6 +165,7 @@ func TestAccAWSGlueConnection_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueConnectionDestroy, Steps: []resource.TestStep{ @@ -196,6 +200,7 @@ func TestAccAWSGlueConnection_MatchCriteria(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueConnectionDestroy, Steps: []resource.TestStep{ @@ -245,6 +250,7 @@ func TestAccAWSGlueConnection_PhysicalConnectionRequirements(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueConnectionDestroy, Steps: []resource.TestStep{ @@ -281,6 +287,7 @@ func TestAccAWSGlueConnection_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueConnectionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_crawler_test.go b/aws/resource_aws_glue_crawler_test.go index 37f9e9fd335b..bc59b615e491 100644 --- a/aws/resource_aws_glue_crawler_test.go +++ b/aws/resource_aws_glue_crawler_test.go @@ -66,6 +66,7 @@ func TestAccAWSGlueCrawler_DynamodbTarget(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -133,6 +134,7 @@ func TestAccAWSGlueCrawler_DynamodbTarget_scanAll(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -176,6 +178,7 @@ func TestAccAWSGlueCrawler_DynamodbTarget_scanRate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -219,6 +222,7 @@ func TestAccAWSGlueCrawler_JdbcTarget(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -288,6 +292,7 @@ func TestAccAWSGlueCrawler_JdbcTarget_Exclusions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -328,6 +333,7 @@ func TestAccAWSGlueCrawler_JdbcTarget_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -386,6 +392,7 @@ func TestAccAWSGlueCrawler_mongoDBTarget(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -425,6 +432,7 @@ func TestAccAWSGlueCrawler_mongoDBTarget_scan_all(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -474,6 +482,7 @@ func TestAccAWSGlueCrawler_mongoDBTarget_multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -529,6 +538,7 @@ func TestAccAWSGlueCrawler_S3Target(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -597,6 +607,7 @@ func TestAccAWSGlueCrawler_S3Target_ConnectionName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -625,6 +636,7 @@ func TestAccAWSGlueCrawler_S3Target_Exclusions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -665,6 +677,7 @@ func TestAccAWSGlueCrawler_S3Target_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -718,6 +731,7 @@ func TestAccAWSGlueCrawler_CatalogTarget(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -790,6 +804,7 @@ func TestAccAWSGlueCrawler_CatalogTarget_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -845,6 +860,7 @@ func TestAccAWSGlueCrawler_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -867,6 +883,7 @@ func TestAccAWSGlueCrawler_Classifiers(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -913,6 +930,7 @@ func TestAccAWSGlueCrawler_Configuration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -946,6 +964,7 @@ func TestAccAWSGlueCrawler_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -980,6 +999,7 @@ func TestAccAWSGlueCrawler_Role_ARN_NoPath(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -1006,6 +1026,7 @@ func TestAccAWSGlueCrawler_Role_ARN_Path(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -1032,6 +1053,7 @@ func TestAccAWSGlueCrawler_Role_Name_Path(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -1058,6 +1080,7 @@ func TestAccAWSGlueCrawler_Schedule(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -1098,6 +1121,7 @@ func TestAccAWSGlueCrawler_SchemaChangePolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -1135,6 +1159,7 @@ func TestAccAWSGlueCrawler_TablePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -1168,6 +1193,7 @@ func TestAccAWSGlueCrawler_RemoveTablePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -1201,6 +1227,7 @@ func TestAccAWSGlueCrawler_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -1245,6 +1272,7 @@ func TestAccAWSGlueCrawler_SecurityConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -1278,6 +1306,7 @@ func TestAccAWSGlueCrawler_lineageConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ @@ -1320,6 +1349,7 @@ func TestAccAWSGlueCrawler_recrawlPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueCrawlerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_data_catalog_encryption_settings_test.go b/aws/resource_aws_glue_data_catalog_encryption_settings_test.go index e258ee7df5a5..f4cd477591c7 100644 --- a/aws/resource_aws_glue_data_catalog_encryption_settings_test.go +++ b/aws/resource_aws_glue_data_catalog_encryption_settings_test.go @@ -20,6 +20,7 @@ func TestAccAWSDataCatalogEncryptionSettings_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_dev_endpoint_test.go b/aws/resource_aws_glue_dev_endpoint_test.go index 8fb2cc10cb9e..6167f05894c7 100644 --- a/aws/resource_aws_glue_dev_endpoint_test.go +++ b/aws/resource_aws_glue_dev_endpoint_test.go @@ -79,6 +79,7 @@ func TestAccGlueDevEndpoint_Basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -112,6 +113,7 @@ func TestAccGlueDevEndpoint_Arguments(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -159,6 +161,7 @@ func TestAccGlueDevEndpoint_ExtraJarsS3Path(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -195,6 +198,7 @@ func TestAccGlueDevEndpoint_ExtraPythonLibsS3Path(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -229,6 +233,7 @@ func TestAccGlueDevEndpoint_GlueVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -267,6 +272,7 @@ func TestAccGlueDevEndpoint_NumberOfNodes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -305,6 +311,7 @@ func TestAccGlueDevEndpoint_NumberOfWorkers(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -343,6 +350,7 @@ func TestAccGlueDevEndpoint_PublicKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -377,6 +385,7 @@ func TestAccGlueDevEndpoint_PublicKeys(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -418,6 +427,7 @@ func TestAccGlueDevEndpoint_SecurityConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -446,6 +456,7 @@ func TestAccGlueDevEndpoint_SubnetID_SecurityGroupIDs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -476,6 +487,7 @@ func TestAccGlueDevEndpoint_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -521,6 +533,7 @@ func TestAccGlueDevEndpoint_WorkerType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ @@ -562,6 +575,7 @@ func TestAccGlueDevEndpoint_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueDevEndpointDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_job_test.go b/aws/resource_aws_glue_job_test.go index 4e0d36e1e3ef..5c23d6a64d04 100644 --- a/aws/resource_aws_glue_job_test.go +++ b/aws/resource_aws_glue_job_test.go @@ -64,6 +64,7 @@ func TestAccAWSGlueJob_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -99,6 +100,7 @@ func TestAccAWSGlueJob_Command(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -135,6 +137,7 @@ func TestAccAWSGlueJob_DefaultArguments(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -173,6 +176,7 @@ func TestAccAWSGlueJob_nonOverridableArguments(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -211,6 +215,7 @@ func TestAccAWSGlueJob_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -245,6 +250,7 @@ func TestAccAWSGlueJob_GlueVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -286,6 +292,7 @@ func TestAccAWSGlueJob_ExecutionProperty(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -326,6 +333,7 @@ func TestAccAWSGlueJob_MaxRetries(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -364,6 +372,7 @@ func TestAccAWSGlueJob_NotificationProperty(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -404,6 +413,7 @@ func TestAccAWSGlueJob_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -449,6 +459,7 @@ func TestAccAWSGlueJob_Timeout(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -483,6 +494,7 @@ func TestAccAWSGlueJob_SecurityConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -517,6 +529,7 @@ func TestAccAWSGlueJob_WorkerType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -558,6 +571,7 @@ func TestAccAWSGlueJob_PythonShell(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -613,6 +627,7 @@ func TestAccAWSGlueJob_MaxCapacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ @@ -650,6 +665,7 @@ func TestAccAWSGlueJob_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueJobDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_ml_transform_test.go b/aws/resource_aws_glue_ml_transform_test.go index 68336cbbd185..43f055441f49 100644 --- a/aws/resource_aws_glue_ml_transform_test.go +++ b/aws/resource_aws_glue_ml_transform_test.go @@ -74,6 +74,7 @@ func TestAccAWSGlueMLTransform_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueMLTransformDestroy, Steps: []resource.TestStep{ @@ -121,6 +122,7 @@ func TestAccAWSGlueMLTransform_typeFindMatchesFull(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueMLTransformDestroy, Steps: []resource.TestStep{ @@ -180,6 +182,7 @@ func TestAccAWSGlueMLTransform_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueMLTransformDestroy, Steps: []resource.TestStep{ @@ -214,6 +217,7 @@ func TestAccAWSGlueMLTransform_glueVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueMLTransformDestroy, Steps: []resource.TestStep{ @@ -248,6 +252,7 @@ func TestAccAWSGlueMLTransform_maxRetries(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueMLTransformDestroy, Steps: []resource.TestStep{ @@ -286,6 +291,7 @@ func TestAccAWSGlueMLTransform_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueMLTransformDestroy, Steps: []resource.TestStep{ @@ -331,6 +337,7 @@ func TestAccAWSGlueMLTransform_timeout(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueMLTransformDestroy, Steps: []resource.TestStep{ @@ -365,6 +372,7 @@ func TestAccAWSGlueMLTransform_workerType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueMLTransformDestroy, Steps: []resource.TestStep{ @@ -401,6 +409,7 @@ func TestAccAWSGlueMLTransform_maxCapacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueMLTransformDestroy, Steps: []resource.TestStep{ @@ -435,6 +444,7 @@ func TestAccAWSGlueMLTransform_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueMLTransformDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_partition_test.go b/aws/resource_aws_glue_partition_test.go index e4cece3c9ea6..2aa50029fd3c 100644 --- a/aws/resource_aws_glue_partition_test.go +++ b/aws/resource_aws_glue_partition_test.go @@ -18,6 +18,7 @@ func TestAccAWSGluePartition_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGluePartitionDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSGluePartition_multipleValues(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGluePartitionDestroy, Steps: []resource.TestStep{ @@ -78,6 +80,7 @@ func TestAccAWSGluePartition_parameters(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGluePartitionDestroy, Steps: []resource.TestStep{ @@ -122,6 +125,7 @@ func TestAccAWSGluePartition_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGluePartitionDestroy, Steps: []resource.TestStep{ @@ -144,6 +148,7 @@ func TestAccAWSGluePartition_disappears_table(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGluePartitionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_registry_test.go b/aws/resource_aws_glue_registry_test.go index 56b044967b50..b7e28a0353f7 100644 --- a/aws/resource_aws_glue_registry_test.go +++ b/aws/resource_aws_glue_registry_test.go @@ -58,6 +58,7 @@ func TestAccAWSGlueRegistry_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueRegistry(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueRegistryDestroy, Steps: []resource.TestStep{ @@ -88,6 +89,7 @@ func TestAccAWSGlueRegistry_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueRegistry(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueRegistryDestroy, Steps: []resource.TestStep{ @@ -121,6 +123,7 @@ func TestAccAWSGlueRegistry_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueRegistry(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueRegistryDestroy, Steps: []resource.TestStep{ @@ -166,6 +169,7 @@ func TestAccAWSGlueRegistry_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueRegistry(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueRegistryDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_resource_policy_test.go b/aws/resource_aws_glue_resource_policy_test.go index 6e179a198522..d629590d15cd 100644 --- a/aws/resource_aws_glue_resource_policy_test.go +++ b/aws/resource_aws_glue_resource_policy_test.go @@ -32,6 +32,7 @@ func testAccAWSGlueResourcePolicy_basic(t *testing.T) { resourceName := "aws_glue_resource_policy.test" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueResourcePolicyDestroy, Steps: []resource.TestStep{ @@ -54,6 +55,7 @@ func testAccAWSGlueResourcePolicy_disappears(t *testing.T) { resourceName := "aws_glue_resource_policy.test" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueResourcePolicyDestroy, Steps: []resource.TestStep{ @@ -98,6 +100,7 @@ func testAccAWSGlueResourcePolicy_update(t *testing.T) { resourceName := "aws_glue_resource_policy.test" resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueResourcePolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_schema_test.go b/aws/resource_aws_glue_schema_test.go index 706a5f6d481c..808d4361e973 100644 --- a/aws/resource_aws_glue_schema_test.go +++ b/aws/resource_aws_glue_schema_test.go @@ -59,6 +59,7 @@ func TestAccAWSGlueSchema_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueSchema(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSchemaDestroy, Steps: []resource.TestStep{ @@ -97,6 +98,7 @@ func TestAccAWSGlueSchema_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueSchema(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSchemaDestroy, Steps: []resource.TestStep{ @@ -131,6 +133,7 @@ func TestAccAWSGlueSchema_compatibility(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueSchema(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSchemaDestroy, Steps: []resource.TestStep{ @@ -164,6 +167,7 @@ func TestAccAWSGlueSchema_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueSchema(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSchemaDestroy, Steps: []resource.TestStep{ @@ -209,6 +213,7 @@ func TestAccAWSGlueSchema_schemaDefUpdated(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueSchema(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSchemaDestroy, Steps: []resource.TestStep{ @@ -247,6 +252,7 @@ func TestAccAWSGlueSchema_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueSchema(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSchemaDestroy, Steps: []resource.TestStep{ @@ -270,6 +276,7 @@ func TestAccAWSGlueSchema_disappears_registry(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueSchema(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSchemaDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_security_configuration_test.go b/aws/resource_aws_glue_security_configuration_test.go index 48171716700b..c6fe723704f8 100644 --- a/aws/resource_aws_glue_security_configuration_test.go +++ b/aws/resource_aws_glue_security_configuration_test.go @@ -68,6 +68,7 @@ func TestAccAWSGlueSecurityConfiguration_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSecurityConfigurationDestroy, Steps: []resource.TestStep{ @@ -106,6 +107,7 @@ func TestAccAWSGlueSecurityConfiguration_CloudWatchEncryption_CloudWatchEncrypti resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSecurityConfigurationDestroy, Steps: []resource.TestStep{ @@ -137,6 +139,7 @@ func TestAccAWSGlueSecurityConfiguration_JobBookmarksEncryption_JobBookmarksEncr resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSecurityConfigurationDestroy, Steps: []resource.TestStep{ @@ -168,6 +171,7 @@ func TestAccAWSGlueSecurityConfiguration_S3Encryption_S3EncryptionMode_SSEKMS(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSecurityConfigurationDestroy, Steps: []resource.TestStep{ @@ -198,6 +202,7 @@ func TestAccAWSGlueSecurityConfiguration_S3Encryption_S3EncryptionMode_SSES3(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueSecurityConfigurationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_trigger_test.go b/aws/resource_aws_glue_trigger_test.go index 0c6b837d52be..80dfb311d8c5 100644 --- a/aws/resource_aws_glue_trigger_test.go +++ b/aws/resource_aws_glue_trigger_test.go @@ -66,6 +66,7 @@ func TestAccAWSGlueTrigger_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ @@ -105,6 +106,7 @@ func TestAccAWSGlueTrigger_Crawler(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ @@ -152,6 +154,7 @@ func TestAccAWSGlueTrigger_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ @@ -187,6 +190,7 @@ func TestAccAWSGlueTrigger_Enabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ @@ -229,6 +233,7 @@ func TestAccAWSGlueTrigger_Predicate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ @@ -272,6 +277,7 @@ func TestAccAWSGlueTrigger_Schedule(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ @@ -307,6 +313,7 @@ func TestAccAWSGlueTrigger_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ @@ -353,6 +360,7 @@ func TestAccAWSGlueTrigger_WorkflowName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ @@ -381,6 +389,7 @@ func TestAccAWSGlueTrigger_actions_notify(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ @@ -432,6 +441,7 @@ func TestAccAWSGlueTrigger_actions_securityConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ @@ -462,6 +472,7 @@ func TestAccAWSGlueTrigger_onDemandDisable(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ @@ -507,6 +518,7 @@ func TestAccAWSGlueTrigger_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueTriggerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_user_defined_function_test.go b/aws/resource_aws_glue_user_defined_function_test.go index c9e83ce8b836..a2a437ca4584 100644 --- a/aws/resource_aws_glue_user_defined_function_test.go +++ b/aws/resource_aws_glue_user_defined_function_test.go @@ -18,6 +18,7 @@ func TestAccAWSGlueUserDefinedFunction_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueUDFDestroy, Steps: []resource.TestStep{ @@ -57,6 +58,7 @@ func TestAccAWSGlueUserDefinedFunction_resource_uri(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueUDFDestroy, Steps: []resource.TestStep{ @@ -96,6 +98,7 @@ func TestAccAWSGlueUserDefinedFunction_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckGlueUDFDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_glue_workflow_test.go b/aws/resource_aws_glue_workflow_test.go index 12bdd1fcfd6d..49fbc7c2ea98 100644 --- a/aws/resource_aws_glue_workflow_test.go +++ b/aws/resource_aws_glue_workflow_test.go @@ -52,6 +52,7 @@ func TestAccAWSGlueWorkflow_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueWorkflow(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueWorkflowDestroy, Steps: []resource.TestStep{ @@ -81,6 +82,7 @@ func TestAccAWSGlueWorkflow_maxConcurrentRuns(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueWorkflow(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueWorkflowDestroy, Steps: []resource.TestStep{ @@ -122,6 +124,7 @@ func TestAccAWSGlueWorkflow_DefaultRunProperties(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueWorkflow(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueWorkflowDestroy, Steps: []resource.TestStep{ @@ -151,6 +154,7 @@ func TestAccAWSGlueWorkflow_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueWorkflow(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueWorkflowDestroy, Steps: []resource.TestStep{ @@ -184,6 +188,7 @@ func TestAccAWSGlueWorkflow_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueWorkflow(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueWorkflowDestroy, Steps: []resource.TestStep{ @@ -229,6 +234,7 @@ func TestAccAWSGlueWorkflow_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSGlueWorkflow(t) }, + ErrorCheck: testAccErrorCheck(t, glue.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGlueWorkflowDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_guardduty_detector_test.go b/aws/resource_aws_guardduty_detector_test.go index e41b211b6677..cdb389191266 100644 --- a/aws/resource_aws_guardduty_detector_test.go +++ b/aws/resource_aws_guardduty_detector_test.go @@ -72,6 +72,7 @@ func testAccAwsGuardDutyDetector_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyDetectorDestroy, Steps: []resource.TestStep{ @@ -121,6 +122,7 @@ func testAccAwsGuardDutyDetector_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyDetectorDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_guardduty_filter_test.go b/aws/resource_aws_guardduty_filter_test.go index 44b5b4d62f2c..2d80d7d77368 100644 --- a/aws/resource_aws_guardduty_filter_test.go +++ b/aws/resource_aws_guardduty_filter_test.go @@ -21,6 +21,7 @@ func testAccAwsGuardDutyFilter_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyFilterDestroy, Steps: []resource.TestStep{ @@ -86,6 +87,7 @@ func testAccAwsGuardDutyFilter_update(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyFilterDestroy, Steps: []resource.TestStep{ @@ -129,6 +131,7 @@ func testAccAwsGuardDutyFilter_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyFilterDestroy, Steps: []resource.TestStep{ @@ -169,6 +172,7 @@ func testAccAwsGuardDutyFilter_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsAcmpcaCertificateAuthorityDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_guardduty_invite_accepter_test.go b/aws/resource_aws_guardduty_invite_accepter_test.go index 588a6210cf3d..61540719ffac 100644 --- a/aws/resource_aws_guardduty_invite_accepter_test.go +++ b/aws/resource_aws_guardduty_invite_accepter_test.go @@ -23,6 +23,7 @@ func testAccAwsGuardDutyInviteAccepter_basic(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsGuardDutyInviteAccepterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_guardduty_ipset_test.go b/aws/resource_aws_guardduty_ipset_test.go index fe1cdd0077ba..fd4cb7e50898 100644 --- a/aws/resource_aws_guardduty_ipset_test.go +++ b/aws/resource_aws_guardduty_ipset_test.go @@ -22,6 +22,7 @@ func testAccAwsGuardDutyIpset_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyIpsetDestroy, Steps: []resource.TestStep{ @@ -60,6 +61,7 @@ func testAccAwsGuardDutyIpset_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyIpsetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_guardduty_member_test.go b/aws/resource_aws_guardduty_member_test.go index 943fe8b2c09d..0ee8172e1434 100644 --- a/aws/resource_aws_guardduty_member_test.go +++ b/aws/resource_aws_guardduty_member_test.go @@ -17,6 +17,7 @@ func testAccAwsGuardDutyMember_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyMemberDestroy, Steps: []resource.TestStep{ @@ -45,6 +46,7 @@ func testAccAwsGuardDutyMember_invite_disassociate(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyMemberDestroy, Steps: []resource.TestStep{ @@ -83,6 +85,7 @@ func testAccAwsGuardDutyMember_invite_onUpdate(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyMemberDestroy, Steps: []resource.TestStep{ @@ -122,6 +125,7 @@ func testAccAwsGuardDutyMember_invitationMessage(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyMemberDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_guardduty_organization_admin_account_test.go b/aws/resource_aws_guardduty_organization_admin_account_test.go index c84baad899a6..f8b1559fff14 100644 --- a/aws/resource_aws_guardduty_organization_admin_account_test.go +++ b/aws/resource_aws_guardduty_organization_admin_account_test.go @@ -17,6 +17,7 @@ func testAccAwsGuardDutyOrganizationAdminAccount_basic(t *testing.T) { testAccPreCheck(t) testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyOrganizationAdminAccountDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_guardduty_organization_configuration_test.go b/aws/resource_aws_guardduty_organization_configuration_test.go index 7efdefc5176d..5d31055cf7bb 100644 --- a/aws/resource_aws_guardduty_organization_configuration_test.go +++ b/aws/resource_aws_guardduty_organization_configuration_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/guardduty" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -16,7 +17,8 @@ func testAccAwsGuardDutyOrganizationConfiguration_basic(t *testing.T) { testAccPreCheck(t) testAccOrganizationsAccountPreCheck(t) }, - Providers: testAccProviders, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), + Providers: testAccProviders, // GuardDuty Organization Configuration cannot be deleted separately. // Ensure parent resource is destroyed instead. CheckDestroy: testAccCheckAwsGuardDutyDetectorDestroy, diff --git a/aws/resource_aws_guardduty_publishing_destination_test.go b/aws/resource_aws_guardduty_publishing_destination_test.go index a05c13d9396a..9e3aefeec07f 100644 --- a/aws/resource_aws_guardduty_publishing_destination_test.go +++ b/aws/resource_aws_guardduty_publishing_destination_test.go @@ -87,6 +87,7 @@ func testAccAwsGuardDutyPublishingDestination_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyPublishingDestinationDestroy, Steps: []resource.TestStep{ @@ -114,6 +115,7 @@ func testAccAwsGuardDutyPublishingDestination_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyPublishingDestinationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_guardduty_threatintelset_test.go b/aws/resource_aws_guardduty_threatintelset_test.go index 8a0769a689e6..4b0a6fa848bc 100644 --- a/aws/resource_aws_guardduty_threatintelset_test.go +++ b/aws/resource_aws_guardduty_threatintelset_test.go @@ -22,6 +22,7 @@ func testAccAwsGuardDutyThreatintelset_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyThreatintelsetDestroy, Steps: []resource.TestStep{ @@ -60,6 +61,7 @@ func testAccAwsGuardDutyThreatintelset_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, guardduty.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsGuardDutyThreatintelsetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_iam_access_key_test.go b/aws/resource_aws_iam_access_key_test.go index 3881ab8ba4be..f22bf919cc2b 100644 --- a/aws/resource_aws_iam_access_key_test.go +++ b/aws/resource_aws_iam_access_key_test.go @@ -22,6 +22,7 @@ func TestAccAWSAccessKey_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAccessKeyDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSAccessKey_encrypted(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAccessKeyDestroy, Steps: []resource.TestStep{ @@ -83,6 +85,7 @@ func TestAccAWSAccessKey_Status(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSAccessKeyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_iam_account_alias_test.go b/aws/resource_aws_iam_account_alias_test.go index 59654ea8353d..2e5ae4016983 100644 --- a/aws/resource_aws_iam_account_alias_test.go +++ b/aws/resource_aws_iam_account_alias_test.go @@ -41,6 +41,7 @@ func testAccAWSIAMAccountAlias_importBasic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSIAMAccountAliasDestroy, Steps: []resource.TestStep{ @@ -64,6 +65,7 @@ func testAccAWSIAMAccountAlias_basic_with_datasource(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSIAMAccountAliasDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_iam_account_password_policy_test.go b/aws/resource_aws_iam_account_password_policy_test.go index 041e40cfb063..65e859471b1e 100644 --- a/aws/resource_aws_iam_account_password_policy_test.go +++ b/aws/resource_aws_iam_account_password_policy_test.go @@ -16,6 +16,7 @@ func TestAccAWSIAMAccountPasswordPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSIAMAccountPasswordPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_iam_group_membership_test.go b/aws/resource_aws_iam_group_membership_test.go index d350fc72bc0e..5f633752ae85 100644 --- a/aws/resource_aws_iam_group_membership_test.go +++ b/aws/resource_aws_iam_group_membership_test.go @@ -25,6 +25,7 @@ func TestAccAWSGroupMembership_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGroupMembershipDestroy, Steps: []resource.TestStep{ @@ -65,6 +66,7 @@ func TestAccAWSGroupMembership_paginatedUserList(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGroupMembershipDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_iam_group_policy_attachment_test.go b/aws/resource_aws_iam_group_policy_attachment_test.go index 98a31430d3b1..ee226df1e996 100644 --- a/aws/resource_aws_iam_group_policy_attachment_test.go +++ b/aws/resource_aws_iam_group_policy_attachment_test.go @@ -23,6 +23,7 @@ func TestAccAWSIAMGroupPolicyAttachment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGroupPolicyAttachmentDestroy, Steps: []resource.TestStep{ @@ -61,6 +62,7 @@ func TestAccAWSIAMGroupPolicyAttachment_basic(t *testing.T) { }, }) } + func testAccCheckAWSGroupPolicyAttachmentDestroy(s *terraform.State) error { return nil } @@ -93,6 +95,7 @@ func testAccCheckAWSGroupPolicyAttachmentExists(n string, c int, out *iam.ListAt return nil } } + func testAccCheckAWSGroupPolicyAttachmentAttributes(policies []string, out *iam.ListAttachedGroupPoliciesOutput) resource.TestCheckFunc { return func(s *terraform.State) error { matched := 0 diff --git a/aws/resource_aws_iam_group_policy_test.go b/aws/resource_aws_iam_group_policy_test.go index 10084541513c..c3773cc08eeb 100644 --- a/aws/resource_aws_iam_group_policy_test.go +++ b/aws/resource_aws_iam_group_policy_test.go @@ -17,6 +17,7 @@ func TestAccAWSIAMGroupPolicy_basic(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckIAMGroupPolicyDestroy, Steps: []resource.TestStep{ @@ -61,6 +62,7 @@ func TestAccAWSIAMGroupPolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckIAMGroupPolicyDestroy, Steps: []resource.TestStep{ @@ -85,6 +87,7 @@ func TestAccAWSIAMGroupPolicy_namePrefix(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), IDRefreshName: "aws_iam_group_policy.test", Providers: testAccProviders, CheckDestroy: testAccCheckIAMGroupPolicyDestroy, @@ -125,6 +128,7 @@ func TestAccAWSIAMGroupPolicy_generatedName(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), IDRefreshName: "aws_iam_group_policy.test", Providers: testAccProviders, CheckDestroy: testAccCheckIAMGroupPolicyDestroy, diff --git a/aws/resource_aws_iam_group_test.go b/aws/resource_aws_iam_group_test.go index d1c152a7881b..a83cf3464796 100644 --- a/aws/resource_aws_iam_group_test.go +++ b/aws/resource_aws_iam_group_test.go @@ -151,6 +151,7 @@ func TestAccAWSIAMGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGroupDestroy, Steps: []resource.TestStep{ @@ -186,6 +187,7 @@ func TestAccAWSIAMGroup_nameChange(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_iam_instance_profile.go b/aws/resource_aws_iam_instance_profile.go index 33e15b2a8bc7..0dc6969d9532 100644 --- a/aws/resource_aws_iam_instance_profile.go +++ b/aws/resource_aws_iam_instance_profile.go @@ -11,6 +11,8 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsIamInstanceProfile() *schema.Resource { @@ -67,6 +69,7 @@ func resourceAwsIamInstanceProfile() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "tags": tagsSchema(), }, } } @@ -86,12 +89,13 @@ func resourceAwsIamInstanceProfileCreate(d *schema.ResourceData, meta interface{ request := &iam.CreateInstanceProfileInput{ InstanceProfileName: aws.String(name), Path: aws.String(d.Get("path").(string)), + Tags: keyvaluetags.New(d.Get("tags").(map[string]interface{})).IgnoreAws().IamTags(), } var err error response, err := conn.CreateInstanceProfile(request) if err == nil { - err = instanceProfileReadResult(d, response.InstanceProfile) + err = instanceProfileReadResult(d, response.InstanceProfile, meta) } if err != nil { return fmt.Errorf("creating IAM instance profile %s: %w", name, err) @@ -117,7 +121,7 @@ func instanceProfileAddRole(conn *iam.IAM, profileName, roleName string) error { RoleName: aws.String(roleName), } - err := resource.Retry(30*time.Second, func() *resource.RetryError { + err := resource.Retry(waiter.PropagationTimeout, func() *resource.RetryError { var err error _, err = conn.AddRoleToInstanceProfile(request) // IAM unfortunately does not provide a better error code or message for eventual consistency @@ -186,6 +190,14 @@ func resourceAwsIamInstanceProfileUpdate(d *schema.ResourceData, meta interface{ } } + if d.HasChange("tags") { + o, n := d.GetChange("tags") + + if err := keyvaluetags.IamInstanceProfileUpdateTags(conn, d.Id(), o, n); err != nil { + return fmt.Errorf("error updating tags for IAM Instance Profile (%s): %w", d.Id(), err) + } + } + return nil } @@ -225,7 +237,7 @@ func resourceAwsIamInstanceProfileRead(d *schema.ResourceData, meta interface{}) } } - return instanceProfileReadResult(d, instanceProfile) + return instanceProfileReadResult(d, instanceProfile, meta) } func resourceAwsIamInstanceProfileDelete(d *schema.ResourceData, meta interface{}) error { @@ -249,7 +261,9 @@ func resourceAwsIamInstanceProfileDelete(d *schema.ResourceData, meta interface{ return nil } -func instanceProfileReadResult(d *schema.ResourceData, result *iam.InstanceProfile) error { +func instanceProfileReadResult(d *schema.ResourceData, result *iam.InstanceProfile, meta interface{}) error { + ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig + d.SetId(aws.StringValue(result.InstanceProfileName)) if err := d.Set("name", result.InstanceProfileName); err != nil { return err @@ -269,5 +283,9 @@ func instanceProfileReadResult(d *schema.ResourceData, result *iam.InstanceProfi d.Set("role", result.Roles[0].RoleName) //there will only be 1 role returned } + if err := d.Set("tags", keyvaluetags.IamKeyValueTags(result.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + return fmt.Errorf("error setting tags: %w", err) + } + return nil } diff --git a/aws/resource_aws_iam_instance_profile_test.go b/aws/resource_aws_iam_instance_profile_test.go index 0bc63b918c54..d2781996ec7a 100644 --- a/aws/resource_aws_iam_instance_profile_test.go +++ b/aws/resource_aws_iam_instance_profile_test.go @@ -2,16 +2,65 @@ package aws import ( "fmt" + "log" "strings" "testing" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/iam" + "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) +func init() { + resource.AddTestSweepers("aws_iam_instance_profile", &resource.Sweeper{ + Name: "aws_iam_instance_profile", + F: testSweepIamInstanceProfile, + Dependencies: []string{"aws_iam_role"}, + }) +} + +func testSweepIamInstanceProfile(region string) error { + client, err := sharedClientForRegion(region) + if err != nil { + return fmt.Errorf("error getting client: %w", err) + } + conn := client.(*AWSClient).iamconn + + var sweeperErrs *multierror.Error + + out, err := conn.ListInstanceProfiles(&iam.ListInstanceProfilesInput{}) + + for _, instanceProfile := range out.InstanceProfiles { + name := aws.StringValue(instanceProfile.InstanceProfileName) + + r := resourceAwsIamInstanceProfile() + d := r.Data(nil) + d.SetId(name) + err := r.Delete(d, client) + + if err != nil { + sweeperErr := fmt.Errorf("error deleting IAM Instance Profile (%s): %w", name, err) + log.Printf("[ERROR] %s", sweeperErr) + sweeperErrs = multierror.Append(sweeperErrs, sweeperErr) + continue + } + } + + if testSweepSkipSweepError(err) { + log.Printf("[WARN] Skipping IAM Instance Profile sweep for %s: %s", region, err) + return sweeperErrs.ErrorOrNil() // In case we have completed some pages, but had errors + } + + if err != nil { + sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error describing IAM Instance Profiles: %w", err)) + } + + return sweeperErrs.ErrorOrNil() +} + func TestAccAWSIAMInstanceProfile_basic(t *testing.T) { var conf iam.GetInstanceProfileOutput resourceName := "aws_iam_instance_profile.test" @@ -19,6 +68,7 @@ func TestAccAWSIAMInstanceProfile_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSInstanceProfileDestroy, Steps: []resource.TestStep{ @@ -29,6 +79,7 @@ func TestAccAWSIAMInstanceProfile_basic(t *testing.T) { testAccCheckResourceAttrGlobalARN(resourceName, "arn", "iam", fmt.Sprintf("instance-profile/test-%s", rName)), resource.TestCheckResourceAttrPair(resourceName, "role", "aws_iam_role.test", "name"), resource.TestCheckResourceAttr(resourceName, "name", fmt.Sprintf("test-%s", rName)), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), ), }, { @@ -46,6 +97,7 @@ func TestAccAWSIAMInstanceProfile_withoutRole(t *testing.T) { rName := acctest.RandString(5) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSInstanceProfileDestroy, Steps: []resource.TestStep{ @@ -65,6 +117,52 @@ func TestAccAWSIAMInstanceProfile_withoutRole(t *testing.T) { }) } +func TestAccAWSIAMInstanceProfile_tags(t *testing.T) { + var conf iam.GetInstanceProfileOutput + resourceName := "aws_iam_instance_profile.test" + rName := acctest.RandString(5) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSInstanceProfileDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsIamInstanceProfileConfigTags1(rName, "key1", "value1"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSInstanceProfileExists(resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"name_prefix"}, + }, + { + Config: testAccAwsIamInstanceProfileConfigTags2(rName, "key1", "value1updated", "key2", "value2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSInstanceProfileExists(resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1updated"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + { + Config: testAccAwsIamInstanceProfileConfigTags1(rName, "key2", "value2"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSInstanceProfileExists(resourceName, &conf), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key2", "value2"), + ), + }, + }, + }) +} + func TestAccAWSIAMInstanceProfile_namePrefix(t *testing.T) { var conf iam.GetInstanceProfileOutput rName := acctest.RandString(5) @@ -72,6 +170,7 @@ func TestAccAWSIAMInstanceProfile_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), IDRefreshName: resourceName, IDRefreshIgnore: []string{"name_prefix"}, Providers: testAccProviders, @@ -102,6 +201,7 @@ func TestAccAWSIAMInstanceProfile_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSInstanceProfileDestroy, Steps: []resource.TestStep{ @@ -124,6 +224,7 @@ func TestAccAWSIAMInstanceProfile_disappears_role(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, iam.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSInstanceProfileDestroy, Steps: []resource.TestStep{ @@ -208,7 +309,7 @@ func testAccCheckAWSInstanceProfileExists(n string, res *iam.GetInstanceProfileO } } -func testAccAwsIamInstanceProfileConfig(rName string) string { +func testAccAwsIamInstanceProfileBaseConfig(rName string) string { return fmt.Sprintf(` resource "aws_iam_role" "test" { name = "test-%s" @@ -232,7 +333,11 @@ resource "aws_iam_role" "test" { } EOF } +`, rName) +} +func testAccAwsIamInstanceProfileConfig(rName string) string { + return testAccAwsIamInstanceProfileBaseConfig(rName) + fmt.Sprintf(` resource "aws_iam_instance_profile" "test" { name = "test-%[1]s" role = aws_iam_role.test.name @@ -249,33 +354,37 @@ resource "aws_iam_instance_profile" "test" { } func testAccAWSInstanceProfilePrefixNameConfig(rName string) string { - return fmt.Sprintf(` -resource "aws_iam_role" "test" { - name = "test-%s" + return testAccAwsIamInstanceProfileBaseConfig(rName) + ` +resource "aws_iam_instance_profile" "test" { + name_prefix = "test-" + role = aws_iam_role.test.name +} +` +} - assume_role_policy = < 1 { - return fmt.Errorf("error reading Lake Formation permissions: %s", "multiple permissions found for same resource") + if len(principalResourcePermissions) == 0 { + return fmt.Errorf("error reading Lake Formation permissions: %s", "no permissions found") } - for _, permissions := range principalResourcePermissions { - d.Set("principal", permissions.Principal.DataLakePrincipalIdentifier) - d.Set("permissions", permissions.Permissions) - d.Set("permissions_with_grant_option", permissions.PermissionsWithGrantOption) + if len(principalResourcePermissions) > 2 { + return fmt.Errorf("error reading Lake Formation permissions: %s", "multiple permissions found for same resource") + } - if permissions.Resource.Catalog != nil { - d.Set("catalog_resource", true) - } + d.Set("principal", principalResourcePermissions[0].Principal.DataLakePrincipalIdentifier) + d.Set("permissions", flattenLakeFormationPermissions(principalResourcePermissions)) + d.Set("permissions_with_grant_option", flattenLakeFormationGrantPermissions(principalResourcePermissions)) - if permissions.Resource.DataLocation != nil { - d.Set("data_location", []interface{}{flattenLakeFormationDataLocationResource(permissions.Resource.DataLocation)}) - } else { - d.Set("data_location", nil) - } + if principalResourcePermissions[0].Resource.Catalog != nil { + d.Set("catalog_resource", true) + } - if permissions.Resource.Database != nil { - d.Set("database", []interface{}{flattenLakeFormationDatabaseResource(permissions.Resource.Database)}) - } else { - d.Set("database", nil) - } + if principalResourcePermissions[0].Resource.DataLocation != nil { + d.Set("data_location", []interface{}{flattenLakeFormationDataLocationResource(principalResourcePermissions[0].Resource.DataLocation)}) + } else { + d.Set("data_location", nil) + } - // table with columns permissions will include the table and table with columns - if permissions.Resource.TableWithColumns != nil { - d.Set("table_with_columns", []interface{}{flattenLakeFormationTableWithColumnsResource(permissions.Resource.TableWithColumns)}) - } else if permissions.Resource.Table != nil { - d.Set("table_with_columns", nil) - d.Set("table", []interface{}{flattenLakeFormationTableResource(permissions.Resource.Table)}) - } else { - d.Set("table", nil) - } + if principalResourcePermissions[0].Resource.Database != nil { + d.Set("database", []interface{}{flattenLakeFormationDatabaseResource(principalResourcePermissions[0].Resource.Database)}) + } else { + d.Set("database", nil) } + // table with columns permissions will include the table and table with columns + if principalResourcePermissions[0].Resource.TableWithColumns != nil { + d.Set("table_with_columns", []interface{}{flattenLakeFormationTableWithColumnsResource(principalResourcePermissions[0].Resource.TableWithColumns)}) + } else if principalResourcePermissions[0].Resource.Table != nil { + d.Set("table_with_columns", nil) + d.Set("table", []interface{}{flattenLakeFormationTableResource(principalResourcePermissions[0].Resource.Table)}) + } else { + d.Set("table", nil) + } return nil } @@ -464,6 +480,37 @@ func expandLakeFormationResource(d *schema.ResourceData, squashTableWithColumns return res } +func expandLakeFormationResourceForSelectPermissions(d *schema.ResourceData) *lakeformation.Resource { + tableMapSchema := d.Get("table").([]interface{}) + if len(tableMapSchema) == 0 { + return nil + } + + tableSchema := tableMapSchema[0].(map[string]interface{}) + if tableSchema == nil { + return nil + } + + databaseName, ok := tableSchema["database_name"].(string) + if !ok { + return nil + } + name, ok := tableSchema["name"].(string) + if !ok { + return nil + } + + res := &lakeformation.Resource{ + TableWithColumns: &lakeformation.TableWithColumnsResource{ + DatabaseName: aws.String(databaseName), + Name: aws.String(name), + ColumnWildcard: &lakeformation.ColumnWildcard{}, // A wildcard is used for SELECT permissions + }, + } + + return res +} + func expandLakeFormationDataLocationResource(tfMap map[string]interface{}) *lakeformation.DataLocationResource { if tfMap == nil { return nil @@ -647,3 +694,35 @@ func flattenLakeFormationTableWithColumnsResource(apiObject *lakeformation.Table return tfMap } + +func flattenLakeFormationPermissions(apiObjects []*lakeformation.PrincipalResourcePermissions) []string { + if apiObjects == nil { + return nil + } + + tfList := make([]string, 0) + + for _, resourcePermission := range apiObjects { + for _, permission := range resourcePermission.Permissions { + tfList = append(tfList, aws.StringValue(permission)) + } + } + + return tfList +} + +func flattenLakeFormationGrantPermissions(apiObjects []*lakeformation.PrincipalResourcePermissions) []string { + if apiObjects == nil { + return nil + } + + tfList := make([]string, 0) + + for _, resourcePermission := range apiObjects { + for _, grantPermission := range resourcePermission.PermissionsWithGrantOption { + tfList = append(tfList, aws.StringValue(grantPermission)) + } + } + + return tfList +} diff --git a/aws/resource_aws_lakeformation_permissions_test.go b/aws/resource_aws_lakeformation_permissions_test.go index c33019ffcdb6..f52288d56eca 100644 --- a/aws/resource_aws_lakeformation_permissions_test.go +++ b/aws/resource_aws_lakeformation_permissions_test.go @@ -19,6 +19,7 @@ func testAccAWSLakeFormationPermissions_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ @@ -44,6 +45,7 @@ func testAccAWSLakeFormationPermissions_dataLocation(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ @@ -71,6 +73,7 @@ func testAccAWSLakeFormationPermissions_database(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ @@ -103,6 +106,7 @@ func testAccAWSLakeFormationPermissions_table_name(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ @@ -131,6 +135,7 @@ func testAccAWSLakeFormationPermissions_table_wildcard(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ @@ -155,6 +160,7 @@ func testAccAWSLakeFormationPermissions_tableWithColumns(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ @@ -185,6 +191,7 @@ func testAccAWSLakeFormationPermissions_tableWithColumnsAndTable(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, Steps: []resource.TestStep{ @@ -207,6 +214,30 @@ func testAccAWSLakeFormationPermissions_tableWithColumnsAndTable(t *testing.T) { }) } +func testAccAWSLakeFormationPermissions_selectPermissions(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_lakeformation_permissions.test" + roleName := "aws_iam_role.test" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(lakeformation.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, lakeformation.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSLakeFormationPermissionsDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSLakeFormationPermissionsConfig_selectPermissions(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSLakeFormationPermissionsExists(resourceName), + resource.TestCheckResourceAttrPair(resourceName, "principal", roleName, "arn"), + resource.TestCheckResourceAttr(resourceName, "permissions.#", "7"), + resource.TestCheckResourceAttr(resourceName, "permissions_with_grant_option.#", "7"), + ), + }, + }, + }) +} + func testAccCheckAWSLakeFormationPermissionsDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).lakeformationconn @@ -735,3 +766,73 @@ resource "aws_lakeformation_permissions" "test" { } `, rName) } + +func testAccAWSLakeFormationPermissionsConfig_selectPermissions(rName string) string { + return fmt.Sprintf(` +data "aws_partition" "current" {} + +resource "aws_iam_role" "test" { + name = %[1]q + path = "/" + + assume_role_policy = < 0 { + portInfos = expandLightsailPortInfos(v.(*schema.Set).List()) + } + + input := &lightsail.PutInstancePublicPortsInput{ + InstanceName: aws.String(d.Get("instance_name").(string)), + PortInfos: portInfos, + } + + _, err := conn.PutInstancePublicPorts(input) + + if err != nil { + return fmt.Errorf("unable to create public ports for instance %s: %w", d.Get("instance_name").(string), err) + } + + var buffer bytes.Buffer + for _, portInfo := range portInfos { + buffer.WriteString(fmt.Sprintf("%s-%d-%d\n", aws.StringValue(portInfo.Protocol), aws.Int64Value(portInfo.FromPort), aws.Int64Value(portInfo.ToPort))) + } + + d.SetId(fmt.Sprintf("%s-%d", d.Get("instance_name").(string), hashcode.String(buffer.String()))) + + return resourceAwsLightsailInstancePublicPortsRead(d, meta) +} + +func resourceAwsLightsailInstancePublicPortsRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).lightsailconn + + input := &lightsail.GetInstancePortStatesInput{ + InstanceName: aws.String(d.Get("instance_name").(string)), + } + + output, err := conn.GetInstancePortStates(input) + + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, "NotFoundException") { + log.Printf("[WARN] Lightsail instance public ports (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + + if err != nil { + return fmt.Errorf("error reading Lightsail instance public ports (%s): %w", d.Id(), err) + } + + if err := d.Set("port_info", flattenLightsailInstancePortStates(output.PortStates)); err != nil { + return fmt.Errorf("error setting port_info: %w", err) + } + + return nil +} + +func resourceAwsLightsailInstancePublicPortsDelete(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).lightsailconn + + var err *multierror.Error + + var portInfos []*lightsail.PortInfo + if v, ok := d.GetOk("port_info"); ok && v.(*schema.Set).Len() > 0 { + portInfos = expandLightsailPortInfos(v.(*schema.Set).List()) + } + + for _, portInfo := range portInfos { + _, portError := conn.CloseInstancePublicPorts(&lightsail.CloseInstancePublicPortsInput{ + InstanceName: aws.String(d.Get("instance_name").(string)), + PortInfo: portInfo, + }) + + if portError != nil { + err = multierror.Append(err, portError) + } + } + + if err != nil { + return fmt.Errorf("unable to close public ports for instance %s: %w", d.Get("instance_name").(string), err) + } + + return nil +} + +func expandLightsailPortInfo(tfMap map[string]interface{}) *lightsail.PortInfo { + if tfMap == nil { + return nil + } + + apiObject := &lightsail.PortInfo{ + FromPort: aws.Int64((int64)(tfMap["from_port"].(int))), + ToPort: aws.Int64((int64)(tfMap["to_port"].(int))), + Protocol: aws.String(tfMap["protocol"].(string)), + } + + if v, ok := tfMap["cidrs"].(*schema.Set); ok && v.Len() > 0 { + apiObject.Cidrs = expandStringSet(v) + } + + return apiObject +} + +func expandLightsailPortInfos(tfList []interface{}) []*lightsail.PortInfo { + if len(tfList) == 0 { + return nil + } + + var apiObjects []*lightsail.PortInfo + + for _, tfMapRaw := range tfList { + tfMap, ok := tfMapRaw.(map[string]interface{}) + + if !ok { + continue + } + + apiObject := expandLightsailPortInfo(tfMap) + + if apiObject == nil { + continue + } + + apiObjects = append(apiObjects, apiObject) + } + + return apiObjects +} + +func flattenLightsailInstancePortState(apiObject *lightsail.InstancePortState) map[string]interface{} { + if apiObject == nil { + return nil + } + + tfMap := map[string]interface{}{} + + tfMap["from_port"] = aws.Int64Value(apiObject.FromPort) + tfMap["to_port"] = aws.Int64Value(apiObject.ToPort) + tfMap["protocol"] = aws.StringValue(apiObject.Protocol) + + if v := apiObject.Cidrs; v != nil { + tfMap["cidrs"] = aws.StringValueSlice(v) + } + + return tfMap +} + +func flattenLightsailInstancePortStates(apiObjects []*lightsail.InstancePortState) []interface{} { + if len(apiObjects) == 0 { + return nil + } + + var tfList []interface{} + + for _, apiObject := range apiObjects { + if apiObject == nil { + continue + } + + tfList = append(tfList, flattenLightsailInstancePortState(apiObject)) + } + + return tfList +} diff --git a/aws/resource_aws_lightsail_instance_public_ports_test.go b/aws/resource_aws_lightsail_instance_public_ports_test.go new file mode 100644 index 000000000000..ac152a39cba3 --- /dev/null +++ b/aws/resource_aws_lightsail_instance_public_ports_test.go @@ -0,0 +1,261 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/lightsail" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" +) + +func TestAccAWSLightsailInstancePublicPorts_basic(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_lightsail_instance_public_ports.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + testAccPartitionHasServicePreCheck(lightsail.EndpointsID, t) + testAccPreCheckAWSLightsail(t) + }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSLightsailInstancePublicPortsDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSLightsailInstancePublicPortsConfig_basic(rName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSLightsailInstancePublicPortsExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "port_info.#", "1"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "port_info.*", map[string]string{ + "protocol": "tcp", + "from_port": "80", + "to_port": "80", + }), + ), + }, + }, + }) +} + +func TestAccAWSLightsailInstancePublicPorts_multiple(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_lightsail_instance_public_ports.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + testAccPartitionHasServicePreCheck(lightsail.EndpointsID, t) + testAccPreCheckAWSLightsail(t) + }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSLightsailInstancePublicPortsDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSLightsailInstancePublicPortsConfig_multiple(rName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSLightsailInstancePublicPortsExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "port_info.#", "2"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "port_info.*", map[string]string{ + "protocol": "tcp", + "from_port": "80", + "to_port": "80", + }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "port_info.*", map[string]string{ + "protocol": "tcp", + "from_port": "443", + "to_port": "443", + }), + ), + }, + }, + }) +} + +func TestAccAWSLightsailInstancePublicPorts_cidrs(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_lightsail_instance_public_ports.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + testAccPartitionHasServicePreCheck(lightsail.EndpointsID, t) + testAccPreCheckAWSLightsail(t) + }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSLightsailInstancePublicPortsDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSLightsailInstancePublicPortsConfig_cidrs(rName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckAWSLightsailInstancePublicPortsExists(resourceName), + resource.TestCheckResourceAttr(resourceName, "port_info.#", "1"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "port_info.*", map[string]string{ + "protocol": "tcp", + "from_port": "125", + "to_port": "125", + "cidrs.#": "2", + }), + resource.TestCheckTypeSetElemAttr(resourceName, "port_info.*.cidrs.*", "1.1.1.1/32"), + resource.TestCheckTypeSetElemAttr(resourceName, "port_info.*.cidrs.*", "192.168.1.0/24"), + ), + }, + }, + }) +} + +func testAccCheckAWSLightsailInstancePublicPortsExists(resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("resource not found: %s", resourceName) + } + + conn := testAccProvider.Meta().(*AWSClient).lightsailconn + + input := &lightsail.GetInstancePortStatesInput{ + InstanceName: aws.String(rs.Primary.Attributes["instance_name"]), + } + + _, err := conn.GetInstancePortStates(input) + + if err != nil { + return fmt.Errorf("error getting Lightsail Instance Public Ports (%s): %w", rs.Primary.ID, err) + } + + return nil + } +} + +func testAccCheckAWSLightsailInstancePublicPortsDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).lightsailconn + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_lightsail_instance_public_ports" { + continue + } + + input := &lightsail.GetInstancePortStatesInput{ + InstanceName: aws.String(rs.Primary.Attributes["instance_name"]), + } + + output, err := conn.GetInstancePortStates(input) + + if tfawserr.ErrCodeEquals(err, lightsail.ErrCodeNotFoundException) { + continue + } + + if err != nil { + return fmt.Errorf("error getting Lightsail Instance Public Ports (%s): %w", rs.Primary.ID, err) + } + + if output != nil { + return fmt.Errorf("Lightsail Instance Public Ports (%s) still exists", rs.Primary.ID) + } + } + + return nil +} + +func testAccAWSLightsailInstancePublicPortsConfig_basic(rName string) string { + return fmt.Sprintf(` +data "aws_availability_zones" "available" { + state = "available" + + filter { + name = "opt-in-status" + values = ["opt-in-not-required"] + } +} + +resource "aws_lightsail_instance" "test" { + name = %[1]q + availability_zone = data.aws_availability_zones.available.names[0] + blueprint_id = "amazon_linux" + bundle_id = "nano_1_0" +} + +resource "aws_lightsail_instance_public_ports" "test" { + instance_name = aws_lightsail_instance.test.name + + port_info { + protocol = "tcp" + from_port = 80 + to_port = 80 + } +} +`, rName) +} + +func testAccAWSLightsailInstancePublicPortsConfig_multiple(rName string) string { + return fmt.Sprintf(` +data "aws_availability_zones" "available" { + state = "available" + + filter { + name = "opt-in-status" + values = ["opt-in-not-required"] + } +} + +resource "aws_lightsail_instance" "test" { + name = %[1]q + availability_zone = data.aws_availability_zones.available.names[0] + blueprint_id = "amazon_linux" + bundle_id = "nano_1_0" +} + +resource "aws_lightsail_instance_public_ports" "test" { + instance_name = aws_lightsail_instance.test.name + + port_info { + protocol = "tcp" + from_port = 80 + to_port = 80 + } + + port_info { + protocol = "tcp" + from_port = 443 + to_port = 443 + } +} +`, rName) +} + +func testAccAWSLightsailInstancePublicPortsConfig_cidrs(rName string) string { + return fmt.Sprintf(` +data "aws_availability_zones" "available" { + state = "available" + + filter { + name = "opt-in-status" + values = ["opt-in-not-required"] + } +} + +resource "aws_lightsail_instance" "test" { + name = %[1]q + availability_zone = data.aws_availability_zones.available.names[0] + blueprint_id = "amazon_linux" + bundle_id = "nano_1_0" +} + +resource "aws_lightsail_instance_public_ports" "test" { + instance_name = aws_lightsail_instance.test.name + + port_info { + protocol = "tcp" + from_port = 125 + to_port = 125 + cidrs = ["192.168.1.0/24", "1.1.1.1/32"] + } +} +`, rName) +} diff --git a/aws/resource_aws_lightsail_instance_test.go b/aws/resource_aws_lightsail_instance_test.go index a4dce503afe9..6a20036d7bdb 100644 --- a/aws/resource_aws_lightsail_instance_test.go +++ b/aws/resource_aws_lightsail_instance_test.go @@ -82,6 +82,7 @@ func TestAccAWSLightsailInstance_basic(t *testing.T) { testAccPartitionHasServicePreCheck(lightsail.EndpointsID, t) testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), IDRefreshName: "aws_lightsail_instance.lightsail_instance_test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailInstanceDestroy, @@ -117,6 +118,7 @@ func TestAccAWSLightsailInstance_Name(t *testing.T) { testAccPartitionHasServicePreCheck(lightsail.EndpointsID, t) testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), IDRefreshName: "aws_lightsail_instance.lightsail_instance_test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailInstanceDestroy, @@ -163,6 +165,7 @@ func TestAccAWSLightsailInstance_Tags(t *testing.T) { testAccPartitionHasServicePreCheck(lightsail.EndpointsID, t) testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), IDRefreshName: "aws_lightsail_instance.lightsail_instance_test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailInstanceDestroy, @@ -220,6 +223,7 @@ func TestAccAWSLightsailInstance_disapear(t *testing.T) { testAccPartitionHasServicePreCheck(lightsail.EndpointsID, t) testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailInstanceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_lightsail_key_pair_test.go b/aws/resource_aws_lightsail_key_pair_test.go index e1a6a534da66..fe003123aa36 100644 --- a/aws/resource_aws_lightsail_key_pair_test.go +++ b/aws/resource_aws_lightsail_key_pair_test.go @@ -19,6 +19,7 @@ func TestAccAWSLightsailKeyPair_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailKeyPairDestroy, Steps: []resource.TestStep{ @@ -42,6 +43,7 @@ func TestAccAWSLightsailKeyPair_publicKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailKeyPairDestroy, Steps: []resource.TestStep{ @@ -67,6 +69,7 @@ func TestAccAWSLightsailKeyPair_encrypted(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailKeyPairDestroy, Steps: []resource.TestStep{ @@ -91,6 +94,7 @@ func TestAccAWSLightsailKeyPair_nameprefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailKeyPairDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_lightsail_static_ip_attachment_test.go b/aws/resource_aws_lightsail_static_ip_attachment_test.go index 3044174be0e4..9201ee1a41a6 100644 --- a/aws/resource_aws_lightsail_static_ip_attachment_test.go +++ b/aws/resource_aws_lightsail_static_ip_attachment_test.go @@ -21,6 +21,7 @@ func TestAccAWSLightsailStaticIpAttachment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailStaticIpAttachmentDestroy, Steps: []resource.TestStep{ @@ -56,6 +57,7 @@ func TestAccAWSLightsailStaticIpAttachment_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailStaticIpAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_lightsail_static_ip_test.go b/aws/resource_aws_lightsail_static_ip_test.go index b44f0927ecd3..c288f5602512 100644 --- a/aws/resource_aws_lightsail_static_ip_test.go +++ b/aws/resource_aws_lightsail_static_ip_test.go @@ -72,6 +72,7 @@ func TestAccAWSLightsailStaticIp_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailStaticIpDestroy, Steps: []resource.TestStep{ @@ -104,6 +105,7 @@ func TestAccAWSLightsailStaticIp_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSLightsail(t) }, + ErrorCheck: testAccErrorCheck(t, lightsail.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLightsailStaticIpDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_load_balancer_backend_server_policy_test.go b/aws/resource_aws_load_balancer_backend_server_policy_test.go index b524a7b24369..14a47e4a8a1d 100644 --- a/aws/resource_aws_load_balancer_backend_server_policy_test.go +++ b/aws/resource_aws_load_balancer_backend_server_policy_test.go @@ -23,6 +23,7 @@ func TestAccAWSLoadBalancerBackendServerPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLoadBalancerBackendServerPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_load_balancer_listener_policy_test.go b/aws/resource_aws_load_balancer_listener_policy_test.go index 5b26e5d6cfd0..9bae9b386f0f 100644 --- a/aws/resource_aws_load_balancer_listener_policy_test.go +++ b/aws/resource_aws_load_balancer_listener_policy_test.go @@ -19,6 +19,7 @@ func TestAccAWSLoadBalancerListenerPolicy_basic(t *testing.T) { mcName := rChar resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLoadBalancerListenerPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_load_balancer_policy_test.go b/aws/resource_aws_load_balancer_policy_test.go index 598c439c6850..4a53fe684545 100644 --- a/aws/resource_aws_load_balancer_policy_test.go +++ b/aws/resource_aws_load_balancer_policy_test.go @@ -22,6 +22,7 @@ func TestAccAWSLoadBalancerPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLoadBalancerPolicyDestroy, Steps: []resource.TestStep{ @@ -45,6 +46,7 @@ func TestAccAWSLoadBalancerPolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLoadBalancerPolicyDestroy, Steps: []resource.TestStep{ @@ -78,6 +80,7 @@ func TestAccAWSLoadBalancerPolicy_updateWhileAssigned(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, elb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSLoadBalancerPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_macie_member_account_association_test.go b/aws/resource_aws_macie_member_account_association_test.go index 803eb1ba2a8a..cb82ce760243 100644 --- a/aws/resource_aws_macie_member_account_association_test.go +++ b/aws/resource_aws_macie_member_account_association_test.go @@ -20,6 +20,7 @@ func TestAccAWSMacieMemberAccountAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMacie(t) }, + ErrorCheck: testAccErrorCheck(t, macie.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSMacieMemberAccountAssociationDestroy, Steps: []resource.TestStep{ @@ -35,8 +36,9 @@ func TestAccAWSMacieMemberAccountAssociation_basic(t *testing.T) { func TestAccAWSMacieMemberAccountAssociation_self(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMacie(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMacie(t) }, + ErrorCheck: testAccErrorCheck(t, macie.EndpointsID), + Providers: testAccProviders, // master account associated with Macie it can't be disassociated. CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_macie_s3_bucket_association_test.go b/aws/resource_aws_macie_s3_bucket_association_test.go index 1d682986ac3a..3bdcbd57708a 100644 --- a/aws/resource_aws_macie_s3_bucket_association_test.go +++ b/aws/resource_aws_macie_s3_bucket_association_test.go @@ -16,6 +16,7 @@ func TestAccAWSMacieS3BucketAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMacie(t) }, + ErrorCheck: testAccErrorCheck(t, macie.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSMacieS3BucketAssociationDestroy, Steps: []resource.TestStep{ @@ -44,6 +45,7 @@ func TestAccAWSMacieS3BucketAssociation_accountIdAndPrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMacie(t) }, + ErrorCheck: testAccErrorCheck(t, macie.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSMacieS3BucketAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_main_route_table_association_test.go b/aws/resource_aws_main_route_table_association_test.go index e5ca346a28fa..c511349fb007 100644 --- a/aws/resource_aws_main_route_table_association_test.go +++ b/aws/resource_aws_main_route_table_association_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -12,6 +13,7 @@ import ( func TestAccAWSMainRouteTableAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMainRouteTableAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_media_convert_queue_test.go b/aws/resource_aws_media_convert_queue_test.go index dba3b7f6f348..d6f92b639e86 100644 --- a/aws/resource_aws_media_convert_queue_test.go +++ b/aws/resource_aws_media_convert_queue_test.go @@ -19,6 +19,7 @@ func TestAccAWSMediaConvertQueue_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaConvert(t) }, + ErrorCheck: testAccErrorCheck(t, mediaconvert.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaConvertQueueDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSMediaConvertQueue_ReservationPlanSettings(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaConvert(t) }, + ErrorCheck: testAccErrorCheck(t, mediaconvert.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaConvertQueueDestroy, Steps: []resource.TestStep{ @@ -91,6 +93,7 @@ func TestAccAWSMediaConvertQueue_withStatus(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaConvert(t) }, + ErrorCheck: testAccErrorCheck(t, mediaconvert.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaConvertQueueDestroy, Steps: []resource.TestStep{ @@ -124,6 +127,7 @@ func TestAccAWSMediaConvertQueue_withTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaConvert(t) }, + ErrorCheck: testAccErrorCheck(t, mediaconvert.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaConvertQueueDestroy, Steps: []resource.TestStep{ @@ -168,6 +172,7 @@ func TestAccAWSMediaConvertQueue_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaConvert(t) }, + ErrorCheck: testAccErrorCheck(t, mediaconvert.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaConvertQueueDestroy, Steps: []resource.TestStep{ @@ -192,6 +197,7 @@ func TestAccAWSMediaConvertQueue_withDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaConvert(t) }, + ErrorCheck: testAccErrorCheck(t, mediaconvert.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaConvertQueueDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_media_package_channel_test.go b/aws/resource_aws_media_package_channel_test.go index 66da48871755..b35267871825 100644 --- a/aws/resource_aws_media_package_channel_test.go +++ b/aws/resource_aws_media_package_channel_test.go @@ -17,6 +17,7 @@ func TestAccAWSMediaPackageChannel_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaPackage(t) }, + ErrorCheck: testAccErrorCheck(t, mediapackage.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaPackageChannelDestroy, Steps: []resource.TestStep{ @@ -48,6 +49,7 @@ func TestAccAWSMediaPackageChannel_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaPackage(t) }, + ErrorCheck: testAccErrorCheck(t, mediapackage.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaPackageChannelDestroy, Steps: []resource.TestStep{ @@ -80,6 +82,7 @@ func TestAccAWSMediaPackageChannel_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaPackage(t) }, + ErrorCheck: testAccErrorCheck(t, mediapackage.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaPackageChannelDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_media_store_container_policy_test.go b/aws/resource_aws_media_store_container_policy_test.go index 1295d6b2775d..b5925bb3ded3 100644 --- a/aws/resource_aws_media_store_container_policy_test.go +++ b/aws/resource_aws_media_store_container_policy_test.go @@ -17,6 +17,7 @@ func TestAccAWSMediaStoreContainerPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaStore(t) }, + ErrorCheck: testAccErrorCheck(t, mediastore.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaStoreContainerPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_media_store_container_test.go b/aws/resource_aws_media_store_container_test.go index e51a82b94aaa..34c6628d6c58 100644 --- a/aws/resource_aws_media_store_container_test.go +++ b/aws/resource_aws_media_store_container_test.go @@ -16,6 +16,7 @@ func TestAccAWSMediaStoreContainer_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaStore(t) }, + ErrorCheck: testAccErrorCheck(t, mediastore.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaStoreContainerDestroy, Steps: []resource.TestStep{ @@ -40,6 +41,7 @@ func TestAccAWSMediaStoreContainer_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMediaStore(t) }, + ErrorCheck: testAccErrorCheck(t, mediastore.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMediaStoreContainerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_mq_broker_test.go b/aws/resource_aws_mq_broker_test.go index d0fa5141d236..6bc9289b45cb 100644 --- a/aws/resource_aws_mq_broker_test.go +++ b/aws/resource_aws_mq_broker_test.go @@ -263,6 +263,7 @@ func TestAccAWSMqBroker_basic(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -335,6 +336,7 @@ func TestAccAWSMqBroker_throughputOptimized(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -413,6 +415,7 @@ func TestAccAWSMqBroker_allFieldsDefaultVpc(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -536,6 +539,7 @@ func TestAccAWSMqBroker_allFieldsCustomVpc(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -647,6 +651,7 @@ func TestAccAWSMqBroker_EncryptionOptions_KmsKeyId(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -680,6 +685,7 @@ func TestAccAWSMqBroker_EncryptionOptions_UseAwsOwnedKey_Disabled(t *testing.T) testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -712,6 +718,7 @@ func TestAccAWSMqBroker_EncryptionOptions_UseAwsOwnedKey_Enabled(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -744,6 +751,7 @@ func TestAccAWSMqBroker_updateUsers(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -816,6 +824,7 @@ func TestAccAWSMqBroker_tags(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -865,6 +874,7 @@ func TestAccAWSMqBroker_updateSecurityGroup(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -917,6 +927,7 @@ func TestAccAWSMqBroker_updateEngineVersion(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -955,6 +966,7 @@ func TestAccAWSMqBroker_disappears(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -981,6 +993,7 @@ func TestAccAWSMqBroker_rabbitmq(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -1018,6 +1031,7 @@ func TestAccAWSMqBroker_clusterRabbitMQ(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ @@ -1078,6 +1092,7 @@ func TestAccAWSMqBroker_ldap(t *testing.T) { testAccPartitionHasServicePreCheck(mq.EndpointsID, t) testAccPreCheckAWSMq(t) }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqBrokerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_mq_configuration.go b/aws/resource_aws_mq_configuration.go index 7ac2056d1b31..b3d8f837e0b1 100644 --- a/aws/resource_aws_mq_configuration.go +++ b/aws/resource_aws_mq_configuration.go @@ -42,6 +42,12 @@ func resourceAwsMqConfiguration() *schema.Resource { Type: schema.TypeString, Computed: true, }, + "authentication_strategy": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice(mq.AuthenticationStrategy_Values(), true), + }, "data": { Type: schema.TypeString, Required: true, @@ -52,12 +58,10 @@ func resourceAwsMqConfiguration() *schema.Resource { Optional: true, }, "engine_type": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - ValidateFunc: validation.StringInSlice([]string{ - mq.EngineTypeActivemq, - }, true), + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice(mq.EngineType_Values(), true), }, "engine_version": { Type: schema.TypeString, @@ -87,6 +91,9 @@ func resourceAwsMqConfigurationCreate(d *schema.ResourceData, meta interface{}) Name: aws.String(d.Get("name").(string)), } + if v, ok := d.GetOk("authentication_strategy"); ok { + input.AuthenticationStrategy = aws.String(v.(string)) + } if v, ok := d.GetOk("tags"); ok { input.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().MqTags() } @@ -121,11 +128,12 @@ func resourceAwsMqConfigurationRead(d *schema.ResourceData, meta interface{}) er } d.Set("arn", out.Arn) + d.Set("authentication_strategy", out.AuthenticationStrategy) d.Set("description", out.LatestRevision.Description) d.Set("engine_type", out.EngineType) d.Set("engine_version", out.EngineVersion) - d.Set("name", out.Name) d.Set("latest_revision", out.LatestRevision.Revision) + d.Set("name", out.Name) rOut, err := conn.DescribeConfigurationRevision(&mq.DescribeConfigurationRevisionInput{ ConfigurationId: aws.String(d.Id()), diff --git a/aws/resource_aws_mq_configuration_test.go b/aws/resource_aws_mq_configuration_test.go index 8d3c507fc7db..8c62234154a4 100644 --- a/aws/resource_aws_mq_configuration_test.go +++ b/aws/resource_aws_mq_configuration_test.go @@ -13,24 +13,30 @@ import ( ) func TestAccAWSMqConfiguration_basic(t *testing.T) { - configurationName := fmt.Sprintf("tf-acc-test-%s", acctest.RandString(5)) + rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_mq_configuration.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMq(t) }, + PreCheck: func() { + testAccPreCheck(t) + testAccPartitionHasServicePreCheck(mq.EndpointsID, t) + testAccPreCheckAWSMq(t) + }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqConfigurationDestroy, Steps: []resource.TestStep{ { - Config: testAccMqConfigurationConfig(configurationName), + Config: testAccMqConfigurationConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsMqConfigurationExists(resourceName), testAccMatchResourceAttrRegionalARN(resourceName, "arn", "mq", regexp.MustCompile(`configuration:+.`)), + resource.TestCheckResourceAttr(resourceName, "authentication_strategy", "simple"), resource.TestCheckResourceAttr(resourceName, "description", "TfAccTest MQ Configuration"), resource.TestCheckResourceAttr(resourceName, "engine_type", "ActiveMQ"), resource.TestCheckResourceAttr(resourceName, "engine_version", "5.15.0"), resource.TestCheckResourceAttr(resourceName, "latest_revision", "2"), - resource.TestCheckResourceAttr(resourceName, "name", configurationName), + resource.TestCheckResourceAttr(resourceName, "name", rName), ), }, { @@ -39,7 +45,7 @@ func TestAccAWSMqConfiguration_basic(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccMqConfigurationConfig_descriptionUpdated(configurationName), + Config: testAccMqConfigurationConfig_descriptionUpdated(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsMqConfigurationExists(resourceName), testAccMatchResourceAttrRegionalARN(resourceName, "arn", "mq", regexp.MustCompile(`configuration:+.`)), @@ -47,7 +53,7 @@ func TestAccAWSMqConfiguration_basic(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "engine_type", "ActiveMQ"), resource.TestCheckResourceAttr(resourceName, "engine_version", "5.15.0"), resource.TestCheckResourceAttr(resourceName, "latest_revision", "3"), - resource.TestCheckResourceAttr(resourceName, "name", configurationName), + resource.TestCheckResourceAttr(resourceName, "name", rName), ), }, }, @@ -55,24 +61,65 @@ func TestAccAWSMqConfiguration_basic(t *testing.T) { } func TestAccAWSMqConfiguration_withData(t *testing.T) { - configurationName := fmt.Sprintf("tf-acc-test-%s", acctest.RandString(5)) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_mq_configuration.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + testAccPartitionHasServicePreCheck(mq.EndpointsID, t) + testAccPreCheckAWSMq(t) + }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsMqConfigurationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccMqConfigurationWithDataConfig(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsMqConfigurationExists(resourceName), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "mq", regexp.MustCompile(`configuration:+.`)), + resource.TestCheckResourceAttr(resourceName, "description", "TfAccTest MQ Configuration"), + resource.TestCheckResourceAttr(resourceName, "engine_type", "ActiveMQ"), + resource.TestCheckResourceAttr(resourceName, "engine_version", "5.15.0"), + resource.TestCheckResourceAttr(resourceName, "latest_revision", "2"), + resource.TestCheckResourceAttr(resourceName, "name", rName), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSMqConfiguration_withLdapData(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_mq_configuration.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMq(t) }, + PreCheck: func() { + testAccPreCheck(t) + testAccPartitionHasServicePreCheck(mq.EndpointsID, t) + testAccPreCheckAWSMq(t) + }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqConfigurationDestroy, Steps: []resource.TestStep{ { - Config: testAccMqConfigurationWithDataConfig(configurationName), + Config: testAccMqConfigurationWithLdapDataConfig(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsMqConfigurationExists(resourceName), testAccMatchResourceAttrRegionalARN(resourceName, "arn", "mq", regexp.MustCompile(`configuration:+.`)), + resource.TestCheckResourceAttr(resourceName, "authentication_strategy", "ldap"), resource.TestCheckResourceAttr(resourceName, "description", "TfAccTest MQ Configuration"), resource.TestCheckResourceAttr(resourceName, "engine_type", "ActiveMQ"), resource.TestCheckResourceAttr(resourceName, "engine_version", "5.15.0"), resource.TestCheckResourceAttr(resourceName, "latest_revision", "2"), - resource.TestCheckResourceAttr(resourceName, "name", configurationName), + resource.TestCheckResourceAttr(resourceName, "name", rName), ), }, { @@ -85,16 +132,21 @@ func TestAccAWSMqConfiguration_withData(t *testing.T) { } func TestAccAWSMqConfiguration_updateTags(t *testing.T) { - configurationName := fmt.Sprintf("tf-acc-test-%s", acctest.RandString(5)) + rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_mq_configuration.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMq(t) }, + PreCheck: func() { + testAccPreCheck(t) + testAccPartitionHasServicePreCheck(mq.EndpointsID, t) + testAccPreCheckAWSMq(t) + }, + ErrorCheck: testAccErrorCheck(t, mq.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsMqConfigurationDestroy, Steps: []resource.TestStep{ { - Config: testAccMqConfigurationConfig_updateTags1(configurationName), + Config: testAccMqConfigurationConfig_updateTags1(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsMqConfigurationExists(resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), @@ -107,7 +159,7 @@ func TestAccAWSMqConfiguration_updateTags(t *testing.T) { ImportStateVerify: true, }, { - Config: testAccMqConfigurationConfig_updateTags2(configurationName), + Config: testAccMqConfigurationConfig_updateTags2(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsMqConfigurationExists(resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), @@ -116,7 +168,7 @@ func TestAccAWSMqConfiguration_updateTags(t *testing.T) { ), }, { - Config: testAccMqConfigurationConfig_updateTags3(configurationName), + Config: testAccMqConfigurationConfig_updateTags3(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsMqConfigurationExists(resourceName), resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), @@ -166,13 +218,14 @@ func testAccCheckAwsMqConfigurationExists(name string) resource.TestCheckFunc { } } -func testAccMqConfigurationConfig(configurationName string) string { +func testAccMqConfigurationConfig(rName string) string { return fmt.Sprintf(` resource "aws_mq_configuration" "test" { - description = "TfAccTest MQ Configuration" - name = "%s" - engine_type = "ActiveMQ" - engine_version = "5.15.0" + description = "TfAccTest MQ Configuration" + name = %[1]q + engine_type = "ActiveMQ" + engine_version = "5.15.0" + authentication_strategy = "simple" data = < @@ -180,14 +233,14 @@ resource "aws_mq_configuration" "test" { DATA } -`, configurationName) +`, rName) } -func testAccMqConfigurationConfig_descriptionUpdated(configurationName string) string { +func testAccMqConfigurationConfig_descriptionUpdated(rName string) string { return fmt.Sprintf(` resource "aws_mq_configuration" "test" { description = "TfAccTest MQ Configuration Updated" - name = "%s" + name = %[1]q engine_type = "ActiveMQ" engine_version = "5.15.0" @@ -197,14 +250,14 @@ resource "aws_mq_configuration" "test" { DATA } -`, configurationName) +`, rName) } -func testAccMqConfigurationWithDataConfig(configurationName string) string { +func testAccMqConfigurationWithDataConfig(rName string) string { return fmt.Sprintf(` resource "aws_mq_configuration" "test" { description = "TfAccTest MQ Configuration" - name = "%s" + name = %[1]q engine_type = "ActiveMQ" engine_version = "5.15.0" @@ -232,14 +285,42 @@ resource "aws_mq_configuration" "test" { DATA } -`, configurationName) +`, rName) +} + +func testAccMqConfigurationWithLdapDataConfig(rName string) string { + return fmt.Sprintf(` +resource "aws_mq_configuration" "test" { + description = "TfAccTest MQ Configuration" + name = %[1]q + engine_type = "ActiveMQ" + engine_version = "5.15.0" + authentication_strategy = "ldap" + + data = < + + + + + + + + + + + + +DATA +} +`, rName) } -func testAccMqConfigurationConfig_updateTags1(configurationName string) string { +func testAccMqConfigurationConfig_updateTags1(rName string) string { return fmt.Sprintf(` resource "aws_mq_configuration" "test" { description = "TfAccTest MQ Configuration" - name = "%s" + name = %[1]q engine_type = "ActiveMQ" engine_version = "5.15.0" @@ -253,14 +334,14 @@ DATA env = "test" } } -`, configurationName) +`, rName) } -func testAccMqConfigurationConfig_updateTags2(configurationName string) string { +func testAccMqConfigurationConfig_updateTags2(rName string) string { return fmt.Sprintf(` resource "aws_mq_configuration" "test" { description = "TfAccTest MQ Configuration" - name = "%s" + name = %[1]q engine_type = "ActiveMQ" engine_version = "5.15.0" @@ -275,14 +356,14 @@ DATA role = "test-role" } } -`, configurationName) +`, rName) } -func testAccMqConfigurationConfig_updateTags3(configurationName string) string { +func testAccMqConfigurationConfig_updateTags3(rName string) string { return fmt.Sprintf(` resource "aws_mq_configuration" "test" { description = "TfAccTest MQ Configuration" - name = "%s" + name = %[1]q engine_type = "ActiveMQ" engine_version = "5.15.0" @@ -296,5 +377,5 @@ DATA role = "test-role" } } -`, configurationName) +`, rName) } diff --git a/aws/resource_aws_msk_cluster_test.go b/aws/resource_aws_msk_cluster_test.go index 4efd96dbf689..b1aac5672eed 100644 --- a/aws/resource_aws_msk_cluster_test.go +++ b/aws/resource_aws_msk_cluster_test.go @@ -82,6 +82,7 @@ func TestAccAWSMskCluster_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -141,6 +142,7 @@ func TestAccAWSMskCluster_BrokerNodeGroupInfo_EbsVolumeSize(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -178,6 +180,7 @@ func TestAccAWSMskCluster_ClientAuthentication_Sasl_Scram(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -238,6 +241,7 @@ func TestAccAWSMskCluster_ClientAuthentication_Tls_CertificateAuthorityArns(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -269,6 +273,7 @@ func TestAccAWSMskCluster_ConfigurationInfo_Revision(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -307,6 +312,7 @@ func TestAccAWSMskCluster_EncryptionInfo_EncryptionAtRestKmsKeyArn(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -336,6 +342,7 @@ func TestAccAWSMskCluster_EncryptionInfo_EncryptionInTransit_ClientBroker(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -370,6 +377,7 @@ func TestAccAWSMskCluster_EncryptionInfo_EncryptionInTransit_InCluster(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -398,6 +406,7 @@ func TestAccAWSMskCluster_EnhancedMonitoring(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -432,6 +441,7 @@ func TestAccAWSMskCluster_NumberOfBrokerNodes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -489,6 +499,7 @@ func TestAccAWSMskCluster_OpenMonitoring(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -536,6 +547,7 @@ func TestAccAWSMskCluster_LoggingInfo(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -584,6 +596,7 @@ func TestAccAWSMskCluster_KafkaVersionUpgrade(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -618,6 +631,7 @@ func TestAccAWSMskCluster_KafkaVersionDowngrade(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -668,6 +682,7 @@ func TestAccAWSMskCluster_KafkaVersionUpgradeWithConfigurationInfo(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -709,6 +724,7 @@ func TestAccAWSMskCluster_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskClusterDestroy, Steps: []resource.TestStep{ @@ -911,6 +927,7 @@ resource "aws_security_group" "example_sg" { } ` } + func testAccMskClusterConfig_basic(rName string) string { return testAccMskClusterBaseConfig() + fmt.Sprintf(` resource "aws_msk_cluster" "test" { @@ -1242,8 +1259,9 @@ resource "aws_cloudwatch_log_group" "test" { } resource "aws_s3_bucket" "bucket" { - bucket = %[1]q - acl = "private" + acl = "private" + bucket = %[1]q + force_destroy = true } resource "aws_iam_role" "firehose_role" { diff --git a/aws/resource_aws_msk_configuration_test.go b/aws/resource_aws_msk_configuration_test.go index 398af256ee77..0313ccad7af5 100644 --- a/aws/resource_aws_msk_configuration_test.go +++ b/aws/resource_aws_msk_configuration_test.go @@ -82,6 +82,7 @@ func TestAccAWSMskConfiguration_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskConfigurationDestroy, Steps: []resource.TestStep{ @@ -113,6 +114,7 @@ func TestAccAWSMskConfiguration_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskConfigurationDestroy, Steps: []resource.TestStep{ @@ -135,6 +137,7 @@ func TestAccAWSMskConfiguration_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskConfigurationDestroy, Steps: []resource.TestStep{ @@ -169,6 +172,7 @@ func TestAccAWSMskConfiguration_KafkaVersions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskConfigurationDestroy, Steps: []resource.TestStep{ @@ -197,6 +201,7 @@ func TestAccAWSMskConfiguration_ServerProperties(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskConfigurationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_msk_scram_secret_association_test.go b/aws/resource_aws_msk_scram_secret_association_test.go index 0847e305a2e9..6b5641a1edbb 100644 --- a/aws/resource_aws_msk_scram_secret_association_test.go +++ b/aws/resource_aws_msk_scram_secret_association_test.go @@ -21,6 +21,7 @@ func TestAccAwsMskScramSecretAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskScramSecretAssociationDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func TestAccAwsMskScramSecretAssociation_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskScramSecretAssociationDestroy, Steps: []resource.TestStep{ @@ -94,6 +96,7 @@ func TestAccAwsMskScramSecretAssociation_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskScramSecretAssociationDestroy, Steps: []resource.TestStep{ @@ -116,6 +119,7 @@ func TestAccAwsMskScramSecretAssociation_disappears_Cluster(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSMsk(t) }, + ErrorCheck: testAccErrorCheck(t, kafka.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckMskScramSecretAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_nat_gateway_test.go b/aws/resource_aws_nat_gateway_test.go index 115bb15307fb..de22388be397 100644 --- a/aws/resource_aws_nat_gateway_test.go +++ b/aws/resource_aws_nat_gateway_test.go @@ -62,6 +62,7 @@ func TestAccAWSNatGateway_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckNatGatewayDestroy, @@ -88,6 +89,7 @@ func TestAccAWSNatGateway_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckNatGatewayDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_neptune_cluster.go b/aws/resource_aws_neptune_cluster.go index 3272ff27702b..dae385de1e90 100644 --- a/aws/resource_aws_neptune_cluster.go +++ b/aws/resource_aws_neptune_cluster.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) const ( @@ -372,7 +373,7 @@ func resourceAwsNeptuneClusterCreate(d *schema.ResourceData, meta interface{}) e log.Printf("[DEBUG] Neptune Cluster create options: %s", createDbClusterInput) } - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error if restoreDBClusterFromSnapshot { _, err = conn.RestoreDBClusterFromSnapshot(restoreDBClusterFromSnapshotInput) diff --git a/aws/resource_aws_neptune_cluster_instance.go b/aws/resource_aws_neptune_cluster_instance.go index e1ea9f1ce66a..29364e813096 100644 --- a/aws/resource_aws_neptune_cluster_instance.go +++ b/aws/resource_aws_neptune_cluster_instance.go @@ -11,6 +11,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsNeptuneClusterInstance() *schema.Resource { @@ -237,7 +238,7 @@ func resourceAwsNeptuneClusterInstanceCreate(d *schema.ResourceData, meta interf log.Printf("[DEBUG] Creating Neptune Instance: %s", createOpts) var resp *neptune.CreateDBInstanceOutput - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { var err error resp, err = conn.CreateDBInstance(createOpts) if err != nil { @@ -405,7 +406,7 @@ func resourceAwsNeptuneClusterInstanceUpdate(d *schema.ResourceData, meta interf log.Printf("[DEBUG] Send Neptune Instance Modification request: %#v", requestUpdate) if requestUpdate { log.Printf("[DEBUG] Neptune Instance Modification request: %#v", req) - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := conn.ModifyDBInstance(req) if err != nil { if isAWSErr(err, "InvalidParameterValue", "IAM role ARN value is invalid or does not include the required permissions") { diff --git a/aws/resource_aws_neptune_cluster_instance_test.go b/aws/resource_aws_neptune_cluster_instance_test.go index 9f0c0d5f19ae..fab377ee977a 100644 --- a/aws/resource_aws_neptune_cluster_instance_test.go +++ b/aws/resource_aws_neptune_cluster_instance_test.go @@ -26,6 +26,7 @@ func TestAccAWSNeptuneClusterInstance_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -77,6 +78,7 @@ func TestAccAWSNeptuneClusterInstance_withaz(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -103,6 +105,7 @@ func TestAccAWSNeptuneClusterInstance_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -127,6 +130,7 @@ func TestAccAWSNeptuneClusterInstance_withSubnetGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -150,6 +154,7 @@ func TestAccAWSNeptuneClusterInstance_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -174,6 +179,7 @@ func TestAccAWSNeptuneClusterInstance_kmsKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_neptune_cluster_parameter_group_test.go b/aws/resource_aws_neptune_cluster_parameter_group_test.go index f010dc4df171..58204f30731f 100644 --- a/aws/resource_aws_neptune_cluster_parameter_group_test.go +++ b/aws/resource_aws_neptune_cluster_parameter_group_test.go @@ -22,6 +22,7 @@ func TestAccAWSNeptuneClusterParameterGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -54,6 +55,7 @@ func TestAccAWSNeptuneClusterParameterGroup_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -81,6 +83,7 @@ func TestAccAWSNeptuneClusterParameterGroup_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -108,6 +111,7 @@ func TestAccAWSNeptuneClusterParameterGroup_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -137,6 +141,7 @@ func TestAccAWSNeptuneClusterParameterGroup_NamePrefix_Parameter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -183,6 +188,7 @@ func TestAccAWSNeptuneClusterParameterGroup_Parameter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterParameterGroupDestroy, Steps: []resource.TestStep{ @@ -230,6 +236,7 @@ func TestAccAWSNeptuneClusterParameterGroup_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterParameterGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_neptune_cluster_snapshot_test.go b/aws/resource_aws_neptune_cluster_snapshot_test.go index e64ab0582b62..bb0149cf248a 100644 --- a/aws/resource_aws_neptune_cluster_snapshot_test.go +++ b/aws/resource_aws_neptune_cluster_snapshot_test.go @@ -19,6 +19,7 @@ func TestAccAWSNeptuneClusterSnapshot_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckNeptuneClusterSnapshotDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_neptune_cluster_test.go b/aws/resource_aws_neptune_cluster_test.go index b7de72447ef2..e9b5e3eda481 100644 --- a/aws/resource_aws_neptune_cluster_test.go +++ b/aws/resource_aws_neptune_cluster_test.go @@ -22,6 +22,7 @@ func TestAccAWSNeptuneCluster_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -63,6 +64,7 @@ func TestAccAWSNeptuneCluster_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -95,6 +97,7 @@ func TestAccAWSNeptuneCluster_takeFinalSnapshot(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterSnapshot(rName), Steps: []resource.TestStep{ @@ -126,6 +129,7 @@ func TestAccAWSNeptuneCluster_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -176,6 +180,7 @@ func TestAccAWSNeptuneCluster_updateIamRoles(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -222,6 +227,7 @@ func TestAccAWSNeptuneCluster_kmsKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -254,6 +260,7 @@ func TestAccAWSNeptuneCluster_encrypted(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -286,6 +293,7 @@ func TestAccAWSNeptuneCluster_backupsUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -329,6 +337,7 @@ func TestAccAWSNeptuneCluster_iamAuth(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -361,6 +370,7 @@ func TestAccAWSNeptuneCluster_updateCloudwatchLogsExports(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ @@ -408,6 +418,7 @@ func TestAccAWSNeptuneCluster_deleteProtection(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneClusterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_neptune_event_subscription_test.go b/aws/resource_aws_neptune_event_subscription_test.go index 4b56d30fcd12..7a1aac2d39f0 100644 --- a/aws/resource_aws_neptune_event_subscription_test.go +++ b/aws/resource_aws_neptune_event_subscription_test.go @@ -86,6 +86,7 @@ func TestAccAWSNeptuneEventSubscription_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneEventSubscriptionDestroy, Steps: []resource.TestStep{ @@ -129,6 +130,7 @@ func TestAccAWSNeptuneEventSubscription_withPrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneEventSubscriptionDestroy, Steps: []resource.TestStep{ @@ -157,6 +159,7 @@ func TestAccAWSNeptuneEventSubscription_withSourceIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneEventSubscriptionDestroy, Steps: []resource.TestStep{ @@ -194,6 +197,7 @@ func TestAccAWSNeptuneEventSubscription_withCategories(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneEventSubscriptionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_neptune_parameter_group_test.go b/aws/resource_aws_neptune_parameter_group_test.go index a8b367becc7e..4cccbfe94cea 100644 --- a/aws/resource_aws_neptune_parameter_group_test.go +++ b/aws/resource_aws_neptune_parameter_group_test.go @@ -19,6 +19,7 @@ func TestAccAWSNeptuneParameterGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneParameterGroupDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func TestAccAWSNeptuneParameterGroup_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneParameterGroupDestroy, Steps: []resource.TestStep{ @@ -78,6 +80,7 @@ func TestAccAWSNeptuneParameterGroup_Parameter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneParameterGroupDestroy, Steps: []resource.TestStep{ @@ -125,6 +128,7 @@ func TestAccAWSNeptuneParameterGroup_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNeptuneParameterGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_neptune_subnet_group_test.go b/aws/resource_aws_neptune_subnet_group_test.go index 492398e35d06..313751d65820 100644 --- a/aws/resource_aws_neptune_subnet_group_test.go +++ b/aws/resource_aws_neptune_subnet_group_test.go @@ -20,6 +20,7 @@ func TestAccAWSNeptuneSubnetGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckNeptuneSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -48,6 +49,7 @@ func TestAccAWSNeptuneSubnetGroup_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckNeptuneSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -75,6 +77,7 @@ func TestAccAWSNeptuneSubnetGroup_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckNeptuneSubnetGroupDestroy, Steps: []resource.TestStep{ @@ -100,6 +103,7 @@ func TestAccAWSNeptuneSubnetGroup_updateDescription(t *testing.T) { rName := fmt.Sprintf("tf-test-%d", acctest.RandInt()) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, neptune.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckNeptuneSubnetGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_network_acl.go b/aws/resource_aws_network_acl.go index 7621b33494be..390668789356 100644 --- a/aws/resource_aws_network_acl.go +++ b/aws/resource_aws_network_acl.go @@ -11,11 +11,15 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2/finder" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2/waiter" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource" ) func resourceAwsNetworkAcl() *schema.Resource { @@ -196,39 +200,119 @@ func resourceAwsNetworkAclCreate(d *schema.ResourceData, meta interface{}) error log.Printf("[DEBUG] Network Acl create config: %#v", createOpts) resp, err := conn.CreateNetworkAcl(createOpts) + if err != nil { - return fmt.Errorf("Error creating network acl: %s", err) + return fmt.Errorf("error creating EC2 Network ACL: %w", err) + } + + if resp == nil || resp.NetworkAcl == nil { + return fmt.Errorf("error creating EC2 Network ACL: empty response") + } + + d.SetId(aws.StringValue(resp.NetworkAcl.NetworkAclId)) + + if v, ok := d.GetOk("egress"); ok && v.(*schema.Set).Len() > 0 { + err := updateNetworkAclEntries(d, "egress", conn) + + if err != nil { + return fmt.Errorf("error updating EC2 Network ACL (%s) Egress Entries: %w", d.Id(), err) + } + } + + if v, ok := d.GetOk("ingress"); ok && v.(*schema.Set).Len() > 0 { + err := updateNetworkAclEntries(d, "ingress", conn) + + if err != nil { + return fmt.Errorf("error updating EC2 Network ACL (%s) Ingress Entries: %w", d.Id(), err) + } } - // Get the ID and store it - networkAcl := resp.NetworkAcl - d.SetId(aws.StringValue(networkAcl.NetworkAclId)) + if v, ok := d.GetOk("subnet_ids"); ok && v.(*schema.Set).Len() > 0 { + for _, subnetIDRaw := range v.(*schema.Set).List() { + subnetID, ok := subnetIDRaw.(string) + + if !ok { + continue + } + + association, err := findNetworkAclAssociation(subnetID, conn) + + if err != nil { + return fmt.Errorf("error finding existing EC2 Network ACL association for Subnet (%s): %w", subnetID, err) + } - // Update rules and subnet association once acl is created - return resourceAwsNetworkAclUpdate(d, meta) + if association == nil { + return fmt.Errorf("error finding existing EC2 Network ACL association for Subnet (%s): empty response", subnetID) + } + + input := &ec2.ReplaceNetworkAclAssociationInput{ + AssociationId: association.NetworkAclAssociationId, + NetworkAclId: aws.String(d.Id()), + } + + _, err = conn.ReplaceNetworkAclAssociation(input) + + if err != nil { + return fmt.Errorf("error replacing existing EC2 Network ACL association for Subnet (%s): %w", subnetID, err) + } + } + } + + return resourceAwsNetworkAclRead(d, meta) } func resourceAwsNetworkAclRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig - resp, err := conn.DescribeNetworkAcls(&ec2.DescribeNetworkAclsInput{ - NetworkAclIds: []*string{aws.String(d.Id())}, + var networkAcl *ec2.NetworkAcl + + err := resource.Retry(waiter.NetworkAclPropagationTimeout, func() *resource.RetryError { + var err error + + networkAcl, err = finder.NetworkAclByID(conn, d.Id()) + + if d.IsNewResource() && tfawserr.ErrCodeEquals(err, "InvalidNetworkAclID.NotFound") { + return resource.RetryableError(err) + } + + if err != nil { + return resource.NonRetryableError(err) + } + + if d.IsNewResource() && networkAcl == nil { + return resource.RetryableError(&resource.NotFoundError{ + LastError: fmt.Errorf("EC2 Network ACL (%s) not found", d.Id()), + }) + } + + return nil }) + if tfresource.TimedOut(err) { + networkAcl, err = finder.NetworkAclByID(conn, d.Id()) + } + + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, "InvalidNetworkAclID.NotFound") { + log.Printf("[WARN] EC2 Network ACL (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + if err != nil { - if isAWSErr(err, "InvalidNetworkAclID.NotFound", "") { - log.Printf("[WARN] Network ACL (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } - return err + return fmt.Errorf("error reading EC2 Network ACL (%s): %w", d.Id(), err) } - if resp == nil { + + if networkAcl == nil { + if d.IsNewResource() { + return fmt.Errorf("error reading EC2 Network ACL (%s): not found after creation", d.Id()) + } + + log.Printf("[WARN] EC2 Network ACL (%s) not found, removing from state", d.Id()) + d.SetId("") return nil } - networkAcl := resp.NetworkAcls[0] var ingressEntries []*ec2.NetworkAclEntry var egressEntries []*ec2.NetworkAclEntry @@ -275,7 +359,7 @@ func resourceAwsNetworkAclRead(d *schema.ResourceData, meta interface{}) error { Partition: meta.(*AWSClient).partition, Service: ec2.ServiceName, Region: meta.(*AWSClient).region, - AccountID: meta.(*AWSClient).accountid, + AccountID: aws.StringValue(networkAcl.OwnerId), Resource: fmt.Sprintf("network-acl/%s", d.Id()), }.String() diff --git a/aws/resource_aws_network_acl_rule.go b/aws/resource_aws_network_acl_rule.go index ca11f71b304b..36dd1686fa64 100644 --- a/aws/resource_aws_network_acl_rule.go +++ b/aws/resource_aws_network_acl_rule.go @@ -6,13 +6,16 @@ import ( "log" "strconv" "strings" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2/finder" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2/waiter" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource" ) func resourceAwsNetworkAclRule() *schema.Resource { @@ -123,6 +126,9 @@ func resourceAwsNetworkAclRule() *schema.Resource { func resourceAwsNetworkAclRuleCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn + egress := d.Get("egress").(bool) + networkAclID := d.Get("network_acl_id").(string) + ruleNumber := d.Get("rule_number").(int) protocol := d.Get("protocol").(string) p, protocolErr := strconv.Atoi(protocol) @@ -136,9 +142,9 @@ func resourceAwsNetworkAclRuleCreate(d *schema.ResourceData, meta interface{}) e log.Printf("[INFO] Transformed Protocol %s into %d", protocol, p) params := &ec2.CreateNetworkAclEntryInput{ - NetworkAclId: aws.String(d.Get("network_acl_id").(string)), - Egress: aws.Bool(d.Get("egress").(bool)), - RuleNumber: aws.Int64(int64(d.Get("rule_number").(int))), + NetworkAclId: aws.String(networkAclID), + Egress: aws.Bool(egress), + RuleNumber: aws.Int64(int64(ruleNumber)), Protocol: aws.String(strconv.Itoa(p)), RuleAction: aws.String(d.Get("rule_action").(string)), PortRange: &ec2.PortRange{ @@ -169,63 +175,83 @@ func resourceAwsNetworkAclRuleCreate(d *schema.ResourceData, meta interface{}) e if v, ok := d.GetOk("icmp_type"); ok { icmpType, err := strconv.Atoi(v.(string)) if err != nil { - return fmt.Errorf("Unable to parse ICMP type %s for rule %d", v, d.Get("rule_number").(int)) + return fmt.Errorf("Unable to parse ICMP type %s for rule %d", v, ruleNumber) } params.IcmpTypeCode.Type = aws.Int64(int64(icmpType)) - log.Printf("[DEBUG] Got ICMP type %d for rule %d", icmpType, d.Get("rule_number").(int)) + log.Printf("[DEBUG] Got ICMP type %d for rule %d", icmpType, ruleNumber) } if v, ok := d.GetOk("icmp_code"); ok { icmpCode, err := strconv.Atoi(v.(string)) if err != nil { - return fmt.Errorf("Unable to parse ICMP code %s for rule %d", v, d.Get("rule_number").(int)) + return fmt.Errorf("Unable to parse ICMP code %s for rule %d", v, ruleNumber) } params.IcmpTypeCode.Code = aws.Int64(int64(icmpCode)) - log.Printf("[DEBUG] Got ICMP code %d for rule %d", icmpCode, d.Get("rule_number").(int)) + log.Printf("[DEBUG] Got ICMP code %d for rule %d", icmpCode, ruleNumber) } } - log.Printf("[INFO] Creating Network Acl Rule: %d (%t)", d.Get("rule_number").(int), d.Get("egress").(bool)) + log.Printf("[INFO] Creating Network Acl Rule: %d (%t)", ruleNumber, egress) _, err := conn.CreateNetworkAclEntry(params) + if err != nil { - return fmt.Errorf("Error Creating Network Acl Rule: %s", err.Error()) + return fmt.Errorf("error creating Network ACL (%s) Egress (%t) Rule (%d): %w", networkAclID, egress, ruleNumber, err) } - d.SetId(networkAclIdRuleNumberEgressHash(d.Get("network_acl_id").(string), d.Get("rule_number").(int), d.Get("egress").(bool), d.Get("protocol").(string))) - - // It appears it might be a while until the newly created rule is visible via the - // API (see issue GH-4721). Retry the `findNetworkAclRule` function until it is - // visible (which in most cases is likely immediately). - var r *ec2.NetworkAclEntry - err = resource.Retry(3*time.Minute, func() *resource.RetryError { - r, err = findNetworkAclRule(d, meta) + + d.SetId(networkAclIdRuleNumberEgressHash(networkAclID, ruleNumber, egress, d.Get("protocol").(string))) + + return resourceAwsNetworkAclRuleRead(d, meta) +} + +func resourceAwsNetworkAclRuleRead(d *schema.ResourceData, meta interface{}) error { + conn := meta.(*AWSClient).ec2conn + egress := d.Get("egress").(bool) + networkAclID := d.Get("network_acl_id").(string) + ruleNumber := d.Get("rule_number").(int) + + var resp *ec2.NetworkAclEntry + + err := resource.Retry(waiter.NetworkAclEntryPropagationTimeout, func() *resource.RetryError { + var err error + + resp, err = finder.NetworkAclEntry(conn, networkAclID, egress, ruleNumber) + + if d.IsNewResource() && tfawserr.ErrCodeEquals(err, "InvalidNetworkAclID.NotFound") { + return resource.RetryableError(err) + } + if err != nil { return resource.NonRetryableError(err) } - if r == nil { - return resource.RetryableError(fmt.Errorf("Network ACL rule (%s) not found", d.Id())) + + if d.IsNewResource() && resp == nil { + return resource.RetryableError(&resource.NotFoundError{ + LastError: fmt.Errorf("EC2 Network ACL (%s) Egress (%t) Rule (%d) not found", networkAclID, egress, ruleNumber), + }) } return nil }) - if isResourceTimeoutError(err) { - r, err = findNetworkAclRule(d, meta) - if r == nil { - return fmt.Errorf("Network ACL rule (%s) not found", d.Id()) - } - } - if err != nil { - return fmt.Errorf("Created Network ACL Rule was not visible in API within 3 minute period. Running 'terraform apply' again will resume infrastructure creation.") + + if tfresource.TimedOut(err) { + resp, err = finder.NetworkAclEntry(conn, networkAclID, egress, ruleNumber) } - return resourceAwsNetworkAclRuleRead(d, meta) -} + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, "InvalidNetworkAclID.NotFound") { + log.Printf("[WARN] EC2 Network ACL (%s) not found, removing from state", networkAclID) + d.SetId("") + return nil + } -func resourceAwsNetworkAclRuleRead(d *schema.ResourceData, meta interface{}) error { - resp, err := findNetworkAclRule(d, meta) if err != nil { - return err + return fmt.Errorf("error reading EC2 Network ACL (%s) Egress (%t) Rule (%d): %w", networkAclID, egress, ruleNumber, err) } + if resp == nil { - log.Printf("[DEBUG] Network ACL rule (%s) not found", d.Id()) + if d.IsNewResource() { + return fmt.Errorf("error reading EC2 Network ACL (%s) Egress (%t) Rule (%d): not found after creation", networkAclID, egress, ruleNumber) + } + + log.Printf("[WARN] EC2 Network ACL (%s) Egress (%t) Rule (%d) not found, removing from state", networkAclID, egress, ruleNumber) d.SetId("") return nil } @@ -278,61 +304,6 @@ func resourceAwsNetworkAclRuleDelete(d *schema.ResourceData, meta interface{}) e return nil } -func findNetworkAclRule(d *schema.ResourceData, meta interface{}) (*ec2.NetworkAclEntry, error) { - conn := meta.(*AWSClient).ec2conn - - filters := make([]*ec2.Filter, 0, 2) - ruleNumberFilter := &ec2.Filter{ - Name: aws.String("entry.rule-number"), - Values: []*string{aws.String(fmt.Sprintf("%d", d.Get("rule_number").(int)))}, - } - filters = append(filters, ruleNumberFilter) - egressFilter := &ec2.Filter{ - Name: aws.String("entry.egress"), - Values: []*string{aws.String(fmt.Sprintf("%v", d.Get("egress").(bool)))}, - } - filters = append(filters, egressFilter) - params := &ec2.DescribeNetworkAclsInput{ - NetworkAclIds: []*string{aws.String(d.Get("network_acl_id").(string))}, - Filters: filters, - } - - log.Printf("[INFO] Describing Network Acl: %s", d.Get("network_acl_id").(string)) - log.Printf("[INFO] Describing Network Acl with the Filters %#v", params) - resp, err := conn.DescribeNetworkAcls(params) - - if isAWSErr(err, "InvalidNetworkAclID.NotFound", "") { - return nil, nil - } - - if err != nil { - return nil, fmt.Errorf("Error Finding Network Acl Rule %d: %s", d.Get("rule_number").(int), err.Error()) - } - - if resp == nil || len(resp.NetworkAcls) == 0 || resp.NetworkAcls[0] == nil { - // Missing NACL rule. - return nil, nil - } - if len(resp.NetworkAcls) > 1 { - return nil, fmt.Errorf( - "Expected to find one Network ACL, got: %#v", - resp.NetworkAcls) - } - networkAcl := resp.NetworkAcls[0] - if networkAcl.Entries != nil { - for _, i := range networkAcl.Entries { - if *i.RuleNumber == int64(d.Get("rule_number").(int)) && *i.Egress == d.Get("egress").(bool) { - return i, nil - } - } - return nil, nil - } - return nil, fmt.Errorf( - "Expected the Network ACL to have Entries, got: %#v", - networkAcl) - -} - func networkAclIdRuleNumberEgressHash(networkAclId string, ruleNumber int, egress bool, protocol string) string { var buf bytes.Buffer buf.WriteString(fmt.Sprintf("%s-", networkAclId)) diff --git a/aws/resource_aws_network_acl_rule_test.go b/aws/resource_aws_network_acl_rule_test.go index 92c3cad51f76..54feb50745f6 100644 --- a/aws/resource_aws_network_acl_rule_test.go +++ b/aws/resource_aws_network_acl_rule_test.go @@ -17,6 +17,7 @@ import ( func TestAccAWSNetworkAclRule_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, Steps: []resource.TestStep{ @@ -53,6 +54,7 @@ func TestAccAWSNetworkAclRule_basic(t *testing.T) { func TestAccAWSNetworkAclRule_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, Steps: []resource.TestStep{ @@ -71,6 +73,7 @@ func TestAccAWSNetworkAclRule_disappears(t *testing.T) { func TestAccAWSNetworkAclRule_disappears_IngressEgressSameNumber(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, Steps: []resource.TestStep{ @@ -92,6 +95,7 @@ func TestAccAWSNetworkAclRule_disappears_NetworkAcl(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, Steps: []resource.TestStep{ @@ -110,6 +114,7 @@ func TestAccAWSNetworkAclRule_disappears_NetworkAcl(t *testing.T) { func TestAccAWSNetworkAclRule_missingParam(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, Steps: []resource.TestStep{ @@ -124,6 +129,7 @@ func TestAccAWSNetworkAclRule_missingParam(t *testing.T) { func TestAccAWSNetworkAclRule_ipv6(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, Steps: []resource.TestStep{ @@ -149,6 +155,7 @@ func TestAccAWSNetworkAclRule_ipv6ICMP(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, Steps: []resource.TestStep{ @@ -176,6 +183,7 @@ func TestAccAWSNetworkAclRule_ipv6VpcAssignGeneratedIpv6CidrBlockUpdate(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, Steps: []resource.TestStep{ @@ -209,6 +217,7 @@ func TestAccAWSNetworkAclRule_ipv6VpcAssignGeneratedIpv6CidrBlockUpdate(t *testi func TestAccAWSNetworkAclRule_allProtocol(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, Steps: []resource.TestStep{ @@ -225,8 +234,9 @@ func TestAccAWSNetworkAclRule_allProtocol(t *testing.T) { } func TestAccAWSNetworkAclRule_tcpProtocol(t *testing.T) { - resource.Test(t, resource.TestCase{ + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_network_acl_test.go b/aws/resource_aws_network_acl_test.go index 47dbece2d951..c5d5f3e03afe 100644 --- a/aws/resource_aws_network_acl_test.go +++ b/aws/resource_aws_network_acl_test.go @@ -109,6 +109,7 @@ func TestAccAWSNetworkAcl_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ @@ -136,6 +137,7 @@ func TestAccAWSNetworkAcl_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ @@ -179,6 +181,7 @@ func TestAccAWSNetworkAcl_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ @@ -200,6 +203,7 @@ func TestAccAWSNetworkAcl_Egress_ConfigMode(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ @@ -252,6 +256,7 @@ func TestAccAWSNetworkAcl_Ingress_ConfigMode(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ @@ -304,6 +309,7 @@ func TestAccAWSNetworkAcl_EgressAndIngressRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, @@ -346,6 +352,7 @@ func TestAccAWSNetworkAcl_OnlyIngressRules_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, @@ -380,6 +387,7 @@ func TestAccAWSNetworkAcl_OnlyIngressRules_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, @@ -435,6 +443,7 @@ func TestAccAWSNetworkAcl_CaseSensitivityNoChanges(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, @@ -460,6 +469,7 @@ func TestAccAWSNetworkAcl_OnlyEgressRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, @@ -488,6 +498,7 @@ func TestAccAWSNetworkAcl_SubnetChange(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, @@ -533,6 +544,7 @@ func TestAccAWSNetworkAcl_Subnets(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, @@ -581,6 +593,7 @@ func TestAccAWSNetworkAcl_SubnetsDelete(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, @@ -617,6 +630,7 @@ func TestAccAWSNetworkAcl_ipv6Rules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, @@ -653,6 +667,7 @@ func TestAccAWSNetworkAcl_ipv6ICMPRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ @@ -672,6 +687,7 @@ func TestAccAWSNetworkAcl_ipv6VpcRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, @@ -702,6 +718,7 @@ func TestAccAWSNetworkAcl_espProtocol(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, diff --git a/aws/resource_aws_network_interface_attachment_test.go b/aws/resource_aws_network_interface_attachment_test.go index bdfa0947f715..000d9b6e80fa 100644 --- a/aws/resource_aws_network_interface_attachment_test.go +++ b/aws/resource_aws_network_interface_attachment_test.go @@ -15,6 +15,7 @@ func TestAccAWSNetworkInterfaceAttachment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: "aws_network_interface.bar", Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, diff --git a/aws/resource_aws_network_interface_sg_attachment_test.go b/aws/resource_aws_network_interface_sg_attachment_test.go index 3fe47374d081..2d03de451365 100644 --- a/aws/resource_aws_network_interface_sg_attachment_test.go +++ b/aws/resource_aws_network_interface_sg_attachment_test.go @@ -19,6 +19,7 @@ func TestAccAWSNetworkInterfaceSGAttachment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkInterfaceSGAttachmentDestroy, Steps: []resource.TestStep{ @@ -41,6 +42,7 @@ func TestAccAWSNetworkInterfaceSGAttachment_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkInterfaceSGAttachmentDestroy, Steps: []resource.TestStep{ @@ -73,6 +75,7 @@ func TestAccAWSNetworkInterfaceSGAttachment_Instance(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkInterfaceSGAttachmentDestroy, Steps: []resource.TestStep{ @@ -97,6 +100,7 @@ func TestAccAWSNetworkInterfaceSGAttachment_DataSource(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkInterfaceSGAttachmentDestroy, Steps: []resource.TestStep{ @@ -127,6 +131,7 @@ func TestAccAWSNetworkInterfaceSGAttachment_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkInterfaceSGAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_network_interface_test.go b/aws/resource_aws_network_interface_test.go index 9c9d240eccc4..a1c1f3e1dfe5 100644 --- a/aws/resource_aws_network_interface_test.go +++ b/aws/resource_aws_network_interface_test.go @@ -73,6 +73,7 @@ func TestAccAWSENI_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, @@ -107,6 +108,7 @@ func TestAccAWSENI_ipv6(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, @@ -154,6 +156,7 @@ func TestAccAWSENI_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, @@ -199,6 +202,7 @@ func TestAccAWSENI_ipv6_count(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, @@ -246,6 +250,7 @@ func TestAccAWSENI_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, Steps: []resource.TestStep{ @@ -267,6 +272,7 @@ func TestAccAWSENI_updatedDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, @@ -300,6 +306,7 @@ func TestAccAWSENI_attached(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, @@ -328,6 +335,7 @@ func TestAccAWSENI_ignoreExternalAttachment(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, @@ -356,6 +364,7 @@ func TestAccAWSENI_sourceDestCheck(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, @@ -396,6 +405,7 @@ func TestAccAWSENI_computedIPs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, @@ -422,6 +432,7 @@ func TestAccAWSENI_PrivateIpsCount(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSENIDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_networkfirewall_firewall_policy_test.go b/aws/resource_aws_networkfirewall_firewall_policy_test.go index 7d339047e88d..26004e40c4df 100644 --- a/aws/resource_aws_networkfirewall_firewall_policy_test.go +++ b/aws/resource_aws_networkfirewall_firewall_policy_test.go @@ -83,6 +83,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -117,6 +118,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_statefulRuleGroupReference(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -145,6 +147,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_updateStatefulRuleGroupReference(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -186,6 +189,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_multipleStatefulRuleGroupReferences resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -224,6 +228,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_statelessRuleGroupReference(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -266,6 +271,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_updateStatelessRuleGroupReference(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -311,6 +317,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_multipleStatelessRuleGroupReference resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -357,6 +364,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_statelessCustomAction(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -389,6 +397,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_updateStatelessCustomAction(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -448,6 +457,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_multipleStatelessCustomActions(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -501,6 +511,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_statefulRuleGroupReferenceAndCustom resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -543,6 +554,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ @@ -585,6 +597,7 @@ func TestAccAwsNetworkFirewallFirewallPolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_networkfirewall_firewall_test.go b/aws/resource_aws_networkfirewall_firewall_test.go index a6754f1a8461..ed7050a7ca29 100644 --- a/aws/resource_aws_networkfirewall_firewall_test.go +++ b/aws/resource_aws_networkfirewall_firewall_test.go @@ -86,6 +86,7 @@ func TestAccAwsNetworkFirewallFirewall_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallDestroy, Steps: []resource.TestStep{ @@ -127,6 +128,7 @@ func TestAccAwsNetworkFirewallFirewall_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallDestroy, Steps: []resource.TestStep{ @@ -166,6 +168,7 @@ func TestAccAwsNetworkFirewallFirewall_deleteProtection(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallDestroy, Steps: []resource.TestStep{ @@ -208,6 +211,7 @@ func TestAccAwsNetworkFirewallFirewall_subnetMappings_updateSubnet(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallDestroy, Steps: []resource.TestStep{ @@ -252,6 +256,7 @@ func TestAccAwsNetworkFirewallFirewall_subnetMappings_updateMultipleSubnets(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallDestroy, Steps: []resource.TestStep{ @@ -307,6 +312,7 @@ func TestAccAwsNetworkFirewallFirewall_tags(t *testing.T) { resourceName := "aws_networkfirewall_firewall.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallDestroy, Steps: []resource.TestStep{ @@ -349,6 +355,7 @@ func TestAccAwsNetworkFirewallFirewall_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallFirewallDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_networkfirewall_logging_configuration_test.go b/aws/resource_aws_networkfirewall_logging_configuration_test.go index c727feff1db1..c2366fb54fca 100644 --- a/aws/resource_aws_networkfirewall_logging_configuration_test.go +++ b/aws/resource_aws_networkfirewall_logging_configuration_test.go @@ -83,6 +83,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_cloudwatchLogDestination_logG resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -126,6 +127,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_cloudwatchLogDestination_logT resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -166,6 +168,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_kinesisLogDestination_deliver resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -209,6 +212,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_kinesisLogDestination_logType resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -249,6 +253,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_s3LogDestination_bucketName(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -291,6 +296,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_s3LogDestination_logType(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -331,6 +337,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_s3LogDestination_prefix(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -375,6 +382,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_updateFirewallArn(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -411,6 +419,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_updateLogDestinationType(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -468,6 +477,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_updateToMultipleLogDestinatio resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -522,6 +532,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_updateToSingleAlertTypeLogDes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -576,6 +587,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_updateToSingleFlowTypeLogDest resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -629,6 +641,7 @@ func TestAccAwsNetworkFirewallLoggingConfiguration_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallLoggingConfigurationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_networkfirewall_resource_policy_test.go b/aws/resource_aws_networkfirewall_resource_policy_test.go index 9fdd47a59d37..142de57a31d6 100644 --- a/aws/resource_aws_networkfirewall_resource_policy_test.go +++ b/aws/resource_aws_networkfirewall_resource_policy_test.go @@ -20,6 +20,7 @@ func TestAccAwsNetworkFirewallResourcePolicy_firewallPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallResourcePolicyDestroy, Steps: []resource.TestStep{ @@ -54,6 +55,7 @@ func TestAccAwsNetworkFirewallResourcePolicy_ruleGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallResourcePolicyDestroy, Steps: []resource.TestStep{ @@ -88,6 +90,7 @@ func TestAccAwsNetworkFirewallResourcePolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallResourcePolicyDestroy, Steps: []resource.TestStep{ @@ -109,6 +112,7 @@ func TestAccAwsNetworkFirewallResourcePolicy_disappears_FirewallPolicy(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallResourcePolicyDestroy, Steps: []resource.TestStep{ @@ -130,6 +134,7 @@ func TestAccAwsNetworkFirewallResourcePolicy_disappears_RuleGroup(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallResourcePolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_networkfirewall_rule_group_test.go b/aws/resource_aws_networkfirewall_rule_group_test.go index 5a03f00387e6..255ba5780f2e 100644 --- a/aws/resource_aws_networkfirewall_rule_group_test.go +++ b/aws/resource_aws_networkfirewall_rule_group_test.go @@ -83,6 +83,7 @@ func TestAccAwsNetworkFirewallRuleGroup_basic_rulesSourceList(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -120,6 +121,7 @@ func TestAccAwsNetworkFirewallRuleGroup_basic_statefulRule(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -166,6 +168,7 @@ func TestAccAwsNetworkFirewallRuleGroup_basic_statelessRule(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -208,6 +211,7 @@ func TestAccAwsNetworkFirewallRuleGroup_basic_rules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -243,6 +247,7 @@ func TestAccAwsNetworkFirewallRuleGroup_statelessRuleWithCustomAction(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -290,6 +295,7 @@ func TestAccAwsNetworkFirewallRuleGroup_updateRulesSourceList(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -334,6 +340,7 @@ func TestAccAwsNetworkFirewallRuleGroup_rulesSourceAndRuleVariables(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -412,6 +419,7 @@ func TestAccAwsNetworkFirewallRuleGroup_updateStatefulRule(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -457,6 +465,7 @@ func TestAccAwsNetworkFirewallRuleGroup_updateMultipleStatefulRules(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -537,6 +546,7 @@ func TestAccAwsNetworkFirewallRuleGroup_statefulRule_action(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -596,6 +606,7 @@ func TestAccAwsNetworkFirewallRuleGroup_statefulRule_header(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -655,6 +666,7 @@ func TestAccAwsNetworkFirewallRuleGroup_updateStatelessRule(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -703,6 +715,7 @@ func TestAccAwsNetworkFirewallRuleGroup_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ @@ -745,6 +758,7 @@ func TestAccAwsNetworkFirewallRuleGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAwsNetworkFirewall(t) }, + ErrorCheck: testAccErrorCheck(t, networkfirewall.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsNetworkFirewallRuleGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_application_test.go b/aws/resource_aws_opsworks_application_test.go index c3ac99b09906..7ed44c0862ce 100644 --- a/aws/resource_aws_opsworks_application_test.go +++ b/aws/resource_aws_opsworks_application_test.go @@ -20,6 +20,7 @@ func TestAccAWSOpsworksApplication_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksApplicationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_custom_layer_test.go b/aws/resource_aws_opsworks_custom_layer_test.go index d569ded72c91..01ec306ca9f4 100644 --- a/aws/resource_aws_opsworks_custom_layer_test.go +++ b/aws/resource_aws_opsworks_custom_layer_test.go @@ -22,6 +22,7 @@ func TestAccAWSOpsworksCustomLayer_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksCustomLayerDestroy, Steps: []resource.TestStep{ @@ -64,6 +65,7 @@ func TestAccAWSOpsworksCustomLayer_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksCustomLayerDestroy, Steps: []resource.TestStep{ @@ -108,6 +110,7 @@ func TestAccAWSOpsworksCustomLayer_noVPC(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksCustomLayerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_ganglia_layer_test.go b/aws/resource_aws_opsworks_ganglia_layer_test.go index ad3d2d6dcfee..1c53eb28769e 100644 --- a/aws/resource_aws_opsworks_ganglia_layer_test.go +++ b/aws/resource_aws_opsworks_ganglia_layer_test.go @@ -16,6 +16,7 @@ func TestAccAWSOpsworksGangliaLayer_basic(t *testing.T) { resourceName := "aws_opsworks_ganglia_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksGangliaLayerDestroy, Steps: []resource.TestStep{ @@ -36,6 +37,7 @@ func TestAccAWSOpsworksGangliaLayer_tags(t *testing.T) { resourceName := "aws_opsworks_ganglia_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksGangliaLayerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_haproxy_layer_test.go b/aws/resource_aws_opsworks_haproxy_layer_test.go index 43ab5cb86a14..8586ec8e5cd7 100644 --- a/aws/resource_aws_opsworks_haproxy_layer_test.go +++ b/aws/resource_aws_opsworks_haproxy_layer_test.go @@ -16,6 +16,7 @@ func TestAccAWSOpsworksHAProxyLayer_basic(t *testing.T) { resourceName := "aws_opsworks_haproxy_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksHAProxyLayerDestroy, Steps: []resource.TestStep{ @@ -36,6 +37,7 @@ func TestAccAWSOpsworksHAProxyLayer_tags(t *testing.T) { resourceName := "aws_opsworks_haproxy_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksHAProxyLayerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_instance_test.go b/aws/resource_aws_opsworks_instance_test.go index faeabf6d69d7..bcf63d3a2379 100644 --- a/aws/resource_aws_opsworks_instance_test.go +++ b/aws/resource_aws_opsworks_instance_test.go @@ -20,6 +20,7 @@ func TestAccAWSOpsworksInstance_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksInstanceDestroy, Steps: []resource.TestStep{ @@ -69,6 +70,7 @@ func TestAccAWSOpsworksInstance_UpdateHostNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksInstanceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_java_app_layer_test.go b/aws/resource_aws_opsworks_java_app_layer_test.go index 7585bac4c92e..a328bcf7b5a4 100644 --- a/aws/resource_aws_opsworks_java_app_layer_test.go +++ b/aws/resource_aws_opsworks_java_app_layer_test.go @@ -19,6 +19,7 @@ func TestAccAWSOpsworksJavaAppLayer_basic(t *testing.T) { resourceName := "aws_opsworks_java_app_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksJavaAppLayerDestroy, Steps: []resource.TestStep{ @@ -38,6 +39,7 @@ func TestAccAWSOpsworksJavaAppLayer_tags(t *testing.T) { resourceName := "aws_opsworks_java_app_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksJavaAppLayerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_memcached_layer_test.go b/aws/resource_aws_opsworks_memcached_layer_test.go index 53a5bc94c159..1dd554ce07a2 100644 --- a/aws/resource_aws_opsworks_memcached_layer_test.go +++ b/aws/resource_aws_opsworks_memcached_layer_test.go @@ -19,6 +19,7 @@ func TestAccAWSOpsworksMemcachedLayer_basic(t *testing.T) { resourceName := "aws_opsworks_memcached_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksMemcachedLayerDestroy, Steps: []resource.TestStep{ @@ -38,6 +39,7 @@ func TestAccAWSOpsworksMemcachedLayer_tags(t *testing.T) { resourceName := "aws_opsworks_memcached_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksMemcachedLayerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_mysql_layer_test.go b/aws/resource_aws_opsworks_mysql_layer_test.go index caa1ed8e4e85..2382cb0b3d1e 100644 --- a/aws/resource_aws_opsworks_mysql_layer_test.go +++ b/aws/resource_aws_opsworks_mysql_layer_test.go @@ -19,6 +19,7 @@ func TestAccAWSOpsworksMysqlLayer_basic(t *testing.T) { resourceName := "aws_opsworks_mysql_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksMysqlLayerDestroy, Steps: []resource.TestStep{ @@ -38,6 +39,7 @@ func TestAccAWSOpsworksMysqlLayer_tags(t *testing.T) { resourceName := "aws_opsworks_mysql_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksMysqlLayerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_nodejs_app_layer_test.go b/aws/resource_aws_opsworks_nodejs_app_layer_test.go index 4f7e90dc1555..c0fd756705b3 100644 --- a/aws/resource_aws_opsworks_nodejs_app_layer_test.go +++ b/aws/resource_aws_opsworks_nodejs_app_layer_test.go @@ -19,6 +19,7 @@ func TestAccAWSOpsworksNodejsAppLayer_basic(t *testing.T) { resourceName := "aws_opsworks_nodejs_app_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksNodejsAppLayerDestroy, Steps: []resource.TestStep{ @@ -38,6 +39,7 @@ func TestAccAWSOpsworksNodejsAppLayer_tags(t *testing.T) { resourceName := "aws_opsworks_nodejs_app_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksNodejsAppLayerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_permission.go b/aws/resource_aws_opsworks_permission.go index 03b0700717fe..3a9a73ae1f5a 100644 --- a/aws/resource_aws_opsworks_permission.go +++ b/aws/resource_aws_opsworks_permission.go @@ -2,7 +2,6 @@ package aws import ( "log" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" @@ -10,6 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsOpsworksPermission() *schema.Resource { @@ -120,7 +120,7 @@ func resourceAwsOpsworksSetPermission(d *schema.ResourceData, meta interface{}) req.Level = aws.String(d.Get("level").(string)) } - err := resource.Retry(2*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := client.SetPermission(req) if err != nil { diff --git a/aws/resource_aws_opsworks_permission_test.go b/aws/resource_aws_opsworks_permission_test.go index fb15496aff4d..a60cc3b336ec 100644 --- a/aws/resource_aws_opsworks_permission_test.go +++ b/aws/resource_aws_opsworks_permission_test.go @@ -17,6 +17,7 @@ func TestAccAWSOpsworksPermission_basic(t *testing.T) { var opsperm opsworks.Permission resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksPermissionDestroy, Steps: []resource.TestStep{ @@ -100,6 +101,7 @@ func TestAccAWSOpsworksPermission_Self(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, // Cannot delete own OpsWorks Permission Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_php_app_layer_test.go b/aws/resource_aws_opsworks_php_app_layer_test.go index e0c5f77c347f..4d95e37c5074 100644 --- a/aws/resource_aws_opsworks_php_app_layer_test.go +++ b/aws/resource_aws_opsworks_php_app_layer_test.go @@ -19,6 +19,7 @@ func TestAccAWSOpsworksPhpAppLayer_basic(t *testing.T) { resourceName := "aws_opsworks_php_app_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksPhpAppLayerDestroy, Steps: []resource.TestStep{ @@ -43,6 +44,7 @@ func TestAccAWSOpsworksPhpAppLayer_tags(t *testing.T) { resourceName := "aws_opsworks_php_app_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksPhpAppLayerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_rails_app_layer_test.go b/aws/resource_aws_opsworks_rails_app_layer_test.go index 5ed6469a76b3..f4c42fb7bde6 100644 --- a/aws/resource_aws_opsworks_rails_app_layer_test.go +++ b/aws/resource_aws_opsworks_rails_app_layer_test.go @@ -19,6 +19,7 @@ func TestAccAWSOpsworksRailsAppLayer_basic(t *testing.T) { resourceName := "aws_opsworks_rails_app_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksRailsAppLayerDestroy, Steps: []resource.TestStep{ @@ -48,6 +49,7 @@ func TestAccAWSOpsworksRailsAppLayer_tags(t *testing.T) { resourceName := "aws_opsworks_rails_app_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksRailsAppLayerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_rds_db_instance_test.go b/aws/resource_aws_opsworks_rds_db_instance_test.go index dc96d52a0a6b..72e40153e160 100644 --- a/aws/resource_aws_opsworks_rds_db_instance_test.go +++ b/aws/resource_aws_opsworks_rds_db_instance_test.go @@ -17,6 +17,7 @@ func TestAccAWSOpsworksRdsDbInstance_basic(t *testing.T) { var opsdb opsworks.RdsDbInstance resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksRdsDbDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_stack_test.go b/aws/resource_aws_opsworks_stack_test.go index 03535e404de0..a35106ef2ada 100644 --- a/aws/resource_aws_opsworks_stack_test.go +++ b/aws/resource_aws_opsworks_stack_test.go @@ -27,6 +27,7 @@ func TestAccAWSOpsworksStack_noVpcBasic(t *testing.T) { testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) testAccPreCheckAWSOpsWorksStacks(t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksStackDestroy, Steps: []resource.TestStep{ @@ -57,6 +58,7 @@ func TestAccAWSOpsworksStack_noVpcChangeServiceRoleForceNew(t *testing.T) { testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) testAccPreCheckAWSOpsWorksStacks(t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksStackDestroy, Steps: []resource.TestStep{ @@ -93,6 +95,7 @@ func TestAccAWSOpsworksStack_vpc(t *testing.T) { testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) testAccPreCheckAWSOpsWorksStacks(t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksStackDestroy, Steps: []resource.TestStep{ @@ -141,6 +144,7 @@ func TestAccAWSOpsworksStack_noVpcCreateTags(t *testing.T) { testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) testAccPreCheckAWSOpsWorksStacks(t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksStackDestroy, Steps: []resource.TestStep{ @@ -184,6 +188,7 @@ func TestAccAWSOpsworksStack_CustomCookbooks_SetPrivateProperties(t *testing.T) testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) testAccPreCheckAWSOpsWorksStacks(t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksStackDestroy, Steps: []resource.TestStep{ @@ -222,6 +227,7 @@ func TestAccAWSOpsWorksStack_classicEndpoints(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccRegionPreCheck(t, "us-west-2") }, //lintignore:AWSAT003 + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksStackDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_static_web_layer_test.go b/aws/resource_aws_opsworks_static_web_layer_test.go index 6c7875f106e7..081ea3509720 100644 --- a/aws/resource_aws_opsworks_static_web_layer_test.go +++ b/aws/resource_aws_opsworks_static_web_layer_test.go @@ -19,6 +19,7 @@ func TestAccAWSOpsworksStaticWebLayer_basic(t *testing.T) { resourceName := "aws_opsworks_static_web_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksStaticWebLayerDestroy, Steps: []resource.TestStep{ @@ -43,6 +44,7 @@ func TestAccAWSOpsworksStaticWebLayer_tags(t *testing.T) { resourceName := "aws_opsworks_static_web_layer.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksStaticWebLayerDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_opsworks_user_profile_test.go b/aws/resource_aws_opsworks_user_profile_test.go index 42e91468d944..8c04f6f5b781 100644 --- a/aws/resource_aws_opsworks_user_profile_test.go +++ b/aws/resource_aws_opsworks_user_profile_test.go @@ -17,6 +17,7 @@ func TestAccAWSOpsworksUserProfile_basic(t *testing.T) { updateRName := fmt.Sprintf("test-user-%d", acctest.RandInt()) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(opsworks.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, opsworks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOpsworksUserProfileDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_organizations_account_test.go b/aws/resource_aws_organizations_account_test.go index 2d129268e820..3941fb7f7169 100644 --- a/aws/resource_aws_organizations_account_test.go +++ b/aws/resource_aws_organizations_account_test.go @@ -28,6 +28,7 @@ func testAccAwsOrganizationsAccount_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsAccountDestroy, Steps: []resource.TestStep{ @@ -74,6 +75,7 @@ func testAccAwsOrganizationsAccount_ParentId(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsAccountDestroy, Steps: []resource.TestStep{ @@ -118,6 +120,7 @@ func testAccAwsOrganizationsAccount_Tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsAccountDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_organizations_organization_test.go b/aws/resource_aws_organizations_organization_test.go index 6fba30451691..59dcae6129e3 100644 --- a/aws/resource_aws_organizations_organization_test.go +++ b/aws/resource_aws_organizations_organization_test.go @@ -17,6 +17,7 @@ func testAccAwsOrganizationsOrganization_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsOrganizationDestroy, Steps: []resource.TestStep{ @@ -57,6 +58,7 @@ func testAccAwsOrganizationsOrganization_AwsServiceAccessPrincipals(t *testing.T resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsOrganizationDestroy, Steps: []resource.TestStep{ @@ -100,6 +102,7 @@ func testAccAwsOrganizationsOrganization_EnabledPolicyTypes(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsOrganizationDestroy, Steps: []resource.TestStep{ @@ -184,6 +187,7 @@ func testAccAwsOrganizationsOrganization_FeatureSet(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsOrganizationDestroy, Steps: []resource.TestStep{ @@ -209,6 +213,7 @@ func testAccAwsOrganizationsOrganization_FeatureSetForcesNew(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsOrganizationDestroy, Steps: []resource.TestStep{ @@ -242,6 +247,7 @@ func testAccAwsOrganizationsOrganization_FeatureSetUpdate(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsOrganizationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_organizations_organizational_unit_test.go b/aws/resource_aws_organizations_organizational_unit_test.go index 2d6f35afee6d..d4ff09f85965 100644 --- a/aws/resource_aws_organizations_organizational_unit_test.go +++ b/aws/resource_aws_organizations_organizational_unit_test.go @@ -20,6 +20,7 @@ func testAccAwsOrganizationsOrganizationalUnit_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsOrganizationalUnitDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func testAccAwsOrganizationsOrganizationalUnit_Name(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsOrganizationalUnitDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_organizations_policy_attachment_test.go b/aws/resource_aws_organizations_policy_attachment_test.go index bf0fa8db5156..df9b82f126d7 100644 --- a/aws/resource_aws_organizations_policy_attachment_test.go +++ b/aws/resource_aws_organizations_policy_attachment_test.go @@ -24,6 +24,7 @@ func testAccAwsOrganizationsPolicyAttachment_Account(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyAttachmentDestroy, Steps: []resource.TestStep{ @@ -60,6 +61,7 @@ func testAccAwsOrganizationsPolicyAttachment_OrganizationalUnit(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyAttachmentDestroy, Steps: []resource.TestStep{ @@ -88,6 +90,7 @@ func testAccAwsOrganizationsPolicyAttachment_Root(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_organizations_policy_test.go b/aws/resource_aws_organizations_policy_test.go index 08c24544e357..fb6b5eba525b 100644 --- a/aws/resource_aws_organizations_policy_test.go +++ b/aws/resource_aws_organizations_policy_test.go @@ -21,6 +21,7 @@ func testAccAwsOrganizationsPolicy_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyDestroy, Steps: []resource.TestStep{ @@ -63,6 +64,7 @@ func testAccAwsOrganizationsPolicy_concurrent(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyDestroy, Steps: []resource.TestStep{ @@ -87,6 +89,7 @@ func testAccAwsOrganizationsPolicy_description(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyDestroy, Steps: []resource.TestStep{ @@ -120,6 +123,7 @@ func testAccAwsOrganizationsPolicy_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyDestroy, Steps: []resource.TestStep{ @@ -172,6 +176,7 @@ func testAccAwsOrganizationsPolicy_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyDestroy, Steps: []resource.TestStep{ @@ -196,6 +201,7 @@ func testAccAwsOrganizationsPolicy_type_AI_OPT_OUT(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyDestroy, Steps: []resource.TestStep{ @@ -292,6 +298,7 @@ func testAccAwsOrganizationsPolicy_type_Backup(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyDestroy, Steps: []resource.TestStep{ @@ -319,6 +326,7 @@ func testAccAwsOrganizationsPolicy_type_SCP(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyDestroy, Steps: []resource.TestStep{ @@ -353,6 +361,7 @@ func testAccAwsOrganizationsPolicy_type_Tag(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyDestroy, Steps: []resource.TestStep{ @@ -379,6 +388,7 @@ func testAccAwsOrganizationsPolicy_ImportAwsManagedPolicy(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, organizations.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsOrganizationsPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_pinpoint_adm_channel_test.go b/aws/resource_aws_pinpoint_adm_channel_test.go index b4be543cd53f..f7431ab2771e 100644 --- a/aws/resource_aws_pinpoint_adm_channel_test.go +++ b/aws/resource_aws_pinpoint_adm_channel_test.go @@ -48,6 +48,7 @@ func TestAccAWSPinpointADMChannel_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointADMChannelDestroy, diff --git a/aws/resource_aws_pinpoint_apns_channel_test.go b/aws/resource_aws_pinpoint_apns_channel_test.go index b3f7803b6f64..3d0abd308254 100644 --- a/aws/resource_aws_pinpoint_apns_channel_test.go +++ b/aws/resource_aws_pinpoint_apns_channel_test.go @@ -95,6 +95,7 @@ func TestAccAWSPinpointAPNSChannel_basicCertificate(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAPNSChannelDestroy, @@ -129,6 +130,7 @@ func TestAccAWSPinpointAPNSChannel_basicToken(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAPNSChannelDestroy, diff --git a/aws/resource_aws_pinpoint_apns_sandbox_channel_test.go b/aws/resource_aws_pinpoint_apns_sandbox_channel_test.go index 16a4420e2493..01552afd4d82 100644 --- a/aws/resource_aws_pinpoint_apns_sandbox_channel_test.go +++ b/aws/resource_aws_pinpoint_apns_sandbox_channel_test.go @@ -95,6 +95,7 @@ func TestAccAWSPinpointAPNSSandboxChannel_basicCertificate(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAPNSSandboxChannelDestroy, @@ -129,6 +130,7 @@ func TestAccAWSPinpointAPNSSandboxChannel_basicToken(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAPNSSandboxChannelDestroy, diff --git a/aws/resource_aws_pinpoint_apns_voip_channel_test.go b/aws/resource_aws_pinpoint_apns_voip_channel_test.go index 06eeb2074d0f..6bb2bb994bde 100644 --- a/aws/resource_aws_pinpoint_apns_voip_channel_test.go +++ b/aws/resource_aws_pinpoint_apns_voip_channel_test.go @@ -95,6 +95,7 @@ func TestAccAWSPinpointAPNSVoipChannel_basicCertificate(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAPNSVoipChannelDestroy, @@ -129,6 +130,7 @@ func TestAccAWSPinpointAPNSVoipChannel_basicToken(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAPNSVoipChannelDestroy, diff --git a/aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go b/aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go index defd42ad74bd..7089abddc0c3 100644 --- a/aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go +++ b/aws/resource_aws_pinpoint_apns_voip_sandbox_channel_test.go @@ -95,6 +95,7 @@ func TestAccAWSPinpointAPNSVoipSandboxChannel_basicCertificate(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAPNSVoipSandboxChannelDestroy, @@ -129,6 +130,7 @@ func TestAccAWSPinpointAPNSVoipSandboxChannel_basicToken(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAPNSVoipSandboxChannelDestroy, diff --git a/aws/resource_aws_pinpoint_app_test.go b/aws/resource_aws_pinpoint_app_test.go index 422e15d252b7..b72affc0f27a 100644 --- a/aws/resource_aws_pinpoint_app_test.go +++ b/aws/resource_aws_pinpoint_app_test.go @@ -70,6 +70,7 @@ func TestAccAWSPinpointApp_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAppDestroy, @@ -96,6 +97,7 @@ func TestAccAWSPinpointApp_CampaignHookLambda(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAppDestroy, @@ -124,6 +126,7 @@ func TestAccAWSPinpointApp_Limits(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAppDestroy, @@ -152,6 +155,7 @@ func TestAccAWSPinpointApp_QuietTime(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointAppDestroy, @@ -180,6 +184,7 @@ func TestAccAWSPinpointApp_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsRamResourceShareDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_pinpoint_baidu_channel_test.go b/aws/resource_aws_pinpoint_baidu_channel_test.go index 8d279a3eff89..d313c2b2d795 100644 --- a/aws/resource_aws_pinpoint_baidu_channel_test.go +++ b/aws/resource_aws_pinpoint_baidu_channel_test.go @@ -20,6 +20,7 @@ func TestAccAWSPinpointBaiduChannel_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointBaiduChannelDestroy, diff --git a/aws/resource_aws_pinpoint_email_channel.go b/aws/resource_aws_pinpoint_email_channel.go index b77e9ec458d1..41ddb56470c0 100644 --- a/aws/resource_aws_pinpoint_email_channel.go +++ b/aws/resource_aws_pinpoint_email_channel.go @@ -25,6 +25,11 @@ func resourceAwsPinpointEmailChannel() *schema.Resource { Required: true, ForceNew: true, }, + "configuration_set": { + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateArn, + }, "enabled": { Type: schema.TypeBool, Optional: true, @@ -35,12 +40,14 @@ func resourceAwsPinpointEmailChannel() *schema.Resource { Required: true, }, "identity": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: validateArn, }, "role_arn": { - Type: schema.TypeString, - Required: true, + Type: schema.TypeString, + Required: true, + ValidateFunc: validateArn, }, "messages_per_second": { Type: schema.TypeInt, @@ -62,6 +69,10 @@ func resourceAwsPinpointEmailChannelUpsert(d *schema.ResourceData, meta interfac params.Identity = aws.String(d.Get("identity").(string)) params.RoleArn = aws.String(d.Get("role_arn").(string)) + if v, ok := d.GetOk("configuration_set"); ok { + params.ConfigurationSet = aws.String(v.(string)) + } + req := pinpoint.UpdateEmailChannelInput{ ApplicationId: aws.String(applicationId), EmailChannelRequest: params, @@ -69,7 +80,7 @@ func resourceAwsPinpointEmailChannelUpsert(d *schema.ResourceData, meta interfac _, err := conn.UpdateEmailChannel(&req) if err != nil { - return fmt.Errorf("error updating Pinpoint Email Channel for application %s: %s", applicationId, err) + return fmt.Errorf("error updating Pinpoint Email Channel for application %s: %w", applicationId, err) } d.SetId(applicationId) @@ -92,15 +103,18 @@ func resourceAwsPinpointEmailChannelRead(d *schema.ResourceData, meta interface{ return nil } - return fmt.Errorf("error getting Pinpoint Email Channel for application %s: %s", d.Id(), err) + return fmt.Errorf("error getting Pinpoint Email Channel for application %s: %w", d.Id(), err) } - d.Set("application_id", output.EmailChannelResponse.ApplicationId) - d.Set("enabled", output.EmailChannelResponse.Enabled) - d.Set("from_address", output.EmailChannelResponse.FromAddress) - d.Set("identity", output.EmailChannelResponse.Identity) - d.Set("role_arn", output.EmailChannelResponse.RoleArn) - d.Set("messages_per_second", aws.Int64Value(output.EmailChannelResponse.MessagesPerSecond)) + res := output.EmailChannelResponse + d.Set("application_id", res.ApplicationId) + d.Set("enabled", res.Enabled) + d.Set("from_address", res.FromAddress) + d.Set("identity", res.Identity) + d.Set("role_arn", res.RoleArn) + d.Set("configuration_set", res.ConfigurationSet) + d.Set("messages_per_second", aws.Int64Value(res.MessagesPerSecond)) + return nil } @@ -117,7 +131,7 @@ func resourceAwsPinpointEmailChannelDelete(d *schema.ResourceData, meta interfac } if err != nil { - return fmt.Errorf("error deleting Pinpoint Email Channel for application %s: %s", d.Id(), err) + return fmt.Errorf("error deleting Pinpoint Email Channel for application %s: %w", d.Id(), err) } return nil } diff --git a/aws/resource_aws_pinpoint_email_channel_test.go b/aws/resource_aws_pinpoint_email_channel_test.go index e492bbc5df08..63127fcdd73d 100644 --- a/aws/resource_aws_pinpoint_email_channel_test.go +++ b/aws/resource_aws_pinpoint_email_channel_test.go @@ -6,16 +6,18 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/pinpoint" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) func TestAccAWSPinpointEmailChannel_basic(t *testing.T) { var channel pinpoint.EmailChannelResponse - resourceName := "aws_pinpoint_email_channel.test_email_channel" + resourceName := "aws_pinpoint_email_channel.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSPinpointEmailChannelDestroy, @@ -26,6 +28,8 @@ func TestAccAWSPinpointEmailChannel_basic(t *testing.T) { testAccCheckAWSPinpointEmailChannelExists(resourceName, &channel), resource.TestCheckResourceAttr(resourceName, "enabled", "false"), resource.TestCheckResourceAttrSet(resourceName, "messages_per_second"), + resource.TestCheckResourceAttrPair(resourceName, "role_arn", "aws_iam_role.test", "arn"), + resource.TestCheckResourceAttrPair(resourceName, "identity", "aws_ses_domain_identity.test", "arn"), ), }, { @@ -45,6 +49,56 @@ func TestAccAWSPinpointEmailChannel_basic(t *testing.T) { }) } +func TestAccAWSPinpointEmailChannel_configurationSet(t *testing.T) { + var channel pinpoint.EmailChannelResponse + resourceName := "aws_pinpoint_email_channel.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), + IDRefreshName: resourceName, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSPinpointEmailChannelDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSPinpointEmailChannelConfigConfigurationSet("user@example.com", rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSPinpointEmailChannelExists(resourceName, &channel), + resource.TestCheckResourceAttrPair(resourceName, "configuration_set", "aws_ses_configuration_set.test", "arn"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} +func TestAccAWSPinpointEmailChannel_disappears(t *testing.T) { + var channel pinpoint.EmailChannelResponse + resourceName := "aws_pinpoint_email_channel.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSPinpointApp(t) }, + ErrorCheck: testAccErrorCheck(t, pinpoint.EndpointsID), + IDRefreshName: resourceName, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSPinpointEmailChannelDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSPinpointEmailChannelConfig_FromAddress("user@example.com"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSPinpointEmailChannelExists(resourceName, &channel), + testAccCheckResourceDisappears(testAccProvider, resourceAwsPinpointEmailChannel(), resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + func testAccCheckAWSPinpointEmailChannelExists(n string, channel *pinpoint.EmailChannelResponse) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -76,21 +130,21 @@ func testAccCheckAWSPinpointEmailChannelExists(n string, channel *pinpoint.Email func testAccAWSPinpointEmailChannelConfig_FromAddress(fromAddress string) string { return fmt.Sprintf(` -resource "aws_pinpoint_app" "test_app" {} +resource "aws_pinpoint_app" "test" {} -resource "aws_pinpoint_email_channel" "test_email_channel" { - application_id = aws_pinpoint_app.test_app.application_id +resource "aws_pinpoint_email_channel" "test" { + application_id = aws_pinpoint_app.test.application_id enabled = "false" from_address = %[1]q - identity = aws_ses_domain_identity.test_identity.arn - role_arn = aws_iam_role.test_role.arn + identity = aws_ses_domain_identity.test.arn + role_arn = aws_iam_role.test.arn } -resource "aws_ses_domain_identity" "test_identity" { +resource "aws_ses_domain_identity" "test" { domain = "example.com" } -resource "aws_iam_role" "test_role" { +resource "aws_iam_role" "test" { assume_role_policy = < 0 { - numTargets++ - setTarget = target - } + + destinationAttributeKey, destination, err := routeDestinationAttribute(d) + + if err != nil { + return fmt.Errorf("error creating Route: %w", err) } - if numTargets > 1 { - return routeTargetValidationError + targetAttributeKey, target, err := routeTargetAttribute(d) + + if err != nil { + return fmt.Errorf("error creating Route: %w", err) } - createOpts := &ec2.CreateRouteInput{} - // Formulate CreateRouteInput based on the target type - switch setTarget { - case "gateway_id": - createOpts = &ec2.CreateRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - GatewayId: aws.String(d.Get("gateway_id").(string)), - } + routeTableID := d.Get("route_table_id").(string) + input := &ec2.CreateRouteInput{ + RouteTableId: aws.String(routeTableID), + } - if v, ok := d.GetOk("destination_cidr_block"); ok { - createOpts.DestinationCidrBlock = aws.String(v.(string)) - } + var routeFinder finder.RouteFinder - if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { - createOpts.DestinationIpv6CidrBlock = aws.String(v.(string)) - } + switch destination := aws.String(destination); destinationAttributeKey { + case "destination_cidr_block": + input.DestinationCidrBlock = destination + routeFinder = finder.RouteByIPv4Destination + case "destination_ipv6_cidr_block": + input.DestinationIpv6CidrBlock = destination + routeFinder = finder.RouteByIPv6Destination + default: + return fmt.Errorf("error creating Route: unexpected route destination attribute: %q", destinationAttributeKey) + } + switch target := aws.String(target); targetAttributeKey { + case "carrier_gateway_id": + input.CarrierGatewayId = target case "egress_only_gateway_id": - createOpts = &ec2.CreateRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationIpv6CidrBlock: aws.String(d.Get("destination_ipv6_cidr_block").(string)), - EgressOnlyInternetGatewayId: aws.String(d.Get("egress_only_gateway_id").(string)), - } - case "nat_gateway_id": - createOpts = &ec2.CreateRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), - NatGatewayId: aws.String(d.Get("nat_gateway_id").(string)), - } - case "local_gateway_id": - createOpts = &ec2.CreateRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), - LocalGatewayId: aws.String(d.Get("local_gateway_id").(string)), - } + input.EgressOnlyInternetGatewayId = target + case "gateway_id": + input.GatewayId = target case "instance_id": - createOpts = &ec2.CreateRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - InstanceId: aws.String(d.Get("instance_id").(string)), - } - - if v, ok := d.GetOk("destination_cidr_block"); ok { - createOpts.DestinationCidrBlock = aws.String(v.(string)) - } - - if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { - createOpts.DestinationIpv6CidrBlock = aws.String(v.(string)) - } - + input.InstanceId = target + case "local_gateway_id": + input.LocalGatewayId = target + case "nat_gateway_id": + input.NatGatewayId = target case "network_interface_id": - createOpts = &ec2.CreateRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - NetworkInterfaceId: aws.String(d.Get("network_interface_id").(string)), - } - - if v, ok := d.GetOk("destination_cidr_block"); ok { - createOpts.DestinationCidrBlock = aws.String(v.(string)) - } - - if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { - createOpts.DestinationIpv6CidrBlock = aws.String(v.(string)) - } - + input.NetworkInterfaceId = target case "transit_gateway_id": - createOpts = &ec2.CreateRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - TransitGatewayId: aws.String(d.Get("transit_gateway_id").(string)), - } - - if v, ok := d.GetOk("destination_cidr_block"); ok { - createOpts.DestinationCidrBlock = aws.String(v.(string)) - } - - if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { - createOpts.DestinationIpv6CidrBlock = aws.String(v.(string)) - } - + input.TransitGatewayId = target case "vpc_endpoint_id": - createOpts = &ec2.CreateRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - VpcEndpointId: aws.String(d.Get("vpc_endpoint_id").(string)), - } - - if v, ok := d.GetOk("destination_cidr_block"); ok { - createOpts.DestinationCidrBlock = aws.String(v.(string)) - } - - if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { - createOpts.DestinationIpv6CidrBlock = aws.String(v.(string)) - } - + input.VpcEndpointId = target case "vpc_peering_connection_id": - createOpts = &ec2.CreateRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - VpcPeeringConnectionId: aws.String(d.Get("vpc_peering_connection_id").(string)), - } - - if v, ok := d.GetOk("destination_cidr_block"); ok { - createOpts.DestinationCidrBlock = aws.String(v.(string)) - } - - if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { - createOpts.DestinationIpv6CidrBlock = aws.String(v.(string)) - } - + input.VpcPeeringConnectionId = target default: - return fmt.Errorf("A valid target type is missing. Specify one of the following attributes: %s", strings.Join(allowedTargets, ", ")) + return fmt.Errorf("error creating Route: unexpected route target attribute: %q", targetAttributeKey) } - log.Printf("[DEBUG] Route create config: %s", createOpts) - - // Create the route - var err error + log.Printf("[DEBUG] Creating Route: %s", input) err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { - _, err = conn.CreateRoute(createOpts) + _, err = conn.CreateRoute(input) - if isAWSErr(err, "InvalidParameterException", "") { + if tfawserr.ErrCodeEquals(err, tfec2.ErrCodeInvalidParameterException) { return resource.RetryableError(err) } - if isAWSErr(err, "InvalidTransitGatewayID.NotFound", "") { + if tfawserr.ErrCodeEquals(err, tfec2.ErrCodeInvalidTransitGatewayIDNotFound) { return resource.RetryableError(err) } @@ -311,64 +253,42 @@ func resourceAwsRouteCreate(d *schema.ResourceData, meta interface{}) error { return nil }) - if isResourceTimeoutError(err) { - _, err = conn.CreateRoute(createOpts) + + if tfresource.TimedOut(err) { + _, err = conn.CreateRoute(input) } + if err != nil { - return fmt.Errorf("Error creating route: %s", err) + return fmt.Errorf("error creating Route for Route Table (%s) with destination (%s): %w", routeTableID, destination, err) } - var route *ec2.Route - - if v, ok := d.GetOk("destination_cidr_block"); ok { - err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { - route, err = resourceAwsRouteFindRoute(conn, d.Get("route_table_id").(string), v.(string), "") - if err == nil { - if route != nil { - return nil - } else { - err = errors.New("Route not found") - } - } + err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { + _, err = routeFinder(conn, routeTableID, destination) - return resource.RetryableError(err) - }) - if isResourceTimeoutError(err) { - route, err = resourceAwsRouteFindRoute(conn, d.Get("route_table_id").(string), v.(string), "") - } if err != nil { - return fmt.Errorf("Error finding route after creating it: %s", err) + return resource.RetryableError(err) } - if route == nil { - return fmt.Errorf("Unable to find matching route for Route Table (%s) and destination CIDR block (%s).", d.Get("route_table_id").(string), v) + + if tfresource.NotFound(err) { + return resource.RetryableError(fmt.Errorf("route not found")) } + + return nil + }) + + if tfresource.TimedOut(err) { + _, err = routeFinder(conn, routeTableID, destination) } - if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { - err = resource.Retry(d.Timeout(schema.TimeoutCreate), func() *resource.RetryError { - route, err = resourceAwsRouteFindRoute(conn, d.Get("route_table_id").(string), "", v.(string)) - if err == nil { - if route != nil { - return nil - } else { - err = errors.New("Route not found") - } - } + if err != nil { + return fmt.Errorf("error reading Route for Route Table (%s) with destination (%s): %w", routeTableID, destination, err) + } - return resource.RetryableError(err) - }) - if isResourceTimeoutError(err) { - route, err = resourceAwsRouteFindRoute(conn, d.Get("route_table_id").(string), "", v.(string)) - } - if err != nil { - return fmt.Errorf("Error finding route after creating it: %s", err) - } - if route == nil { - return fmt.Errorf("Unable to find matching route for Route Table (%s) and destination IPv6 CIDR block (%s).", d.Get("route_table_id").(string), v) - } + if tfresource.NotFound(err) { + return fmt.Errorf("Route in Route Table (%s) with destination (%s) not found", routeTableID, destination) } - d.SetId(resourceAwsRouteID(d, route)) + d.SetId(tfec2.RouteCreateID(routeTableID, destination)) return resourceAwsRouteRead(d, meta) } @@ -376,34 +296,48 @@ func resourceAwsRouteCreate(d *schema.ResourceData, meta interface{}) error { func resourceAwsRouteRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn - routeTableId := d.Get("route_table_id").(string) - destinationCidrBlock := d.Get("destination_cidr_block").(string) - destinationIpv6CidrBlock := d.Get("destination_ipv6_cidr_block").(string) + destinationAttributeKey, destination, err := routeDestinationAttribute(d) - route, err := resourceAwsRouteFindRoute(conn, routeTableId, destinationCidrBlock, destinationIpv6CidrBlock) - if isAWSErr(err, "InvalidRouteTableID.NotFound", "") { - log.Printf("[WARN] Route Table (%s) not found, removing from state", routeTableId) - d.SetId("") - return nil - } if err != nil { - return err + return fmt.Errorf("error reading Route: %w", err) + } + + var routeFinder finder.RouteFinder + + switch destinationAttributeKey { + case "destination_cidr_block": + routeFinder = finder.RouteByIPv4Destination + case "destination_ipv6_cidr_block": + routeFinder = finder.RouteByIPv6Destination + default: + return fmt.Errorf("error reading Route: unexpected route destination attribute: %q", destinationAttributeKey) } - if route == nil { - log.Printf("[WARN] Matching route not found, removing from state") + routeTableID := d.Get("route_table_id").(string) + + route, err := routeFinder(conn, routeTableID, destination) + + if !d.IsNewResource() && tfresource.NotFound(err) { + log.Printf("[WARN] Route in Route Table (%s) with destination (%s) not found, removing from state", routeTableID, destination) d.SetId("") return nil } + if err != nil { + return fmt.Errorf("error reading Route for Route Table (%s) with destination (%s): %w", routeTableID, destination, err) + } + + d.Set("carrier_gateway_id", route.CarrierGatewayId) d.Set("destination_cidr_block", route.DestinationCidrBlock) d.Set("destination_ipv6_cidr_block", route.DestinationIpv6CidrBlock) d.Set("destination_prefix_list_id", route.DestinationPrefixListId) // VPC Endpoint ID is returned in Gateway ID field if strings.HasPrefix(aws.StringValue(route.GatewayId), "vpce-") { + d.Set("gateway_id", "") d.Set("vpc_endpoint_id", route.GatewayId) } else { d.Set("gateway_id", route.GatewayId) + d.Set("vpc_endpoint_id", "") } d.Set("egress_only_gateway_id", route.EgressOnlyInternetGatewayId) d.Set("nat_gateway_id", route.NatGatewayId) @@ -421,200 +355,168 @@ func resourceAwsRouteRead(d *schema.ResourceData, meta interface{}) error { func resourceAwsRouteUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn - var numTargets int - var setTarget string - - allowedTargets := []string{ - "egress_only_gateway_id", - "gateway_id", - "nat_gateway_id", - "local_gateway_id", - "network_interface_id", - "instance_id", - "transit_gateway_id", - "vpc_endpoint_id", - "vpc_peering_connection_id", - } - // Check if more than 1 target is specified - for _, target := range allowedTargets { - if len(d.Get(target).(string)) > 0 { - numTargets++ - setTarget = target - } + + destinationAttributeKey, destination, err := routeDestinationAttribute(d) + + if err != nil { + return fmt.Errorf("error updating Route: %w", err) } - switch setTarget { - //instance_id is a special case due to the fact that AWS will "discover" the network_interface_id - //when it creates the route and return that data. In the case of an update, we should ignore the - //existing network_interface_id - case "instance_id": - if numTargets > 2 || (numTargets == 2 && len(d.Get("network_interface_id").(string)) == 0) { - return routeTargetValidationError - } + targetAttributeKey, target, err := routeTargetAttribute(d) + + if err != nil { + return fmt.Errorf("error updating Route: %w", err) + } + + routeTableID := d.Get("route_table_id").(string) + input := &ec2.ReplaceRouteInput{ + RouteTableId: aws.String(routeTableID), + } + + switch destination := aws.String(destination); destinationAttributeKey { + case "destination_cidr_block": + input.DestinationCidrBlock = destination + case "destination_ipv6_cidr_block": + input.DestinationIpv6CidrBlock = destination default: - if numTargets > 1 { - return routeTargetValidationError - } + return fmt.Errorf("error updating Route: unexpected route destination attribute: %q", destinationAttributeKey) } - var replaceOpts *ec2.ReplaceRouteInput - // Formulate ReplaceRouteInput based on the target type - switch setTarget { - case "gateway_id": - replaceOpts = &ec2.ReplaceRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), - GatewayId: aws.String(d.Get("gateway_id").(string)), - } + switch target := aws.String(target); targetAttributeKey { + case "carrier_gateway_id": + input.CarrierGatewayId = target case "egress_only_gateway_id": - replaceOpts = &ec2.ReplaceRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationIpv6CidrBlock: aws.String(d.Get("destination_ipv6_cidr_block").(string)), - EgressOnlyInternetGatewayId: aws.String(d.Get("egress_only_gateway_id").(string)), - } - case "nat_gateway_id": - replaceOpts = &ec2.ReplaceRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), - NatGatewayId: aws.String(d.Get("nat_gateway_id").(string)), - } - case "local_gateway_id": - replaceOpts = &ec2.ReplaceRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), - LocalGatewayId: aws.String(d.Get("local_gateway_id").(string)), - } + input.EgressOnlyInternetGatewayId = target + case "gateway_id": + input.GatewayId = target case "instance_id": - replaceOpts = &ec2.ReplaceRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), - InstanceId: aws.String(d.Get("instance_id").(string)), - } + input.InstanceId = target + case "local_gateway_id": + input.LocalGatewayId = target + case "nat_gateway_id": + input.NatGatewayId = target case "network_interface_id": - replaceOpts = &ec2.ReplaceRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), - NetworkInterfaceId: aws.String(d.Get("network_interface_id").(string)), - } + input.NetworkInterfaceId = target case "transit_gateway_id": - replaceOpts = &ec2.ReplaceRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), - TransitGatewayId: aws.String(d.Get("transit_gateway_id").(string)), - } + input.TransitGatewayId = target case "vpc_endpoint_id": - replaceOpts = &ec2.ReplaceRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), - VpcEndpointId: aws.String(d.Get("vpc_endpoint_id").(string)), - } + input.VpcEndpointId = target case "vpc_peering_connection_id": - replaceOpts = &ec2.ReplaceRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), - DestinationCidrBlock: aws.String(d.Get("destination_cidr_block").(string)), - VpcPeeringConnectionId: aws.String(d.Get("vpc_peering_connection_id").(string)), - } + input.VpcPeeringConnectionId = target default: - return fmt.Errorf("An invalid target type specified: %s", setTarget) + return fmt.Errorf("error updating Route: unexpected route target attribute: %q", targetAttributeKey) } - log.Printf("[DEBUG] Route replace config: %s", replaceOpts) - // Replace the route - _, err := conn.ReplaceRoute(replaceOpts) - return err + log.Printf("[DEBUG] Updating Route: %s", input) + _, err = conn.ReplaceRoute(input) + + if err != nil { + return fmt.Errorf("error updating Route for Route Table (%s) with destination (%s): %w", routeTableID, destination, err) + } + + return resourceAwsRouteRead(d, meta) } func resourceAwsRouteDelete(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn - deleteOpts := &ec2.DeleteRouteInput{ - RouteTableId: aws.String(d.Get("route_table_id").(string)), + destinationAttributeKey, destination, err := routeDestinationAttribute(d) + + if err != nil { + return fmt.Errorf("error deleting Route: %w", err) } - if v, ok := d.GetOk("destination_cidr_block"); ok { - deleteOpts.DestinationCidrBlock = aws.String(v.(string)) + + routeTableID := d.Get("route_table_id").(string) + input := &ec2.DeleteRouteInput{ + RouteTableId: aws.String(routeTableID), } - if v, ok := d.GetOk("destination_ipv6_cidr_block"); ok { - deleteOpts.DestinationIpv6CidrBlock = aws.String(v.(string)) + + switch destination := aws.String(destination); destinationAttributeKey { + case "destination_cidr_block": + input.DestinationCidrBlock = destination + case "destination_ipv6_cidr_block": + input.DestinationIpv6CidrBlock = destination + default: + return fmt.Errorf("error deleting Route: unexpected route destination attribute: %q", destinationAttributeKey) } - log.Printf("[DEBUG] Route delete opts: %s", deleteOpts) - err := resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { - log.Printf("[DEBUG] Trying to delete route with opts %s", deleteOpts) - var err error - _, err = conn.DeleteRoute(deleteOpts) + err = resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { + log.Printf("[DEBUG] Deleting Route (%s)", d.Id()) + _, err = conn.DeleteRoute(input) if err == nil { return nil } - if isAWSErr(err, "InvalidRoute.NotFound", "") { + if tfawserr.ErrCodeEquals(err, tfec2.ErrCodeInvalidRouteNotFound) { + return nil + } + + // Local routes (which may have been imported) cannot be deleted. Remove from state. + if tfawserr.ErrMessageContains(err, tfec2.ErrCodeInvalidParameterValue, "cannot remove local route") { return nil } - if isAWSErr(err, "InvalidParameterException", "") { + if tfawserr.ErrCodeEquals(err, tfec2.ErrCodeInvalidParameterException) { return resource.RetryableError(err) } return resource.NonRetryableError(err) }) - if isResourceTimeoutError(err) { - _, err = conn.DeleteRoute(deleteOpts) + + if tfresource.TimedOut(err) { + log.Printf("[DEBUG] Deleting Route (%s)", d.Id()) + _, err = conn.DeleteRoute(input) } - if isAWSErr(err, "InvalidRoute.NotFound", "") { + + if tfawserr.ErrCodeEquals(err, tfec2.ErrCodeInvalidRouteNotFound) { return nil } - if err != nil { - return fmt.Errorf("Error deleting route: %s", err) - } - return nil -} -// Helper: Create an ID for a route -func resourceAwsRouteID(d *schema.ResourceData, r *ec2.Route) string { - - if r.DestinationIpv6CidrBlock != nil && *r.DestinationIpv6CidrBlock != "" { - return fmt.Sprintf("r-%s%d", d.Get("route_table_id").(string), hashcode.String(*r.DestinationIpv6CidrBlock)) + if err != nil { + return fmt.Errorf("error deleting Route for Route Table (%s) with destination (%s): %w", routeTableID, destination, err) } - return fmt.Sprintf("r-%s%d", d.Get("route_table_id").(string), hashcode.String(*r.DestinationCidrBlock)) + return nil } -// resourceAwsRouteFindRoute returns any route whose destination is the specified IPv4 or IPv6 CIDR block. -// Returns nil if the route table exists but no matching destination is found. -func resourceAwsRouteFindRoute(conn *ec2.EC2, rtbid string, cidr string, ipv6cidr string) (*ec2.Route, error) { - routeTableID := rtbid - - findOpts := &ec2.DescribeRouteTablesInput{ - RouteTableIds: []*string{&routeTableID}, +func resourceAwsRouteImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + idParts := strings.Split(d.Id(), "_") + if len(idParts) != 2 || idParts[0] == "" || idParts[1] == "" { + return nil, fmt.Errorf("unexpected format of ID (%q), expected ROUTETABLEID_DESTINATION", d.Id()) } - resp, err := conn.DescribeRouteTables(findOpts) - if err != nil { - return nil, err + routeTableID := idParts[0] + destination := idParts[1] + d.Set("route_table_id", routeTableID) + if strings.Contains(destination, ":") { + d.Set("destination_ipv6_cidr_block", destination) + } else { + d.Set("destination_cidr_block", destination) } + d.SetId(tfec2.RouteCreateID(routeTableID, destination)) - if len(resp.RouteTables) < 1 || resp.RouteTables[0] == nil { - return nil, nil - } + return []*schema.ResourceData{d}, nil +} - if cidr != "" { - for _, route := range (*resp.RouteTables[0]).Routes { - if route.DestinationCidrBlock != nil && *route.DestinationCidrBlock == cidr { - return route, nil - } +// routeDestinationAttribute returns the attribute key and value of the route's destination. +func routeDestinationAttribute(d *schema.ResourceData) (string, string, error) { + for _, key := range routeValidDestinations { + if v, ok := d.Get(key).(string); ok && v != "" { + return key, v, nil } - - return nil, nil } - if ipv6cidr != "" { - for _, route := range (*resp.RouteTables[0]).Routes { - if cidrBlocksEqual(aws.StringValue(route.DestinationIpv6CidrBlock), ipv6cidr) { - return route, nil - } - } + return "", "", fmt.Errorf("route destination attribute not specified") +} - return nil, nil +// routeTargetAttribute returns the attribute key and value of the route's target. +func routeTargetAttribute(d *schema.ResourceData) (string, string, error) { + for _, key := range routeValidTargets { + // The HasChange check is necessary to handle Computed attributes that will be cleared once they are read back after update. + if v, ok := d.Get(key).(string); ok && v != "" && d.HasChange(key) { + return key, v, nil + } } - return nil, nil + return "", "", fmt.Errorf("route target attribute not specified") } diff --git a/aws/resource_aws_route53_delegation_set_test.go b/aws/resource_aws_route53_delegation_set_test.go index 07d4f568a4ef..a5072caeab2c 100644 --- a/aws/resource_aws_route53_delegation_set_test.go +++ b/aws/resource_aws_route53_delegation_set_test.go @@ -19,7 +19,7 @@ func TestAccAWSRoute53DelegationSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, IDRefreshIgnore: []string{"reference_name"}, Providers: testAccProviders, @@ -52,7 +52,7 @@ func TestAccAWSRoute53DelegationSet_withZones(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, IDRefreshIgnore: []string{"reference_name"}, Providers: testAccProviders, diff --git a/aws/resource_aws_route53_health_check_test.go b/aws/resource_aws_route53_health_check_test.go index 84238eacd73f..9a5af313ed6b 100644 --- a/aws/resource_aws_route53_health_check_test.go +++ b/aws/resource_aws_route53_health_check_test.go @@ -17,7 +17,7 @@ func TestAccAWSRoute53HealthCheck_basic(t *testing.T) { resourceName := "aws_route53_health_check.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53HealthCheckDestroy, @@ -54,7 +54,7 @@ func TestAccAWSRoute53HealthCheck_tags(t *testing.T) { resourceName := "aws_route53_health_check.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53HealthCheckDestroy, @@ -98,7 +98,7 @@ func TestAccAWSRoute53HealthCheck_withSearchString(t *testing.T) { resourceName := "aws_route53_health_check.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53HealthCheckDestroy, @@ -133,7 +133,7 @@ func TestAccAWSRoute53HealthCheck_withChildHealthChecks(t *testing.T) { resourceName := "aws_route53_health_check.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53HealthCheckDestroy, Steps: []resource.TestStep{ @@ -157,7 +157,7 @@ func TestAccAWSRoute53HealthCheck_withHealthCheckRegions(t *testing.T) { resourceName := "aws_route53_health_check.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionPreCheck("aws", t) }, // GovCloud has 2 regions, test requires 3 - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53HealthCheckDestroy, Steps: []resource.TestStep{ @@ -182,7 +182,7 @@ func TestAccAWSRoute53HealthCheck_IpConfig(t *testing.T) { resourceName := "aws_route53_health_check.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53HealthCheckDestroy, Steps: []resource.TestStep{ @@ -207,7 +207,7 @@ func TestAccAWSRoute53HealthCheck_Ipv6Config(t *testing.T) { resourceName := "aws_route53_health_check.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53HealthCheckDestroy, Steps: []resource.TestStep{ @@ -236,7 +236,7 @@ func TestAccAWSRoute53HealthCheck_CloudWatchAlarmCheck(t *testing.T) { resourceName := "aws_route53_health_check.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53HealthCheckDestroy, Steps: []resource.TestStep{ @@ -261,7 +261,7 @@ func TestAccAWSRoute53HealthCheck_withSNI(t *testing.T) { resourceName := "aws_route53_health_check.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53HealthCheckDestroy, @@ -302,7 +302,7 @@ func TestAccAWSRoute53HealthCheck_Disabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53HealthCheckDestroy, Steps: []resource.TestStep{ @@ -341,7 +341,7 @@ func TestAccAWSRoute53HealthCheck_disappears(t *testing.T) { resourceName := "aws_route53_health_check.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53HealthCheckDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_hosted_zone_dnssec_test.go b/aws/resource_aws_route53_hosted_zone_dnssec_test.go index 88b51282a687..98864244204a 100644 --- a/aws/resource_aws_route53_hosted_zone_dnssec_test.go +++ b/aws/resource_aws_route53_hosted_zone_dnssec_test.go @@ -21,7 +21,7 @@ func TestAccAwsRoute53HostedZoneDnssec_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckRoute53KeySigningKey(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsRoute53HostedZoneDnssecDestroy, Steps: []resource.TestStep{ @@ -48,7 +48,7 @@ func TestAccAwsRoute53HostedZoneDnssec_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckRoute53KeySigningKey(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsRoute53HostedZoneDnssecDestroy, Steps: []resource.TestStep{ @@ -70,7 +70,7 @@ func TestAccAwsRoute53HostedZoneDnssec_SigningStatus(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckRoute53KeySigningKey(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsRoute53HostedZoneDnssecDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_key_signing_key_test.go b/aws/resource_aws_route53_key_signing_key_test.go index fdfc60b2ab1b..2917e6980569 100644 --- a/aws/resource_aws_route53_key_signing_key_test.go +++ b/aws/resource_aws_route53_key_signing_key_test.go @@ -22,7 +22,7 @@ func TestAccAwsRoute53KeySigningKey_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckRoute53KeySigningKey(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsRoute53KeySigningKeyDestroy, Steps: []resource.TestStep{ @@ -61,7 +61,7 @@ func TestAccAwsRoute53KeySigningKey_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckRoute53KeySigningKey(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsRoute53KeySigningKeyDestroy, Steps: []resource.TestStep{ @@ -83,7 +83,7 @@ func TestAccAwsRoute53KeySigningKey_Status(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckRoute53KeySigningKey(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAwsRoute53KeySigningKeyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_query_log_test.go b/aws/resource_aws_route53_query_log_test.go index 4e1c67f4796d..efd55f410b60 100644 --- a/aws/resource_aws_route53_query_log_test.go +++ b/aws/resource_aws_route53_query_log_test.go @@ -76,7 +76,7 @@ func TestAccAWSRoute53QueryLog_basic(t *testing.T) { var queryLoggingConfig route53.QueryLoggingConfig resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckRoute53QueryLog(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckRoute53QueryLogDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_record_test.go b/aws/resource_aws_route53_record_test.go index c2b29e2fdaec..d35c0d210640 100644 --- a/aws/resource_aws_route53_record_test.go +++ b/aws/resource_aws_route53_record_test.go @@ -15,6 +15,10 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) +func init() { + RegisterServiceErrorCheckFunc(route53.EndpointsID, testAccErrorCheckSkipRoute53) +} + func TestCleanRecordName(t *testing.T) { cases := []struct { Input, Output string @@ -110,7 +114,7 @@ func TestAccAWSRoute53Record_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -137,7 +141,7 @@ func TestAccAWSRoute53Record_underscored(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, Steps: []resource.TestStep{ @@ -164,7 +168,7 @@ func TestAccAWSRoute53Record_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, Steps: []resource.TestStep{ @@ -187,7 +191,7 @@ func TestAccAWSRoute53Record_disappears_MultipleRecords(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, Steps: []resource.TestStep{ @@ -214,7 +218,7 @@ func TestAccAWSRoute53Record_basic_fqdn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -256,7 +260,7 @@ func TestAccAWSRoute53Record_basic_trailingPeriodAndZoneID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -283,7 +287,7 @@ func TestAccAWSRoute53Record_txtSupport(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, IDRefreshIgnore: []string{"zone_id"}, // just for this test Providers: testAccProviders, @@ -311,7 +315,7 @@ func TestAccAWSRoute53Record_spfSupport(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -339,7 +343,7 @@ func TestAccAWSRoute53Record_caaSupport(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -367,7 +371,7 @@ func TestAccAWSRoute53Record_dsSupport(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -393,7 +397,7 @@ func TestAccAWSRoute53Record_generatesSuffix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -420,7 +424,7 @@ func TestAccAWSRoute53Record_wildcard(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -455,7 +459,7 @@ func TestAccAWSRoute53Record_failover(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -483,7 +487,7 @@ func TestAccAWSRoute53Record_weighted_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: "aws_route53_record.www-live", Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -512,7 +516,7 @@ func TestAccAWSRoute53Record_weighted_to_simple_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, Steps: []resource.TestStep{ @@ -546,7 +550,7 @@ func TestAccAWSRoute53Record_Alias_Elb(t *testing.T) { config := fmt.Sprintf(testAccRoute53RecordConfigAliasElb, rs) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -574,7 +578,7 @@ func TestAccAWSRoute53Record_Alias_S3(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, Steps: []resource.TestStep{ @@ -601,7 +605,7 @@ func TestAccAWSRoute53Record_Alias_VpcEndpoint(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, Steps: []resource.TestStep{ @@ -633,7 +637,7 @@ func TestAccAWSRoute53Record_Alias_Uppercase(t *testing.T) { config := fmt.Sprintf(testAccRoute53RecordConfigAliasElbUppercase, rs) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -660,7 +664,7 @@ func TestAccAWSRoute53Record_weighted_alias(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -698,7 +702,7 @@ func TestAccAWSRoute53Record_geolocation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, Steps: []resource.TestStep{ @@ -727,7 +731,7 @@ func TestAccAWSRoute53Record_HealthCheckId_SetIdentifierChange(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -760,7 +764,7 @@ func TestAccAWSRoute53Record_HealthCheckId_TypeChange(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -793,7 +797,7 @@ func TestAccAWSRoute53Record_latency_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, Steps: []resource.TestStep{ @@ -821,7 +825,7 @@ func TestAccAWSRoute53Record_TypeChange(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -856,7 +860,7 @@ func TestAccAWSRoute53Record_NameChange(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -892,7 +896,7 @@ func TestAccAWSRoute53Record_SetIdentifierChange(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -927,7 +931,7 @@ func TestAccAWSRoute53Record_AliasChange(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -962,7 +966,7 @@ func TestAccAWSRoute53Record_empty(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -984,7 +988,7 @@ func TestAccAWSRoute53Record_longTXTrecord(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, @@ -1011,7 +1015,7 @@ func TestAccAWSRoute53Record_multivalue_answer_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, Steps: []resource.TestStep{ @@ -1052,7 +1056,7 @@ func TestAccAWSRoute53Record_allowOverwrite(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53RecordDestroy, Steps: []resource.TestStep{ @@ -1075,12 +1079,13 @@ func testAccErrorCheckSkipRoute53(t *testing.T) resource.ErrorCheckFunc { return testAccErrorCheckSkipMessagesContaining(t, "Operations related to PublicDNS", "Regional control plane current does not support", + "NoSuchHostedZone: The specified hosted zone", ) } func testAccAWSRoute53RecordOverwriteExpectErrorCheck(t *testing.T) resource.ErrorCheckFunc { return func(err error) error { - f := testAccErrorCheckSkipRoute53(t) + f := testAccErrorCheck(t, route53.EndpointsID) err = f(err) if err == nil { diff --git a/aws/resource_aws_route53_resolver_dnssec_config_test.go b/aws/resource_aws_route53_resolver_dnssec_config_test.go index 2ba046421fff..44653751b7e0 100644 --- a/aws/resource_aws_route53_resolver_dnssec_config_test.go +++ b/aws/resource_aws_route53_resolver_dnssec_config_test.go @@ -82,7 +82,7 @@ func TestAccAWSRoute53ResolverDnssecConfig_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverDnssecConfigDestroy, Steps: []resource.TestStep{ @@ -112,7 +112,7 @@ func TestAccAWSRoute53ResolverDnssecConfig_disappear(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverDnssecConfigDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_resolver_endpoint_test.go b/aws/resource_aws_route53_resolver_endpoint_test.go index 1b6e222276bf..2e8113e902cb 100644 --- a/aws/resource_aws_route53_resolver_endpoint_test.go +++ b/aws/resource_aws_route53_resolver_endpoint_test.go @@ -82,7 +82,7 @@ func TestAccAWSRoute53ResolverEndpoint_basicInbound(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverEndpointDestroy, Steps: []resource.TestStep{ @@ -115,7 +115,7 @@ func TestAccAWSRoute53ResolverEndpoint_updateOutbound(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverEndpointDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_resolver_query_log_config_association_test.go b/aws/resource_aws_route53_resolver_query_log_config_association_test.go index 3a4b7a944224..39188623ad5d 100644 --- a/aws/resource_aws_route53_resolver_query_log_config_association_test.go +++ b/aws/resource_aws_route53_resolver_query_log_config_association_test.go @@ -72,7 +72,7 @@ func TestAccAWSRoute53ResolverQueryLogConfigAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverQueryLogConfigAssociationDestroy, Steps: []resource.TestStep{ @@ -100,7 +100,7 @@ func TestAccAWSRoute53ResolverQueryLogConfigAssociation_disappears(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverQueryLogConfigAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_resolver_query_log_config_test.go b/aws/resource_aws_route53_resolver_query_log_config_test.go index fa54bb3da4d7..566bb1d12a55 100644 --- a/aws/resource_aws_route53_resolver_query_log_config_test.go +++ b/aws/resource_aws_route53_resolver_query_log_config_test.go @@ -74,7 +74,7 @@ func TestAccAWSRoute53ResolverQueryLogConfig_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverQueryLogConfigDestroy, Steps: []resource.TestStep{ @@ -105,7 +105,7 @@ func TestAccAWSRoute53ResolverQueryLogConfig_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverQueryLogConfigDestroy, Steps: []resource.TestStep{ @@ -129,7 +129,7 @@ func TestAccAWSRoute53ResolverQueryLogConfig_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverQueryLogConfigDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_resolver_rule_association_test.go b/aws/resource_aws_route53_resolver_rule_association_test.go index ee06b851a3b1..71abfd8bb900 100644 --- a/aws/resource_aws_route53_resolver_rule_association_test.go +++ b/aws/resource_aws_route53_resolver_rule_association_test.go @@ -85,7 +85,7 @@ func TestAccAWSRoute53ResolverRuleAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverRuleAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_resolver_rule_test.go b/aws/resource_aws_route53_resolver_rule_test.go index 1cf1723d0ffa..7172f9043f47 100644 --- a/aws/resource_aws_route53_resolver_rule_test.go +++ b/aws/resource_aws_route53_resolver_rule_test.go @@ -86,7 +86,7 @@ func TestAccAWSRoute53ResolverRule_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverRuleDestroy, Steps: []resource.TestStep{ @@ -116,7 +116,7 @@ func TestAccAWSRoute53ResolverRule_justDotDomainName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverRuleDestroy, Steps: []resource.TestStep{ @@ -146,7 +146,7 @@ func TestAccAWSRoute53ResolverRule_trailingDotDomainName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverRuleDestroy, Steps: []resource.TestStep{ @@ -176,7 +176,7 @@ func TestAccAWSRoute53ResolverRule_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverRuleDestroy, Steps: []resource.TestStep{ @@ -229,7 +229,7 @@ func TestAccAWSRoute53ResolverRule_updateName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverRuleDestroy, Steps: []resource.TestStep{ @@ -270,7 +270,7 @@ func TestAccAWSRoute53ResolverRule_forward(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverRuleDestroy, Steps: []resource.TestStep{ @@ -346,7 +346,7 @@ func TestAccAWSRoute53ResolverRule_forwardEndpointRecreate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSRoute53Resolver(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53resolver.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ResolverRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_vpc_association_authorization_test.go b/aws/resource_aws_route53_vpc_association_authorization_test.go index 878047d8c3e0..31aeb667c931 100644 --- a/aws/resource_aws_route53_vpc_association_authorization_test.go +++ b/aws/resource_aws_route53_vpc_association_authorization_test.go @@ -20,7 +20,7 @@ func TestAccAWSRoute53VpcAssociationAuthorization_basic(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckRoute53VPCAssociationAuthorizationDestroy, Steps: []resource.TestStep{ @@ -49,7 +49,7 @@ func TestAccAWSRoute53VpcAssociationAuthorization_disappears(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckRoute53VPCAssociationAuthorizationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_zone_association_test.go b/aws/resource_aws_route53_zone_association_test.go index fb95f54ac6d6..9271b6f4b755 100644 --- a/aws/resource_aws_route53_zone_association_test.go +++ b/aws/resource_aws_route53_zone_association_test.go @@ -4,6 +4,7 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/service/route53" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -14,7 +15,7 @@ func TestAccAWSRoute53ZoneAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneAssociationDestroy, Steps: []resource.TestStep{ @@ -38,7 +39,7 @@ func TestAccAWSRoute53ZoneAssociation_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneAssociationDestroy, Steps: []resource.TestStep{ @@ -60,7 +61,7 @@ func TestAccAWSRoute53ZoneAssociation_disappears_VPC(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneAssociationDestroy, Steps: []resource.TestStep{ @@ -82,7 +83,7 @@ func TestAccAWSRoute53ZoneAssociation_disappears_Zone(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneAssociationDestroy, Steps: []resource.TestStep{ @@ -110,7 +111,7 @@ func TestAccAWSRoute53ZoneAssociation_CrossAccount(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckRoute53ZoneAssociationDestroy, Steps: []resource.TestStep{ @@ -142,7 +143,7 @@ func TestAccAWSRoute53ZoneAssociation_CrossRegion(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckRoute53ZoneAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route53_zone_test.go b/aws/resource_aws_route53_zone_test.go index f2b648b248fc..406c477de564 100644 --- a/aws/resource_aws_route53_zone_test.go +++ b/aws/resource_aws_route53_zone_test.go @@ -82,7 +82,7 @@ func TestAccAWSRoute53Zone_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -115,7 +115,7 @@ func TestAccAWSRoute53Zone_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -136,7 +136,7 @@ func TestAccAWSRoute53Zone_multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -168,7 +168,7 @@ func TestAccAWSRoute53Zone_Comment(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -206,7 +206,7 @@ func TestAccAWSRoute53Zone_DelegationSetID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -236,7 +236,7 @@ func TestAccAWSRoute53Zone_ForceDestroy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -262,7 +262,7 @@ func TestAccAWSRoute53Zone_ForceDestroy_TrailingPeriod(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -288,7 +288,7 @@ func TestAccAWSRoute53Zone_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -337,7 +337,7 @@ func TestAccAWSRoute53Zone_VPC_Single(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -370,7 +370,7 @@ func TestAccAWSRoute53Zone_VPC_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ @@ -404,7 +404,7 @@ func TestAccAWSRoute53Zone_VPC_Updates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, route53.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRoute53ZoneDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route_table.go b/aws/resource_aws_route_table.go index 89e1c27cbee9..625658fc9ddb 100644 --- a/aws/resource_aws_route_table.go +++ b/aws/resource_aws_route_table.go @@ -8,6 +8,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -22,6 +23,7 @@ var routeTableValidDestinations = []string{ } var routeTableValidTargets = []string{ + "carrier_gateway_id", "egress_only_gateway_id", "gateway_id", "instance_id", @@ -67,6 +69,9 @@ func resourceAwsRouteTable() *schema.Resource { ConfigMode: schema.SchemaConfigModeAttr, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ + /// + // Destinations. + /// "cidr_block": { Type: schema.TypeString, Optional: true, @@ -85,6 +90,14 @@ func resourceAwsRouteTable() *schema.Resource { ), }, + // + // Targets. + // + "carrier_gateway_id": { + Type: schema.TypeString, + Optional: true, + }, + "egress_only_gateway_id": { Type: schema.TypeString, Optional: true, @@ -100,32 +113,32 @@ func resourceAwsRouteTable() *schema.Resource { Optional: true, }, - "nat_gateway_id": { + "local_gateway_id": { Type: schema.TypeString, Optional: true, }, - "local_gateway_id": { + "nat_gateway_id": { Type: schema.TypeString, Optional: true, }, - "transit_gateway_id": { + "network_interface_id": { Type: schema.TypeString, Optional: true, }, - "vpc_endpoint_id": { + "transit_gateway_id": { Type: schema.TypeString, Optional: true, }, - "vpc_peering_connection_id": { + "vpc_endpoint_id": { Type: schema.TypeString, Optional: true, }, - "network_interface_id": { + "vpc_peering_connection_id": { Type: schema.TypeString, Optional: true, }, @@ -134,6 +147,11 @@ func resourceAwsRouteTable() *schema.Resource { Set: resourceAwsRouteTableHash, }, + "arn": { + Type: schema.TypeString, + Computed: true, + }, + "owner_id": { Type: schema.TypeString, Computed: true, @@ -231,6 +249,9 @@ func resourceAwsRouteTableRead(d *schema.ResourceData, meta interface{}) error { if r.DestinationIpv6CidrBlock != nil { m["ipv6_cidr_block"] = aws.StringValue(r.DestinationIpv6CidrBlock) } + if r.CarrierGatewayId != nil { + m["carrier_gateway_id"] = aws.StringValue(r.CarrierGatewayId) + } if r.EgressOnlyInternetGatewayId != nil { m["egress_only_gateway_id"] = aws.StringValue(r.EgressOnlyInternetGatewayId) } @@ -269,7 +290,16 @@ func resourceAwsRouteTableRead(d *schema.ResourceData, meta interface{}) error { return fmt.Errorf("error setting tags: %w", err) } - d.Set("owner_id", rt.OwnerId) + ownerID := aws.StringValue(rt.OwnerId) + arn := arn.ARN{ + Partition: meta.(*AWSClient).partition, + Service: ec2.ServiceName, + Region: meta.(*AWSClient).region, + AccountID: ownerID, + Resource: fmt.Sprintf("route-table/%s", d.Id()), + }.String() + d.Set("arn", arn) + d.Set("owner_id", ownerID) return nil } @@ -422,6 +452,10 @@ func resourceAwsRouteTableUpdate(d *schema.ResourceData, meta interface{}) error opts.GatewayId = aws.String(s) } + if s, ok := m["carrier_gateway_id"].(string); ok && s != "" { + opts.CarrierGatewayId = aws.String(s) + } + if s, ok := m["egress_only_gateway_id"].(string); ok && s != "" { opts.EgressOnlyInternetGatewayId = aws.String(s) } @@ -559,6 +593,10 @@ func resourceAwsRouteTableHash(v interface{}) int { buf.WriteString(fmt.Sprintf("%s-", v.(string))) } + if v, ok := m["carrier_gateway_id"]; ok { + buf.WriteString(fmt.Sprintf("%s-", v.(string))) + } + if v, ok := m["egress_only_gateway_id"]; ok { buf.WriteString(fmt.Sprintf("%s-", v.(string))) } diff --git a/aws/resource_aws_route_table_association_test.go b/aws/resource_aws_route_table_association_test.go index 0c138ff1f6ab..9f8658093741 100644 --- a/aws/resource_aws_route_table_association_test.go +++ b/aws/resource_aws_route_table_association_test.go @@ -20,6 +20,7 @@ func TestAccAWSRouteTableAssociation_Subnet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableAssociationDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func TestAccAWSRouteTableAssociation_Subnet_ChangeRouteTable(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableAssociationDestroy, Steps: []resource.TestStep{ @@ -84,6 +86,7 @@ func TestAccAWSRouteTableAssociation_Subnet_ChangeSubnet(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableAssociationDestroy, Steps: []resource.TestStep{ @@ -116,6 +119,7 @@ func TestAccAWSRouteTableAssociation_Gateway_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableAssociationDestroy, Steps: []resource.TestStep{ @@ -147,6 +151,7 @@ func TestAccAWSRouteTableAssociation_Gateway_ChangeRouteTable(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableAssociationDestroy, Steps: []resource.TestStep{ @@ -169,6 +174,7 @@ func TestAccAWSRouteTableAssociation_Gateway_ChangeRouteTable(t *testing.T) { }, }) } + func TestAccAWSRouteTableAssociation_Gateway_ChangeGateway(t *testing.T) { var rta1, rta2 ec2.RouteTableAssociation @@ -179,6 +185,7 @@ func TestAccAWSRouteTableAssociation_Gateway_ChangeGateway(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableAssociationDestroy, Steps: []resource.TestStep{ @@ -209,6 +216,7 @@ func TestAccAWSRouteTableAssociation_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_route_table_test.go b/aws/resource_aws_route_table_test.go index 837a438df527..00ea7daeaac1 100644 --- a/aws/resource_aws_route_table_test.go +++ b/aws/resource_aws_route_table_test.go @@ -149,6 +149,7 @@ func TestAccAWSRouteTable_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ @@ -157,6 +158,7 @@ func TestAccAWSRouteTable_basic(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 1), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "0"), @@ -179,6 +181,7 @@ func TestAccAWSRouteTable_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ @@ -201,6 +204,7 @@ func TestAccAWSRouteTable_disappears_SubnetAssociation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ @@ -227,6 +231,7 @@ func TestAccAWSRouteTable_IPv4_To_InternetGateway(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, @@ -236,6 +241,7 @@ func TestAccAWSRouteTable_IPv4_To_InternetGateway(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 3), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "2"), @@ -250,6 +256,7 @@ func TestAccAWSRouteTable_IPv4_To_InternetGateway(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 3), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "2"), @@ -277,6 +284,7 @@ func TestAccAWSRouteTable_IPv4_To_Instance(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, @@ -286,6 +294,7 @@ func TestAccAWSRouteTable_IPv4_To_Instance(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "1"), @@ -312,6 +321,7 @@ func TestAccAWSRouteTable_IPv6_To_EgressOnlyInternetGateway(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, @@ -321,6 +331,7 @@ func TestAccAWSRouteTable_IPv6_To_EgressOnlyInternetGateway(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 3), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "1"), @@ -350,6 +361,7 @@ func TestAccAWSRouteTable_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, @@ -394,6 +406,7 @@ func TestAccAWSRouteTable_RequireRouteDestination(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, @@ -412,13 +425,14 @@ func TestAccAWSRouteTable_RequireRouteTarget(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ { Config: testAccRouteTableConfigNoTarget(rName), - ExpectError: regexp.MustCompile("error creating route: one of `egress_only_gateway_id"), + ExpectError: regexp.MustCompile(`error creating route: one of .*\begress_only_gateway_id\b`), }, }, }) @@ -434,6 +448,7 @@ func TestAccAWSRouteTable_Route_ConfigMode(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ @@ -442,6 +457,7 @@ func TestAccAWSRouteTable_Route_ConfigMode(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 3), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "2"), @@ -461,6 +477,7 @@ func TestAccAWSRouteTable_Route_ConfigMode(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 3), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "2"), @@ -480,6 +497,7 @@ func TestAccAWSRouteTable_Route_ConfigMode(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 1), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "0"), @@ -505,6 +523,7 @@ func TestAccAWSRouteTable_IPv4_To_TransitGateway(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ @@ -513,6 +532,7 @@ func TestAccAWSRouteTable_IPv4_To_TransitGateway(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "1"), @@ -539,6 +559,7 @@ func TestAccAWSRouteTable_IPv4_To_VpcEndpoint(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckElbv2GatewayLoadBalancer(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ @@ -547,6 +568,7 @@ func TestAccAWSRouteTable_IPv4_To_VpcEndpoint(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "1"), @@ -564,6 +586,42 @@ func TestAccAWSRouteTable_IPv4_To_VpcEndpoint(t *testing.T) { }) } +func TestAccAWSRouteTable_IPv4_To_CarrierGateway(t *testing.T) { + var routeTable ec2.RouteTable + resourceName := "aws_route_table.test" + cgwResourceName := "aws_ec2_carrier_gateway.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "0.0.0.0/0" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWavelengthZoneAvailable(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckRouteTableDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteTableConfigIpv4CarrierGateway(rName, destinationCidr), + Check: resource.ComposeTestCheckFunc( + testAccCheckRouteTableExists(resourceName, &routeTable), + testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), + testAccCheckResourceAttrAccountID(resourceName, "owner_id"), + resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), + resource.TestCheckResourceAttr(resourceName, "route.#", "1"), + testAccCheckAWSRouteTableRoute(resourceName, "cidr_block", destinationCidr, "carrier_gateway_id", cgwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.Name", rName), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccAWSRouteTable_IPv4_To_LocalGateway(t *testing.T) { var routeTable ec2.RouteTable resourceName := "aws_route_table.test" @@ -573,6 +631,7 @@ func TestAccAWSRouteTable_IPv4_To_LocalGateway(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ @@ -581,6 +640,7 @@ func TestAccAWSRouteTable_IPv4_To_LocalGateway(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "1"), @@ -607,6 +667,7 @@ func TestAccAWSRouteTable_IPv4_To_VpcPeeringConnection(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ @@ -615,6 +676,7 @@ func TestAccAWSRouteTable_IPv4_To_VpcPeeringConnection(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "1"), @@ -641,6 +703,7 @@ func TestAccAWSRouteTable_vgwRoutePropagation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, Steps: []resource.TestStep{ @@ -649,6 +712,7 @@ func TestAccAWSRouteTable_vgwRoutePropagation(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 1), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "1"), resource.TestCheckTypeSetElemAttrPair(resourceName, "propagating_vgws.*", vgwResourceName1, "id"), @@ -662,6 +726,7 @@ func TestAccAWSRouteTable_vgwRoutePropagation(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 1), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "1"), resource.TestCheckTypeSetElemAttrPair(resourceName, "propagating_vgws.*", vgwResourceName2, "id"), @@ -689,6 +754,7 @@ func TestAccAWSRouteTable_ConditionalCidrBlock(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ @@ -724,6 +790,7 @@ func TestAccAWSRouteTable_IPv4_To_NatGateway(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, @@ -733,6 +800,7 @@ func TestAccAWSRouteTable_IPv4_To_NatGateway(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "1"), @@ -759,6 +827,7 @@ func TestAccAWSRouteTable_IPv6_To_NetworkInterface_Unattached(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, @@ -768,6 +837,7 @@ func TestAccAWSRouteTable_IPv6_To_NetworkInterface_Unattached(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 3), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "1"), @@ -792,6 +862,7 @@ func TestAccAWSRouteTable_VpcMultipleCidrs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ @@ -800,6 +871,7 @@ func TestAccAWSRouteTable_VpcMultipleCidrs(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "0"), @@ -823,6 +895,7 @@ func TestAccAWSRouteTable_VpcClassicLink(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ @@ -831,6 +904,7 @@ func TestAccAWSRouteTable_VpcClassicLink(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "0"), @@ -856,6 +930,7 @@ func TestAccAWSRouteTable_GatewayVpcEndpoint(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ @@ -868,6 +943,7 @@ func TestAccAWSRouteTable_GatewayVpcEndpoint(t *testing.T) { // Refresh the route table once the VPC endpoint route is present. testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "0"), @@ -899,6 +975,7 @@ func TestAccAWSRouteTable_MultipleRoutes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckRouteTableDestroy, @@ -911,6 +988,7 @@ func TestAccAWSRouteTable_MultipleRoutes(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 5), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "3"), @@ -929,6 +1007,7 @@ func TestAccAWSRouteTable_MultipleRoutes(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 5), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "3"), @@ -947,6 +1026,7 @@ func TestAccAWSRouteTable_MultipleRoutes(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckRouteTableExists(resourceName, &routeTable), testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 5), + testAccMatchResourceAttrRegionalARN(resourceName, "arn", "ec2", regexp.MustCompile(`route-table/.+$`)), testAccCheckResourceAttrAccountID(resourceName, "owner_id"), resource.TestCheckResourceAttr(resourceName, "propagating_vgws.#", "0"), resource.TestCheckResourceAttr(resourceName, "route.#", "3"), @@ -1642,6 +1722,39 @@ resource "aws_route_table" "test" { `, rName, destinationCidr)) } +func testAccAWSRouteTableConfigIpv4CarrierGateway(rName, destinationCidr string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + + tags = { + Name = %[1]q + } +} + +resource "aws_ec2_carrier_gateway" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + route { + cidr_block = %[2]q + carrier_gateway_id = aws_ec2_carrier_gateway.test.id + } + + tags = { + Name = %[1]q + } +} +`, rName, destinationCidr) +} + func testAccAWSRouteTableConfigRouteIpv4LocalGateway(rName, destinationCidr string) string { return fmt.Sprintf(` data "aws_ec2_local_gateways" "all" {} @@ -2028,6 +2141,7 @@ resource "aws_route_table" "test" { ipv6_cidr_block = (route.value["destination_attr"] == "ipv6_cidr_block") ? route.value["destination_value"] : null # Target. + carrier_gateway_id = (route.value["target_attr"] == "carrier_gateway_id") ? route.value["target_value"] : null egress_only_gateway_id = (route.value["target_attr"] == "egress_only_gateway_id") ? route.value["target_value"] : null gateway_id = (route.value["target_attr"] == "gateway_id") ? route.value["target_value"] : null instance_id = (route.value["target_attr"] == "instance_id") ? route.value["target_value"] : null diff --git a/aws/resource_aws_route_test.go b/aws/resource_aws_route_test.go index ebcea685091f..ae7025293bb7 100644 --- a/aws/resource_aws_route_test.go +++ b/aws/resource_aws_route_test.go @@ -4,52 +4,59 @@ import ( "fmt" "testing" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2/finder" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource" ) +// IPv4 to Internet Gateway. func TestAccAWSRoute_basic(t *testing.T) { var route ec2.Route - - //aws creates a default route - testCheck := func(s *terraform.State) error { - if *route.DestinationCidrBlock != "10.3.0.0/16" { - return fmt.Errorf("Destination Cidr (Expected=%s, Actual=%s)\n", "10.3.0.0/16", *route.DestinationCidrBlock) - } - - name := "aws_internet_gateway.foo" - gwres, ok := s.RootModule().Resources[name] - if !ok { - return fmt.Errorf("Not found: %s\n", name) - } - - if *route.GatewayId != gwres.Primary.ID { - return fmt.Errorf("Internet Gateway Id (Expected=%s, Actual=%s)\n", gwres.Primary.ID, *route.GatewayId) - } - - return nil - } + var routeTable ec2.RouteTable + resourceName := "aws_route.test" + igwResourceName := "aws_internet_gateway.test" + rtResourceName := "aws_route_table.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteBasicConfig(), + Config: testAccAWSRouteConfigIpv4InternetGateway(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.bar", &route), - testCheck, + testAccCheckRouteTableExists(rtResourceName, &routeTable), + testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 2), + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "gateway_id", igwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - ResourceName: "aws_route.bar", + ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccAWSRouteImportStateIdFunc("aws_route.bar"), + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), ImportStateVerify: true, }, }, @@ -58,19 +65,21 @@ func TestAccAWSRoute_basic(t *testing.T) { func TestAccAWSRoute_disappears(t *testing.T) { var route ec2.Route + resourceName := "aws_route.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteBasicConfig(), + Config: testAccAWSRouteConfigIpv4InternetGateway(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.bar", &route), - testAccCheckResourceDisappears(testAccProvider, resourceAwsRoute(), "aws_route.bar"), + testAccCheckAWSRouteExists(resourceName, &route), + testAccCheckResourceDisappears(testAccProvider, resourceAwsRoute(), resourceName), ), ExpectNonEmptyPlan: true, }, @@ -78,354 +87,634 @@ func TestAccAWSRoute_disappears(t *testing.T) { }) } -func TestAccAWSRoute_ipv6Support(t *testing.T) { +func TestAccAWSRoute_disappears_RouteTable(t *testing.T) { var route ec2.Route + resourceName := "aws_route.test" + rtResourceName := "aws_route_table.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" - //aws creates a default route - testCheck := func(s *terraform.State) error { - name := "aws_egress_only_internet_gateway.foo" - gwres, ok := s.RootModule().Resources[name] - if !ok { - return fmt.Errorf("Not found: %s\n", name) - } - - if *route.EgressOnlyInternetGatewayId != gwres.Primary.ID { - return fmt.Errorf("Egress Only Internet Gateway Id (Expected=%s, Actual=%s)\n", gwres.Primary.ID, *route.EgressOnlyInternetGatewayId) - } + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteConfigIpv4InternetGateway(rName, destinationCidr), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + testAccCheckResourceDisappears(testAccProvider, resourceAwsRouteTable(), rtResourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} - return nil - } +func TestAccAWSRoute_IPv6_To_EgressOnlyInternetGateway(t *testing.T) { + var route ec2.Route + resourceName := "aws_route.test" + eoigwResourceName := "aws_egress_only_internet_gateway.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "::/0" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteConfigIpv6(), + Config: testAccAWSRouteConfigIpv6EgressOnlyInternetGateway(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.bar", &route), - testCheck, - resource.TestCheckResourceAttr("aws_route.bar", "destination_ipv6_cidr_block", "::/0"), + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "egress_only_gateway_id", eoigwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - ResourceName: "aws_route.bar", + ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccAWSRouteImportStateIdFunc("aws_route.bar"), + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), ImportStateVerify: true, }, { - Config: testAccAWSRouteConfigIpv6Expanded(), + // Verify that expanded form of the destination CIDR causes no diff. + Config: testAccAWSRouteConfigIpv6EgressOnlyInternetGateway(rName, "::0/0"), PlanOnly: true, }, }, }) } -func TestAccAWSRoute_ipv6ToInternetGateway(t *testing.T) { +func TestAccAWSRoute_IPv6_To_InternetGateway(t *testing.T) { var route ec2.Route + resourceName := "aws_route.test" + igwResourceName := "aws_internet_gateway.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "::/0" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteConfigIpv6InternetGateway(), + Config: testAccAWSRouteConfigIpv6InternetGateway(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.igw", &route), + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "gateway_id", igwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - ResourceName: "aws_route.igw", + ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccAWSRouteImportStateIdFunc("aws_route.igw"), + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), ImportStateVerify: true, }, }, }) } -func TestAccAWSRoute_ipv6ToInstance(t *testing.T) { +func TestAccAWSRoute_IPv6_To_Instance(t *testing.T) { var route ec2.Route + resourceName := "aws_route.test" + instanceResourceName := "aws_instance.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "::/0" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteConfigIpv6Instance(), + Config: testAccAWSRouteConfigIpv6Instance(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.internal-default-route-ipv6", &route), + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), + testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", instanceResourceName, "primary_network_interface_id"), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - ResourceName: "aws_route.internal-default-route-ipv6", + ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccAWSRouteImportStateIdFunc("aws_route.internal-default-route-ipv6"), + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), ImportStateVerify: true, }, - { - Config: testAccAWSRouteConfigIpv6InstanceExpanded(), - PlanOnly: true, - }, }, }) } -func TestAccAWSRoute_ipv6ToNetworkInterface(t *testing.T) { +func TestAccAWSRoute_IPv6_To_NetworkInterface_Unattached(t *testing.T) { var route ec2.Route + resourceName := "aws_route.test" + eniResourceName := "aws_network_interface.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "::/0" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteConfigIpv6NetworkInterface(), + Config: testAccAWSRouteConfigIpv6NetworkInterfaceUnattached(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.internal-default-route-ipv6", &route), + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", eniResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateBlackhole), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - ResourceName: "aws_route.internal-default-route-ipv6", + ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccAWSRouteImportStateIdFunc("aws_route.internal-default-route-ipv6"), + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), ImportStateVerify: true, }, }, }) } -func TestAccAWSRoute_ipv6ToPeeringConnection(t *testing.T) { +func TestAccAWSRoute_IPv6_To_VpcPeeringConnection(t *testing.T) { var route ec2.Route + resourceName := "aws_route.test" + pcxResourceName := "aws_vpc_peering_connection.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "::/0" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteConfigIpv6PeeringConnection(), + Config: testAccAWSRouteConfigIpv6VpcPeeringConnection(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.pc", &route), + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "vpc_peering_connection_id", pcxResourceName, "id"), ), }, { - ResourceName: "aws_route.pc", + ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccAWSRouteImportStateIdFunc("aws_route.pc"), + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), ImportStateVerify: true, }, }, }) } -func TestAccAWSRoute_changeRouteTable(t *testing.T) { - var before ec2.Route - var after ec2.Route +func TestAccAWSRoute_IPv6_To_VpnGateway(t *testing.T) { + var route ec2.Route + resourceName := "aws_route.test" + vgwResourceName := "aws_vpn_gateway.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "::/0" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteBasicConfig(), + Config: testAccAWSRouteConfigIpv6VpnGateway(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.bar", &before), + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "gateway_id", vgwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - Config: testAccAWSRouteNewRouteTable(), + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSRoute_IPv4_To_VpnGateway(t *testing.T) { + var route ec2.Route + resourceName := "aws_route.test" + vgwResourceName := "aws_vpn_gateway.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteConfigIpv4VpnGateway(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.bar", &after), + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "gateway_id", vgwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - ResourceName: "aws_route.bar", + ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccAWSRouteImportStateIdFunc("aws_route.bar"), + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), ImportStateVerify: true, }, }, }) } -func TestAccAWSRoute_changeCidr(t *testing.T) { +func TestAccAWSRoute_IPv4_To_Instance(t *testing.T) { var route ec2.Route - var routeTable ec2.RouteTable - - //aws creates a default route - testCheck := func(s *terraform.State) error { - if *route.DestinationCidrBlock != "10.3.0.0/16" { - return fmt.Errorf("Destination Cidr (Expected=%s, Actual=%s)\n", "10.3.0.0/16", *route.DestinationCidrBlock) - } - - name := "aws_internet_gateway.foo" - gwres, ok := s.RootModule().Resources[name] - if !ok { - return fmt.Errorf("Not found: %s\n", name) - } - - if *route.GatewayId != gwres.Primary.ID { - return fmt.Errorf("Internet Gateway Id (Expected=%s, Actual=%s)\n", gwres.Primary.ID, *route.GatewayId) - } - - return nil - } - - testCheckChange := func(s *terraform.State) error { - if *route.DestinationCidrBlock != "10.2.0.0/16" { - return fmt.Errorf("Destination Cidr (Expected=%s, Actual=%s)\n", "10.2.0.0/16", *route.DestinationCidrBlock) - } - - name := "aws_internet_gateway.foo" - gwres, ok := s.RootModule().Resources[name] - if !ok { - return fmt.Errorf("Not found: %s\n", name) - } - - if *route.GatewayId != gwres.Primary.ID { - return fmt.Errorf("Internet Gateway Id (Expected=%s, Actual=%s)\n", gwres.Primary.ID, *route.GatewayId) - } - - if rtlen := len(routeTable.Routes); rtlen != 2 { - return fmt.Errorf("Route Table has too many routes (Expected=%d, Actual=%d)\n", rtlen, 2) - } - - return nil - } + resourceName := "aws_route.test" + instanceResourceName := "aws_instance.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteBasicConfig(), + Config: testAccAWSRouteConfigIpv4Instance(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.bar", &route), - testCheck, + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), + testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", instanceResourceName, "primary_network_interface_id"), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - Config: testAccAWSRouteBasicConfigChangeCidr(), + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSRoute_IPv4_To_NetworkInterface_Unattached(t *testing.T) { + var route ec2.Route + resourceName := "aws_route.test" + eniResourceName := "aws_network_interface.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteConfigIpv4NetworkInterfaceUnattached(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.bar", &route), - testAccCheckRouteTableExists("aws_route_table.foo", &routeTable), - testCheckChange, + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", eniResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateBlackhole), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - ResourceName: "aws_route.bar", + ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccAWSRouteImportStateIdFunc("aws_route.bar"), + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), ImportStateVerify: true, }, }, }) } -func TestAccAWSRoute_noopdiff(t *testing.T) { +func TestAccAWSRoute_IPv4_To_NetworkInterface_Attached(t *testing.T) { var route ec2.Route - var routeTable ec2.RouteTable + resourceName := "aws_route.test" + eniResourceName := "aws_network_interface.test" + instanceResourceName := "aws_instance.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" - testCheck := func(s *terraform.State) error { - return nil - } + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteConfigIpv4NetworkInterfaceAttached(rName, destinationCidr), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), + testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", eniResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} - testCheckChange := func(s *terraform.State) error { - return nil - } +func TestAccAWSRoute_IPv4_To_NetworkInterface_TwoAttachments(t *testing.T) { + var route ec2.Route + resourceName := "aws_route.test" + eni1ResourceName := "aws_network_interface.test1" + eni2ResourceName := "aws_network_interface.test2" + instanceResourceName := "aws_instance.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteNoopChange(), + Config: testAccAWSRouteConfigIpv4NetworkInterfaceTwoAttachments(rName, destinationCidr, eni1ResourceName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.test", &route), - testCheck, + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), + testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", eni1ResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - Config: testAccAWSRouteNoopChange(), + Config: testAccAWSRouteConfigIpv4NetworkInterfaceTwoAttachments(rName, destinationCidr, eni2ResourceName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.test", &route), - testAccCheckRouteTableExists("aws_route_table.test", &routeTable), - testCheckChange, + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), + testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", eni2ResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - ResourceName: "aws_route.test", + ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccAWSRouteImportStateIdFunc("aws_route.test"), + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), ImportStateVerify: true, }, }, }) } -func TestAccAWSRoute_doesNotCrashWithVPCEndpoint(t *testing.T) { +func TestAccAWSRoute_IPv4_To_VpcPeeringConnection(t *testing.T) { var route ec2.Route + resourceName := "aws_route.test" + pcxResourceName := "aws_vpc_peering_connection.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteWithVPCEndpoint(), + Config: testAccAWSRouteConfigIpv4VpcPeeringConnection(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSRouteExists("aws_route.bar", &route), + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "vpc_peering_connection_id", pcxResourceName, "id"), ), }, { - ResourceName: "aws_route.bar", + ResourceName: resourceName, ImportState: true, - ImportStateIdFunc: testAccAWSRouteImportStateIdFunc("aws_route.bar"), + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), ImportStateVerify: true, }, }, }) } -func TestAccAWSRoute_TransitGatewayID_DestinationCidrBlock(t *testing.T) { +func TestAccAWSRoute_IPv4_To_NatGateway(t *testing.T) { var route ec2.Route resourceName := "aws_route.test" - transitGatewayResourceName := "aws_ec2_transit_gateway.test" + ngwResourceName := "aws_nat_gateway.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteConfigTransitGatewayIDDestinatationCidrBlock(), + Config: testAccAWSRouteConfigIpv4NatGateway(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRouteExists(resourceName, &route), - resource.TestCheckResourceAttrPair(resourceName, "transit_gateway_id", transitGatewayResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "nat_gateway_id", ngwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { @@ -438,21 +727,25 @@ func TestAccAWSRoute_TransitGatewayID_DestinationCidrBlock(t *testing.T) { }) } -func TestAccAWSRoute_LocalGatewayID(t *testing.T) { +func TestAccAWSRoute_DoesNotCrashWithVpcEndpoint(t *testing.T) { var route ec2.Route + var routeTable ec2.RouteTable resourceName := "aws_route.test" - localGatewayDataSourceName := "data.aws_ec2_local_gateway.first" + rtResourceName := "aws_route_table.test" + rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteResourceConfigLocalGatewayID(), + Config: testAccAWSRouteConfigWithVpcEndpoint(rName), Check: resource.ComposeTestCheckFunc( + testAccCheckRouteTableExists(rtResourceName, &routeTable), + testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 3), testAccCheckAWSRouteExists(resourceName, &route), - resource.TestCheckResourceAttrPair(resourceName, "local_gateway_id", localGatewayDataSourceName, "id"), ), }, { @@ -465,30 +758,84 @@ func TestAccAWSRoute_LocalGatewayID(t *testing.T) { }) } -func TestAccAWSRoute_ConditionalCidrBlock(t *testing.T) { +func TestAccAWSRoute_IPv4_To_TransitGateway(t *testing.T) { var route ec2.Route resourceName := "aws_route.test" + tgwResourceName := "aws_ec2_transit_gateway.test" rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteConfigConditionalIpv4Ipv6(rName, false), + Config: testAccAWSRouteConfigIpv4TransitGateway(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRouteExists(resourceName, &route), - resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", "0.0.0.0/0"), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttrPair(resourceName, "transit_gateway_id", tgwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { - Config: testAccAWSRouteConfigConditionalIpv4Ipv6(rName, true), + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSRoute_IPv6_To_TransitGateway(t *testing.T) { + var route ec2.Route + resourceName := "aws_route.test" + tgwResourceName := "aws_ec2_transit_gateway.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "::/0" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteConfigIpv6TransitGateway(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), - resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", "::/0"), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttrPair(resourceName, "transit_gateway_id", tgwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { @@ -500,23 +847,39 @@ func TestAccAWSRoute_ConditionalCidrBlock(t *testing.T) { }, }) } - -func TestAccAWSRoute_VpcEndpointId(t *testing.T) { +func TestAccAWSRoute_IPv4_To_CarrierGateway(t *testing.T) { var route ec2.Route - rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_route.test" - vpcEndpointResourceName := "aws_vpc_endpoint.test" + cgwResourceName := "aws_ec2_carrier_gateway.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "172.16.1.0/24" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t); testAccPreCheckElbv2GatewayLoadBalancer(t) }, + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWavelengthZoneAvailable(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSRouteDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSRouteResourceConfigVpcEndpointId(rName), + Config: testAccAWSRouteConfigIpv4CarrierGateway(rName, destinationCidr), Check: resource.ComposeTestCheckFunc( testAccCheckAWSRouteExists(resourceName, &route), - resource.TestCheckResourceAttrPair(resourceName, "vpc_endpoint_id", vpcEndpointResourceName, "id"), + resource.TestCheckResourceAttrPair(resourceName, "carrier_gateway_id", cgwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), ), }, { @@ -529,754 +892,1892 @@ func TestAccAWSRoute_VpcEndpointId(t *testing.T) { }) } -func testAccCheckAWSRouteExists(n string, res *ec2.Route) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Not found: %s\n", n) - } - +func TestAccAWSRoute_IPv4_To_LocalGateway(t *testing.T) { + var route ec2.Route + resourceName := "aws_route.test" + localGatewayDataSourceName := "data.aws_ec2_local_gateway.first" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "172.16.1.0/24" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteResourceConfigIpv4LocalGateway(rName, destinationCidr), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "local_gateway_id", localGatewayDataSourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSRoute_IPv6_To_LocalGateway(t *testing.T) { + var route ec2.Route + resourceName := "aws_route.test" + localGatewayDataSourceName := "data.aws_ec2_local_gateway.first" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "2002:bc9:1234:1a00::/56" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteResourceConfigIpv6LocalGateway(rName, destinationCidr), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "local_gateway_id", localGatewayDataSourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSRoute_ConditionalCidrBlock(t *testing.T) { + var route ec2.Route + resourceName := "aws_route.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.2.0.0/16" + destinationIpv6Cidr := "::/0" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteConfigConditionalIpv4Ipv6(rName, destinationCidr, destinationIpv6Cidr, false), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + ), + }, + { + Config: testAccAWSRouteConfigConditionalIpv4Ipv6(rName, destinationCidr, destinationIpv6Cidr, true), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationIpv6Cidr), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSRoute_IPv4_Update_Target(t *testing.T) { + var route ec2.Route + resourceName := "aws_route.test" + vgwResourceName := "aws_vpn_gateway.test" + instanceResourceName := "aws_instance.test" + igwResourceName := "aws_internet_gateway.test" + eniResourceName := "aws_network_interface.test" + pcxResourceName := "aws_vpc_peering_connection.test" + ngwResourceName := "aws_nat_gateway.test" + tgwResourceName := "aws_ec2_transit_gateway.test" + vpcEndpointResourceName := "aws_vpc_endpoint.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "10.3.0.0/16" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckElbv2GatewayLoadBalancer(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID, "elasticloadbalancing"), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteConfigIpv4FlexiTarget(rName, destinationCidr, "instance_id", instanceResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), + testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", instanceResourceName, "primary_network_interface_id"), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv4FlexiTarget(rName, destinationCidr, "gateway_id", vgwResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "gateway_id", vgwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv4FlexiTarget(rName, destinationCidr, "gateway_id", igwResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "gateway_id", igwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv4FlexiTarget(rName, destinationCidr, "nat_gateway_id", ngwResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "nat_gateway_id", ngwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv4FlexiTarget(rName, destinationCidr, "network_interface_id", eniResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", eniResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateBlackhole), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv4FlexiTarget(rName, destinationCidr, "transit_gateway_id", tgwResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttrPair(resourceName, "transit_gateway_id", tgwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv4FlexiTarget(rName, destinationCidr, "vpc_endpoint_id", vpcEndpointResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "vpc_endpoint_id", vpcEndpointResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv4FlexiTarget(rName, destinationCidr, "vpc_peering_connection_id", pcxResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "vpc_peering_connection_id", pcxResourceName, "id"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSRoute_IPv6_Update_Target(t *testing.T) { + var route ec2.Route + resourceName := "aws_route.test" + vgwResourceName := "aws_vpn_gateway.test" + instanceResourceName := "aws_instance.test" + igwResourceName := "aws_internet_gateway.test" + eniResourceName := "aws_network_interface.test" + pcxResourceName := "aws_vpc_peering_connection.test" + eoigwResourceName := "aws_egress_only_internet_gateway.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + destinationCidr := "::/0" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteConfigIpv6FlexiTarget(rName, destinationCidr, "instance_id", instanceResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "instance_id", instanceResourceName, "id"), + testAccCheckResourceAttrAccountID(resourceName, "instance_owner_id"), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", instanceResourceName, "primary_network_interface_id"), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv6FlexiTarget(rName, destinationCidr, "gateway_id", vgwResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "gateway_id", vgwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv6FlexiTarget(rName, destinationCidr, "gateway_id", igwResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "gateway_id", igwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv6FlexiTarget(rName, destinationCidr, "egress_only_gateway_id", eoigwResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "egress_only_gateway_id", eoigwResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv6FlexiTarget(rName, destinationCidr, "network_interface_id", eniResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "network_interface_id", eniResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateBlackhole), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + Config: testAccAWSRouteConfigIpv6FlexiTarget(rName, destinationCidr, "vpc_peering_connection_id", pcxResourceName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "vpc_endpoint_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "vpc_peering_connection_id", pcxResourceName, "id"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSRoute_IPv4_To_VpcEndpoint(t *testing.T) { + var route ec2.Route + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_route.test" + vpcEndpointResourceName := "aws_vpc_endpoint.test" + destinationCidr := "172.16.1.0/24" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID, "elasticloadbalancing"), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteResourceConfigIpv4VpcEndpoint(rName, destinationCidr), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSRouteExists(resourceName, &route), + resource.TestCheckResourceAttr(resourceName, "carrier_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "destination_cidr_block", destinationCidr), + resource.TestCheckResourceAttr(resourceName, "destination_ipv6_cidr_block", ""), + resource.TestCheckResourceAttr(resourceName, "destination_prefix_list_id", ""), + resource.TestCheckResourceAttr(resourceName, "egress_only_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_id", ""), + resource.TestCheckResourceAttr(resourceName, "instance_owner_id", ""), + resource.TestCheckResourceAttr(resourceName, "local_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "nat_gateway_id", ""), + resource.TestCheckResourceAttr(resourceName, "network_interface_id", ""), + resource.TestCheckResourceAttr(resourceName, "origin", ec2.RouteOriginCreateRoute), + resource.TestCheckResourceAttr(resourceName, "state", ec2.RouteStateActive), + resource.TestCheckResourceAttr(resourceName, "transit_gateway_id", ""), + resource.TestCheckResourceAttrPair(resourceName, "vpc_endpoint_id", vpcEndpointResourceName, "id"), + resource.TestCheckResourceAttr(resourceName, "vpc_peering_connection_id", ""), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccAWSRouteImportStateIdFunc(resourceName), + ImportStateVerify: true, + }, + }, + }) +} + +// https://github.com/terraform-providers/terraform-provider-aws/issues/11455. +func TestAccAWSRoute_LocalRoute(t *testing.T) { + var routeTable ec2.RouteTable + var vpc ec2.Vpc + resourceName := "aws_route.test" + rtResourceName := "aws_route_table.test" + vpcResourceName := "aws_vpc.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSRouteDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSRouteConfigIpv4NoRoute(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(vpcResourceName, &vpc), + testAccCheckRouteTableExists(rtResourceName, &routeTable), + testAccCheckAWSRouteTableNumberOfRoutes(&routeTable, 1), + ), + }, + { + Config: testAccAWSRouteConfigIpv4LocalRoute(rName), + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: func(rt *ec2.RouteTable, v *ec2.Vpc) resource.ImportStateIdFunc { + return func(s *terraform.State) (string, error) { + return fmt.Sprintf("%s_%s", aws.StringValue(rt.RouteTableId), aws.StringValue(v.CidrBlock)), nil + } + }(&routeTable, &vpc), + // Don't verify the state as the local route isn't actually in the pre-import state. + // Just running ImportState verifies that we can import a local route. + ImportStateVerify: false, + }, + }, + }) +} + +func testAccCheckAWSRouteExists(n string, v *ec2.Route) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } + if rs.Primary.ID == "" { return fmt.Errorf("No ID is set") } - conn := testAccProvider.Meta().(*AWSClient).ec2conn - r, err := resourceAwsRouteFindRoute( - conn, - rs.Primary.Attributes["route_table_id"], - rs.Primary.Attributes["destination_cidr_block"], - rs.Primary.Attributes["destination_ipv6_cidr_block"], - ) + conn := testAccProvider.Meta().(*AWSClient).ec2conn + + var route *ec2.Route + var err error + if v := rs.Primary.Attributes["destination_cidr_block"]; v != "" { + route, err = finder.RouteByIPv4Destination(conn, rs.Primary.Attributes["route_table_id"], v) + } else if v := rs.Primary.Attributes["destination_ipv6_cidr_block"]; v != "" { + route, err = finder.RouteByIPv6Destination(conn, rs.Primary.Attributes["route_table_id"], v) + } + + if err != nil { + return err + } + + *v = *route + + return nil + } +} + +func testAccCheckAWSRouteDestroy(s *terraform.State) error { + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_route" { + continue + } + + conn := testAccProvider.Meta().(*AWSClient).ec2conn + + var err error + if v := rs.Primary.Attributes["destination_cidr_block"]; v != "" { + _, err = finder.RouteByIPv4Destination(conn, rs.Primary.Attributes["route_table_id"], v) + } else if v := rs.Primary.Attributes["destination_ipv6_cidr_block"]; v != "" { + _, err = finder.RouteByIPv6Destination(conn, rs.Primary.Attributes["route_table_id"], v) + } + + if tfresource.NotFound(err) { + continue + } + + if err != nil { + return err + } + + return fmt.Errorf("Route still exists") + } + + return nil +} + +func testAccAWSRouteImportStateIdFunc(resourceName string) resource.ImportStateIdFunc { + return func(s *terraform.State) (string, error) { + rs, ok := s.RootModule().Resources[resourceName] + if !ok { + return "", fmt.Errorf("not found: %s", resourceName) + } + + destination := rs.Primary.Attributes["destination_cidr_block"] + if v, ok := rs.Primary.Attributes["destination_ipv6_cidr_block"]; ok && v != "" { + destination = v + } + + return fmt.Sprintf("%s_%s", rs.Primary.Attributes["route_table_id"], destination), nil + } +} + +func testAccAWSRouteConfigIpv4InternetGateway(rName, destinationCidr string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + + tags = { + Name = %[1]q + } +} + +resource "aws_internet_gateway" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = %[2]q + gateway_id = aws_internet_gateway.test.id +} +`, rName, destinationCidr) +} + +func testAccAWSRouteConfigIpv6InternetGateway(rName, destinationCidr string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags = { + Name = %[1]q + } +} + +resource "aws_egress_only_internet_gateway" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_internet_gateway" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_ipv6_cidr_block = %[2]q + gateway_id = aws_internet_gateway.test.id +} +`, rName, destinationCidr) +} + +func testAccAWSRouteConfigIpv6NetworkInterfaceUnattached(rName, destinationCidr string) string { + return composeConfig( + testAccAvailableAZsNoOptInConfig(), + fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags = { + Name = %[1]q + } +} + +resource "aws_subnet" "test" { + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id + availability_zone = data.aws_availability_zones.available.names[0] + ipv6_cidr_block = cidrsubnet(aws_vpc.test.ipv6_cidr_block, 8, 1) + + tags = { + Name = %[1]q + } +} + +resource "aws_network_interface" "test" { + subnet_id = aws_subnet.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_ipv6_cidr_block = %[2]q + network_interface_id = aws_network_interface.test.id +} +`, rName, destinationCidr)) +} + +func testAccAWSRouteConfigIpv6Instance(rName, destinationCidr string) string { + return composeConfig( + testAccLatestAmazonNatInstanceAmiConfig(), + testAccAvailableAZsNoOptInConfig(), + testAccAvailableEc2InstanceTypeForAvailabilityZone("data.aws_availability_zones.available.names[0]", "t3.micro", "t2.micro"), + fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags = { + Name = %[1]q + } +} + +resource "aws_subnet" "test" { + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id + availability_zone = data.aws_availability_zones.available.names[0] + ipv6_cidr_block = cidrsubnet(aws_vpc.test.ipv6_cidr_block, 8, 1) + + tags = { + Name = %[1]q + } +} + +resource "aws_instance" "test" { + ami = data.aws_ami.amzn-ami-nat-instance.id + instance_type = data.aws_ec2_instance_type_offering.available.instance_type + subnet_id = aws_subnet.test.id + + ipv6_address_count = 1 + + tags = { + Name = %[1]q + } +} + +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_ipv6_cidr_block = %[2]q + instance_id = aws_instance.test.id +} +`, rName, destinationCidr)) +} + +func testAccAWSRouteConfigIpv6VpcPeeringConnection(rName, destinationCidr string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags = { + Name = %[1]q + } +} + +resource "aws_vpc" "target" { + cidr_block = "10.0.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags = { + Name = %[1]q + } +} + +resource "aws_vpc_peering_connection" "test" { + vpc_id = aws_vpc.test.id + peer_vpc_id = aws_vpc.target.id + auto_accept = true + + tags = { + Name = %[1]q + } +} + +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_ipv6_cidr_block = %[2]q + vpc_peering_connection_id = aws_vpc_peering_connection.test.id +} +`, rName, destinationCidr) +} + +func testAccAWSRouteConfigIpv6EgressOnlyInternetGateway(rName, destinationCidr string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags = { + Name = %[1]q + } +} + +resource "aws_egress_only_internet_gateway" "test" { + vpc_id = aws_vpc.test.id - if err != nil { - return err - } + tags = { + Name = %[1]q + } +} - if r == nil { - return fmt.Errorf("Route not found") - } +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id - *res = *r + tags = { + Name = %[1]q + } +} - return nil - } +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_ipv6_cidr_block = %[2]q + egress_only_gateway_id = aws_egress_only_internet_gateway.test.id +} +`, rName, destinationCidr) } -func testAccCheckAWSRouteDestroy(s *terraform.State) error { - for _, rs := range s.RootModule().Resources { - if rs.Type != "aws_route" { - continue - } +func testAccAWSRouteConfigWithVpcEndpoint(rName string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" - conn := testAccProvider.Meta().(*AWSClient).ec2conn - route, err := resourceAwsRouteFindRoute( - conn, - rs.Primary.Attributes["route_table_id"], - rs.Primary.Attributes["destination_cidr_block"], - rs.Primary.Attributes["destination_ipv6_cidr_block"], - ) - - if route == nil && err == nil { - return nil - } - } + tags = { + Name = %[1]q + } +} - return nil +resource "aws_internet_gateway" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } -func testAccAWSRouteImportStateIdFunc(resourceName string) resource.ImportStateIdFunc { - return func(s *terraform.State) (string, error) { - rs, ok := s.RootModule().Resources[resourceName] - if !ok { - return "", fmt.Errorf("not found: %s", resourceName) - } +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = "10.3.0.0/16" + gateway_id = aws_internet_gateway.test.id + + # Forcing endpoint to create before route - without this the crash is a race. + depends_on = [aws_vpc_endpoint.test] +} + +data "aws_region" "current" {} + +resource "aws_vpc_endpoint" "test" { + vpc_id = aws_vpc.test.id + service_name = "com.amazonaws.${data.aws_region.current.name}.s3" + route_table_ids = [aws_route_table.test.id] +} +`, rName) +} + +func testAccAWSRouteConfigIpv4TransitGateway(rName, destinationCidr string) string { + return composeConfig( + testAccAvailableAZsNoOptInDefaultExcludeConfig(), + fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + + tags = { + Name = %[1]q + } +} + +resource "aws_subnet" "test" { + availability_zone = data.aws_availability_zones.available.names[0] + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_ec2_transit_gateway" "test" { + tags = { + Name = %[1]q + } +} + +resource "aws_ec2_transit_gateway_vpc_attachment" "test" { + subnet_ids = [aws_subnet.test.id] + transit_gateway_id = aws_ec2_transit_gateway.test.id + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route" "test" { + destination_cidr_block = %[2]q + route_table_id = aws_route_table.test.id + transit_gateway_id = aws_ec2_transit_gateway_vpc_attachment.test.transit_gateway_id +} +`, rName, destinationCidr)) +} + +func testAccAWSRouteConfigIpv6TransitGateway(rName, destinationCidr string) string { + return composeConfig( + testAccAvailableAZsNoOptInConfig(), + fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags = { + Name = %[1]q + } +} + +resource "aws_subnet" "test" { + availability_zone = data.aws_availability_zones.available.names[0] + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_ec2_transit_gateway" "test" { + tags = { + Name = %[1]q + } +} + +resource "aws_ec2_transit_gateway_vpc_attachment" "test" { + subnet_ids = [aws_subnet.test.id] + transit_gateway_id = aws_ec2_transit_gateway.test.id + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route" "test" { + destination_ipv6_cidr_block = %[2]q + route_table_id = aws_route_table.test.id + transit_gateway_id = aws_ec2_transit_gateway_vpc_attachment.test.transit_gateway_id +} +`, rName, destinationCidr)) +} + +func testAccAWSRouteConfigConditionalIpv4Ipv6(rName, destinationCidr, destinationIpv6Cidr string, ipv6Route bool) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags = { + Name = %[1]q + } +} + +resource "aws_internet_gateway" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +locals { + ipv6 = %[4]t + destination = %[2]q + destination_ipv6 = %[3]q +} + +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + gateway_id = aws_internet_gateway.test.id + + destination_cidr_block = local.ipv6 ? "" : local.destination + destination_ipv6_cidr_block = local.ipv6 ? local.destination_ipv6 : "" +} +`, rName, destinationCidr, destinationIpv6Cidr, ipv6Route) +} + +func testAccAWSRouteConfigIpv4Instance(rName, destinationCidr string) string { + return composeConfig( + testAccLatestAmazonNatInstanceAmiConfig(), + testAccAvailableAZsNoOptInConfig(), + testAccAvailableEc2InstanceTypeForAvailabilityZone("data.aws_availability_zones.available.names[0]", "t3.micro", "t2.micro"), + fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + + tags = { + Name = %[1]q + } +} + +resource "aws_subnet" "test" { + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id + availability_zone = data.aws_availability_zones.available.names[0] + + tags = { + Name = %[1]q + } +} + +resource "aws_instance" "test" { + ami = data.aws_ami.amzn-ami-nat-instance.id + instance_type = data.aws_ec2_instance_type_offering.available.instance_type + subnet_id = aws_subnet.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } +} + +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = %[2]q + instance_id = aws_instance.test.id +} +`, rName, destinationCidr)) +} + +func testAccAWSRouteConfigIpv4NetworkInterfaceUnattached(rName, destinationCidr string) string { + return composeConfig( + testAccAvailableAZsNoOptInConfig(), + fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + + tags = { + Name = %[1]q + } +} - destination := rs.Primary.Attributes["destination_cidr_block"] - if v, ok := rs.Primary.Attributes["destination_ipv6_cidr_block"]; ok && v != "" { - destination = v - } +resource "aws_subnet" "test" { + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id + availability_zone = data.aws_availability_zones.available.names[0] - return fmt.Sprintf("%s_%s", rs.Primary.Attributes["route_table_id"], destination), nil - } + tags = { + Name = %[1]q + } } -func testAccAWSRouteBasicConfig() string { - return ` -resource "aws_vpc" "foo" { - cidr_block = "10.1.0.0/16" +resource "aws_network_interface" "test" { + subnet_id = aws_subnet.test.id tags = { - Name = "terraform-testacc-route-basic" + Name = %[1]q } } -resource "aws_internet_gateway" "foo" { - vpc_id = aws_vpc.foo.id +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id tags = { - Name = "terraform-testacc-route-basic" + Name = %[1]q } } -resource "aws_route_table" "foo" { - vpc_id = aws_vpc.foo.id +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = %[2]q + network_interface_id = aws_network_interface.test.id +} +`, rName, destinationCidr)) } -resource "aws_route" "bar" { - route_table_id = aws_route_table.foo.id - destination_cidr_block = "10.3.0.0/16" - gateway_id = aws_internet_gateway.foo.id +func testAccAWSRouteResourceConfigIpv4LocalGateway(rName, destinationCidr string) string { + return fmt.Sprintf(` +data "aws_ec2_local_gateways" "all" {} + +data "aws_ec2_local_gateway" "first" { + id = tolist(data.aws_ec2_local_gateways.all.ids)[0] } -` + +data "aws_ec2_local_gateway_route_tables" "all" {} + +data "aws_ec2_local_gateway_route_table" "first" { + local_gateway_route_table_id = tolist(data.aws_ec2_local_gateway_route_tables.all.ids)[0] } -func testAccAWSRouteConfigIpv6InternetGateway() string { - return ` -resource "aws_vpc" "foo" { - cidr_block = "10.1.0.0/16" - assign_generated_ipv6_cidr_block = true +resource "aws_vpc" "test" { + cidr_block = "10.0.0.0/16" tags = { - Name = "terraform-testacc-route-ipv6-igw" + Name = %[1]q } } -resource "aws_egress_only_internet_gateway" "foo" { - vpc_id = aws_vpc.foo.id +resource "aws_ec2_local_gateway_route_table_vpc_association" "example" { + local_gateway_route_table_id = data.aws_ec2_local_gateway_route_table.first.id + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } -resource "aws_internet_gateway" "foo" { - vpc_id = aws_vpc.foo.id +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id tags = { - Name = "terraform-testacc-route-ipv6-igw" + Name = %[1]q } + + depends_on = [aws_ec2_local_gateway_route_table_vpc_association.example] } -resource "aws_route_table" "external" { - vpc_id = aws_vpc.foo.id +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = %[2]q + local_gateway_id = data.aws_ec2_local_gateway.first.id +} +`, rName, destinationCidr) } -resource "aws_route" "igw" { - route_table_id = aws_route_table.external.id - destination_ipv6_cidr_block = "::/0" - gateway_id = aws_internet_gateway.foo.id +func testAccAWSRouteResourceConfigIpv6LocalGateway(rName, destinationCidr string) string { + return fmt.Sprintf(` +data "aws_ec2_local_gateways" "all" {} + +data "aws_ec2_local_gateway" "first" { + id = tolist(data.aws_ec2_local_gateways.all.ids)[0] } -` + +data "aws_ec2_local_gateway_route_tables" "all" {} + +data "aws_ec2_local_gateway_route_table" "first" { + local_gateway_route_table_id = tolist(data.aws_ec2_local_gateway_route_tables.all.ids)[0] } -func testAccAWSRouteConfigIpv6NetworkInterface() string { - return composeConfig( - testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.router-network.availability_zone", "t2.small", "t3.small"), - testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` -resource "aws_vpc" "examplevpc" { - cidr_block = "10.100.0.0/16" - enable_dns_hostnames = true +resource "aws_vpc" "test" { + cidr_block = "10.0.0.0/16" assign_generated_ipv6_cidr_block = true tags = { - Name = "terraform-testacc-route-ipv6-network-interface" + Name = %[1]q } } -data "aws_availability_zones" "available" { - state = "available" +resource "aws_ec2_local_gateway_route_table_vpc_association" "example" { + local_gateway_route_table_id = data.aws_ec2_local_gateway_route_table.first.id + vpc_id = aws_vpc.test.id - filter { - name = "opt-in-status" - values = ["opt-in-not-required"] + tags = { + Name = %[1]q } } -resource "aws_internet_gateway" "internet" { - vpc_id = aws_vpc.examplevpc.id +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id tags = { - Name = "terraform-testacc-route-ipv6-network-interface" + Name = %[1]q } -} -resource "aws_route" "igw" { - route_table_id = aws_vpc.examplevpc.main_route_table_id - destination_cidr_block = "0.0.0.0/0" - gateway_id = aws_internet_gateway.internet.id + depends_on = [aws_ec2_local_gateway_route_table_vpc_association.example] } -resource "aws_route" "igw-ipv6" { - route_table_id = aws_vpc.examplevpc.main_route_table_id - destination_ipv6_cidr_block = "::/0" - gateway_id = aws_internet_gateway.internet.id +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_ipv6_cidr_block = %[2]q + local_gateway_id = data.aws_ec2_local_gateway.first.id +} +`, rName, destinationCidr) } -resource "aws_subnet" "router-network" { - cidr_block = "10.100.1.0/24" - vpc_id = aws_vpc.examplevpc.id - ipv6_cidr_block = cidrsubnet(aws_vpc.examplevpc.ipv6_cidr_block, 8, 1) - assign_ipv6_address_on_creation = true - map_public_ip_on_launch = true - availability_zone = data.aws_availability_zones.available.names[0] +func testAccAWSRouteConfigIpv4NetworkInterfaceAttached(rName, destinationCidr string) string { + return composeConfig( + testAccLatestAmazonNatInstanceAmiConfig(), + testAccAvailableAZsNoOptInConfig(), + testAccAvailableEc2InstanceTypeForAvailabilityZone("data.aws_availability_zones.available.names[0]", "t3.micro", "t2.micro"), + fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" tags = { - Name = "tf-acc-route-ipv6-network-interface-router" + Name = %[1]q } } -resource "aws_subnet" "client-network" { - cidr_block = "10.100.10.0/24" - vpc_id = aws_vpc.examplevpc.id - ipv6_cidr_block = cidrsubnet(aws_vpc.examplevpc.ipv6_cidr_block, 8, 2) - assign_ipv6_address_on_creation = true - map_public_ip_on_launch = false - availability_zone = data.aws_availability_zones.available.names[0] +resource "aws_subnet" "test" { + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id + availability_zone = data.aws_availability_zones.available.names[0] tags = { - Name = "tf-acc-route-ipv6-network-interface-client" + Name = %[1]q } } -resource "aws_route_table" "client-routes" { - vpc_id = aws_vpc.examplevpc.id -} +resource "aws_network_interface" "test" { + subnet_id = aws_subnet.test.id -resource "aws_route_table_association" "client-routes" { - route_table_id = aws_route_table.client-routes.id - subnet_id = aws_subnet.client-network.id + tags = { + Name = %[1]q + } } -resource "aws_instance" "test-router" { - ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id +resource "aws_instance" "test" { + ami = data.aws_ami.amzn-ami-nat-instance.id instance_type = data.aws_ec2_instance_type_offering.available.instance_type - subnet_id = aws_subnet.router-network.id -} -resource "aws_network_interface" "router-internal" { - subnet_id = aws_subnet.client-network.id - source_dest_check = false -} + network_interface { + device_index = 0 + network_interface_id = aws_network_interface.test.id + } -resource "aws_network_interface_attachment" "router-internal" { - device_index = 1 - instance_id = aws_instance.test-router.id - network_interface_id = aws_network_interface.router-internal.id + tags = { + Name = %[1]q + } } -resource "aws_route" "internal-default-route" { - route_table_id = aws_route_table.client-routes.id - destination_cidr_block = "0.0.0.0/0" - network_interface_id = aws_network_interface.router-internal.id +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } -resource "aws_route" "internal-default-route-ipv6" { - route_table_id = aws_route_table.client-routes.id - destination_ipv6_cidr_block = "::/0" - network_interface_id = aws_network_interface.router-internal.id +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = %[2]q + network_interface_id = aws_network_interface.test.id + + # Wait for the ENI attachment. + depends_on = [aws_instance.test] } -`) +`, rName, destinationCidr)) } -func testAccAWSRouteConfigIpv6Instance() string { +func testAccAWSRouteConfigIpv4NetworkInterfaceTwoAttachments(rName, destinationCidr, targetResourceName string) string { return composeConfig( - testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.router-network.availability_zone", "t2.small", "t3.small"), - testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` -resource "aws_vpc" "examplevpc" { - cidr_block = "10.100.0.0/16" - enable_dns_hostnames = true - assign_generated_ipv6_cidr_block = true + testAccLatestAmazonNatInstanceAmiConfig(), + testAccAvailableAZsNoOptInConfig(), + testAccAvailableEc2InstanceTypeForAvailabilityZone("data.aws_availability_zones.available.names[0]", "t3.micro", "t2.micro"), + fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" tags = { - Name = "terraform-testacc-route-ipv6-instance" + Name = %[1]q } } -data "aws_availability_zones" "available" { - state = "available" +resource "aws_subnet" "test" { + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id + availability_zone = data.aws_availability_zones.available.names[0] - filter { - name = "opt-in-status" - values = ["opt-in-not-required"] + tags = { + Name = %[1]q } } -resource "aws_internet_gateway" "internet" { - vpc_id = aws_vpc.examplevpc.id +resource "aws_network_interface" "test1" { + subnet_id = aws_subnet.test.id tags = { - Name = "terraform-testacc-route-ipv6-instance" + Name = %[1]q } } -resource "aws_route" "igw" { - route_table_id = aws_vpc.examplevpc.main_route_table_id - destination_cidr_block = "0.0.0.0/0" - gateway_id = aws_internet_gateway.internet.id -} +resource "aws_network_interface" "test2" { + subnet_id = aws_subnet.test.id -resource "aws_route" "igw-ipv6" { - route_table_id = aws_vpc.examplevpc.main_route_table_id - destination_ipv6_cidr_block = "::/0" - gateway_id = aws_internet_gateway.internet.id + tags = { + Name = %[1]q + } } -resource "aws_subnet" "router-network" { - cidr_block = "10.100.1.0/24" - vpc_id = aws_vpc.examplevpc.id - ipv6_cidr_block = cidrsubnet(aws_vpc.examplevpc.ipv6_cidr_block, 8, 1) - assign_ipv6_address_on_creation = true - map_public_ip_on_launch = true - availability_zone = data.aws_availability_zones.available.names[0] +resource "aws_instance" "test" { + ami = data.aws_ami.amzn-ami-nat-instance.id + instance_type = data.aws_ec2_instance_type_offering.available.instance_type + + network_interface { + device_index = 0 + network_interface_id = aws_network_interface.test1.id + } + + network_interface { + device_index = 1 + network_interface_id = aws_network_interface.test2.id + } tags = { - Name = "tf-acc-route-ipv6-instance-router" + Name = %[1]q } } -resource "aws_subnet" "client-network" { - cidr_block = "10.100.10.0/24" - vpc_id = aws_vpc.examplevpc.id - ipv6_cidr_block = cidrsubnet(aws_vpc.examplevpc.ipv6_cidr_block, 8, 2) - assign_ipv6_address_on_creation = true - map_public_ip_on_launch = false - availability_zone = data.aws_availability_zones.available.names[0] +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id tags = { - Name = "tf-acc-route-ipv6-instance-client" + Name = %[1]q } } -resource "aws_route_table" "client-routes" { - vpc_id = aws_vpc.examplevpc.id -} +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = %[2]q + network_interface_id = %[3]s.id -resource "aws_route_table_association" "client-routes" { - route_table_id = aws_route_table.client-routes.id - subnet_id = aws_subnet.client-network.id + # Wait for the ENI attachment. + depends_on = [aws_instance.test] } - -resource "aws_instance" "test-router" { - ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id - instance_type = data.aws_ec2_instance_type_offering.available.instance_type - subnet_id = aws_subnet.router-network.id +`, rName, destinationCidr, targetResourceName)) } -resource "aws_route" "internal-default-route" { - route_table_id = aws_route_table.client-routes.id - destination_cidr_block = "0.0.0.0/0" - instance_id = aws_instance.test-router.id -} +func testAccAWSRouteConfigIpv4VpcPeeringConnection(rName, destinationCidr string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" -resource "aws_route" "internal-default-route-ipv6" { - route_table_id = aws_route_table.client-routes.id - destination_ipv6_cidr_block = "::/0" - instance_id = aws_instance.test-router.id -} -`) + tags = { + Name = %[1]q + } } -func testAccAWSRouteConfigIpv6InstanceExpanded() string { - return composeConfig( - testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.router-network.availability_zone", "t2.small", "t3.small"), - testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` -resource "aws_vpc" "examplevpc" { - cidr_block = "10.100.0.0/16" - enable_dns_hostnames = true - assign_generated_ipv6_cidr_block = true +resource "aws_vpc" "target" { + cidr_block = "10.0.0.0/16" tags = { - Name = "terraform-testacc-route-ipv6-instance" + Name = %[1]q } } -data "aws_availability_zones" "available" { - state = "available" +resource "aws_vpc_peering_connection" "test" { + vpc_id = aws_vpc.test.id + peer_vpc_id = aws_vpc.target.id + auto_accept = true - filter { - name = "opt-in-status" - values = ["opt-in-not-required"] + tags = { + Name = %[1]q } } -resource "aws_internet_gateway" "internet" { - vpc_id = aws_vpc.examplevpc.id +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id tags = { - Name = "terraform-testacc-route-ipv6-instance" + Name = %[1]q } } -resource "aws_route" "igw" { - route_table_id = aws_vpc.examplevpc.main_route_table_id - destination_cidr_block = "0.0.0.0/0" - gateway_id = aws_internet_gateway.internet.id +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = %[2]q + vpc_peering_connection_id = aws_vpc_peering_connection.test.id } - -resource "aws_route" "igw-ipv6" { - route_table_id = aws_vpc.examplevpc.main_route_table_id - destination_ipv6_cidr_block = "::0/0" - gateway_id = aws_internet_gateway.internet.id +`, rName, destinationCidr) } -resource "aws_subnet" "router-network" { - cidr_block = "10.100.1.0/24" - vpc_id = aws_vpc.examplevpc.id - ipv6_cidr_block = cidrsubnet(aws_vpc.examplevpc.ipv6_cidr_block, 8, 1) - assign_ipv6_address_on_creation = true - map_public_ip_on_launch = true - availability_zone = data.aws_availability_zones.available.names[0] +func testAccAWSRouteConfigIpv4NatGateway(rName, destinationCidr string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" tags = { - Name = "tf-acc-route-ipv6-instance-router" + Name = %[1]q } } -resource "aws_subnet" "client-network" { - cidr_block = "10.100.10.0/24" - vpc_id = aws_vpc.examplevpc.id - ipv6_cidr_block = cidrsubnet(aws_vpc.examplevpc.ipv6_cidr_block, 8, 2) - assign_ipv6_address_on_creation = true - map_public_ip_on_launch = false - availability_zone = data.aws_availability_zones.available.names[0] +resource "aws_subnet" "test" { + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id + + map_public_ip_on_launch = true tags = { - Name = "tf-acc-route-ipv6-instance-client" + Name = %[1]q } } -resource "aws_route_table" "client-routes" { - vpc_id = aws_vpc.examplevpc.id +resource "aws_internet_gateway" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } -resource "aws_route_table_association" "client-routes" { - route_table_id = aws_route_table.client-routes.id - subnet_id = aws_subnet.client-network.id +resource "aws_eip" "test" { + vpc = true + + tags = { + Name = %[1]q + } } -resource "aws_instance" "test-router" { - ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id - instance_type = data.aws_ec2_instance_type_offering.available.instance_type - subnet_id = aws_subnet.router-network.id +resource "aws_nat_gateway" "test" { + allocation_id = aws_eip.test.id + subnet_id = aws_subnet.test.id + + tags = { + Name = %[1]q + } + + depends_on = [aws_internet_gateway.test] } -resource "aws_route" "internal-default-route" { - route_table_id = aws_route_table.client-routes.id - destination_cidr_block = "0.0.0.0/0" - instance_id = aws_instance.test-router.id +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } -resource "aws_route" "internal-default-route-ipv6" { - route_table_id = aws_route_table.client-routes.id - destination_ipv6_cidr_block = "::0/0" - instance_id = aws_instance.test-router.id +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = %[2]q + nat_gateway_id = aws_nat_gateway.test.id } -`) +`, rName, destinationCidr) } -func testAccAWSRouteConfigIpv6PeeringConnection() string { - return ` -resource "aws_vpc" "foo" { - cidr_block = "10.0.0.0/16" - assign_generated_ipv6_cidr_block = true +func testAccAWSRouteConfigIpv4VpnGateway(rName, destinationCidr string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" tags = { - Name = "terraform-testacc-route-ipv6-peering-connection" + Name = %[1]q } } -resource "aws_vpc" "bar" { - cidr_block = "10.1.0.0/16" - assign_generated_ipv6_cidr_block = true -} +resource "aws_vpn_gateway" "test" { + vpc_id = aws_vpc.test.id -resource "aws_vpc_peering_connection" "foo" { - vpc_id = aws_vpc.foo.id - peer_vpc_id = aws_vpc.bar.id - auto_accept = true + tags = { + Name = %[1]q + } } -resource "aws_route_table" "peering" { - vpc_id = aws_vpc.foo.id +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } -resource "aws_route" "pc" { - route_table_id = aws_route_table.peering.id - destination_ipv6_cidr_block = aws_vpc.bar.ipv6_cidr_block - vpc_peering_connection_id = aws_vpc_peering_connection.foo.id +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = %[2]q + gateway_id = aws_vpn_gateway.test.id } -` +`, rName, destinationCidr) } -func testAccAWSRouteConfigIpv6() string { - return ` -resource "aws_vpc" "foo" { +func testAccAWSRouteConfigIpv6VpnGateway(rName, destinationCidr string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { cidr_block = "10.1.0.0/16" assign_generated_ipv6_cidr_block = true tags = { - Name = "terraform-testacc-route-ipv6" + Name = %[1]q } } -resource "aws_egress_only_internet_gateway" "foo" { - vpc_id = aws_vpc.foo.id +resource "aws_vpn_gateway" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } -resource "aws_route_table" "foo" { - vpc_id = aws_vpc.foo.id +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } -resource "aws_route" "bar" { - route_table_id = aws_route_table.foo.id - destination_ipv6_cidr_block = "::/0" - egress_only_gateway_id = aws_egress_only_internet_gateway.foo.id +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_ipv6_cidr_block = %[2]q + gateway_id = aws_vpn_gateway.test.id } -` +`, rName, destinationCidr) } -func testAccAWSRouteConfigIpv6Expanded() string { - return ` -resource "aws_vpc" "foo" { - cidr_block = "10.1.0.0/16" - assign_generated_ipv6_cidr_block = true +func testAccAWSRouteResourceConfigIpv4VpcEndpoint(rName, destinationCidr string) string { + return composeConfig( + testAccAvailableAZsNoOptInConfig(), + fmt.Sprintf(` +data "aws_caller_identity" "current" {} + +resource "aws_vpc" "test" { + cidr_block = "10.10.10.0/25" + + tags = { + Name = %[1]q + } +} + +resource "aws_subnet" "test" { + availability_zone = data.aws_availability_zones.available.names[0] + cidr_block = cidrsubnet(aws_vpc.test.cidr_block, 2, 0) + vpc_id = aws_vpc.test.id tags = { - Name = "terraform-testacc-route-ipv6" + Name = %[1]q } } -resource "aws_egress_only_internet_gateway" "foo" { - vpc_id = aws_vpc.foo.id -} - -resource "aws_route_table" "foo" { - vpc_id = aws_vpc.foo.id -} +resource "aws_lb" "test" { + load_balancer_type = "gateway" + name = %[1]q -resource "aws_route" "bar" { - route_table_id = aws_route_table.foo.id - destination_ipv6_cidr_block = "::0/0" - egress_only_gateway_id = aws_egress_only_internet_gateway.foo.id -} -` + subnet_mapping { + subnet_id = aws_subnet.test.id + } } -func testAccAWSRouteBasicConfigChangeCidr() string { - return ` -resource "aws_vpc" "foo" { - cidr_block = "10.1.0.0/16" +resource "aws_vpc_endpoint_service" "test" { + acceptance_required = false + allowed_principals = [data.aws_caller_identity.current.arn] + gateway_load_balancer_arns = [aws_lb.test.arn] tags = { - Name = "terraform-testacc-route-change-cidr" + Name = %[1]q } } -resource "aws_internet_gateway" "foo" { - vpc_id = aws_vpc.foo.id +resource "aws_vpc_endpoint" "test" { + service_name = aws_vpc_endpoint_service.test.service_name + subnet_ids = [aws_subnet.test.id] + vpc_endpoint_type = aws_vpc_endpoint_service.test.service_type + vpc_id = aws_vpc.test.id tags = { - Name = "terraform-testacc-route-change-cidr" + Name = %[1]q } } -resource "aws_route_table" "foo" { - vpc_id = aws_vpc.foo.id +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } -resource "aws_route" "bar" { - route_table_id = aws_route_table.foo.id - destination_cidr_block = "10.2.0.0/16" - gateway_id = aws_internet_gateway.foo.id +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = %[2]q + vpc_endpoint_id = aws_vpc_endpoint.test.id } -` +`, rName, destinationCidr)) } -func testAccAWSRouteNoopChange() string { +func testAccAWSRouteConfigIpv4FlexiTarget(rName, destinationCidr, targetAttribute, targetValue string) string { return composeConfig( - testAccAvailableEc2InstanceTypeForAvailabilityZone("aws_subnet.test.availability_zone", "t2.nano", "t3.nano"), - testAccLatestAmazonLinuxHvmEbsAmiConfig(), ` -data "aws_availability_zones" "available" { - state = "available" + testAccLatestAmazonLinuxHvmEbsAmiConfig(), + testAccAvailableAZsNoOptInDefaultExcludeConfig(), + testAccAvailableEc2InstanceTypeForAvailabilityZone("data.aws_availability_zones.available.names[0]", "t3.micro", "t2.micro"), + fmt.Sprintf(` +locals { + target_attr = %[3]q + target_value = %[4]s.id +} + +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" - filter { - name = "opt-in-status" - values = ["opt-in-not-required"] + tags = { + Name = %[1]q } } -resource "aws_vpc" "test" { - cidr_block = "10.10.0.0/16" +resource "aws_vpn_gateway" "test" { + vpc_id = aws_vpc.test.id tags = { - Name = "terraform-testacc-route-noop-change" + Name = %[1]q } } -resource "aws_route_table" "test" { +resource "aws_internet_gateway" "test" { vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } resource "aws_subnet" "test" { - availability_zone = data.aws_availability_zones.available.names[0] + cidr_block = "10.1.1.0/24" vpc_id = aws_vpc.test.id - cidr_block = "10.10.10.0/24" + availability_zone = data.aws_availability_zones.available.names[0] + + map_public_ip_on_launch = true tags = { - Name = "tf-acc-route-noop-change" + Name = %[1]q } } -resource "aws_route" "test" { - route_table_id = aws_route_table.test.id - destination_cidr_block = "0.0.0.0/0" - instance_id = aws_instance.nat.id -} - -resource "aws_instance" "nat" { +resource "aws_instance" "test" { ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id instance_type = data.aws_ec2_instance_type_offering.available.instance_type subnet_id = aws_subnet.test.id -} -`) -} - -func testAccAWSRouteWithVPCEndpoint() string { - return ` -data "aws_region" "current" {} - -resource "aws_vpc" "foo" { - cidr_block = "10.1.0.0/16" tags = { - Name = "terraform-testacc-route-with-vpc-endpoint" + Name = %[1]q } } -resource "aws_internet_gateway" "foo" { - vpc_id = aws_vpc.foo.id - +resource "aws_ec2_transit_gateway" "test" { tags = { - Name = "terraform-testacc-route-with-vpc-endpoint" + Name = %[1]q } } -resource "aws_route_table" "foo" { - vpc_id = aws_vpc.foo.id -} - -resource "aws_route" "bar" { - route_table_id = aws_route_table.foo.id - destination_cidr_block = "10.3.0.0/16" - gateway_id = aws_internet_gateway.foo.id - - # Forcing endpoint to create before route - without this the crash is a race. - depends_on = [aws_vpc_endpoint.baz] -} - -resource "aws_vpc_endpoint" "baz" { - vpc_id = aws_vpc.foo.id - service_name = "com.amazonaws.${data.aws_region.current.name}.s3" - route_table_ids = [aws_route_table.foo.id] -} -` -} - -func testAccAWSRouteNewRouteTable() string { - return ` -resource "aws_vpc" "foo" { - cidr_block = "10.1.0.0/16" +resource "aws_ec2_transit_gateway_vpc_attachment" "test" { + subnet_ids = [aws_subnet.test.id] + transit_gateway_id = aws_ec2_transit_gateway.test.id + vpc_id = aws_vpc.test.id tags = { - Name = "terraform-testacc-route-basic" + Name = %[1]q } } -resource "aws_vpc" "bar" { - cidr_block = "10.2.0.0/16" +resource "aws_network_interface" "test" { + subnet_id = aws_subnet.test.id tags = { - Name = "terraform-testacc-route-new-route-table" + Name = %[1]q } } -resource "aws_internet_gateway" "foo" { - vpc_id = aws_vpc.foo.id +resource "aws_vpc" "target" { + cidr_block = "10.0.0.0/16" tags = { - Name = "terraform-testacc-route-basic" + Name = %[1]q } } -resource "aws_internet_gateway" "bar" { - vpc_id = aws_vpc.bar.id +resource "aws_vpc_peering_connection" "test" { + vpc_id = aws_vpc.test.id + peer_vpc_id = aws_vpc.target.id + auto_accept = true tags = { - Name = "terraform-testacc-route-new-route-table" + Name = %[1]q } } -resource "aws_route_table" "foo" { - vpc_id = aws_vpc.foo.id +resource "aws_eip" "test" { + vpc = true tags = { - Name = "terraform-testacc-route-basic" + Name = %[1]q } } -resource "aws_route_table" "bar" { - vpc_id = aws_vpc.bar.id +resource "aws_nat_gateway" "test" { + allocation_id = aws_eip.test.id + subnet_id = aws_subnet.test.id tags = { - Name = "terraform-testacc-route-new-route-table" + Name = %[1]q } -} -resource "aws_route" "bar" { - route_table_id = aws_route_table.bar.id - destination_cidr_block = "10.4.0.0/16" - gateway_id = aws_internet_gateway.bar.id -} -` + depends_on = [aws_internet_gateway.test] } -func testAccAWSRouteConfigTransitGatewayIDDestinatationCidrBlock() string { - return composeConfig(testAccAvailableAZsNoOptInDefaultExcludeConfig(), - ` -# IncorrectState: Transit Gateway is not available in availability zone usw2-az4 +data "aws_caller_identity" "current" {} -resource "aws_vpc" "test" { - cidr_block = "10.0.0.0/16" +resource "aws_lb" "test" { + load_balancer_type = "gateway" + name = %[1]q + + subnet_mapping { + subnet_id = aws_subnet.test.id + } +} + +resource "aws_vpc_endpoint_service" "test" { + acceptance_required = false + allowed_principals = [data.aws_caller_identity.current.arn] + gateway_load_balancer_arns = [aws_lb.test.arn] tags = { - Name = "tf-acc-test-ec2-route-transit-gateway-id" + Name = %[1]q } } -resource "aws_subnet" "test" { - availability_zone = data.aws_availability_zones.available.names[0] - cidr_block = "10.0.0.0/24" +resource "aws_vpc_endpoint" "test" { + service_name = aws_vpc_endpoint_service.test.service_name + subnet_ids = [aws_subnet.test.id] + vpc_endpoint_type = aws_vpc_endpoint_service.test.service_type vpc_id = aws_vpc.test.id tags = { - Name = "tf-acc-test-ec2-route-transit-gateway-id" + Name = %[1]q } } -resource "aws_ec2_transit_gateway" "test" {} +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id -resource "aws_ec2_transit_gateway_vpc_attachment" "test" { - subnet_ids = [aws_subnet.test.id] - transit_gateway_id = aws_ec2_transit_gateway.test.id - vpc_id = aws_vpc.test.id + tags = { + Name = %[1]q + } } resource "aws_route" "test" { - destination_cidr_block = "0.0.0.0/0" - route_table_id = aws_vpc.test.default_route_table_id - transit_gateway_id = aws_ec2_transit_gateway_vpc_attachment.test.transit_gateway_id + route_table_id = aws_route_table.test.id + destination_cidr_block = %[2]q + + carrier_gateway_id = (local.target_attr == "carrier_gateway_id") ? local.target_value : null + egress_only_gateway_id = (local.target_attr == "egress_only_gateway_id") ? local.target_value : null + gateway_id = (local.target_attr == "gateway_id") ? local.target_value : null + instance_id = (local.target_attr == "instance_id") ? local.target_value : null + local_gateway_id = (local.target_attr == "local_gateway_id") ? local.target_value : null + nat_gateway_id = (local.target_attr == "nat_gateway_id") ? local.target_value : null + network_interface_id = (local.target_attr == "network_interface_id") ? local.target_value : null + transit_gateway_id = (local.target_attr == "transit_gateway_id") ? local.target_value : null + vpc_endpoint_id = (local.target_attr == "vpc_endpoint_id") ? local.target_value : null + vpc_peering_connection_id = (local.target_attr == "vpc_peering_connection_id") ? local.target_value : null } -`) +`, rName, destinationCidr, targetAttribute, targetValue)) +} + +func testAccAWSRouteConfigIpv6FlexiTarget(rName, destinationCidr, targetAttribute, targetValue string) string { + return composeConfig( + testAccLatestAmazonLinuxHvmEbsAmiConfig(), + testAccAvailableAZsNoOptInConfig(), + testAccAvailableEc2InstanceTypeForAvailabilityZone("data.aws_availability_zones.available.names[0]", "t3.micro", "t2.micro"), + fmt.Sprintf(` +locals { + target_attr = %[3]q + target_value = %[4]s.id } -func testAccAWSRouteConfigConditionalIpv4Ipv6(rName string, ipv6Route bool) string { - return fmt.Sprintf(` resource "aws_vpc" "test" { cidr_block = "10.1.0.0/16" assign_generated_ipv6_cidr_block = true @@ -1286,7 +2787,7 @@ resource "aws_vpc" "test" { } } -resource "aws_egress_only_internet_gateway" "test" { +resource "aws_vpn_gateway" "test" { vpc_id = aws_vpc.test.id tags = { @@ -1302,118 +2803,154 @@ resource "aws_internet_gateway" "test" { } } -resource "aws_route_table" "test" { - vpc_id = aws_vpc.test.id +resource "aws_subnet" "test" { + cidr_block = "10.1.1.0/24" + vpc_id = aws_vpc.test.id + availability_zone = data.aws_availability_zones.available.names[0] + ipv6_cidr_block = cidrsubnet(aws_vpc.test.ipv6_cidr_block, 8, 1) + + map_public_ip_on_launch = true tags = { Name = %[1]q } } -locals { - ipv6 = %[2]t - destination = "0.0.0.0/0" - destination_ipv6 = "::/0" -} +resource "aws_instance" "test" { + ami = data.aws_ami.amzn-ami-minimal-hvm-ebs.id + instance_type = data.aws_ec2_instance_type_offering.available.instance_type + subnet_id = aws_subnet.test.id -resource "aws_route" "test" { - route_table_id = aws_route_table.test.id - gateway_id = aws_internet_gateway.test.id + ipv6_address_count = 1 - destination_cidr_block = local.ipv6 ? "" : local.destination - destination_ipv6_cidr_block = local.ipv6 ? local.destination_ipv6 : "" -} -`, rName, ipv6Route) + tags = { + Name = %[1]q + } } -func testAccAWSRouteResourceConfigLocalGatewayID() string { - return ` -data "aws_ec2_local_gateways" "all" {} -data "aws_ec2_local_gateway" "first" { - id = tolist(data.aws_ec2_local_gateways.all.ids)[0] +resource "aws_egress_only_internet_gateway" "test" { + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } -data "aws_ec2_local_gateway_route_tables" "all" {} -data "aws_ec2_local_gateway_route_table" "first" { - local_gateway_route_table_id = tolist(data.aws_ec2_local_gateway_route_tables.all.ids)[0] +resource "aws_network_interface" "test" { + subnet_id = aws_subnet.test.id + + tags = { + Name = %[1]q + } } -resource "aws_vpc" "test" { - cidr_block = "10.0.0.0/16" +resource "aws_vpc" "target" { + cidr_block = "10.0.0.0/16" + assign_generated_ipv6_cidr_block = true + + tags = { + Name = %[1]q + } } -resource "aws_ec2_local_gateway_route_table_vpc_association" "example" { - local_gateway_route_table_id = data.aws_ec2_local_gateway_route_table.first.id - vpc_id = aws_vpc.test.id +resource "aws_vpc_peering_connection" "test" { + vpc_id = aws_vpc.test.id + peer_vpc_id = aws_vpc.target.id + auto_accept = true + + tags = { + Name = %[1]q + } } resource "aws_route_table" "test" { - vpc_id = aws_vpc.test.id - depends_on = [aws_ec2_local_gateway_route_table_vpc_association.example] + vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } resource "aws_route" "test" { - route_table_id = aws_route_table.test.id - destination_cidr_block = "172.16.1.0/24" - local_gateway_id = data.aws_ec2_local_gateway.first.id + route_table_id = aws_route_table.test.id + destination_ipv6_cidr_block = %[2]q + + carrier_gateway_id = (local.target_attr == "carrier_gateway_id") ? local.target_value : null + egress_only_gateway_id = (local.target_attr == "egress_only_gateway_id") ? local.target_value : null + gateway_id = (local.target_attr == "gateway_id") ? local.target_value : null + instance_id = (local.target_attr == "instance_id") ? local.target_value : null + local_gateway_id = (local.target_attr == "local_gateway_id") ? local.target_value : null + nat_gateway_id = (local.target_attr == "nat_gateway_id") ? local.target_value : null + network_interface_id = (local.target_attr == "network_interface_id") ? local.target_value : null + transit_gateway_id = (local.target_attr == "transit_gateway_id") ? local.target_value : null + vpc_endpoint_id = (local.target_attr == "vpc_endpoint_id") ? local.target_value : null + vpc_peering_connection_id = (local.target_attr == "vpc_peering_connection_id") ? local.target_value : null } -` +`, rName, destinationCidr, targetAttribute, targetValue)) } -func testAccAWSRouteResourceConfigVpcEndpointId(rName string) string { - return composeConfig( - testAccAvailableAZsNoOptInConfig(), - fmt.Sprintf(` -data "aws_caller_identity" "current" {} - +func testAccAWSRouteConfigIpv4NoRoute(rName string) string { + return fmt.Sprintf(` resource "aws_vpc" "test" { - cidr_block = "10.10.10.0/25" + cidr_block = "10.1.0.0/16" tags = { - Name = "tf-acc-test-load-balancer" + Name = %[1]q } } -resource "aws_subnet" "test" { - availability_zone = data.aws_availability_zones.available.names[0] - cidr_block = cidrsubnet(aws_vpc.test.cidr_block, 2, 0) - vpc_id = aws_vpc.test.id +resource "aws_route_table" "test" { + vpc_id = aws_vpc.test.id tags = { - Name = "tf-acc-test-load-balancer" + Name = %[1]q } } +`, rName) +} -resource "aws_lb" "test" { - load_balancer_type = "gateway" - name = %[1]q +func testAccAWSRouteConfigIpv4LocalRoute(rName string) string { + return composeConfig( + testAccAWSRouteConfigIpv4NoRoute(rName), + ` +resource "aws_route" "test" { + route_table_id = aws_route_table.test.id + destination_cidr_block = aws_vpc.test.cidr_block + gateway_id = "local" +} +`) +} - subnet_mapping { - subnet_id = aws_subnet.test.id +func testAccAWSRouteConfigIpv4CarrierGateway(rName, destinationCidr string) string { + return fmt.Sprintf(` +resource "aws_vpc" "test" { + cidr_block = "10.1.0.0/16" + + tags = { + Name = %[1]q } } -resource "aws_vpc_endpoint_service" "test" { - acceptance_required = false - allowed_principals = [data.aws_caller_identity.current.arn] - gateway_load_balancer_arns = [aws_lb.test.arn] -} +resource "aws_ec2_carrier_gateway" "test" { + vpc_id = aws_vpc.test.id -resource "aws_vpc_endpoint" "test" { - service_name = aws_vpc_endpoint_service.test.service_name - subnet_ids = [aws_subnet.test.id] - vpc_endpoint_type = aws_vpc_endpoint_service.test.service_type - vpc_id = aws_vpc.test.id + tags = { + Name = %[1]q + } } resource "aws_route_table" "test" { vpc_id = aws_vpc.test.id + + tags = { + Name = %[1]q + } } resource "aws_route" "test" { + destination_cidr_block = %[2]q route_table_id = aws_route_table.test.id - destination_cidr_block = "172.16.1.0/24" - vpc_endpoint_id = aws_vpc_endpoint.test.id + carrier_gateway_id = aws_ec2_carrier_gateway.test.id } -`, rName)) +`, rName, destinationCidr) } diff --git a/aws/resource_aws_s3_access_point_test.go b/aws/resource_aws_s3_access_point_test.go index 9dc1917e1325..c6defba78463 100644 --- a/aws/resource_aws_s3_access_point_test.go +++ b/aws/resource_aws_s3_access_point_test.go @@ -86,6 +86,7 @@ func TestAccAWSS3AccessPoint_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccessPointDestroy, Steps: []resource.TestStep{ @@ -126,6 +127,7 @@ func TestAccAWSS3AccessPoint_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccessPointDestroy, Steps: []resource.TestStep{ @@ -150,6 +152,7 @@ func TestAccAWSS3AccessPoint_disappears_Bucket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccessPointDestroy, Steps: []resource.TestStep{ @@ -172,6 +175,7 @@ func TestAccAWSS3AccessPoint_Bucket_Arn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccessPointDestroy, Steps: []resource.TestStep{ @@ -252,6 +256,7 @@ func TestAccAWSS3AccessPoint_Policy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccessPointDestroy, Steps: []resource.TestStep{ @@ -305,6 +310,7 @@ func TestAccAWSS3AccessPoint_PublicAccessBlockConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccessPointDestroy, Steps: []resource.TestStep{ @@ -344,6 +350,7 @@ func TestAccAWSS3AccessPoint_VpcConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccessPointDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3_account_public_access_block_test.go b/aws/resource_aws_s3_account_public_access_block_test.go index 0cea344960da..5b77d47908be 100644 --- a/aws/resource_aws_s3_account_public_access_block_test.go +++ b/aws/resource_aws_s3_account_public_access_block_test.go @@ -47,6 +47,7 @@ func testAccAWSS3AccountPublicAccessBlock_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccountPublicAccessBlockDestroy, Steps: []resource.TestStep{ @@ -76,6 +77,7 @@ func testAccAWSS3AccountPublicAccessBlock_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccountPublicAccessBlockDestroy, Steps: []resource.TestStep{ @@ -97,6 +99,7 @@ func testAccAWSS3AccountPublicAccessBlock_AccountId(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccountPublicAccessBlockDestroy, Steps: []resource.TestStep{ @@ -122,6 +125,7 @@ func testAccAWSS3AccountPublicAccessBlock_BlockPublicAcls(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccountPublicAccessBlockDestroy, Steps: []resource.TestStep{ @@ -161,6 +165,7 @@ func testAccAWSS3AccountPublicAccessBlock_BlockPublicPolicy(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccountPublicAccessBlockDestroy, Steps: []resource.TestStep{ @@ -200,6 +205,7 @@ func testAccAWSS3AccountPublicAccessBlock_IgnorePublicAcls(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccountPublicAccessBlockDestroy, Steps: []resource.TestStep{ @@ -239,6 +245,7 @@ func testAccAWSS3AccountPublicAccessBlock_RestrictPublicBuckets(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3AccountPublicAccessBlockDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3_bucket_analytics_configuration_test.go b/aws/resource_aws_s3_bucket_analytics_configuration_test.go index ccd3b84fa80c..f09da9cac49d 100644 --- a/aws/resource_aws_s3_bucket_analytics_configuration_test.go +++ b/aws/resource_aws_s3_bucket_analytics_configuration_test.go @@ -22,6 +22,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_removed(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -80,6 +82,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_updateBasic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -129,6 +132,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_WithFilter_Empty(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -151,6 +155,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_WithFilter_Prefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -192,6 +197,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_WithFilter_SingleTag(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -237,6 +243,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_WithFilter_MultipleTags(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -286,6 +293,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_WithFilter_PrefixAndTags(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -330,6 +338,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_WithFilter_Remove(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -360,6 +369,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_WithStorageClassAnalysis_Empty(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -379,6 +389,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_WithStorageClassAnalysis_Default(t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -414,6 +425,7 @@ func TestAccAWSS3BucketAnalyticsConfiguration_WithStorageClassAnalysis_Full(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketAnalyticsConfigurationDestroy, Steps: []resource.TestStep{ @@ -1106,6 +1118,7 @@ func TestFlattenS3AnalyticsFilter(t *testing.T) { } } } + func TestFlattenS3StorageClassAnalysis(t *testing.T) { testCases := map[string]struct { Input *s3.StorageClassAnalysis diff --git a/aws/resource_aws_s3_bucket_inventory_test.go b/aws/resource_aws_s3_bucket_inventory_test.go index a3ac2ef43328..24812e2f0bbf 100644 --- a/aws/resource_aws_s3_bucket_inventory_test.go +++ b/aws/resource_aws_s3_bucket_inventory_test.go @@ -24,6 +24,7 @@ func TestAccAWSS3BucketInventory_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketInventoryDestroy, Steps: []resource.TestStep{ @@ -69,6 +70,7 @@ func TestAccAWSS3BucketInventory_encryptWithSSES3(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketInventoryDestroy, Steps: []resource.TestStep{ @@ -98,6 +100,7 @@ func TestAccAWSS3BucketInventory_encryptWithSSEKMS(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketInventoryDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3_bucket_metric_test.go b/aws/resource_aws_s3_bucket_metric_test.go index dcc59b7b8ae5..e32fad9f814e 100644 --- a/aws/resource_aws_s3_bucket_metric_test.go +++ b/aws/resource_aws_s3_bucket_metric_test.go @@ -271,6 +271,7 @@ func TestAccAWSS3BucketMetric_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketMetricDestroy, Steps: []resource.TestStep{ @@ -304,6 +305,7 @@ func TestAccAWSS3BucketMetric_WithEmptyFilter(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketMetricDestroy, Steps: []resource.TestStep{ @@ -330,6 +332,7 @@ func TestAccAWSS3BucketMetric_WithFilterPrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketMetricDestroy, Steps: []resource.TestStep{ @@ -376,6 +379,7 @@ func TestAccAWSS3BucketMetric_WithFilterPrefixAndMultipleTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketMetricDestroy, Steps: []resource.TestStep{ @@ -424,6 +428,7 @@ func TestAccAWSS3BucketMetric_WithFilterPrefixAndSingleTag(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketMetricDestroy, Steps: []resource.TestStep{ @@ -470,6 +475,7 @@ func TestAccAWSS3BucketMetric_WithFilterMultipleTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketMetricDestroy, Steps: []resource.TestStep{ @@ -516,6 +522,7 @@ func TestAccAWSS3BucketMetric_WithFilterSingleTag(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketMetricDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3_bucket_notification_test.go b/aws/resource_aws_s3_bucket_notification_test.go index e8237d5f807d..c920412e4f13 100644 --- a/aws/resource_aws_s3_bucket_notification_test.go +++ b/aws/resource_aws_s3_bucket_notification_test.go @@ -21,6 +21,7 @@ func TestAccAWSS3BucketNotification_LambdaFunction(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketNotificationDestroy, Steps: []resource.TestStep{ @@ -62,6 +63,7 @@ func TestAccAWSS3BucketNotification_LambdaFunction_LambdaFunctionArn_Alias(t *te resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketNotificationDestroy, Steps: []resource.TestStep{ @@ -92,6 +94,7 @@ func TestAccAWSS3BucketNotification_Queue(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketNotificationDestroy, Steps: []resource.TestStep{ @@ -133,6 +136,7 @@ func TestAccAWSS3BucketNotification_Topic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketNotificationDestroy, Steps: []resource.TestStep{ @@ -163,6 +167,7 @@ func TestAccAWSS3BucketNotification_Topic_Multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketNotificationDestroy, Steps: []resource.TestStep{ @@ -217,6 +222,7 @@ func TestAccAWSS3BucketNotification_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketNotificationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3_bucket_object_test.go b/aws/resource_aws_s3_bucket_object_test.go index 03dba231973f..ed3a8238ed11 100644 --- a/aws/resource_aws_s3_bucket_object_test.go +++ b/aws/resource_aws_s3_bucket_object_test.go @@ -109,6 +109,7 @@ func TestAccAWSS3BucketObject_noNameNoKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -125,6 +126,7 @@ func TestAccAWSS3BucketObject_noNameNoKey(t *testing.T) { }, }) } + func TestAccAWSS3BucketObject_empty(t *testing.T) { var obj s3.GetObjectOutput resourceName := "aws_s3_bucket_object.object" @@ -132,6 +134,7 @@ func TestAccAWSS3BucketObject_empty(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -157,6 +160,7 @@ func TestAccAWSS3BucketObject_source(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -178,6 +182,7 @@ func TestAccAWSS3BucketObject_content(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -202,6 +207,7 @@ func TestAccAWSS3BucketObject_etagEncryption(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -225,6 +231,7 @@ func TestAccAWSS3BucketObject_contentBase64(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -250,6 +257,7 @@ func TestAccAWSS3BucketObject_withContentCharacteristics(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -275,6 +283,7 @@ func TestAccAWSS3BucketObject_NonVersioned(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAssumeRoleARNPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -302,6 +311,7 @@ func TestAccAWSS3BucketObject_updates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -352,6 +362,7 @@ func TestAccAWSS3BucketObject_updateSameFile(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -389,6 +400,7 @@ func TestAccAWSS3BucketObject_updatesWithVersioning(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -426,6 +438,7 @@ func TestAccAWSS3BucketObject_updatesWithVersioningViaAccessPoint(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -461,6 +474,7 @@ func TestAccAWSS3BucketObject_kms(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -487,6 +501,7 @@ func TestAccAWSS3BucketObject_sse(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -510,6 +525,7 @@ func TestAccAWSS3BucketObject_acl(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -553,6 +569,7 @@ func TestAccAWSS3BucketObject_metadata(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -592,6 +609,7 @@ func TestAccAWSS3BucketObject_storageClass(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -648,6 +666,7 @@ func TestAccAWSS3BucketObject_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -712,6 +731,7 @@ func TestAccAWSS3BucketObject_tagsLeadingSingleSlash(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -776,6 +796,7 @@ func TestAccAWSS3BucketObject_tagsLeadingMultipleSlashes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -840,6 +861,7 @@ func TestAccAWSS3BucketObject_tagsMultipleSlashes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -903,6 +925,7 @@ func TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithNone(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -950,6 +973,7 @@ func TestAccAWSS3BucketObject_ObjectLockLegalHoldStartWithOn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -986,6 +1010,7 @@ func TestAccAWSS3BucketObject_ObjectLockRetentionStartWithNone(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -1036,6 +1061,7 @@ func TestAccAWSS3BucketObject_ObjectLockRetentionStartWithSet(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -1093,6 +1119,7 @@ func TestAccAWSS3BucketObject_defaultBucketSSE(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ @@ -1116,6 +1143,7 @@ func TestAccAWSS3BucketObject_ignoreTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: testAccCheckAWSS3BucketObjectDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3_bucket_ownership_controls_test.go b/aws/resource_aws_s3_bucket_ownership_controls_test.go index 453bf167b840..d3b7750f1643 100644 --- a/aws/resource_aws_s3_bucket_ownership_controls_test.go +++ b/aws/resource_aws_s3_bucket_ownership_controls_test.go @@ -18,6 +18,7 @@ func TestAccAWSS3BucketOwnershipControls_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketOwnershipControlsDestroy, Steps: []resource.TestStep{ @@ -45,6 +46,7 @@ func TestAccAWSS3BucketOwnershipControls_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketOwnershipControlsDestroy, Steps: []resource.TestStep{ @@ -67,6 +69,7 @@ func TestAccAWSS3BucketOwnershipControls_disappears_Bucket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketOwnershipControlsDestroy, Steps: []resource.TestStep{ @@ -88,6 +91,7 @@ func TestAccAWSS3BucketOwnershipControls_Rule_ObjectOwnership(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketOwnershipControlsDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3_bucket_policy_test.go b/aws/resource_aws_s3_bucket_policy_test.go index 8fcd5bf5a5eb..1c79049fdd98 100644 --- a/aws/resource_aws_s3_bucket_policy_test.go +++ b/aws/resource_aws_s3_bucket_policy_test.go @@ -36,6 +36,7 @@ func TestAccAWSS3BucketPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -101,6 +102,7 @@ func TestAccAWSS3BucketPolicy_policyUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3_bucket_public_access_block_test.go b/aws/resource_aws_s3_bucket_public_access_block_test.go index b065203e0fdf..0805084ce2a4 100644 --- a/aws/resource_aws_s3_bucket_public_access_block_test.go +++ b/aws/resource_aws_s3_bucket_public_access_block_test.go @@ -21,6 +21,7 @@ func TestAccAWSS3BucketPublicAccessBlock_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSS3BucketPublicAccessBlock_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -75,6 +77,7 @@ func TestAccAWSS3BucketPublicAccessBlock_disappears_Bucket(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -97,6 +100,7 @@ func TestAccAWSS3BucketPublicAccessBlock_BlockPublicAcls(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -137,6 +141,7 @@ func TestAccAWSS3BucketPublicAccessBlock_BlockPublicPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -177,6 +182,7 @@ func TestAccAWSS3BucketPublicAccessBlock_IgnorePublicAcls(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -217,6 +223,7 @@ func TestAccAWSS3BucketPublicAccessBlock_RestrictPublicBuckets(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3_bucket_test.go b/aws/resource_aws_s3_bucket_test.go index 9c2ce501a5b7..f4c9a1a0af31 100644 --- a/aws/resource_aws_s3_bucket_test.go +++ b/aws/resource_aws_s3_bucket_test.go @@ -172,6 +172,7 @@ func TestAccAWSS3Bucket_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -205,6 +206,7 @@ func TestAccAWSS3Bucket_Bucket_EmptyString(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -231,6 +233,7 @@ func TestAccAWSS3Bucket_tagsWithNoSystemTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -290,8 +293,9 @@ func TestAccAWSS3Bucket_tagsWithSystemTags(t *testing.T) { var stackID string resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), + Providers: testAccProviders, CheckDestroy: resource.ComposeAggregateTestCheckFunc( testAccCheckAWSS3BucketDestroy, func(s *terraform.State) error { @@ -373,6 +377,7 @@ func TestAccAWSS3Bucket_ignoreTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -417,6 +422,7 @@ func TestAccAWSS3MultiBucket_withTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -438,6 +444,7 @@ func TestAccAWSS3Bucket_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -463,6 +470,7 @@ func TestAccAWSS3Bucket_generatedName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -491,6 +499,7 @@ func TestAccAWSS3Bucket_acceleration(t *testing.T) { testAccPreCheck(t) testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -524,6 +533,7 @@ func TestAccAWSS3Bucket_RequestPayer(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -560,6 +570,7 @@ func TestAccAWSS3Bucket_Policy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -610,6 +621,7 @@ func TestAccAWSS3Bucket_UpdateAcl(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -643,6 +655,7 @@ func TestAccAWSS3Bucket_UpdateGrant(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -700,6 +713,7 @@ func TestAccAWSS3Bucket_AclToGrant(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -729,6 +743,7 @@ func TestAccAWSS3Bucket_GrantToAcl(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -759,6 +774,7 @@ func TestAccAWSS3Bucket_Website_Simple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -803,6 +819,7 @@ func TestAccAWSS3Bucket_WebsiteRedirect(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -847,6 +864,7 @@ func TestAccAWSS3Bucket_WebsiteRoutingRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -897,6 +915,7 @@ func TestAccAWSS3Bucket_enableDefaultEncryption_whenTypical(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -927,6 +946,7 @@ func TestAccAWSS3Bucket_enableDefaultEncryption_whenAES256IsUsed(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -957,6 +977,7 @@ func TestAccAWSS3Bucket_disableDefaultEncryption_whenDefaultEncryptionIsEnabled( resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -992,6 +1013,7 @@ func TestAccAWSS3Bucket_shouldFailNotFound(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -1013,6 +1035,7 @@ func TestAccAWSS3Bucket_Versioning(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -1080,6 +1103,7 @@ func TestAccAWSS3Bucket_Cors_Update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -1155,6 +1179,7 @@ func TestAccAWSS3Bucket_Cors_Delete(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -1176,6 +1201,7 @@ func TestAccAWSS3Bucket_Cors_EmptyOrigin(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -1213,6 +1239,7 @@ func TestAccAWSS3Bucket_Logging(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -1239,6 +1266,7 @@ func TestAccAWSS3Bucket_LifecycleBasic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -1355,6 +1383,7 @@ func TestAccAWSS3Bucket_LifecycleExpireMarkerOnly(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -1392,6 +1421,7 @@ func TestAccAWSS3Bucket_LifecycleRule_Expiration_EmptyConfigurationBlock(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -1412,6 +1442,7 @@ func TestAccAWSS3Bucket_LifecycleRule_AbortIncompleteMultipartUploadDays_NoExpir resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -1447,6 +1478,7 @@ func TestAccAWSS3Bucket_Replication(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckWithProviders(testAccCheckAWSS3BucketDestroyWithProvider, &providers), Steps: []resource.TestStep{ @@ -1759,6 +1791,7 @@ func TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AccessControlT testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckWithProviders(testAccCheckAWSS3BucketDestroyWithProvider, &providers), Steps: []resource.TestStep{ @@ -1851,6 +1884,7 @@ func TestAccAWSS3Bucket_ReplicationConfiguration_Rule_Destination_AddAccessContr testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckWithProviders(testAccCheckAWSS3BucketDestroyWithProvider, &providers), Steps: []resource.TestStep{ @@ -1931,6 +1965,7 @@ func TestAccAWSS3Bucket_ReplicationWithoutStorageClass(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckWithProviders(testAccCheckAWSS3BucketDestroyWithProvider, &providers), Steps: []resource.TestStep{ @@ -1963,6 +1998,7 @@ func TestAccAWSS3Bucket_ReplicationExpectVersioningValidationError(t *testing.T) testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckWithProviders(testAccCheckAWSS3BucketDestroyWithProvider, &providers), Steps: []resource.TestStep{ @@ -1989,6 +2025,7 @@ func TestAccAWSS3Bucket_ReplicationWithoutPrefix(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckWithProviders(testAccCheckAWSS3BucketDestroyWithProvider, &providers), Steps: []resource.TestStep{ @@ -2026,6 +2063,7 @@ func TestAccAWSS3Bucket_ReplicationSchemaV2(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckWithProviders(testAccCheckAWSS3BucketDestroyWithProvider, &providers), Steps: []resource.TestStep{ @@ -2204,6 +2242,7 @@ func TestAccAWSS3Bucket_SameRegionReplicationSchemaV2(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -2255,6 +2294,7 @@ func TestAccAWSS3Bucket_objectLock(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -2294,6 +2334,7 @@ func TestAccAWSS3Bucket_forceDestroy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -2319,6 +2360,7 @@ func TestAccAWSS3Bucket_forceDestroyWithEmptyPrefixes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ @@ -2339,6 +2381,7 @@ func TestAccAWSS3Bucket_forceDestroyWithObjectLockEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3BucketDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3_object_copy_test.go b/aws/resource_aws_s3_object_copy_test.go index e0e5486e0085..4c660a9ca1eb 100644 --- a/aws/resource_aws_s3_object_copy_test.go +++ b/aws/resource_aws_s3_object_copy_test.go @@ -21,6 +21,7 @@ func TestAccAWSS3ObjectCopy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, s3.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ObjectCopyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3control_bucket_lifecycle_configuration_test.go b/aws/resource_aws_s3control_bucket_lifecycle_configuration_test.go index 7b11ceb6915b..508b96030496 100644 --- a/aws/resource_aws_s3control_bucket_lifecycle_configuration_test.go +++ b/aws/resource_aws_s3control_bucket_lifecycle_configuration_test.go @@ -20,6 +20,7 @@ func TestAccAWSS3ControlBucketLifecycleConfiguration_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketLifecycleConfigurationDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSS3ControlBucketLifecycleConfiguration_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketLifecycleConfigurationDestroy, Steps: []resource.TestStep{ @@ -73,6 +75,7 @@ func TestAccAWSS3ControlBucketLifecycleConfiguration_Rule_AbortIncompleteMultipa resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketLifecycleConfigurationDestroy, Steps: []resource.TestStep{ @@ -115,6 +118,7 @@ func TestAccAWSS3ControlBucketLifecycleConfiguration_Rule_Expiration_Date(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketLifecycleConfigurationDestroy, Steps: []resource.TestStep{ @@ -155,6 +159,7 @@ func TestAccAWSS3ControlBucketLifecycleConfiguration_Rule_Expiration_Days(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketLifecycleConfigurationDestroy, Steps: []resource.TestStep{ @@ -196,6 +201,7 @@ func TestAccAWSS3ControlBucketLifecycleConfiguration_Rule_Expiration_ExpiredObje resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketLifecycleConfigurationDestroy, Steps: []resource.TestStep{ @@ -236,6 +242,7 @@ func TestAccAWSS3ControlBucketLifecycleConfiguration_Rule_Filter_Prefix(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketLifecycleConfigurationDestroy, Steps: []resource.TestStep{ @@ -276,6 +283,7 @@ func TestAccAWSS3ControlBucketLifecycleConfiguration_Rule_Filter_Tags(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketLifecycleConfigurationDestroy, Steps: []resource.TestStep{ @@ -334,6 +342,7 @@ func TestAccAWSS3ControlBucketLifecycleConfiguration_Rule_Id(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketLifecycleConfigurationDestroy, Steps: []resource.TestStep{ @@ -372,6 +381,7 @@ func TestAccAWSS3ControlBucketLifecycleConfiguration_Rule_Status(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketLifecycleConfigurationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3control_bucket_policy_test.go b/aws/resource_aws_s3control_bucket_policy_test.go index 7d42f8723a8a..40a2bf7c38c2 100644 --- a/aws/resource_aws_s3control_bucket_policy_test.go +++ b/aws/resource_aws_s3control_bucket_policy_test.go @@ -20,6 +20,7 @@ func TestAccAWSS3ControlBucketPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketPolicyDestroy, Steps: []resource.TestStep{ @@ -46,6 +47,7 @@ func TestAccAWSS3ControlBucketPolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketPolicyDestroy, Steps: []resource.TestStep{ @@ -67,6 +69,7 @@ func TestAccAWSS3ControlBucketPolicy_Policy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3control_bucket_test.go b/aws/resource_aws_s3control_bucket_test.go index f280150b2a8b..35054754a9d3 100644 --- a/aws/resource_aws_s3control_bucket_test.go +++ b/aws/resource_aws_s3control_bucket_test.go @@ -20,6 +20,7 @@ func TestAccAWSS3ControlBucket_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSS3ControlBucket_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketDestroy, Steps: []resource.TestStep{ @@ -73,6 +75,7 @@ func TestAccAWSS3ControlBucket_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3control.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3ControlBucketDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_s3outposts_endpoint_test.go b/aws/resource_aws_s3outposts_endpoint_test.go index bfbd117e995f..38ed3eff55e8 100644 --- a/aws/resource_aws_s3outposts_endpoint_test.go +++ b/aws/resource_aws_s3outposts_endpoint_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/s3outposts" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -17,6 +18,7 @@ func TestAccAWSS3OutpostsEndpoint_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3OutpostsEndpointDestroy, Steps: []resource.TestStep{ @@ -49,6 +51,7 @@ func TestAccAWSS3OutpostsEndpoint_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, s3outposts.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSS3OutpostsEndpointDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_app_image_config_test.go b/aws/resource_aws_sagemaker_app_image_config_test.go index c45642bca65d..1883f61bec36 100644 --- a/aws/resource_aws_sagemaker_app_image_config_test.go +++ b/aws/resource_aws_sagemaker_app_image_config_test.go @@ -77,6 +77,7 @@ func TestAccAWSSagemakerAppImageConfig_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerAppImageConfigDestroy, Steps: []resource.TestStep{ @@ -106,6 +107,7 @@ func TestAccAWSSagemakerAppImageConfig_kernelGatewayImageConfig_kernalSpecs(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerAppImageConfigDestroy, Steps: []resource.TestStep{ @@ -148,6 +150,7 @@ func TestAccAWSSagemakerAppImageConfig_kernelGatewayImageConfig_fileSystemConfig resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerAppImageConfigDestroy, Steps: []resource.TestStep{ @@ -193,6 +196,7 @@ func TestAccAWSSagemakerAppImageConfig_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerAppImageConfigDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_app_test.go b/aws/resource_aws_sagemaker_app_test.go index 2279e9c9ff78..9f64cc3bc09d 100644 --- a/aws/resource_aws_sagemaker_app_test.go +++ b/aws/resource_aws_sagemaker_app_test.go @@ -75,6 +75,7 @@ func testAccAWSSagemakerApp_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerAppDestroy, Steps: []resource.TestStep{ @@ -108,6 +109,7 @@ func testAccAWSSagemakerApp_resourceSpec(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerAppDestroy, Steps: []resource.TestStep{ @@ -137,6 +139,7 @@ func testAccAWSSagemakerApp_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerAppDestroy, Steps: []resource.TestStep{ @@ -181,6 +184,7 @@ func testAccAWSSagemakerApp_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerAppDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_code_repository_test.go b/aws/resource_aws_sagemaker_code_repository_test.go index af2327c9f399..6ecfc250dff7 100644 --- a/aws/resource_aws_sagemaker_code_repository_test.go +++ b/aws/resource_aws_sagemaker_code_repository_test.go @@ -64,6 +64,7 @@ func TestAccAWSSagemakerCodeRepository_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerCodeRepositoryDestroy, Steps: []resource.TestStep{ @@ -93,6 +94,7 @@ func TestAccAWSSagemakerCodeRepository_gitConfig_branch(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerCodeRepositoryDestroy, Steps: []resource.TestStep{ @@ -123,6 +125,7 @@ func TestAccAWSSagemakerCodeRepository_gitConfig_secret(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerCodeRepositoryDestroy, Steps: []resource.TestStep{ @@ -164,6 +167,7 @@ func TestAccAWSSagemakerCodeRepository_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerCodeRepositoryDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_domain_test.go b/aws/resource_aws_sagemaker_domain_test.go index afa16ffa7992..dcc4ff773340 100644 --- a/aws/resource_aws_sagemaker_domain_test.go +++ b/aws/resource_aws_sagemaker_domain_test.go @@ -119,6 +119,7 @@ func testAccAWSSagemakerDomain_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerDomainDestroy, Steps: []resource.TestStep{ @@ -155,6 +156,7 @@ func testAccAWSSagemakerDomain_kms(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerDomainDestroy, Steps: []resource.TestStep{ @@ -181,6 +183,7 @@ func testAccAWSSagemakerDomain_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerDomainDestroy, Steps: []resource.TestStep{ @@ -225,6 +228,7 @@ func testAccAWSSagemakerDomain_securityGroup(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerDomainDestroy, Steps: []resource.TestStep{ @@ -260,6 +264,7 @@ func testAccAWSSagemakerDomain_sharingSettings(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerDomainDestroy, Steps: []resource.TestStep{ @@ -290,6 +295,7 @@ func testAccAWSSagemakerDomain_tensorboardAppSettings(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerDomainDestroy, Steps: []resource.TestStep{ @@ -319,6 +325,7 @@ func testAccAWSSagemakerDomain_tensorboardAppSettingsWithImage(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerDomainDestroy, Steps: []resource.TestStep{ @@ -349,6 +356,7 @@ func testAccAWSSagemakerDomain_kernelGatewayAppSettings(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerDomainDestroy, Steps: []resource.TestStep{ @@ -384,6 +392,7 @@ func testAccAWSSagemakerDomain_kernelGatewayAppSettings_customImage(t *testing.T resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerDomainDestroy, Steps: []resource.TestStep{ @@ -415,6 +424,7 @@ func testAccAWSSagemakerDomain_jupyterServerAppSettings(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerDomainDestroy, Steps: []resource.TestStep{ @@ -444,6 +454,7 @@ func testAccAWSSagemakerDomain_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerDomainDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_endpoint_configuration_test.go b/aws/resource_aws_sagemaker_endpoint_configuration_test.go index 6e251a43bfac..19f36510b653 100644 --- a/aws/resource_aws_sagemaker_endpoint_configuration_test.go +++ b/aws/resource_aws_sagemaker_endpoint_configuration_test.go @@ -62,6 +62,7 @@ func TestAccAWSSagemakerEndpointConfiguration_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerEndpointConfigurationDestroy, Steps: []resource.TestStep{ @@ -94,6 +95,7 @@ func TestAccAWSSagemakerEndpointConfiguration_productionVariants_InitialVariantW resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerEndpointConfigurationDestroy, Steps: []resource.TestStep{ @@ -120,6 +122,7 @@ func TestAccAWSSagemakerEndpointConfiguration_productionVariants_AcceleratorType resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerEndpointConfigurationDestroy, Steps: []resource.TestStep{ @@ -145,6 +148,7 @@ func TestAccAWSSagemakerEndpointConfiguration_kmsKeyId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerEndpointConfigurationDestroy, Steps: []resource.TestStep{ @@ -170,6 +174,7 @@ func TestAccAWSSagemakerEndpointConfiguration_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerEndpointConfigurationDestroy, Steps: []resource.TestStep{ @@ -213,6 +218,7 @@ func TestAccAWSSagemakerEndpointConfiguration_dataCaptureConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerEndpointConfigurationDestroy, Steps: []resource.TestStep{ @@ -245,6 +251,7 @@ func TestAccAWSSagemakerEndpointConfiguration_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerEndpointConfigurationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_endpoint_test.go b/aws/resource_aws_sagemaker_endpoint_test.go index fc8a76cd7455..26ca59528531 100644 --- a/aws/resource_aws_sagemaker_endpoint_test.go +++ b/aws/resource_aws_sagemaker_endpoint_test.go @@ -63,6 +63,7 @@ func TestAccAWSSagemakerEndpoint_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerEndpointDestroy, Steps: []resource.TestStep{ @@ -92,6 +93,7 @@ func TestAccAWSSagemakerEndpoint_EndpointConfigName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerEndpointDestroy, Steps: []resource.TestStep{ @@ -124,6 +126,7 @@ func TestAccAWSSagemakerEndpoint_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerEndpointDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_feature_group_test.go b/aws/resource_aws_sagemaker_feature_group_test.go index 774b44dd8c90..2429c423992d 100644 --- a/aws/resource_aws_sagemaker_feature_group_test.go +++ b/aws/resource_aws_sagemaker_feature_group_test.go @@ -65,6 +65,7 @@ func TestAccAWSSagemakerFeatureGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerFeatureGroupDestroy, Steps: []resource.TestStep{ @@ -100,6 +101,7 @@ func TestAccAWSSagemakerFeatureGroup_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerFeatureGroupDestroy, Steps: []resource.TestStep{ @@ -127,6 +129,7 @@ func TestAccAWSSagemakerFeatureGroup_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerFeatureGroupDestroy, Steps: []resource.TestStep{ @@ -174,6 +177,7 @@ func TestAccAWSSagemakerFeatureGroup_multipleFeatures(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerFeatureGroupDestroy, Steps: []resource.TestStep{ @@ -205,6 +209,7 @@ func TestAccAWSSagemakerFeatureGroup_onlineConfigSecurityConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerFeatureGroupDestroy, Steps: []resource.TestStep{ @@ -235,6 +240,7 @@ func TestAccAWSSagemakerFeatureGroup_offlineConfig_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerFeatureGroupDestroy, Steps: []resource.TestStep{ @@ -266,6 +272,7 @@ func TestAccAWSSagemakerFeatureGroup_offlineConfig_createCatalog(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerFeatureGroupDestroy, Steps: []resource.TestStep{ @@ -301,6 +308,7 @@ func TestAccAWSSagemakerFeatureGroup_offlineConfig_providedCatalog(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerFeatureGroupDestroy, Steps: []resource.TestStep{ @@ -335,6 +343,7 @@ func TestAccAWSSagemakerFeatureGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerFeatureGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_image_test.go b/aws/resource_aws_sagemaker_image_test.go index d2f25826f590..a34063ead083 100644 --- a/aws/resource_aws_sagemaker_image_test.go +++ b/aws/resource_aws_sagemaker_image_test.go @@ -64,6 +64,7 @@ func TestAccAWSSagemakerImage_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerImageDestroy, Steps: []resource.TestStep{ @@ -93,6 +94,7 @@ func TestAccAWSSagemakerImage_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerImageDestroy, Steps: []resource.TestStep{ @@ -133,6 +135,7 @@ func TestAccAWSSagemakerImage_displayName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerImageDestroy, Steps: []resource.TestStep{ @@ -173,6 +176,7 @@ func TestAccAWSSagemakerImage_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerImageDestroy, Steps: []resource.TestStep{ @@ -217,6 +221,7 @@ func TestAccAWSSagemakerImage_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerImageDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_image_version_test.go b/aws/resource_aws_sagemaker_image_version_test.go index 0b39ba996611..710d4ace8cc4 100644 --- a/aws/resource_aws_sagemaker_image_version_test.go +++ b/aws/resource_aws_sagemaker_image_version_test.go @@ -26,6 +26,7 @@ func TestAccAWSSagemakerImageVersion_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerImageVersionDestroy, Steps: []resource.TestStep{ @@ -63,6 +64,7 @@ func TestAccAWSSagemakerImageVersion_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerImageVersionDestroy, Steps: []resource.TestStep{ @@ -91,6 +93,7 @@ func TestAccAWSSagemakerImageVersion_disappears_image(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerImageVersionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_model_package_group_test.go b/aws/resource_aws_sagemaker_model_package_group_test.go index 8e482f523205..af5fe7aeae82 100644 --- a/aws/resource_aws_sagemaker_model_package_group_test.go +++ b/aws/resource_aws_sagemaker_model_package_group_test.go @@ -64,6 +64,7 @@ func TestAccAWSSagemakerModelPackageGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerModelPackageGroupDestroy, Steps: []resource.TestStep{ @@ -92,6 +93,7 @@ func TestAccAWSSagemakerModelPackageGroup_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerModelPackageGroupDestroy, Steps: []resource.TestStep{ @@ -118,6 +120,7 @@ func TestAccAWSSagemakerModelPackageGroup_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerModelPackageGroupDestroy, Steps: []resource.TestStep{ @@ -162,6 +165,7 @@ func TestAccAWSSagemakerModelPackageGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerModelPackageGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_model_test.go b/aws/resource_aws_sagemaker_model_test.go index 2caae650b3c0..3b8b29e29c26 100644 --- a/aws/resource_aws_sagemaker_model_test.go +++ b/aws/resource_aws_sagemaker_model_test.go @@ -57,6 +57,7 @@ func TestAccAWSSagemakerModel_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerModelDestroy, Steps: []resource.TestStep{ @@ -90,6 +91,7 @@ func TestAccAWSSagemakerModel_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerModelDestroy, Steps: []resource.TestStep{ @@ -133,6 +135,7 @@ func TestAccAWSSagemakerModel_primaryContainerModelDataUrl(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerModelDestroy, Steps: []resource.TestStep{ @@ -158,6 +161,7 @@ func TestAccAWSSagemakerModel_primaryContainerHostname(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerModelDestroy, Steps: []resource.TestStep{ @@ -183,6 +187,7 @@ func TestAccAWSSagemakerModel_primaryContainerImageConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerModelDestroy, Steps: []resource.TestStep{ @@ -209,6 +214,7 @@ func TestAccAWSSagemakerModel_primaryContainerEnvironment(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerModelDestroy, Steps: []resource.TestStep{ @@ -235,6 +241,7 @@ func TestAccAWSSagemakerModel_primaryContainerModeSingle(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerModelDestroy, Steps: []resource.TestStep{ @@ -260,6 +267,7 @@ func TestAccAWSSagemakerModel_containers(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerModelDestroy, Steps: []resource.TestStep{ @@ -287,6 +295,7 @@ func TestAccAWSSagemakerModel_vpcConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerModelDestroy, Steps: []resource.TestStep{ @@ -314,6 +323,7 @@ func TestAccAWSSagemakerModel_networkIsolation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerModelDestroy, Steps: []resource.TestStep{ @@ -339,6 +349,7 @@ func TestAccAWSSagemakerModel_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSagemakerModelDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_notebook_instance_lifecycle_configuration_test.go b/aws/resource_aws_sagemaker_notebook_instance_lifecycle_configuration_test.go index dd72f29030b2..a55fc3598d00 100644 --- a/aws/resource_aws_sagemaker_notebook_instance_lifecycle_configuration_test.go +++ b/aws/resource_aws_sagemaker_notebook_instance_lifecycle_configuration_test.go @@ -73,6 +73,7 @@ func TestAccAWSSagemakerNotebookInstanceLifecycleConfiguration_basic(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceLifecycleConfigurationDestroy, Steps: []resource.TestStep{ @@ -103,6 +104,7 @@ func TestAccAWSSagemakerNotebookInstanceLifecycleConfiguration_Update(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceLifecycleConfigurationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_notebook_instance_test.go b/aws/resource_aws_sagemaker_notebook_instance_test.go index 5b5d99fd2a9c..cae2f956f139 100644 --- a/aws/resource_aws_sagemaker_notebook_instance_test.go +++ b/aws/resource_aws_sagemaker_notebook_instance_test.go @@ -80,6 +80,7 @@ func TestAccAWSSagemakerNotebookInstance_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ @@ -116,6 +117,7 @@ func TestAccAWSSagemakerNotebookInstance_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ @@ -149,6 +151,7 @@ func TestAccAWSSagemakerNotebookInstance_volumesize(t *testing.T) { var resourceName = "aws_sagemaker_notebook_instance.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ @@ -192,6 +195,7 @@ func TestAccAWSSagemakerNotebookInstance_LifecycleConfigName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ @@ -232,6 +236,7 @@ func TestAccAWSSagemakerNotebookInstance_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ @@ -276,6 +281,7 @@ func TestAccAWSSagemakerNotebookInstance_kms(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ @@ -302,6 +308,7 @@ func TestAccAWSSagemakerNotebookInstance_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ @@ -394,6 +401,7 @@ func TestAccAWSSagemakerNotebookInstance_root_access(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ @@ -427,6 +435,7 @@ func TestAccAWSSagemakerNotebookInstance_direct_internet_access(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ @@ -465,6 +474,7 @@ func TestAccAWSSagemakerNotebookInstance_default_code_repository(t *testing.T) { var resourceName = "aws_sagemaker_notebook_instance.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ @@ -504,6 +514,7 @@ func TestAccAWSSagemakerNotebookInstance_additional_code_repositories(t *testing var resourceName = "aws_sagemaker_notebook_instance.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ @@ -554,6 +565,7 @@ func TestAccAWSSagemakerNotebookInstance_default_code_repository_sagemakerRepo(t var resourceName = "aws_sagemaker_notebook_instance.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sagemaker_user_profile_test.go b/aws/resource_aws_sagemaker_user_profile_test.go index 7124b8a55e0a..2e5640d00b1e 100644 --- a/aws/resource_aws_sagemaker_user_profile_test.go +++ b/aws/resource_aws_sagemaker_user_profile_test.go @@ -72,6 +72,7 @@ func testAccAWSSagemakerUserProfile_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerUserProfileDestroy, Steps: []resource.TestStep{ @@ -103,6 +104,7 @@ func testAccAWSSagemakerUserProfile_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerUserProfileDestroy, Steps: []resource.TestStep{ @@ -147,6 +149,7 @@ func testAccAWSSagemakerUserProfile_tensorboardAppSettings(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerUserProfileDestroy, Steps: []resource.TestStep{ @@ -176,6 +179,7 @@ func testAccAWSSagemakerUserProfile_tensorboardAppSettingsWithImage(t *testing.T resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerUserProfileDestroy, Steps: []resource.TestStep{ @@ -206,6 +210,7 @@ func testAccAWSSagemakerUserProfile_kernelGatewayAppSettings(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerUserProfileDestroy, Steps: []resource.TestStep{ @@ -235,6 +240,7 @@ func testAccAWSSagemakerUserProfile_jupyterServerAppSettings(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerUserProfileDestroy, Steps: []resource.TestStep{ @@ -264,6 +270,7 @@ func testAccAWSSagemakerUserProfile_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sagemaker.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSagemakerUserProfileDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_secretsmanager_secret_policy_test.go b/aws/resource_aws_secretsmanager_secret_policy_test.go index b6dfaa06f089..305cad4d0c60 100644 --- a/aws/resource_aws_secretsmanager_secret_policy_test.go +++ b/aws/resource_aws_secretsmanager_secret_policy_test.go @@ -70,6 +70,7 @@ func TestAccAwsSecretsManagerSecretPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretPolicyDestroy, Steps: []resource.TestStep{ @@ -106,6 +107,7 @@ func TestAccAwsSecretsManagerSecretPolicy_blockPublicPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretPolicyDestroy, Steps: []resource.TestStep{ @@ -147,6 +149,7 @@ func TestAccAwsSecretsManagerSecretPolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_secretsmanager_secret_rotation_test.go b/aws/resource_aws_secretsmanager_secret_rotation_test.go index df5f8892c689..d41f5532994f 100644 --- a/aws/resource_aws_secretsmanager_secret_rotation_test.go +++ b/aws/resource_aws_secretsmanager_secret_rotation_test.go @@ -19,6 +19,7 @@ func TestAccAwsSecretsManagerSecretRotation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretRotationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_secretsmanager_secret_test.go b/aws/resource_aws_secretsmanager_secret_test.go index 24506ebb6162..6f4067058a33 100644 --- a/aws/resource_aws_secretsmanager_secret_test.go +++ b/aws/resource_aws_secretsmanager_secret_test.go @@ -71,6 +71,7 @@ func TestAccAwsSecretsManagerSecret_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretDestroy, Steps: []resource.TestStep{ @@ -106,6 +107,7 @@ func TestAccAwsSecretsManagerSecret_withNamePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretDestroy, Steps: []resource.TestStep{ @@ -134,6 +136,7 @@ func TestAccAwsSecretsManagerSecret_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretDestroy, Steps: []resource.TestStep{ @@ -168,6 +171,7 @@ func TestAccAwsSecretsManagerSecret_KmsKeyID(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretDestroy, Steps: []resource.TestStep{ @@ -202,6 +206,7 @@ func TestAccAwsSecretsManagerSecret_RecoveryWindowInDays_Recreate(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretDestroy, Steps: []resource.TestStep{ @@ -238,6 +243,7 @@ func TestAccAwsSecretsManagerSecret_RotationLambdaARN(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretDestroy, Steps: []resource.TestStep{ @@ -289,6 +295,7 @@ func TestAccAwsSecretsManagerSecret_RotationRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretDestroy, Steps: []resource.TestStep{ @@ -342,6 +349,7 @@ func TestAccAwsSecretsManagerSecret_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretDestroy, Steps: []resource.TestStep{ @@ -395,6 +403,7 @@ func TestAccAwsSecretsManagerSecret_policy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_secretsmanager_secret_version_test.go b/aws/resource_aws_secretsmanager_secret_version_test.go index 99a916463793..233364f0541b 100644 --- a/aws/resource_aws_secretsmanager_secret_version_test.go +++ b/aws/resource_aws_secretsmanager_secret_version_test.go @@ -19,6 +19,7 @@ func TestAccAwsSecretsManagerSecretVersion_BasicString(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretVersionDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAwsSecretsManagerSecretVersion_Base64Binary(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretVersionDestroy, Steps: []resource.TestStep{ @@ -80,6 +82,7 @@ func TestAccAwsSecretsManagerSecretVersion_VersionStages(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSecretsManager(t) }, + ErrorCheck: testAccErrorCheck(t, secretsmanager.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecretsManagerSecretVersionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_security_group.go b/aws/resource_aws_security_group.go index eafb6c3d7caa..9acb2a034753 100644 --- a/aws/resource_aws_security_group.go +++ b/aws/resource_aws_security_group.go @@ -13,6 +13,7 @@ import ( "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" @@ -34,7 +35,7 @@ func resourceAwsSecurityGroup() *schema.Resource { Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(10 * time.Minute), - Delete: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(15 * time.Minute), }, SchemaVersion: 1, @@ -467,13 +468,23 @@ func resourceAwsSecurityGroupDelete(d *schema.ResourceData, meta interface{}) er err := resource.Retry(d.Timeout(schema.TimeoutDelete), func() *resource.RetryError { _, err := conn.DeleteSecurityGroup(input) if err != nil { - if isAWSErr(err, "InvalidGroup.NotFound", "") { + if tfawserr.ErrCodeEquals(err, "InvalidGroup.NotFound") { return nil } - if isAWSErr(err, "DependencyViolation", "") { - // If it is a dependency violation, we want to retry + + // If it is a dependency violation, we want to retry + if tfawserr.ErrMessageContains(err, "DependencyViolation", "has a dependent object") { + return resource.RetryableError(err) + } + + if tfawserr.ErrCodeEquals(err, "DependencyViolation") { return resource.RetryableError(err) } + + if tfawserr.ErrCodeEquals(err, "InvalidGroup.InUse") { + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) } return nil diff --git a/aws/resource_aws_security_group_rule_test.go b/aws/resource_aws_security_group_rule_test.go index 0453961b4db4..cecb8378ebf1 100644 --- a/aws/resource_aws_security_group_rule_test.go +++ b/aws/resource_aws_security_group_rule_test.go @@ -131,6 +131,7 @@ func TestAccAWSSecurityGroupRule_Ingress_VPC(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -163,6 +164,7 @@ func TestAccAWSSecurityGroupRule_Ingress_Source_With_Account_Id(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -208,6 +210,7 @@ func TestAccAWSSecurityGroupRule_Ingress_Protocol(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -257,6 +260,7 @@ func TestAccAWSSecurityGroupRule_Ingress_Ipv6(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -298,6 +302,7 @@ func TestAccAWSSecurityGroupRule_Ingress_Classic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -347,6 +352,7 @@ func TestAccAWSSecurityGroupRule_MultiIngress(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -373,6 +379,7 @@ func TestAccAWSSecurityGroupRule_Egress(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -398,6 +405,7 @@ func TestAccAWSSecurityGroupRule_SelfReference(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -421,6 +429,7 @@ func TestAccAWSSecurityGroupRule_ExpectInvalidTypeError(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -436,6 +445,7 @@ func TestAccAWSSecurityGroupRule_ExpectInvalidCIDR(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -478,6 +488,7 @@ func TestAccAWSSecurityGroupRule_PartialMatching_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -540,6 +551,7 @@ func TestAccAWSSecurityGroupRule_PartialMatching_Source(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -567,6 +579,7 @@ func TestAccAWSSecurityGroupRule_Issue5310(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -591,6 +604,7 @@ func TestAccAWSSecurityGroupRule_Race(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -610,6 +624,7 @@ func TestAccAWSSecurityGroupRule_SelfSource(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -670,6 +685,7 @@ func TestAccAWSSecurityGroupRule_PrefixListEgress(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -700,6 +716,7 @@ func TestAccAWSSecurityGroupRule_IngressDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -727,6 +744,7 @@ func TestAccAWSSecurityGroupRule_EgressDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -754,6 +772,7 @@ func TestAccAWSSecurityGroupRule_IngressDescription_updates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -790,6 +809,7 @@ func TestAccAWSSecurityGroupRule_EgressDescription_updates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -842,6 +862,7 @@ func TestAccAWSSecurityGroupRule_Description_AllPorts(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -899,6 +920,7 @@ func TestAccAWSSecurityGroupRule_Description_AllPorts_NonZeroPorts(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -960,6 +982,7 @@ func TestAccAWSSecurityGroupRule_MultipleRuleSearching_AllProtocolCrash(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ @@ -1067,6 +1090,7 @@ func TestAccAWSSecurityGroupRule_MultiDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_security_group_test.go b/aws/resource_aws_security_group_test.go index de08b82f6552..6bb0204bdba5 100644 --- a/aws/resource_aws_security_group_test.go +++ b/aws/resource_aws_security_group_test.go @@ -581,6 +581,7 @@ func TestAccAWSSecurityGroup_allowAll(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -606,6 +607,7 @@ func TestAccAWSSecurityGroup_sourceSecurityGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -631,6 +633,7 @@ func TestAccAWSSecurityGroup_IPRangeAndSecurityGroupWithSameRules(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -656,6 +659,7 @@ func TestAccAWSSecurityGroup_IPRangesWithSameRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -681,6 +685,7 @@ func TestAccAWSSecurityGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, @@ -724,6 +729,7 @@ func TestAccAWSSecurityGroup_egressConfigMode(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ @@ -764,6 +770,7 @@ func TestAccAWSSecurityGroup_ingressConfigMode(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSNetworkAclDestroy, Steps: []resource.TestStep{ @@ -805,6 +812,7 @@ func TestAccAWSSecurityGroup_ruleGathering(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -916,6 +924,7 @@ func TestAccAWSSecurityGroup_forceRevokeRulesTrue(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -995,6 +1004,7 @@ func TestAccAWSSecurityGroup_forceRevokeRulesFalse(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1048,6 +1058,7 @@ func TestAccAWSSecurityGroup_ipv6(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, @@ -1100,6 +1111,7 @@ func TestAccAWSSecurityGroup_Name_Generated(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1128,6 +1140,7 @@ func TestAccAWSSecurityGroup_Name_TerraformPrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1155,6 +1168,7 @@ func TestAccAWSSecurityGroup_NamePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1183,6 +1197,7 @@ func TestAccAWSSecurityGroup_NamePrefix_TerraformPrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1224,6 +1239,7 @@ func TestAccAWSSecurityGroup_self(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, @@ -1259,6 +1275,7 @@ func TestAccAWSSecurityGroup_vpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, @@ -1303,6 +1320,7 @@ func TestAccAWSSecurityGroup_vpcNegOneIngress(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, @@ -1333,12 +1351,14 @@ func TestAccAWSSecurityGroup_vpcNegOneIngress(t *testing.T) { }, }) } + func TestAccAWSSecurityGroup_vpcProtoNumIngress(t *testing.T) { var group ec2.SecurityGroup resourceName := "aws_security_group.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, @@ -1368,12 +1388,14 @@ func TestAccAWSSecurityGroup_vpcProtoNumIngress(t *testing.T) { }, }) } + func TestAccAWSSecurityGroup_multiIngress(t *testing.T) { var group ec2.SecurityGroup resourceName := "aws_security_group.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, @@ -1400,6 +1422,7 @@ func TestAccAWSSecurityGroup_change(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, @@ -1433,6 +1456,7 @@ func TestAccAWSSecurityGroup_ruleDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, @@ -1545,6 +1569,7 @@ func TestAccAWSSecurityGroup_defaultEgressVPC(t *testing.T) { // VPC resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, @@ -1572,6 +1597,7 @@ func TestAccAWSSecurityGroup_defaultEgressClassic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSSecurityGroupEc2ClassicDestroy, Steps: []resource.TestStep{ @@ -1599,6 +1625,7 @@ func TestAccAWSSecurityGroup_drift(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1652,6 +1679,7 @@ func TestAccAWSSecurityGroup_driftComplex(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1726,6 +1754,7 @@ func TestAccAWSSecurityGroup_driftComplex(t *testing.T) { func TestAccAWSSecurityGroup_invalidCIDRBlock(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1756,6 +1785,7 @@ func TestAccAWSSecurityGroup_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1800,6 +1830,7 @@ func TestAccAWSSecurityGroup_CIDRandGroups(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1826,6 +1857,7 @@ func TestAccAWSSecurityGroup_ingressWithCidrAndSGsVPC(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1878,6 +1910,7 @@ func TestAccAWSSecurityGroup_ingressWithCidrAndSGsClassic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccEC2ClassicPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSSecurityGroupEc2ClassicDestroy, Steps: []resource.TestStep{ @@ -1917,6 +1950,7 @@ func TestAccAWSSecurityGroup_egressWithPrefixList(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1944,6 +1978,7 @@ func TestAccAWSSecurityGroup_ingressWithPrefixList(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -1971,6 +2006,7 @@ func TestAccAWSSecurityGroup_ipv4andipv6Egress(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -2534,6 +2570,7 @@ func TestAccAWSSecurityGroup_failWithDiffMismatch(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -2558,6 +2595,7 @@ func TestAccAWSSecurityGroup_ruleLimitExceededAppend(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -2604,6 +2642,7 @@ func TestAccAWSSecurityGroup_ruleLimitCidrBlockExceededAppend(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -2672,6 +2711,7 @@ func TestAccAWSSecurityGroup_ruleLimitExceededPrepend(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -2716,6 +2756,7 @@ func TestAccAWSSecurityGroup_ruleLimitExceededAllNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ @@ -2758,6 +2799,7 @@ func TestAccAWSSecurityGroup_rulesDropOnError(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_securityhub_account_test.go b/aws/resource_aws_securityhub_account_test.go index 70eb39b3cc34..dc6e621dedab 100644 --- a/aws/resource_aws_securityhub_account_test.go +++ b/aws/resource_aws_securityhub_account_test.go @@ -12,6 +12,7 @@ import ( func testAccAWSSecurityHubAccount_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityHubAccountDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_securityhub_action_target_test.go b/aws/resource_aws_securityhub_action_target_test.go index bf6b21c0cb9a..47f45b284999 100644 --- a/aws/resource_aws_securityhub_action_target_test.go +++ b/aws/resource_aws_securityhub_action_target_test.go @@ -15,6 +15,7 @@ func testAccAwsSecurityHubActionTarget_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecurityHubActionTargetDestroy, Steps: []resource.TestStep{ @@ -42,6 +43,7 @@ func testAccAwsSecurityHubActionTarget_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecurityHubActionTargetDestroy, Steps: []resource.TestStep{ @@ -62,6 +64,7 @@ func testAccAwsSecurityHubActionTarget_Description(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecurityHubActionTargetDestroy, Steps: []resource.TestStep{ @@ -93,6 +96,7 @@ func testAccAwsSecurityHubActionTarget_Name(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecurityHubActionTargetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_securityhub_invite_accepter_test.go b/aws/resource_aws_securityhub_invite_accepter_test.go index a0015867bc87..e564f8889ff4 100644 --- a/aws/resource_aws_securityhub_invite_accepter_test.go +++ b/aws/resource_aws_securityhub_invite_accepter_test.go @@ -21,6 +21,7 @@ func testAccAWSSecurityHubInviteAccepter_basic(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSSecurityHubInviteAccepterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_securityhub_member_test.go b/aws/resource_aws_securityhub_member_test.go index 6995d6bdf132..23862a53ca46 100644 --- a/aws/resource_aws_securityhub_member_test.go +++ b/aws/resource_aws_securityhub_member_test.go @@ -18,6 +18,7 @@ func testAccAWSSecurityHubMember_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ @@ -42,6 +43,7 @@ func testAccAWSSecurityHubMember_invite(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityHubMemberDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_securityhub_organization_admin_account_test.go b/aws/resource_aws_securityhub_organization_admin_account_test.go index 165d0e0cc148..e720cbf56fe8 100644 --- a/aws/resource_aws_securityhub_organization_admin_account_test.go +++ b/aws/resource_aws_securityhub_organization_admin_account_test.go @@ -7,6 +7,7 @@ import ( "github.com/aws/aws-sdk-go/service/securityhub" "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/securityhub/finder" ) @@ -19,6 +20,7 @@ func testAccAwsSecurityHubOrganizationAdminAccount_basic(t *testing.T) { testAccPreCheck(t) testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecurityHubOrganizationAdminAccountDestroy, Steps: []resource.TestStep{ @@ -46,6 +48,7 @@ func testAccAwsSecurityHubOrganizationAdminAccount_disappears(t *testing.T) { testAccPreCheck(t) testAccOrganizationsAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSecurityHubOrganizationAdminAccountDestroy, Steps: []resource.TestStep{ @@ -61,6 +64,35 @@ func testAccAwsSecurityHubOrganizationAdminAccount_disappears(t *testing.T) { }) } +func testAccAwsSecurityHubOrganizationAdminAccount_MultiRegion(t *testing.T) { + var providers []*schema.Provider + + resourceName := "aws_securityhub_organization_admin_account.test" + altResourceName := "aws_securityhub_organization_admin_account.alternate" + thirdResourceName := "aws_securityhub_organization_admin_account.third" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { + testAccPreCheck(t) + testAccOrganizationsAccountPreCheck(t) + testAccMultipleRegionPreCheck(t, 3) + }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), + ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 3), + CheckDestroy: testAccCheckAwsSecurityHubOrganizationAdminAccountDestroy, + Steps: []resource.TestStep{ + { + Config: testAccSecurityHubOrganizationAdminAccountConfigMultiRegion(), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsSecurityHubOrganizationAdminAccountExists(resourceName), + testAccCheckAwsSecurityHubOrganizationAdminAccountExists(altResourceName), + testAccCheckAwsSecurityHubOrganizationAdminAccountExists(thirdResourceName), + ), + }, + }, + }) +} + func testAccCheckAwsSecurityHubOrganizationAdminAccountDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).securityhubconn @@ -134,3 +166,42 @@ resource "aws_securityhub_organization_admin_account" "test" { } ` } + +func testAccSecurityHubOrganizationAdminAccountConfigMultiRegion() string { + return composeConfig( + testAccMultipleRegionProviderConfig(3), + ` +data "aws_caller_identity" "current" {} + +data "aws_partition" "current" {} + +resource "aws_organizations_organization" "test" { + aws_service_access_principals = ["securityhub.${data.aws_partition.current.dns_suffix}"] + feature_set = "ALL" +} + +resource "aws_securityhub_account" "test" {} + +resource "aws_securityhub_organization_admin_account" "test" { + depends_on = [aws_organizations_organization.test] + + admin_account_id = data.aws_caller_identity.current.account_id +} + +resource "aws_securityhub_organization_admin_account" "alternate" { + provider = awsalternate + + depends_on = [aws_organizations_organization.test] + + admin_account_id = data.aws_caller_identity.current.account_id +} + +resource "aws_securityhub_organization_admin_account" "third" { + provider = awsthird + + depends_on = [aws_organizations_organization.test] + + admin_account_id = data.aws_caller_identity.current.account_id +} +`) +} diff --git a/aws/resource_aws_securityhub_product_subscription_test.go b/aws/resource_aws_securityhub_product_subscription_test.go index 9f0d35c20e7a..e167e63d8a8c 100644 --- a/aws/resource_aws_securityhub_product_subscription_test.go +++ b/aws/resource_aws_securityhub_product_subscription_test.go @@ -14,6 +14,7 @@ import ( func testAccAWSSecurityHubProductSubscription_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityHubAccountDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_securityhub_standards_subscription_test.go b/aws/resource_aws_securityhub_standards_subscription_test.go index b3a5e9bde3bd..f05b8f5a6791 100644 --- a/aws/resource_aws_securityhub_standards_subscription_test.go +++ b/aws/resource_aws_securityhub_standards_subscription_test.go @@ -15,6 +15,7 @@ func testAccAWSSecurityHubStandardsSubscription_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, securityhub.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSecurityHubAccountDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_securityhub_test.go b/aws/resource_aws_securityhub_test.go index e65452d11607..30ae8950a972 100644 --- a/aws/resource_aws_securityhub_test.go +++ b/aws/resource_aws_securityhub_test.go @@ -23,8 +23,9 @@ func TestAccAWSSecurityHub_serial(t *testing.T) { "basic": testAccAWSSecurityHubInviteAccepter_basic, }, "OrganizationAdminAccount": { - "basic": testAccAwsSecurityHubOrganizationAdminAccount_basic, - "disappears": testAccAwsSecurityHubOrganizationAdminAccount_disappears, + "basic": testAccAwsSecurityHubOrganizationAdminAccount_basic, + "disappears": testAccAwsSecurityHubOrganizationAdminAccount_disappears, + "MultiRegion": testAccAwsSecurityHubOrganizationAdminAccount_MultiRegion, }, "ProductSubscription": { "basic": testAccAWSSecurityHubProductSubscription_basic, diff --git a/aws/resource_aws_serverlessapplicationrepository_cloudformation_stack_test.go b/aws/resource_aws_serverlessapplicationrepository_cloudformation_stack_test.go index 8fec44562458..2aee8fbace7c 100644 --- a/aws/resource_aws_serverlessapplicationrepository_cloudformation_stack_test.go +++ b/aws/resource_aws_serverlessapplicationrepository_cloudformation_stack_test.go @@ -25,6 +25,7 @@ func TestAccAwsServerlessApplicationRepositoryCloudFormationStack_basic(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, serverlessrepository.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -75,6 +76,7 @@ func TestAccAwsServerlessApplicationRepositoryCloudFormationStack_disappears(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, serverlessrepository.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAmiDestroy, Steps: []resource.TestStep{ @@ -103,6 +105,7 @@ func TestAccAwsServerlessApplicationRepositoryCloudFormationStack_versioned(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, serverlessrepository.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -156,6 +159,7 @@ func TestAccAwsServerlessApplicationRepositoryCloudFormationStack_paired(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, serverlessrepository.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -181,6 +185,7 @@ func TestAccAwsServerlessApplicationRepositoryCloudFormationStack_Tags(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, serverlessrepository.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ @@ -227,6 +232,7 @@ func TestAccAwsServerlessApplicationRepositoryCloudFormationStack_update(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, serverlessrepository.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudFormationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_service_discovery_http_namespace_test.go b/aws/resource_aws_service_discovery_http_namespace_test.go index 1af657a7aa72..4a818fe1c245 100644 --- a/aws/resource_aws_service_discovery_http_namespace_test.go +++ b/aws/resource_aws_service_discovery_http_namespace_test.go @@ -99,6 +99,7 @@ func TestAccAWSServiceDiscoveryHttpNamespace_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryHttpNamespaceDestroy, Steps: []resource.TestStep{ @@ -128,6 +129,7 @@ func TestAccAWSServiceDiscoveryHttpNamespace_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryHttpNamespaceDestroy, Steps: []resource.TestStep{ @@ -149,6 +151,7 @@ func TestAccAWSServiceDiscoveryHttpNamespace_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryHttpNamespaceDestroy, Steps: []resource.TestStep{ @@ -174,6 +177,7 @@ func TestAccAWSServiceDiscoveryHttpNamespace_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryHttpNamespaceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_service_discovery_private_dns_namespace_test.go b/aws/resource_aws_service_discovery_private_dns_namespace_test.go index b1545bebdcdf..fe3f2d4fc8c5 100644 --- a/aws/resource_aws_service_discovery_private_dns_namespace_test.go +++ b/aws/resource_aws_service_discovery_private_dns_namespace_test.go @@ -99,6 +99,7 @@ func TestAccAWSServiceDiscoveryPrivateDnsNamespace_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryPrivateDnsNamespaceDestroy, Steps: []resource.TestStep{ @@ -128,6 +129,7 @@ func TestAccAWSServiceDiscoveryPrivateDnsNamespace_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryPrivateDnsNamespaceDestroy, Steps: []resource.TestStep{ @@ -149,6 +151,7 @@ func TestAccAWSServiceDiscoveryPrivateDnsNamespace_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryPrivateDnsNamespaceDestroy, Steps: []resource.TestStep{ @@ -171,6 +174,7 @@ func TestAccAWSServiceDiscoveryPrivateDnsNamespace_error_Overlap(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryPrivateDnsNamespaceDestroy, Steps: []resource.TestStep{ @@ -188,6 +192,7 @@ func TestAccAWSServiceDiscoveryPrivateDnsNamespace_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryPrivateDnsNamespaceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_service_discovery_public_dns_namespace_test.go b/aws/resource_aws_service_discovery_public_dns_namespace_test.go index c2c703ca8c1e..ce02f7c2e3a8 100644 --- a/aws/resource_aws_service_discovery_public_dns_namespace_test.go +++ b/aws/resource_aws_service_discovery_public_dns_namespace_test.go @@ -99,6 +99,7 @@ func TestAccAWSServiceDiscoveryPublicDnsNamespace_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryPublicDnsNamespaceDestroy, Steps: []resource.TestStep{ @@ -127,6 +128,7 @@ func TestAccAWSServiceDiscoveryPublicDnsNamespace_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryPublicDnsNamespaceDestroy, Steps: []resource.TestStep{ @@ -148,6 +150,7 @@ func TestAccAWSServiceDiscoveryPublicDnsNamespace_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryPublicDnsNamespaceDestroy, Steps: []resource.TestStep{ @@ -168,6 +171,7 @@ func TestAccAWSServiceDiscoveryPublicDnsNamespace_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryPublicDnsNamespaceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_service_discovery_service_test.go b/aws/resource_aws_service_discovery_service_test.go index 79a19f3e41d9..b24b80579d2a 100644 --- a/aws/resource_aws_service_discovery_service_test.go +++ b/aws/resource_aws_service_discovery_service_test.go @@ -123,6 +123,7 @@ func TestAccAWSServiceDiscoveryService_private(t *testing.T) { testAccPartitionHasServicePreCheck(servicediscovery.EndpointsID, t) testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryServiceDestroy, Steps: []resource.TestStep{ @@ -173,6 +174,7 @@ func TestAccAWSServiceDiscoveryService_public(t *testing.T) { testAccPartitionHasServicePreCheck(servicediscovery.EndpointsID, t) testAccPreCheckAWSServiceDiscovery(t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryServiceDestroy, Steps: []resource.TestStep{ @@ -226,6 +228,7 @@ func TestAccAWSServiceDiscoveryService_http(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicediscovery.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryServiceDestroy, Steps: []resource.TestStep{ @@ -253,6 +256,7 @@ func TestAccAWSServiceDiscoveryService_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicediscovery.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryServiceDestroy, Steps: []resource.TestStep{ @@ -274,6 +278,7 @@ func TestAccAWSServiceDiscoveryService_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(servicediscovery.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, servicediscovery.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsServiceDiscoveryServiceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_servicecatalog_portfolio_test.go b/aws/resource_aws_servicecatalog_portfolio_test.go index e2cc949bfa3e..9e565f33dbe5 100644 --- a/aws/resource_aws_servicecatalog_portfolio_test.go +++ b/aws/resource_aws_servicecatalog_portfolio_test.go @@ -19,6 +19,7 @@ func TestAccAWSServiceCatalogPortfolio_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, servicecatalog.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckServiceCatlaogPortfolioDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSServiceCatalogPortfolio_Disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, servicecatalog.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckServiceCatlaogPortfolioDestroy, Steps: []resource.TestStep{ @@ -72,6 +74,7 @@ func TestAccAWSServiceCatalogPortfolio_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, servicecatalog.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckServiceCatlaogPortfolioDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_servicequotas_service_quota_test.go b/aws/resource_aws_servicequotas_service_quota_test.go index ce5ae69190c8..e0737b3cc9e8 100644 --- a/aws/resource_aws_servicequotas_service_quota_test.go +++ b/aws/resource_aws_servicequotas_service_quota_test.go @@ -19,6 +19,7 @@ func TestAccAwsServiceQuotasServiceQuota_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceQuotas(t) }, + ErrorCheck: testAccErrorCheck(t, servicequotas.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -70,6 +71,7 @@ func TestAccAwsServiceQuotasServiceQuota_Value_IncreaseOnCreate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceQuotas(t) }, + ErrorCheck: testAccErrorCheck(t, servicequotas.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ @@ -112,6 +114,7 @@ func TestAccAwsServiceQuotasServiceQuota_Value_IncreaseOnUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSServiceQuotas(t) }, + ErrorCheck: testAccErrorCheck(t, servicequotas.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_active_receipt_rule_set_test.go b/aws/resource_aws_ses_active_receipt_rule_set_test.go index 3bc025bf64c7..2717641f360f 100644 --- a/aws/resource_aws_ses_active_receipt_rule_set_test.go +++ b/aws/resource_aws_ses_active_receipt_rule_set_test.go @@ -38,6 +38,7 @@ func testAccAWSSESActiveReceiptRuleSet_basic(t *testing.T) { testAccPreCheckAWSSES(t) testAccPreCheckSESReceiptRule(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESActiveReceiptRuleSetDestroy, Steps: []resource.TestStep{ @@ -62,6 +63,7 @@ func testAccAWSSESActiveReceiptRuleSet_disappears(t *testing.T) { testAccPreCheckAWSSES(t) testAccPreCheckSESReceiptRule(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESActiveReceiptRuleSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_configuration_set_test.go b/aws/resource_aws_ses_configuration_set_test.go index 6279ff066bee..775d6e51e1a5 100644 --- a/aws/resource_aws_ses_configuration_set_test.go +++ b/aws/resource_aws_ses_configuration_set_test.go @@ -76,6 +76,7 @@ func TestAccAWSSESConfigurationSet_basic(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESConfigurationSetDestroy, Steps: []resource.TestStep{ @@ -106,6 +107,7 @@ func TestAccAWSSESConfigurationSet_deliveryOptions(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESConfigurationSetDestroy, Steps: []resource.TestStep{ @@ -135,6 +137,7 @@ func TestAccAWSSESConfigurationSet_update_deliveryOptions(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESConfigurationSetDestroy, Steps: []resource.TestStep{ @@ -190,6 +193,7 @@ func TestAccAWSSESConfigurationSet_emptyDeliveryOptions(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESConfigurationSetDestroy, Steps: []resource.TestStep{ @@ -219,6 +223,7 @@ func TestAccAWSSESConfigurationSet_update_emptyDeliveryOptions(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESConfigurationSetDestroy, Steps: []resource.TestStep{ @@ -267,6 +272,7 @@ func TestAccAWSSESConfigurationSet_disappears(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESConfigurationSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_domain_dkim_test.go b/aws/resource_aws_ses_domain_dkim_test.go index b2343f241cba..817fd6577bdf 100644 --- a/aws/resource_aws_ses_domain_dkim_test.go +++ b/aws/resource_aws_ses_domain_dkim_test.go @@ -24,6 +24,7 @@ func TestAccAWSSESDomainDkim_basic(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESDomainDkimDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_domain_identity_test.go b/aws/resource_aws_ses_domain_identity_test.go index 2be3189dc216..14d844e5ced5 100644 --- a/aws/resource_aws_ses_domain_identity_test.go +++ b/aws/resource_aws_ses_domain_identity_test.go @@ -74,6 +74,7 @@ func TestAccAWSSESDomainIdentity_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESDomainIdentityDestroy, Steps: []resource.TestStep{ @@ -95,6 +96,7 @@ func TestAccAWSSESDomainIdentity_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESDomainIdentityDestroy, Steps: []resource.TestStep{ @@ -119,6 +121,7 @@ func TestAccAWSSESDomainIdentity_trailingPeriod(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESDomainIdentityDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_domain_identity_verification_test.go b/aws/resource_aws_ses_domain_identity_verification_test.go index 869f8ba0a266..2c293815e821 100644 --- a/aws/resource_aws_ses_domain_identity_verification_test.go +++ b/aws/resource_aws_ses_domain_identity_verification_test.go @@ -31,6 +31,7 @@ func TestAccAwsSesDomainIdentityVerification_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESDomainIdentityDestroy, Steps: []resource.TestStep{ @@ -49,6 +50,7 @@ func TestAccAwsSesDomainIdentityVerification_timeout(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESDomainIdentityDestroy, Steps: []resource.TestStep{ @@ -67,6 +69,7 @@ func TestAccAwsSesDomainIdentityVerification_nonexistent(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESDomainIdentityDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_domain_mail_from_test.go b/aws/resource_aws_ses_domain_mail_from_test.go index 266819f71cc2..6bf3003d7cf0 100644 --- a/aws/resource_aws_ses_domain_mail_from_test.go +++ b/aws/resource_aws_ses_domain_mail_from_test.go @@ -21,6 +21,7 @@ func TestAccAWSSESDomainMailFrom_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESDomainMailFromDestroy, Steps: []resource.TestStep{ @@ -60,6 +61,7 @@ func TestAccAWSSESDomainMailFrom_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESDomainMailFromDestroy, Steps: []resource.TestStep{ @@ -84,6 +86,7 @@ func TestAccAWSSESDomainMailFrom_disappears_Identity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESDomainMailFromDestroy, Steps: []resource.TestStep{ @@ -107,6 +110,7 @@ func TestAccAWSSESDomainMailFrom_behaviorOnMxFailure(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESDomainMailFromDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_email_identity_test.go b/aws/resource_aws_ses_email_identity_test.go index 423cb76b26f7..ddffd93208d7 100644 --- a/aws/resource_aws_ses_email_identity_test.go +++ b/aws/resource_aws_ses_email_identity_test.go @@ -28,6 +28,7 @@ func TestAccAWSSESEmailIdentity_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESEmailIdentityDestroy, Steps: []resource.TestStep{ @@ -55,6 +56,7 @@ func TestAccAWSSESEmailIdentity_trailingPeriod(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESEmailIdentityDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_event_destination_test.go b/aws/resource_aws_ses_event_destination_test.go index 0890dcc23bd5..53cb2f78ea19 100644 --- a/aws/resource_aws_ses_event_destination_test.go +++ b/aws/resource_aws_ses_event_destination_test.go @@ -25,6 +25,7 @@ func TestAccAWSSESEventDestination_basic(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESEventDestinationDestroy, Steps: []resource.TestStep{ @@ -78,6 +79,7 @@ func TestAccAWSSESEventDestination_disappears(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESEventDestinationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_identity_notification_topic_test.go b/aws/resource_aws_ses_identity_notification_topic_test.go index ec85138f51e2..f4dd72a9b68a 100644 --- a/aws/resource_aws_ses_identity_notification_topic_test.go +++ b/aws/resource_aws_ses_identity_notification_topic_test.go @@ -25,6 +25,7 @@ func TestAccAwsSESIdentityNotificationTopic_basic(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESIdentityNotificationTopicDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_identity_policy_test.go b/aws/resource_aws_ses_identity_policy_test.go index 4db95bf90025..3c4f9cd6fa44 100644 --- a/aws/resource_aws_ses_identity_policy_test.go +++ b/aws/resource_aws_ses_identity_policy_test.go @@ -19,6 +19,7 @@ func TestAccAWSSESIdentityPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESIdentityPolicyDestroy, Steps: []resource.TestStep{ @@ -45,6 +46,7 @@ func TestAccAWSSESIdentityPolicy_Identity_Email(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESIdentityPolicyDestroy, Steps: []resource.TestStep{ @@ -71,6 +73,7 @@ func TestAccAWSSESIdentityPolicy_Policy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSESIdentityPolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_receipt_filter_test.go b/aws/resource_aws_ses_receipt_filter_test.go index 7e419e5e7071..1828f75ad60e 100644 --- a/aws/resource_aws_ses_receipt_filter_test.go +++ b/aws/resource_aws_ses_receipt_filter_test.go @@ -17,6 +17,7 @@ func TestAccAWSSESReceiptFilter_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t); testAccPreCheckSESReceiptRule(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESReceiptFilterDestroy, Steps: []resource.TestStep{ @@ -45,6 +46,7 @@ func TestAccAWSSESReceiptFilter_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t); testAccPreCheckSESReceiptRule(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESReceiptFilterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_receipt_rule_set_test.go b/aws/resource_aws_ses_receipt_rule_set_test.go index 9d754da866b3..be02297e28fd 100644 --- a/aws/resource_aws_ses_receipt_rule_set_test.go +++ b/aws/resource_aws_ses_receipt_rule_set_test.go @@ -86,6 +86,7 @@ func TestAccAWSSESReceiptRuleSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t); testAccPreCheckSESReceiptRule(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESReceiptRuleSetDestroy, Steps: []resource.TestStep{ @@ -112,6 +113,7 @@ func TestAccAWSSESReceiptRuleSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t); testAccPreCheckSESReceiptRule(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESReceiptRuleSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_receipt_rule_test.go b/aws/resource_aws_ses_receipt_rule_test.go index 9e5397b47130..e30041cd004c 100644 --- a/aws/resource_aws_ses_receipt_rule_test.go +++ b/aws/resource_aws_ses_receipt_rule_test.go @@ -23,6 +23,7 @@ func TestAccAWSSESReceiptRule_basic(t *testing.T) { testAccPreCheckAWSSES(t) testAccPreCheckSESReceiptRule(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESReceiptRuleDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSSESReceiptRule_s3Action(t *testing.T) { testAccPreCheckAWSSES(t) testAccPreCheckSESReceiptRule(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESReceiptRuleDestroy, Steps: []resource.TestStep{ @@ -80,6 +82,7 @@ func TestAccAWSSESReceiptRule_order(t *testing.T) { testAccPreCheckAWSSES(t) testAccPreCheckSESReceiptRule(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESReceiptRuleDestroy, Steps: []resource.TestStep{ @@ -108,6 +111,7 @@ func TestAccAWSSESReceiptRule_actions(t *testing.T) { testAccPreCheckAWSSES(t) testAccPreCheckSESReceiptRule(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESReceiptRuleDestroy, Steps: []resource.TestStep{ @@ -138,6 +142,7 @@ func TestAccAWSSESReceiptRule_disappears(t *testing.T) { testAccPreCheckAWSSES(t) testAccPreCheckSESReceiptRule(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSESReceiptRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ses_template_test.go b/aws/resource_aws_ses_template_test.go index d4c8f9ab94d3..7796b9e82b77 100644 --- a/aws/resource_aws_ses_template_test.go +++ b/aws/resource_aws_ses_template_test.go @@ -19,6 +19,7 @@ func TestAccAWSSesTemplate_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSesTemplateDestroy, Steps: []resource.TestStep{ @@ -49,6 +50,7 @@ func TestAccAWSSesTemplate_Update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSesTemplateDestroy, Steps: []resource.TestStep{ @@ -99,6 +101,7 @@ func TestAccAWSSesTemplate_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSES(t) }, + ErrorCheck: testAccErrorCheck(t, ses.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSesTemplateDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sfn_activity_test.go b/aws/resource_aws_sfn_activity_test.go index ed1064de6881..302baf1cb463 100644 --- a/aws/resource_aws_sfn_activity_test.go +++ b/aws/resource_aws_sfn_activity_test.go @@ -19,6 +19,7 @@ func TestAccAWSSfnActivity_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sfn.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSfnActivityDestroy, Steps: []resource.TestStep{ @@ -45,6 +46,7 @@ func TestAccAWSSfnActivity_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sfn.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSfnActivityDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sfn_state_machine_test.go b/aws/resource_aws_sfn_state_machine_test.go index 6aeb6a3beda0..a17715e1c845 100644 --- a/aws/resource_aws_sfn_state_machine_test.go +++ b/aws/resource_aws_sfn_state_machine_test.go @@ -20,6 +20,7 @@ func TestAccAWSSfnStateMachine_createUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sfn.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSfnStateMachineDestroy, Steps: []resource.TestStep{ @@ -63,6 +64,7 @@ func TestAccAWSSfnStateMachine_expressUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sfn.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSfnStateMachineDestroy, Steps: []resource.TestStep{ @@ -101,6 +103,7 @@ func TestAccAWSSfnStateMachine_standardUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sfn.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSfnStateMachineDestroy, Steps: []resource.TestStep{ @@ -140,6 +143,7 @@ func TestAccAWSSfnStateMachine_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sfn.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSfnStateMachineDestroy, Steps: []resource.TestStep{ @@ -184,6 +188,7 @@ func TestAccAWSSfnStateMachine_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sfn.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSfnStateMachineDestroy, Steps: []resource.TestStep{ @@ -205,6 +210,7 @@ func TestAccAWSSfnStateMachine_expressLoggingConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sfn.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSfnStateMachineDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_shield_protection_test.go b/aws/resource_aws_shield_protection_test.go index f6e9ca1012ad..7e29f1ea9f3f 100644 --- a/aws/resource_aws_shield_protection_test.go +++ b/aws/resource_aws_shield_protection_test.go @@ -23,6 +23,7 @@ func TestAccAWSShieldProtection_GlobalAccelerator(t *testing.T) { testAccPartitionHasServicePreCheck(shield.EndpointsID, t) testAccPreCheckAWSShield(t) }, + ErrorCheck: testAccErrorCheck(t, shield.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSShieldProtectionDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func TestAccAWSShieldProtection_ElasticIPAddress(t *testing.T) { testAccPartitionHasServicePreCheck(shield.EndpointsID, t) testAccPreCheckAWSShield(t) }, + ErrorCheck: testAccErrorCheck(t, shield.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSShieldProtectionDestroy, Steps: []resource.TestStep{ @@ -79,6 +81,7 @@ func TestAccAWSShieldProtection_Alb(t *testing.T) { testAccPartitionHasServicePreCheck(shield.EndpointsID, t) testAccPreCheckAWSShield(t) }, + ErrorCheck: testAccErrorCheck(t, shield.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSShieldProtectionDestroy, Steps: []resource.TestStep{ @@ -107,6 +110,7 @@ func TestAccAWSShieldProtection_Elb(t *testing.T) { testAccPartitionHasServicePreCheck(shield.EndpointsID, t) testAccPreCheckAWSShield(t) }, + ErrorCheck: testAccErrorCheck(t, shield.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSShieldProtectionDestroy, Steps: []resource.TestStep{ @@ -136,6 +140,7 @@ func TestAccAWSShieldProtection_Cloudfront(t *testing.T) { testAccPartitionHasServicePreCheck(cloudfront.EndpointsID, t) testAccPreCheckAWSShield(t) }, + ErrorCheck: testAccErrorCheck(t, shield.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSShieldProtectionDestroy, Steps: []resource.TestStep{ @@ -164,7 +169,7 @@ func TestAccAWSShieldProtection_Route53(t *testing.T) { testAccPartitionHasServicePreCheck(shield.EndpointsID, t) testAccPreCheckAWSShield(t) }, - ErrorCheck: testAccErrorCheckSkipRoute53(t), + ErrorCheck: testAccErrorCheck(t, shield.EndpointsID, "route53"), Providers: testAccProviders, CheckDestroy: testAccCheckAWSShieldProtectionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_signer_signing_job_test.go b/aws/resource_aws_signer_signing_job_test.go index cff59f40edc6..0b732a08abb5 100644 --- a/aws/resource_aws_signer_signing_job_test.go +++ b/aws/resource_aws_signer_signing_job_test.go @@ -21,6 +21,7 @@ func TestAccAWSSignerSigningJob_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_signer_signing_profile_permission_test.go b/aws/resource_aws_signer_signing_profile_permission_test.go index bdf705cb9912..efdf1a7611b3 100644 --- a/aws/resource_aws_signer_signing_profile_permission_test.go +++ b/aws/resource_aws_signer_signing_profile_permission_test.go @@ -23,6 +23,7 @@ func TestAccAWSSignerSigningProfilePermission_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ @@ -56,6 +57,7 @@ func TestAccAWSSignerSigningProfilePermission_GetSigningProfile(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ @@ -97,6 +99,7 @@ func TestAccAWSSignerSigningProfilePermission_StartSigningJob_GetSP(t *testing.T resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ @@ -130,6 +133,7 @@ func TestAccAWSSignerSigningProfilePermission_StatementPrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_signer_signing_profile_test.go b/aws/resource_aws_signer_signing_profile_test.go index cac5db06eedd..9b1a3ea3df0c 100644 --- a/aws/resource_aws_signer_signing_profile_test.go +++ b/aws/resource_aws_signer_signing_profile_test.go @@ -22,6 +22,7 @@ func TestAccAWSSignerSigningProfile_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ @@ -52,6 +53,7 @@ func TestAccAWSSignerSigningProfile_GenerateNameWithNamePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ @@ -73,6 +75,7 @@ func TestAccAWSSignerSigningProfile_GenerateName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ @@ -95,6 +98,7 @@ func TestAccAWSSignerSigningProfile_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ @@ -125,6 +129,7 @@ func TestAccAWSSignerSigningProfile_SignatureValidityPeriod(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckSingerSigningProfile(t, "AWSLambda-SHA384-ECDSA") }, + ErrorCheck: testAccErrorCheck(t, signer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSignerSigningProfileDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_simpledb_domain_test.go b/aws/resource_aws_simpledb_domain_test.go index a58ccc7ae8be..54e6a0b2c8b9 100644 --- a/aws/resource_aws_simpledb_domain_test.go +++ b/aws/resource_aws_simpledb_domain_test.go @@ -16,6 +16,7 @@ func TestAccAWSSimpleDBDomain_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(simpledb.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, simpledb.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSimpleDBDomainDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_snapshot_create_volume_permission_test.go b/aws/resource_aws_snapshot_create_volume_permission_test.go index 400bc3f3fe6f..ea1691eac183 100644 --- a/aws/resource_aws_snapshot_create_volume_permission_test.go +++ b/aws/resource_aws_snapshot_create_volume_permission_test.go @@ -5,6 +5,7 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" ) @@ -15,6 +16,7 @@ func TestAccAWSSnapshotCreateVolumePermission_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccAWSSnapshotCreateVolumePermissionDestroy, Steps: []resource.TestStep{ @@ -43,6 +45,7 @@ func TestAccAWSSnapshotCreateVolumePermission_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccAWSSnapshotCreateVolumePermissionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sns_platform_application.go b/aws/resource_aws_sns_platform_application.go index ce5628222ffd..a017c3df893f 100644 --- a/aws/resource_aws_sns_platform_application.go +++ b/aws/resource_aws_sns_platform_application.go @@ -6,13 +6,13 @@ import ( "fmt" "log" "strings" - "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/service/sns" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) var snsPlatformRequiresPlatformPrincipal = map[string]bool{ @@ -180,7 +180,7 @@ func resourceAwsSnsPlatformApplicationUpdate(d *schema.ResourceData, meta interf Attributes: attributes, } - err := resource.Retry(1*time.Minute, func() *resource.RetryError { + err := resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { _, err := snsconn.SetPlatformApplicationAttributes(req) if err != nil { if isAWSErr(err, sns.ErrCodeInvalidParameterException, "is not a valid role to allow SNS to write to Cloudwatch Logs") { diff --git a/aws/resource_aws_sns_platform_application_test.go b/aws/resource_aws_sns_platform_application_test.go index 4b26a78f04ac..6b899d998584 100644 --- a/aws/resource_aws_sns_platform_application_test.go +++ b/aws/resource_aws_sns_platform_application_test.go @@ -211,6 +211,7 @@ func TestAccAWSSnsPlatformApplication_basic(t *testing.T) { t.Run(platform.Name, func(*testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSPlatformApplicationDestroy, Steps: []resource.TestStep{ @@ -277,6 +278,7 @@ func TestAccAWSSnsPlatformApplication_basicAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSPlatformApplicationDestroy, Steps: []resource.TestStep{ @@ -327,6 +329,7 @@ func TestAccAWSSnsPlatformApplication_iamRoleAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSPlatformApplicationDestroy, Steps: []resource.TestStep{ @@ -379,6 +382,7 @@ func TestAccAWSSnsPlatformApplication_snsTopicAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSPlatformApplicationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sns_sms_preferences_test.go b/aws/resource_aws_sns_sms_preferences_test.go index bdd4f777e264..2a79c5dbafa4 100644 --- a/aws/resource_aws_sns_sms_preferences_test.go +++ b/aws/resource_aws_sns_sms_preferences_test.go @@ -33,6 +33,7 @@ func testAccAWSSNSSMSPreferences_empty(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSSMSPrefsDestroy, Steps: []resource.TestStep{ @@ -56,6 +57,7 @@ func testAccAWSSNSSMSPreferences_defaultSMSType(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSSMSPrefsDestroy, Steps: []resource.TestStep{ @@ -79,6 +81,7 @@ func testAccAWSSNSSMSPreferences_almostAll(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSSMSPrefsDestroy, Steps: []resource.TestStep{ @@ -100,6 +103,7 @@ func testAccAWSSNSSMSPreferences_deliveryRole(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSSMSPrefsDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sns_topic_policy_test.go b/aws/resource_aws_sns_topic_policy_test.go index ab7aa7081435..4c9460f45d8c 100644 --- a/aws/resource_aws_sns_topic_policy_test.go +++ b/aws/resource_aws_sns_topic_policy_test.go @@ -4,6 +4,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/sns" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -13,6 +14,7 @@ func TestAccAWSSNSTopicPolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sns_topic_subscription.go b/aws/resource_aws_sns_topic_subscription.go index 99d7ff0578a0..c970dfded668 100644 --- a/aws/resource_aws_sns_topic_subscription.go +++ b/aws/resource_aws_sns_topic_subscription.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/structure" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/sns/finder" "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/sns/waiter" ) @@ -104,13 +105,15 @@ func resourceAwsSnsTopicSubscription() *schema.Resource { DiffSuppressFunc: suppressEquivalentJsonDiffs, }, "subscription_role_arn": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validateArn, }, "topic_arn": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validateArn, }, }, } @@ -168,22 +171,27 @@ func resourceAwsSnsTopicSubscriptionRead(d *schema.ResourceData, meta interface{ log.Printf("[DEBUG] Loading subscription %s", d.Id()) - output, err := conn.GetSubscriptionAttributes(&sns.GetSubscriptionAttributesInput{ - SubscriptionArn: aws.String(d.Id()), - }) + input := &sns.ListSubscriptionsByTopicInput{ + TopicArn: aws.String(d.Get("topic_arn").(string)), + } - if !d.IsNewResource() && (tfawserr.ErrCodeEquals(err, sns.ErrCodeResourceNotFoundException) || tfawserr.ErrCodeEquals(err, sns.ErrCodeNotFoundException)) { - log.Printf("[WARN] SNS subscription attributes (%s) not found, removing from state", d.Id()) + _, err := conn.ListSubscriptionsByTopic(input) + + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, sns.ErrCodeNotFoundException) { + log.Printf("[WARN] SNS Topic Subscription (%s) not found, removing from state", d.Id()) d.SetId("") return nil } + output, err := finder.SubscriptionByARN(conn, d.Id()) if err != nil { return fmt.Errorf("getting SNS subscription attributes (%s): %w", d.Id(), err) } - if output == nil || output.Attributes == nil || len(output.Attributes) == 0 { - return fmt.Errorf("getting SNS subscription attributes (%s): empty response", d.Id()) + if output == nil { + log.Printf("[WARN] SNS subscription attributes (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil } attributes := output.Attributes @@ -282,6 +290,13 @@ func resourceAwsSnsTopicSubscriptionDelete(d *schema.ResourceData, meta interfac return nil } + if _, err := waiter.SubscriptionDeleted(conn, d.Id()); err != nil { + if tfawserr.ErrCodeEquals(err, sns.ErrCodeNotFoundException) { + return nil + } + return fmt.Errorf("error waiting for SNS topic subscription (%s) deletion: %w", d.Id(), err) + } + return err } diff --git a/aws/resource_aws_sns_topic_subscription_test.go b/aws/resource_aws_sns_topic_subscription_test.go index 95fe10e4cdf7..607cd64bef0e 100644 --- a/aws/resource_aws_sns_topic_subscription_test.go +++ b/aws/resource_aws_sns_topic_subscription_test.go @@ -12,11 +12,11 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" - "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/sns" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/sns/finder" ) func TestSuppressEquivalentSnsTopicSubscriptionDeliveryPolicy(t *testing.T) { @@ -67,11 +67,12 @@ func TestSuppressEquivalentSnsTopicSubscriptionDeliveryPolicy(t *testing.T) { func TestAccAWSSNSTopicSubscription_basic(t *testing.T) { attributes := make(map[string]string) - resourceName := "aws_sns_topic_subscription.test_subscription" + resourceName := "aws_sns_topic_subscription.test" rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicSubscriptionDestroy, Steps: []resource.TestStep{ @@ -82,12 +83,12 @@ func TestAccAWSSNSTopicSubscription_basic(t *testing.T) { testAccMatchResourceAttrRegionalARN(resourceName, "arn", sns.ServiceName, regexp.MustCompile(fmt.Sprintf("%s:.+", rName))), resource.TestCheckResourceAttr(resourceName, "confirmation_was_authenticated", "true"), resource.TestCheckResourceAttr(resourceName, "delivery_policy", ""), - resource.TestCheckResourceAttrPair(resourceName, "endpoint", "aws_sqs_queue.test_queue", "arn"), + resource.TestCheckResourceAttrPair(resourceName, "endpoint", "aws_sqs_queue.test", "arn"), resource.TestCheckResourceAttr(resourceName, "filter_policy", ""), resource.TestCheckResourceAttr(resourceName, "pending_confirmation", "false"), resource.TestCheckResourceAttr(resourceName, "protocol", "sqs"), resource.TestCheckResourceAttr(resourceName, "raw_message_delivery", "false"), - resource.TestCheckResourceAttrPair(resourceName, "topic_arn", "aws_sns_topic.test_topic", "arn"), + resource.TestCheckResourceAttrPair(resourceName, "topic_arn", "aws_sns_topic.test", "arn"), ), }, { @@ -105,13 +106,14 @@ func TestAccAWSSNSTopicSubscription_basic(t *testing.T) { func TestAccAWSSNSTopicSubscription_filterPolicy(t *testing.T) { attributes := make(map[string]string) - resourceName := "aws_sns_topic_subscription.test_subscription" + resourceName := "aws_sns_topic_subscription.test" filterPolicy1 := `{"key1": ["val1"], "key2": ["val2"]}` filterPolicy2 := `{"key3": ["val3"], "key4": ["val4"]}` rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicSubscriptionDestroy, Steps: []resource.TestStep{ @@ -153,11 +155,12 @@ func TestAccAWSSNSTopicSubscription_filterPolicy(t *testing.T) { func TestAccAWSSNSTopicSubscription_deliveryPolicy(t *testing.T) { attributes := make(map[string]string) - resourceName := "aws_sns_topic_subscription.test_subscription" + resourceName := "aws_sns_topic_subscription.test" rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicSubscriptionDestroy, Steps: []resource.TestStep{ @@ -211,13 +214,14 @@ func TestAccAWSSNSTopicSubscription_deliveryPolicy(t *testing.T) { func TestAccAWSSNSTopicSubscription_redrivePolicy(t *testing.T) { attributes := make(map[string]string) - resourceName := "aws_sns_topic_subscription.test_subscription" + resourceName := "aws_sns_topic_subscription.test" dlqName := acctest.RandomWithPrefix("tf-acc-test") updatedDlqName := acctest.RandomWithPrefix("tf-acc-test") rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicSubscriptionDestroy, Steps: []resource.TestStep{ @@ -268,11 +272,12 @@ func TestAccAWSSNSTopicSubscription_redrivePolicy(t *testing.T) { func TestAccAWSSNSTopicSubscription_rawMessageDelivery(t *testing.T) { attributes := make(map[string]string) - resourceName := "aws_sns_topic_subscription.test_subscription" + resourceName := "aws_sns_topic_subscription.test" rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicSubscriptionDestroy, Steps: []resource.TestStep{ @@ -314,11 +319,12 @@ func TestAccAWSSNSTopicSubscription_rawMessageDelivery(t *testing.T) { func TestAccAWSSNSTopicSubscription_autoConfirmingEndpoint(t *testing.T) { attributes := make(map[string]string) - resourceName := "aws_sns_topic_subscription.test_subscription" + resourceName := "aws_sns_topic_subscription.test" rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicSubscriptionDestroy, Steps: []resource.TestStep{ @@ -343,11 +349,12 @@ func TestAccAWSSNSTopicSubscription_autoConfirmingEndpoint(t *testing.T) { func TestAccAWSSNSTopicSubscription_autoConfirmingSecuredEndpoint(t *testing.T) { attributes := make(map[string]string) - resourceName := "aws_sns_topic_subscription.test_subscription" + resourceName := "aws_sns_topic_subscription.test" rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicSubscriptionDestroy, Steps: []resource.TestStep{ @@ -372,11 +379,12 @@ func TestAccAWSSNSTopicSubscription_autoConfirmingSecuredEndpoint(t *testing.T) func TestAccAWSSNSTopicSubscription_email(t *testing.T) { attributes := make(map[string]string) - resourceName := "aws_sns_topic_subscription.test_subscription" + resourceName := "aws_sns_topic_subscription.test" rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicSubscriptionDestroy, Steps: []resource.TestStep{ @@ -392,7 +400,7 @@ func TestAccAWSSNSTopicSubscription_email(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "pending_confirmation", "true"), resource.TestCheckResourceAttr(resourceName, "protocol", "email"), resource.TestCheckResourceAttr(resourceName, "raw_message_delivery", "false"), - resource.TestCheckResourceAttrPair(resourceName, "topic_arn", "aws_sns_topic.test_topic", "arn"), + resource.TestCheckResourceAttrPair(resourceName, "topic_arn", "aws_sns_topic.test", "arn"), ), }, }, @@ -401,7 +409,7 @@ func TestAccAWSSNSTopicSubscription_email(t *testing.T) { func TestAccAWSSNSTopicSubscription_firehose(t *testing.T) { attributes := make(map[string]string) - resourceName := "aws_sns_topic_subscription.test_subscription" + resourceName := "aws_sns_topic_subscription.test" rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ @@ -420,7 +428,7 @@ func TestAccAWSSNSTopicSubscription_firehose(t *testing.T) { resource.TestCheckResourceAttr(resourceName, "filter_policy", ""), resource.TestCheckResourceAttr(resourceName, "protocol", "firehose"), resource.TestCheckResourceAttr(resourceName, "raw_message_delivery", "false"), - resource.TestCheckResourceAttrPair(resourceName, "topic_arn", "aws_sns_topic.test_topic", "arn"), + resource.TestCheckResourceAttrPair(resourceName, "topic_arn", "aws_sns_topic.test", "arn"), resource.TestCheckResourceAttrPair(resourceName, "subscription_role_arn", "aws_iam_role.firehose_role", "arn"), ), }, @@ -428,6 +436,52 @@ func TestAccAWSSNSTopicSubscription_firehose(t *testing.T) { }) } +func TestAccAWSSNSTopicSubscription_disappears(t *testing.T) { + attributes := make(map[string]string) + resourceName := "aws_sns_topic_subscription.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSNSTopicSubscriptionDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSNSTopicSubscriptionConfig(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSNSTopicSubscriptionExists(resourceName, attributes), + testAccCheckResourceDisappears(testAccProvider, resourceAwsSnsTopicSubscription(), resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + +func TestAccAWSSNSTopicSubscription_disappears_topic(t *testing.T) { + attributes := make(map[string]string) + resourceName := "aws_sns_topic_subscription.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSNSTopicSubscriptionDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSNSTopicSubscriptionConfig(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSNSTopicSubscriptionExists(resourceName, attributes), + testAccCheckResourceDisappears(testAccProvider, resourceAwsSnsTopic(), "aws_sns_topic.test"), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + // testAccErrorCheckSkipSNS skips SNS tests that have error messages indicating unsupported features func testAccErrorCheckSkipSNS(t *testing.T) resource.ErrorCheckFunc { return testAccErrorCheckSkipMessagesContaining(t, @@ -439,26 +493,20 @@ func testAccCheckAWSSNSTopicSubscriptionDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).snsconn for _, rs := range s.RootModule().Resources { - if rs.Type != "aws_sns_topic" { + if rs.Type != "aws_sns_topic_subscription" { continue } - // Try to find key pair - req := &sns.GetSubscriptionAttributesInput{ - SubscriptionArn: aws.String(rs.Primary.ID), + output, err := finder.SubscriptionByARN(conn, rs.Primary.ID) + if err != nil { + return fmt.Errorf("SNS topic subscription still exists, can't continue.") } - _, err := conn.GetSubscriptionAttributes(req) - - if err == nil { - return fmt.Errorf("Subscription still exists, can't continue.") + if output == nil || aws.StringValue(output.Attributes["Protocol"]) == "email" { + return nil } - // Verify the error is an API error, not something else - _, ok := err.(awserr.Error) - if !ok { - return err - } + return fmt.Errorf("SNS topic Subscription (%s) exists when it should be destroyed", rs.Primary.ID) } return nil @@ -477,11 +525,7 @@ func testAccCheckAWSSNSTopicSubscriptionExists(n string, attributes map[string]s conn := testAccProvider.Meta().(*AWSClient).snsconn - params := &sns.GetSubscriptionAttributesInput{ - SubscriptionArn: aws.String(rs.Primary.ID), - } - output, err := conn.GetSubscriptionAttributes(params) - + output, err := finder.SubscriptionByARN(conn, rs.Primary.ID) for k, v := range output.Attributes { attributes[k] = aws.StringValue(v) } @@ -580,105 +624,105 @@ func TestObfuscateEndpointPassword(t *testing.T) { func testAccAWSSNSTopicSubscriptionConfig(rName string) string { return fmt.Sprintf(` -resource "aws_sns_topic" "test_topic" { +resource "aws_sns_topic" "test" { name = %[1]q } -resource "aws_sqs_queue" "test_queue" { +resource "aws_sqs_queue" "test" { name = %[1]q } -resource "aws_sns_topic_subscription" "test_subscription" { - topic_arn = aws_sns_topic.test_topic.arn +resource "aws_sns_topic_subscription" "test" { + topic_arn = aws_sns_topic.test.arn protocol = "sqs" - endpoint = aws_sqs_queue.test_queue.arn + endpoint = aws_sqs_queue.test.arn } `, rName) } func testAccAWSSNSTopicSubscriptionConfig_filterPolicy(rName, policy string) string { return fmt.Sprintf(` -resource "aws_sns_topic" "test_topic" { +resource "aws_sns_topic" "test" { name = %[1]q } -resource "aws_sqs_queue" "test_queue" { +resource "aws_sqs_queue" "test" { name = %[1]q } -resource "aws_sns_topic_subscription" "test_subscription" { - topic_arn = aws_sns_topic.test_topic.arn +resource "aws_sns_topic_subscription" "test" { + topic_arn = aws_sns_topic.test.arn protocol = "sqs" - endpoint = aws_sqs_queue.test_queue.arn - filter_policy = %s + endpoint = aws_sqs_queue.test.arn + filter_policy = %[2]s } `, rName, policy) } func testAccAWSSNSTopicSubscriptionConfig_deliveryPolicy(rName, policy string) string { return fmt.Sprintf(` -resource "aws_sns_topic" "test_topic" { +resource "aws_sns_topic" "test" { name = %[1]q } -resource "aws_sqs_queue" "test_queue" { +resource "aws_sqs_queue" "test" { name = %[1]q } -resource "aws_sns_topic_subscription" "test_subscription" { - delivery_policy = %s - endpoint = aws_sqs_queue.test_queue.arn +resource "aws_sns_topic_subscription" "test" { + delivery_policy = %[2]s + endpoint = aws_sqs_queue.test.arn protocol = "sqs" - topic_arn = aws_sns_topic.test_topic.arn + topic_arn = aws_sns_topic.test.arn } `, rName, policy) } func testAccAWSSNSTopicSubscriptionConfig_redrivePolicy(rName, dlqName string) string { return fmt.Sprintf(` -resource "aws_sns_topic" "test_topic" { +resource "aws_sns_topic" "test" { name = %[1]q } -resource "aws_sqs_queue" "test_queue" { +resource "aws_sqs_queue" "test" { name = %[1]q } -resource "aws_sqs_queue" "test_queue_dlq" { +resource "aws_sqs_queue" "test_dlq" { name = %[2]q } -resource "aws_sns_topic_subscription" "test_subscription" { - redrive_policy = jsonencode({ deadLetterTargetArn : aws_sqs_queue.test_queue_dlq.arn }) - endpoint = aws_sqs_queue.test_queue.arn +resource "aws_sns_topic_subscription" "test" { + redrive_policy = jsonencode({ deadLetterTargetArn : aws_sqs_queue.test_dlq.arn }) + endpoint = aws_sqs_queue.test.arn protocol = "sqs" - topic_arn = aws_sns_topic.test_topic.arn + topic_arn = aws_sns_topic.test.arn } `, rName, dlqName) } func testAccAWSSNSTopicSubscriptionConfig_rawMessageDelivery(rName string, rawMessageDelivery bool) string { return fmt.Sprintf(` -resource "aws_sns_topic" "test_topic" { +resource "aws_sns_topic" "test" { name = %[1]q } -resource "aws_sqs_queue" "test_queue" { +resource "aws_sqs_queue" "test" { name = %[1]q } -resource "aws_sns_topic_subscription" "test_subscription" { - endpoint = aws_sqs_queue.test_queue.arn +resource "aws_sns_topic_subscription" "test" { + endpoint = aws_sqs_queue.test.arn protocol = "sqs" - raw_message_delivery = %t - topic_arn = aws_sns_topic.test_topic.arn + raw_message_delivery = %[2]t + topic_arn = aws_sns_topic.test.arn } `, rName, rawMessageDelivery) } func testAccAWSSNSTopicSubscriptionConfig_autoConfirmingEndpoint(rName string) string { return fmt.Sprintf(` -resource "aws_sns_topic" "test_topic" { +resource "aws_sns_topic" "test" { name = %[1]q } @@ -791,9 +835,9 @@ resource "aws_api_gateway_deployment" "test" { stage_name = "acctest" } -resource "aws_sns_topic_subscription" "test_subscription" { +resource "aws_sns_topic_subscription" "test" { depends_on = [aws_lambda_permission.apigw_lambda] - topic_arn = aws_sns_topic.test_topic.arn + topic_arn = aws_sns_topic.test.arn protocol = "https" endpoint = aws_api_gateway_deployment.test.invoke_url endpoint_auto_confirms = true @@ -803,7 +847,7 @@ resource "aws_sns_topic_subscription" "test_subscription" { func testAccAWSSNSTopicSubscriptionConfig_autoConfirmingSecuredEndpoint(rName string) string { return fmt.Sprintf(` -resource "aws_sns_topic" "test_topic" { +resource "aws_sns_topic" "test" { name = %[1]q } @@ -993,9 +1037,9 @@ resource "aws_api_gateway_gateway_response" "test" { } } -resource "aws_sns_topic_subscription" "test_subscription" { +resource "aws_sns_topic_subscription" "test" { depends_on = [aws_lambda_permission.apigw_lambda] - topic_arn = aws_sns_topic.test_topic.arn + topic_arn = aws_sns_topic.test.arn protocol = "https" endpoint = replace(aws_api_gateway_deployment.test.invoke_url, "https://", "https://davematthews:granny@") endpoint_auto_confirms = true @@ -1005,12 +1049,12 @@ resource "aws_sns_topic_subscription" "test_subscription" { func testAccAWSSNSTopicSubscriptionEmailConfig(rName string) string { return fmt.Sprintf(` -resource "aws_sns_topic" "test_topic" { +resource "aws_sns_topic" "test" { name = %[1]q } -resource "aws_sns_topic_subscription" "test_subscription" { - topic_arn = aws_sns_topic.test_topic.arn +resource "aws_sns_topic_subscription" "test" { + topic_arn = aws_sns_topic.test.arn protocol = "email" endpoint = "invalid_email@example.com" } @@ -1019,14 +1063,14 @@ resource "aws_sns_topic_subscription" "test_subscription" { func testAccAWSSNSTopicSubscriptionConfig_firehose(rName string) string { return fmt.Sprintf(` -resource "aws_sns_topic" "test_topic" { +resource "aws_sns_topic" "test" { name = %[1]q } -resource "aws_sns_topic_subscription" "test_subscription" { +resource "aws_sns_topic_subscription" "test" { endpoint = aws_kinesis_firehose_delivery_stream.test_stream.arn protocol = "firehose" - topic_arn = aws_sns_topic.test_topic.arn + topic_arn = aws_sns_topic.test.arn subscription_role_arn = aws_iam_role.firehose_role.arn } resource "aws_s3_bucket" "bucket" { diff --git a/aws/resource_aws_sns_topic_test.go b/aws/resource_aws_sns_topic_test.go index 63bbb78f8095..1fa7f5cfb27f 100644 --- a/aws/resource_aws_sns_topic_test.go +++ b/aws/resource_aws_sns_topic_test.go @@ -92,6 +92,7 @@ func TestAccAWSSNSTopic_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicDestroy, @@ -118,6 +119,7 @@ func TestAccAWSSNSTopic_name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicDestroy, @@ -144,6 +146,7 @@ func TestAccAWSSNSTopic_namePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicDestroy, @@ -173,6 +176,7 @@ func TestAccAWSSNSTopic_policy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicDestroy, @@ -200,6 +204,7 @@ func TestAccAWSSNSTopic_withIAMRole(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicDestroy, @@ -218,6 +223,7 @@ func TestAccAWSSNSTopic_withFakeIAMRole(t *testing.T) { rName := acctest.RandString(10) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), IDRefreshName: "aws_sns_topic.test", Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicDestroy, @@ -238,6 +244,7 @@ func TestAccAWSSNSTopic_withDeliveryPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicDestroy, @@ -267,6 +274,7 @@ func TestAccAWSSNSTopic_deliveryStatus(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicDestroy, @@ -300,6 +308,7 @@ func TestAccAWSSNSTopic_encryption(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicDestroy, @@ -334,6 +343,7 @@ func TestAccAWSSNSTopic_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sns.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSSNSTopicDestroy, diff --git a/aws/resource_aws_spot_datafeed_subscription_test.go b/aws/resource_aws_spot_datafeed_subscription_test.go index f71ad27e6b1c..7d0536713207 100644 --- a/aws/resource_aws_spot_datafeed_subscription_test.go +++ b/aws/resource_aws_spot_datafeed_subscription_test.go @@ -33,6 +33,7 @@ func testAccAWSSpotDatafeedSubscription_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSpotDatafeedSubscription(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotDatafeedSubscriptionDestroy, Steps: []resource.TestStep{ @@ -82,6 +83,7 @@ func testAccAWSSpotDatafeedSubscription_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSpotDatafeedSubscription(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotDatafeedSubscriptionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_spot_fleet_request_test.go b/aws/resource_aws_spot_fleet_request_test.go index 95ac81468f66..dedbe440adce 100644 --- a/aws/resource_aws_spot_fleet_request_test.go +++ b/aws/resource_aws_spot_fleet_request_test.go @@ -64,6 +64,7 @@ func TestAccAWSSpotFleetRequest_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -95,6 +96,7 @@ func TestAccAWSSpotFleetRequest_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -141,6 +143,7 @@ func TestAccAWSSpotFleetRequest_associatePublicIpAddress(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -173,6 +176,7 @@ func TestAccAWSSpotFleetRequest_launchTemplate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -203,6 +207,7 @@ func TestAccAWSSpotFleetRequest_launchTemplate_multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -227,6 +232,7 @@ func TestAccAWSSpotFleetRequest_launchTemplateWithOverrides(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -257,6 +263,7 @@ func TestAccAWSSpotFleetRequest_launchTemplateToLaunchSpec(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -297,6 +304,7 @@ func TestAccAWSSpotFleetRequest_launchSpecToLaunchTemplate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -331,6 +339,7 @@ func TestAccAWSSpotFleetRequest_instanceInterruptionBehavior(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -360,6 +369,7 @@ func TestAccAWSSpotFleetRequest_fleetType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -389,6 +399,7 @@ func TestAccAWSSpotFleetRequest_iamInstanceProfileArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -418,6 +429,7 @@ func TestAccAWSSpotFleetRequest_changePriceForcesNewRequest(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -458,6 +470,7 @@ func TestAccAWSSpotFleetRequest_updateTargetCapacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -502,6 +515,7 @@ func TestAccAWSSpotFleetRequest_updateExcessCapacityTerminationPolicy(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -538,6 +552,7 @@ func TestAccAWSSpotFleetRequest_lowestPriceAzOrSubnetInRegion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -568,6 +583,7 @@ func TestAccAWSSpotFleetRequest_lowestPriceAzInGivenList(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -599,6 +615,7 @@ func TestAccAWSSpotFleetRequest_lowestPriceSubnetInGivenList(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -630,6 +647,7 @@ func TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameAz(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -664,6 +682,7 @@ func TestAccAWSSpotFleetRequest_multipleInstanceTypesInSameSubnet(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -694,6 +713,7 @@ func TestAccAWSSpotFleetRequest_overriddingSpotPrice(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -729,6 +749,7 @@ func TestAccAWSSpotFleetRequest_withoutSpotPrice(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -758,6 +779,7 @@ func TestAccAWSSpotFleetRequest_diversifiedAllocation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -788,6 +810,7 @@ func TestAccAWSSpotFleetRequest_multipleInstancePools(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -833,6 +856,7 @@ func TestAccAWSSpotFleetRequest_withWeightedCapacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -871,6 +895,7 @@ func TestAccAWSSpotFleetRequest_withEBSDisk(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -899,6 +924,7 @@ func TestAccAWSSpotFleetRequest_LaunchSpecification_EbsBlockDevice_KmsKeyId(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -926,6 +952,7 @@ func TestAccAWSSpotFleetRequest_LaunchSpecification_RootBlockDevice_KmsKeyId(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -952,6 +979,7 @@ func TestAccAWSSpotFleetRequest_LaunchSpecification_EbsBlockDeviceGp3(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -985,6 +1013,7 @@ func TestAccAWSSpotFleetRequest_LaunchSpecification_RootBlockDeviceGp3(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -1018,6 +1047,7 @@ func TestAccAWSSpotFleetRequest_withTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -1050,6 +1080,7 @@ func TestAccAWSSpotFleetRequest_placementTenancyAndGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -1079,6 +1110,7 @@ func TestAccAWSSpotFleetRequest_WithELBs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -1108,6 +1140,7 @@ func TestAccAWSSpotFleetRequest_WithTargetGroups(t *testing.T) { resourceName := "aws_spot_fleet_request.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -1138,6 +1171,7 @@ func TestAccAWSSpotFleetRequest_zero_capacity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -1180,6 +1214,7 @@ func TestAccAWSSpotFleetRequest_CapacityRebalance(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -1207,6 +1242,7 @@ func TestAccAWSSpotFleetRequest_WithInstanceStoreAmi(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ @@ -1226,6 +1262,7 @@ func TestAccAWSSpotFleetRequest_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEc2SpotFleetRequest(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotFleetRequestDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_spot_instance_request.go b/aws/resource_aws_spot_instance_request.go index 9a140e94acb3..dbd94290211d 100644 --- a/aws/resource_aws_spot_instance_request.go +++ b/aws/resource_aws_spot_instance_request.go @@ -13,6 +13,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" ) func resourceAwsSpotInstanceRequest() *schema.Resource { @@ -188,7 +189,7 @@ func resourceAwsSpotInstanceRequestCreate(d *schema.ResourceData, meta interface log.Printf("[DEBUG] Requesting spot bid opts: %s", spotOpts) var resp *ec2.RequestSpotInstancesOutput - err = resource.Retry(1*time.Minute, func() *resource.RetryError { + err = resource.Retry(iamwaiter.PropagationTimeout, func() *resource.RetryError { resp, err = conn.RequestSpotInstances(spotOpts) // IAM instance profiles can take ~10 seconds to propagate in AWS: // http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html#launch-instance-with-role-console diff --git a/aws/resource_aws_spot_instance_request_test.go b/aws/resource_aws_spot_instance_request_test.go index effff3e2bb84..47debe63a055 100644 --- a/aws/resource_aws_spot_instance_request_test.go +++ b/aws/resource_aws_spot_instance_request_test.go @@ -19,6 +19,7 @@ func TestAccAWSSpotInstanceRequest_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func TestAccAWSSpotInstanceRequest_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -96,6 +98,7 @@ func TestAccAWSSpotInstanceRequest_withLaunchGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -127,6 +130,7 @@ func TestAccAWSSpotInstanceRequest_withBlockDuration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -158,6 +162,7 @@ func TestAccAWSSpotInstanceRequest_vpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -190,6 +195,7 @@ func TestAccAWSSpotInstanceRequest_validUntil(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -221,6 +227,7 @@ func TestAccAWSSpotInstanceRequest_withoutSpotPrice(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -250,6 +257,7 @@ func TestAccAWSSpotInstanceRequest_SubnetAndSGAndPublicIpAddress(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -278,6 +286,7 @@ func TestAccAWSSpotInstanceRequest_NetworkInterfaceAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -307,6 +316,7 @@ func TestAccAWSSpotInstanceRequest_getPasswordData(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -334,6 +344,7 @@ func TestAccAWSSpotInstanceRequest_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -570,6 +581,7 @@ func TestAccAWSSpotInstanceRequest_InterruptStop(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ @@ -598,6 +610,7 @@ func TestAccAWSSpotInstanceRequest_InterruptHibernate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSpotInstanceRequestDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sqs_queue_policy_test.go b/aws/resource_aws_sqs_queue_policy_test.go index 4d226ac2d98b..a75bb561994c 100644 --- a/aws/resource_aws_sqs_queue_policy_test.go +++ b/aws/resource_aws_sqs_queue_policy_test.go @@ -5,6 +5,7 @@ import ( "regexp" "testing" + "github.com/aws/aws-sdk-go/service/sqs" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" ) @@ -16,6 +17,7 @@ func TestAccAWSSQSQueuePolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -51,6 +53,7 @@ func TestAccAWSSQSQueuePolicy_disappears_queue(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -74,6 +77,7 @@ func TestAccAWSSQSQueuePolicy_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_sqs_queue_test.go b/aws/resource_aws_sqs_queue_test.go index 3eb37f1d3786..18877a225bc1 100644 --- a/aws/resource_aws_sqs_queue_test.go +++ b/aws/resource_aws_sqs_queue_test.go @@ -79,6 +79,7 @@ func TestAccAWSSQSQueue_basic(t *testing.T) { queueName := fmt.Sprintf("sqs-queue-%s", acctest.RandString(10)) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -122,6 +123,7 @@ func TestAccAWSSQSQueue_tags(t *testing.T) { queueName := fmt.Sprintf("sqs-queue-%s", acctest.RandString(10)) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -170,6 +172,7 @@ func TestAccAWSSQSQueue_namePrefix(t *testing.T) { prefix := "acctest-sqs-queue" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -200,6 +203,7 @@ func TestAccAWSSQSQueue_namePrefix_fifo(t *testing.T) { prefix := "acctest-sqs-queue" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -231,6 +235,7 @@ func TestAccAWSSQSQueue_policy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -260,6 +265,7 @@ func TestAccAWSSQSQueue_queueDeletedRecently(t *testing.T) { queueName := fmt.Sprintf("sqs-queue-%s", acctest.RandString(10)) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -287,6 +293,7 @@ func TestAccAWSSQSQueue_redrivePolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -317,6 +324,7 @@ func TestAccAWSSQSQueue_Policybasic(t *testing.T) { topicName := fmt.Sprintf("sns-topic-%s", acctest.RandString(10)) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -345,6 +353,7 @@ func TestAccAWSSQSQueue_FIFO(t *testing.T) { resourceName := "aws_sqs_queue.queue" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -370,6 +379,7 @@ func TestAccAWSSQSQueue_FIFO(t *testing.T) { func TestAccAWSSQSQueue_FIFOExpectNameError(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -387,6 +397,7 @@ func TestAccAWSSQSQueue_FIFOWithContentBasedDeduplication(t *testing.T) { resourceName := "aws_sqs_queue.queue" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -413,6 +424,7 @@ func TestAccAWSSQSQueue_FIFOWithContentBasedDeduplication(t *testing.T) { func TestAccAWSSQSQueue_ExpectContentBasedDeduplicationError(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -430,6 +442,7 @@ func TestAccAWSSQSQueue_Encryption(t *testing.T) { resourceName := "aws_sqs_queue.queue" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, sqs.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSQSQueueDestroy, Steps: []resource.TestStep{ @@ -481,6 +494,7 @@ func testAccCheckAWSSQSQueueDestroy(s *terraform.State) error { return nil } + func testAccCheckAWSSQSQueuePolicyAttribute(queueAttributes *map[string]*string, topicName, queueName string) resource.TestCheckFunc { return func(s *terraform.State) error { accountID := testAccProvider.Meta().(*AWSClient).accountid diff --git a/aws/resource_aws_ssm_activation_test.go b/aws/resource_aws_ssm_activation_test.go index 6122f59610a2..0dc68d3453b6 100644 --- a/aws/resource_aws_ssm_activation_test.go +++ b/aws/resource_aws_ssm_activation_test.go @@ -20,6 +20,7 @@ func TestAccAWSSSMActivation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMActivationDestroy, Steps: []resource.TestStep{ @@ -51,6 +52,7 @@ func TestAccAWSSSMActivation_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMActivationDestroy, Steps: []resource.TestStep{ @@ -102,6 +104,7 @@ func TestAccAWSSSMActivation_expirationDate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMActivationDestroy, Steps: []resource.TestStep{ @@ -132,6 +135,7 @@ func TestAccAWSSSMActivation_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMActivationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ssm_association_test.go b/aws/resource_aws_ssm_association_test.go index cbea001e4a0e..48526d472127 100644 --- a/aws/resource_aws_ssm_association_test.go +++ b/aws/resource_aws_ssm_association_test.go @@ -17,6 +17,7 @@ func TestAccAWSSSMAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -42,6 +43,7 @@ func TestAccAWSSSMAssociation_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -63,6 +65,7 @@ func TestAccAWSSSMAssociation_ApplyOnlyAtCronInterval(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -115,6 +118,7 @@ targets { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -173,6 +177,7 @@ func TestAccAWSSSMAssociation_withParameters(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -210,6 +215,7 @@ func TestAccAWSSSMAssociation_withAssociationName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -247,6 +253,7 @@ func TestAccAWSSSMAssociation_withAssociationNameAndScheduleExpression(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -281,6 +288,7 @@ func TestAccAWSSSMAssociation_withDocumentVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -307,6 +315,7 @@ func TestAccAWSSSMAssociation_withOutputLocation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -355,6 +364,7 @@ func TestAccAWSSSMAssociation_withAutomationTargetParamName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -390,6 +400,7 @@ func TestAccAWSSSMAssociation_withScheduleExpression(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -425,6 +436,7 @@ func TestAccAWSSSMAssociation_withComplianceSeverity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ @@ -463,6 +475,7 @@ func TestAccAWSSSMAssociation_rateControl(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ssm_document_test.go b/aws/resource_aws_ssm_document_test.go index 4ff60969b4bf..9d7872f7e3d4 100644 --- a/aws/resource_aws_ssm_document_test.go +++ b/aws/resource_aws_ssm_document_test.go @@ -17,6 +17,7 @@ func TestAccAWSSSMDocument_basic(t *testing.T) { resourceName := "aws_ssm_document.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -48,6 +49,7 @@ func TestAccAWSSSMDocument_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -79,6 +81,7 @@ func TestAccAWSSSMDocument_target_type(t *testing.T) { resourceName := "aws_ssm_document.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -110,6 +113,7 @@ func TestAccAWSSSMDocument_VersionName(t *testing.T) { resourceName := "aws_ssm_document.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -141,6 +145,7 @@ func TestAccAWSSSMDocument_update(t *testing.T) { resourceName := "aws_ssm_document.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -175,6 +180,7 @@ func TestAccAWSSSMDocument_permission_public(t *testing.T) { resourceName := "aws_ssm_document.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -201,6 +207,7 @@ func TestAccAWSSSMDocument_permission_private(t *testing.T) { ids := "123456789012" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -226,6 +233,7 @@ func TestAccAWSSSMDocument_permission_batching(t *testing.T) { ids := "123456789012,123456789013,123456789014,123456789015,123456789016,123456789017,123456789018,123456789019,123456789020,123456789021,123456789022,123456789023,123456789024,123456789025,123456789026,123456789027,123456789028,123456789029,123456789030,123456789031,123456789032" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -253,6 +261,7 @@ func TestAccAWSSSMDocument_permission_change(t *testing.T) { idsAdd := "123456789012,123456789014" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -294,6 +303,7 @@ func TestAccAWSSSMDocument_params(t *testing.T) { resourceName := "aws_ssm_document.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -323,6 +333,7 @@ func TestAccAWSSSMDocument_automation(t *testing.T) { resourceName := "aws_ssm_document.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -350,6 +361,7 @@ func TestAccAWSSSMDocument_package(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -383,6 +395,7 @@ func TestAccAWSSSMDocument_SchemaVersion_1(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -414,6 +427,7 @@ func TestAccAWSSSMDocument_session(t *testing.T) { resourceName := "aws_ssm_document.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -460,6 +474,7 @@ mainSteps: ` resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -494,6 +509,7 @@ func TestAccAWSSSMDocument_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ @@ -536,6 +552,7 @@ func TestAccAWSSSMDocument_disappears(t *testing.T) { resourceName := "aws_ssm_document.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMDocumentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ssm_maintenance_window_target_test.go b/aws/resource_aws_ssm_maintenance_window_target_test.go index 0112b2b50ee5..5a6941a9dd93 100644 --- a/aws/resource_aws_ssm_maintenance_window_target_test.go +++ b/aws/resource_aws_ssm_maintenance_window_target_test.go @@ -18,6 +18,7 @@ func TestAccAWSSSMMaintenanceWindowTarget_basic(t *testing.T) { resourceName := "aws_ssm_maintenance_window_target.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTargetDestroy, Steps: []resource.TestStep{ @@ -53,6 +54,7 @@ func TestAccAWSSSMMaintenanceWindowTarget_noNameOrDescription(t *testing.T) { resourceName := "aws_ssm_maintenance_window_target.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTargetDestroy, Steps: []resource.TestStep{ @@ -83,6 +85,7 @@ func TestAccAWSSSMMaintenanceWindowTarget_validation(t *testing.T) { name := acctest.RandString(10) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTargetDestroy, Steps: []resource.TestStep{ @@ -108,6 +111,7 @@ func TestAccAWSSSMMaintenanceWindowTarget_update(t *testing.T) { resourceName := "aws_ssm_maintenance_window_target.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTargetDestroy, Steps: []resource.TestStep{ @@ -163,6 +167,7 @@ func TestAccAWSSSMMaintenanceWindowTarget_resourceGroup(t *testing.T) { resourceName := "aws_ssm_maintenance_window_target.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTargetDestroy, Steps: []resource.TestStep{ @@ -197,6 +202,7 @@ func TestAccAWSSSMMaintenanceWindowTarget_disappears(t *testing.T) { resourceName := "aws_ssm_maintenance_window_target.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTargetDestroy, Steps: []resource.TestStep{ @@ -218,6 +224,7 @@ func TestAccAWSSSMMaintenanceWindowTarget_disappears_window(t *testing.T) { resourceName := "aws_ssm_maintenance_window_target.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTargetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ssm_maintenance_window_task_test.go b/aws/resource_aws_ssm_maintenance_window_task_test.go index 2ad5b7a3e1a8..ba0e17cf0748 100644 --- a/aws/resource_aws_ssm_maintenance_window_task_test.go +++ b/aws/resource_aws_ssm_maintenance_window_task_test.go @@ -18,6 +18,7 @@ func TestAccAWSSSMMaintenanceWindowTask_basic(t *testing.T) { rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, Steps: []resource.TestStep{ @@ -58,6 +59,7 @@ func TestAccAWSSSMMaintenanceWindowTask_noRole(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, Steps: []resource.TestStep{ @@ -78,6 +80,7 @@ func TestAccAWSSSMMaintenanceWindowTask_updateForcesNewResource(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, Steps: []resource.TestStep{ @@ -113,6 +116,7 @@ func TestAccAWSSSMMaintenanceWindowTask_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, Steps: []resource.TestStep{ @@ -148,6 +152,7 @@ func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationAutomationParameters(t *te rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, Steps: []resource.TestStep{ @@ -188,6 +193,7 @@ func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationLambdaParameters(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, Steps: []resource.TestStep{ @@ -216,6 +222,7 @@ func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationRunCommandParameters(t *te rName := acctest.RandomWithPrefix("tf-acc-test") resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, Steps: []resource.TestStep{ @@ -257,6 +264,7 @@ func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationRunCommandParametersCloudW name := acctest.RandString(10) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, Steps: []resource.TestStep{ @@ -306,6 +314,7 @@ func TestAccAWSSSMMaintenanceWindowTask_TaskInvocationStepFunctionParameters(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, Steps: []resource.TestStep{ @@ -332,6 +341,7 @@ func TestAccAWSSSMMaintenanceWindowTask_emptyNotificationConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, Steps: []resource.TestStep{ @@ -353,6 +363,7 @@ func TestAccAWSSSMMaintenanceWindowTask_disappears(t *testing.T) { name := acctest.RandString(10) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowTaskDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ssm_maintenance_window_test.go b/aws/resource_aws_ssm_maintenance_window_test.go index 0f2b01e61a29..ec54f19e54df 100644 --- a/aws/resource_aws_ssm_maintenance_window_test.go +++ b/aws/resource_aws_ssm_maintenance_window_test.go @@ -83,6 +83,7 @@ func TestAccAWSSSMMaintenanceWindow_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -118,6 +119,7 @@ func TestAccAWSSSMMaintenanceWindow_description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -153,6 +155,7 @@ func TestAccAWSSSMMaintenanceWindow_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -197,6 +200,7 @@ func TestAccAWSSSMMaintenanceWindow_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -220,6 +224,7 @@ func TestAccAWSSSMMaintenanceWindow_multipleUpdates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -256,6 +261,7 @@ func TestAccAWSSSMMaintenanceWindow_Cutoff(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -289,6 +295,7 @@ func TestAccAWSSSMMaintenanceWindow_Duration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -322,6 +329,7 @@ func TestAccAWSSSMMaintenanceWindow_Enabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -357,6 +365,7 @@ func TestAccAWSSSMMaintenanceWindow_EndDate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -397,6 +406,7 @@ func TestAccAWSSSMMaintenanceWindow_Schedule(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -430,6 +440,7 @@ func TestAccAWSSSMMaintenanceWindow_ScheduleTimezone(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -470,6 +481,7 @@ func TestAccAWSSSMMaintenanceWindow_ScheduleOffset(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ @@ -505,6 +517,7 @@ func TestAccAWSSSMMaintenanceWindow_StartDate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMMaintenanceWindowDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ssm_parameter.go b/aws/resource_aws_ssm_parameter.go index b085eee40804..b9d6ad46a9f6 100644 --- a/aws/resource_aws_ssm_parameter.go +++ b/aws/resource_aws_ssm_parameter.go @@ -32,31 +32,29 @@ func resourceAwsSsmParameter() *schema.Resource { Schema: map[string]*schema.Schema{ "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringLenBetween(1, 2048), }, "description": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 1024), }, "tier": { - Type: schema.TypeString, - Optional: true, - Default: ssm.ParameterTierStandard, - ValidateFunc: validation.StringInSlice([]string{ - ssm.ParameterTierStandard, - ssm.ParameterTierAdvanced, - }, false), + Type: schema.TypeString, + Optional: true, + Default: ssm.ParameterTierStandard, + ValidateFunc: validation.StringInSlice(ssm.ParameterTier_Values(), false), + DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { + return d.Get("tier").(string) == ssm.ParameterTierIntelligentTiering + }, }, "type": { - Type: schema.TypeString, - Required: true, - ValidateFunc: validation.StringInSlice([]string{ - ssm.ParameterTypeString, - ssm.ParameterTypeStringList, - ssm.ParameterTypeSecureString, - }, false), + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.StringInSlice(ssm.ParameterType_Values(), false), }, "value": { Type: schema.TypeString, @@ -87,8 +85,9 @@ func resourceAwsSsmParameter() *schema.Resource { Optional: true, }, "allowed_pattern": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, + ValidateFunc: validation.StringLenBetween(1, 1024), }, "version": { Type: schema.TypeInt, @@ -100,8 +99,10 @@ func resourceAwsSsmParameter() *schema.Resource { CustomizeDiff: customdiff.All( // Prevent the following error during tier update from Advanced to Standard: // ValidationException: This parameter uses the advanced-parameter tier. You can't downgrade a parameter from the advanced-parameter tier to the standard-parameter tier. If necessary, you can delete the advanced parameter and recreate it as a standard parameter. + // In the case of Advanced to Intelligent-Tiering, a ValidationException is not thrown + // but rather no change occurs without resource re-creation customdiff.ForceNewIfChange("tier", func(_ context.Context, old, new, meta interface{}) bool { - return old.(string) == ssm.ParameterTierAdvanced && new.(string) == ssm.ParameterTierStandard + return old.(string) == ssm.ParameterTierAdvanced && (new.(string) == ssm.ParameterTierStandard || new.(string) == ssm.ParameterTierIntelligentTiering) }), ), } @@ -166,7 +167,7 @@ func resourceAwsSsmParameterRead(d *schema.ResourceData, meta interface{}) error } describeResp, err := ssmconn.DescribeParameters(describeParamsInput) if err != nil { - return fmt.Errorf("error describing SSM parameter: %s", err) + return fmt.Errorf("error describing SSM parameter: %w", err) } if describeResp == nil || len(describeResp.Parameters) == 0 || describeResp.Parameters[0] == nil { @@ -188,11 +189,11 @@ func resourceAwsSsmParameterRead(d *schema.ResourceData, meta interface{}) error tags, err := keyvaluetags.SsmListTags(ssmconn, name, ssm.ResourceTypeForTaggingParameter) if err != nil { - return fmt.Errorf("error listing tags for SSM Parameter (%s): %s", name, err) + return fmt.Errorf("error listing tags for SSM Parameter (%s): %w", name, err) } if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + return fmt.Errorf("error setting tags: %w", err) } d.Set("arn", param.ARN) @@ -218,10 +219,11 @@ func resourceAwsSsmParameterDelete(d *schema.ResourceData, meta interface{}) err func resourceAwsSsmParameterPut(d *schema.ResourceData, meta interface{}) error { ssmconn := meta.(*AWSClient).ssmconn - log.Printf("[INFO] Creating SSM Parameter: %s", d.Get("name").(string)) + name := d.Get("name").(string) + log.Printf("[INFO] Creating SSM Parameter: %s", name) paramInput := &ssm.PutParameterInput{ - Name: aws.String(d.Get("name").(string)), + Name: aws.String(name), Type: aws.String(d.Get("type").(string)), Tier: aws.String(d.Get("tier").(string)), Value: aws.String(d.Get("value").(string)), @@ -242,6 +244,10 @@ func resourceAwsSsmParameterPut(d *schema.ResourceData, meta interface{}) error paramInput.SetKeyId(keyID.(string)) } + if v, ok := d.GetOk("tags"); ok && d.IsNewResource() { + paramInput.Tags = keyvaluetags.New(v.(map[string]interface{})).IgnoreAws().SsmTags() + } + log.Printf("[DEBUG] Waiting for SSM Parameter %v to be updated", d.Get("name")) _, err := ssmconn.PutParameter(paramInput) @@ -251,19 +257,18 @@ func resourceAwsSsmParameterPut(d *schema.ResourceData, meta interface{}) error } if err != nil { - return fmt.Errorf("error creating SSM parameter: %s", err) + return fmt.Errorf("error creating SSM parameter: %w", err) } - name := d.Get("name").(string) - if d.HasChange("tags") { + if !d.IsNewResource() && d.HasChange("tags") { o, n := d.GetChange("tags") if err := keyvaluetags.SsmUpdateTags(ssmconn, name, ssm.ResourceTypeForTaggingParameter, o, n); err != nil { - return fmt.Errorf("error updating SSM Parameter (%s) tags: %s", name, err) + return fmt.Errorf("error updating SSM Parameter (%s) tags: %w", name, err) } } - d.SetId(d.Get("name").(string)) + d.SetId(name) return resourceAwsSsmParameterRead(d, meta) } diff --git a/aws/resource_aws_ssm_parameter_test.go b/aws/resource_aws_ssm_parameter_test.go index cc3650af14f5..9114e3b19ae8 100644 --- a/aws/resource_aws_ssm_parameter_test.go +++ b/aws/resource_aws_ssm_parameter_test.go @@ -6,6 +6,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ssm" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -18,6 +19,7 @@ func TestAccAWSSSMParameter_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -51,14 +53,15 @@ func TestAccAWSSSMParameter_Tier(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSSMParameterConfigTier(rName, "Advanced"), + Config: testAccAWSSSMParameterConfigTier(rName, ssm.ParameterTierAdvanced), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSSMParameterExists(resourceName, ¶meter1), - resource.TestCheckResourceAttr(resourceName, "tier", "Advanced"), + resource.TestCheckResourceAttr(resourceName, "tier", ssm.ParameterTierAdvanced), ), }, { @@ -68,19 +71,115 @@ func TestAccAWSSSMParameter_Tier(t *testing.T) { ImportStateVerifyIgnore: []string{"overwrite"}, }, { - Config: testAccAWSSSMParameterConfigTier(rName, "Standard"), + Config: testAccAWSSSMParameterConfigTier(rName, ssm.ParameterTierStandard), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSSMParameterExists(resourceName, ¶meter2), - resource.TestCheckResourceAttr(resourceName, "tier", "Standard"), + resource.TestCheckResourceAttr(resourceName, "tier", ssm.ParameterTierStandard), ), }, { - Config: testAccAWSSSMParameterConfigTier(rName, "Advanced"), + Config: testAccAWSSSMParameterConfigTier(rName, ssm.ParameterTierAdvanced), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSSMParameterExists(resourceName, ¶meter3), - resource.TestCheckResourceAttr(resourceName, "tier", "Advanced"), + resource.TestCheckResourceAttr(resourceName, "tier", ssm.ParameterTierAdvanced), + ), + }, + }, + }) +} + +func TestAccAWSSSMParameter_Tier_IntelligentTieringToStandard(t *testing.T) { + var parameter ssm.Parameter + rName := fmt.Sprintf("%s_%s", t.Name(), acctest.RandString(10)) + resourceName := "aws_ssm_parameter.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMParameterDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSSMParameterConfigTier(rName, ssm.ParameterTierIntelligentTiering), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMParameterExists(resourceName, ¶meter), + resource.TestCheckResourceAttr(resourceName, "tier", ssm.ParameterTierStandard), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"overwrite"}, + }, + { + Config: testAccAWSSSMParameterConfigTier(rName, ssm.ParameterTierStandard), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMParameterExists(resourceName, ¶meter), + resource.TestCheckResourceAttr(resourceName, "tier", ssm.ParameterTierStandard), + ), + }, + { + Config: testAccAWSSSMParameterConfigTier(rName, ssm.ParameterTierIntelligentTiering), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMParameterExists(resourceName, ¶meter), + resource.TestCheckResourceAttr(resourceName, "tier", ssm.ParameterTierStandard), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"overwrite"}, + }, + }, + }) +} + +func TestAccAWSSSMParameter_Tier_IntelligentTieringToAdvanced(t *testing.T) { + var parameter1, parameter2 ssm.Parameter + rName := fmt.Sprintf("%s_%s", t.Name(), acctest.RandString(10)) + resourceName := "aws_ssm_parameter.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMParameterDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSSMParameterConfigTier(rName, ssm.ParameterTierIntelligentTiering), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMParameterExists(resourceName, ¶meter1), + resource.TestCheckResourceAttr(resourceName, "tier", ssm.ParameterTierStandard), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"overwrite"}, + }, + { + Config: testAccAWSSSMParameterConfigTier(rName, ssm.ParameterTierAdvanced), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMParameterExists(resourceName, ¶meter1), + resource.TestCheckResourceAttr(resourceName, "tier", ssm.ParameterTierAdvanced), ), }, + { + Config: testAccAWSSSMParameterConfigTier(rName, ssm.ParameterTierIntelligentTiering), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMParameterExists(resourceName, ¶meter2), + resource.TestCheckResourceAttr(resourceName, "tier", ssm.ParameterTierStandard), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"overwrite"}, + }, }, }) } @@ -92,6 +191,7 @@ func TestAccAWSSSMParameter_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -99,7 +199,7 @@ func TestAccAWSSSMParameter_disappears(t *testing.T) { Config: testAccAWSSSMParameterBasicConfig(name, "String", "test2"), Check: resource.ComposeTestCheckFunc( testAccCheckAWSSSMParameterExists(resourceName, ¶m), - testAccCheckAWSSSMParameterDisappears(¶m), + testAccCheckResourceDisappears(testAccProvider, resourceAwsSsmParameter(), resourceName), ), ExpectNonEmptyPlan: true, }, @@ -114,6 +214,7 @@ func TestAccAWSSSMParameter_overwrite(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -145,6 +246,7 @@ func TestAccAWSSSMParameter_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -190,6 +292,7 @@ func TestAccAWSSSMParameter_updateType(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -220,6 +323,7 @@ func TestAccAWSSSMParameter_updateDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -251,6 +355,7 @@ func TestAccAWSSSMParameter_changeNameForcesNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -284,6 +389,7 @@ func TestAccAWSSSMParameter_fullPath(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -313,6 +419,7 @@ func TestAccAWSSSMParameter_secure(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -342,6 +449,7 @@ func TestAccAWSSSMParameter_DataType_AwsEc2Image(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -370,6 +478,7 @@ func TestAccAWSSSMParameter_secure_with_key(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -400,6 +509,7 @@ func TestAccAWSSSMParameter_secure_keyUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMParameterDestroy, Steps: []resource.TestStep{ @@ -476,20 +586,6 @@ func testAccCheckAWSSSMParameterExists(n string, param *ssm.Parameter) resource. } } -func testAccCheckAWSSSMParameterDisappears(param *ssm.Parameter) resource.TestCheckFunc { - return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).ssmconn - - paramInput := &ssm.DeleteParameterInput{ - Name: param.Name, - } - - _, err := conn.DeleteParameter(paramInput) - - return err - } -} - func testAccCheckAWSSSMParameterDestroy(s *terraform.State) error { conn := testAccProvider.Meta().(*AWSClient).ssmconn @@ -504,13 +600,21 @@ func testAccCheckAWSSSMParameterDestroy(s *terraform.State) error { }, } - resp, _ := conn.GetParameters(paramInput) + resp, err := conn.GetParameters(paramInput) - if len(resp.Parameters) > 0 { - return fmt.Errorf("Expected AWS SSM Parameter to be gone, but was still found") + if tfawserr.ErrCodeEquals(err, ssm.ErrCodeParameterNotFound) { + continue } - return nil + if err != nil { + return fmt.Errorf("error reading SSM Parameter (%s): %w", rs.Primary.ID, err) + } + + if resp == nil || len(resp.Parameters) == 0 { + continue + } + + return fmt.Errorf("Expected AWS SSM Parameter to be gone, but was still found") } return nil diff --git a/aws/resource_aws_ssm_patch_baseline_test.go b/aws/resource_aws_ssm_patch_baseline_test.go index be6d53bf8f62..e5ca2676f679 100644 --- a/aws/resource_aws_ssm_patch_baseline_test.go +++ b/aws/resource_aws_ssm_patch_baseline_test.go @@ -18,6 +18,7 @@ func TestAccAWSSSMPatchBaseline_basic(t *testing.T) { resourceName := "aws_ssm_patch_baseline.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMPatchBaselineDestroy, Steps: []resource.TestStep{ @@ -70,6 +71,7 @@ func TestAccAWSSSMPatchBaseline_tags(t *testing.T) { resourceName := "aws_ssm_patch_baseline.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMPatchBaselineDestroy, Steps: []resource.TestStep{ @@ -114,6 +116,7 @@ func TestAccAWSSSMPatchBaseline_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMPatchBaselineDestroy, Steps: []resource.TestStep{ @@ -135,6 +138,7 @@ func TestAccAWSSSMPatchBaseline_OperatingSystem(t *testing.T) { resourceName := "aws_ssm_patch_baseline.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMPatchBaselineDestroy, Steps: []resource.TestStep{ @@ -178,6 +182,7 @@ func TestAccAWSSSMPatchBaseline_ApproveUntilDateParam(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMPatchBaselineDestroy, Steps: []resource.TestStep{ @@ -226,6 +231,7 @@ func TestAccAWSSSMPatchBaseline_Sources(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMPatchBaselineDestroy, Steps: []resource.TestStep{ @@ -277,6 +283,7 @@ func TestAccAWSSSMPatchBaseline_ApprovedPatchesNonSec(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMPatchBaselineDestroy, Steps: []resource.TestStep{ @@ -303,6 +310,7 @@ func TestAccAWSSSMPatchBaseline_RejectPatchesAction(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMPatchBaselineDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ssm_patch_group.go b/aws/resource_aws_ssm_patch_group.go index 07e23114bc55..2d33eda19092 100644 --- a/aws/resource_aws_ssm_patch_group.go +++ b/aws/resource_aws_ssm_patch_group.go @@ -3,10 +3,13 @@ package aws import ( "fmt" "log" + "strings" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ssm" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ssm/finder" ) func resourceAwsSsmPatchGroup() *schema.Resource { @@ -15,6 +18,15 @@ func resourceAwsSsmPatchGroup() *schema.Resource { Read: resourceAwsSsmPatchGroupRead, Delete: resourceAwsSsmPatchGroupDelete, + SchemaVersion: 1, + StateUpgraders: []schema.StateUpgrader{ + { + Type: resourceAwsSsmPatchGroupV0().CoreConfigSchema().ImpliedType(), + Upgrade: resourceAwsSsmPatchGroupStateUpgradeV0, + Version: 0, + }, + }, + Schema: map[string]*schema.Schema{ "baseline_id": { Type: schema.TypeString, @@ -31,66 +43,93 @@ func resourceAwsSsmPatchGroup() *schema.Resource { } func resourceAwsSsmPatchGroupCreate(d *schema.ResourceData, meta interface{}) error { - ssmconn := meta.(*AWSClient).ssmconn + conn := meta.(*AWSClient).ssmconn + + baselineId := d.Get("baseline_id").(string) + patchGroup := d.Get("patch_group").(string) params := &ssm.RegisterPatchBaselineForPatchGroupInput{ - BaselineId: aws.String(d.Get("baseline_id").(string)), - PatchGroup: aws.String(d.Get("patch_group").(string)), + BaselineId: aws.String(baselineId), + PatchGroup: aws.String(patchGroup), } - resp, err := ssmconn.RegisterPatchBaselineForPatchGroup(params) + resp, err := conn.RegisterPatchBaselineForPatchGroup(params) if err != nil { - return err + return fmt.Errorf("error registering SSM Patch Baseline (%s) for Patch Group (%s): %w", baselineId, patchGroup, err) } - d.SetId(aws.StringValue(resp.PatchGroup)) + d.SetId(fmt.Sprintf("%s,%s", aws.StringValue(resp.PatchGroup), aws.StringValue(resp.BaselineId))) + return resourceAwsSsmPatchGroupRead(d, meta) } func resourceAwsSsmPatchGroupRead(d *schema.ResourceData, meta interface{}) error { - ssmconn := meta.(*AWSClient).ssmconn - - params := &ssm.DescribePatchGroupsInput{} + conn := meta.(*AWSClient).ssmconn - resp, err := ssmconn.DescribePatchGroups(params) + patchGroup, baselineId, err := parseSsmPatchGroupId(d.Id()) if err != nil { - return err + return fmt.Errorf("error parsing SSM Patch Group ID (%s): %w", d.Id(), err) } - found := false - for _, t := range resp.Mappings { - if *t.PatchGroup == d.Id() { - found = true + group, err := finder.PatchGroup(conn, patchGroup, baselineId) - d.Set("patch_group", t.PatchGroup) - d.Set("baseline_id", t.BaselineIdentity.BaselineId) - } + if err != nil { + return fmt.Errorf("error reading SSM Patch Group (%s): %w", d.Id(), err) } - if !found { - log.Printf("[INFO] Patch Group not found. Removing from state") + if group == nil { + if d.IsNewResource() { + return fmt.Errorf("error reading SSM Patch Group (%s): not found after creation", d.Id()) + } + + log.Printf("[WARN] SSM Patch Group (%s) not found, removing from state", d.Id()) d.SetId("") return nil } + var groupBaselineId string + if group.BaselineIdentity != nil { + groupBaselineId = aws.StringValue(group.BaselineIdentity.BaselineId) + } + + d.Set("baseline_id", groupBaselineId) + d.Set("patch_group", aws.StringValue(group.PatchGroup)) + return nil } func resourceAwsSsmPatchGroupDelete(d *schema.ResourceData, meta interface{}) error { - ssmconn := meta.(*AWSClient).ssmconn + conn := meta.(*AWSClient).ssmconn - log.Printf("[INFO] Deleting SSM Patch Group: %s", d.Id()) + patchGroup, baselineId, err := parseSsmPatchGroupId(d.Id()) + if err != nil { + return fmt.Errorf("error parsing SSM Patch Group ID (%s): %w", d.Id(), err) + } params := &ssm.DeregisterPatchBaselineForPatchGroupInput{ - BaselineId: aws.String(d.Get("baseline_id").(string)), - PatchGroup: aws.String(d.Get("patch_group").(string)), + BaselineId: aws.String(baselineId), + PatchGroup: aws.String(patchGroup), } - _, err := ssmconn.DeregisterPatchBaselineForPatchGroup(params) + _, err = conn.DeregisterPatchBaselineForPatchGroup(params) + if err != nil { - return fmt.Errorf("error deregistering SSM Patch Group (%s): %s", d.Id(), err) + if tfawserr.ErrCodeEquals(err, ssm.ErrCodeDoesNotExistException) { + return nil + } + return fmt.Errorf("error deregistering SSM Patch Baseline (%s) for Patch Group (%s): %w", baselineId, patchGroup, err) } return nil } + +func parseSsmPatchGroupId(id string) (string, string, error) { + parts := strings.SplitN(id, ",", 2) + + if len(parts) != 2 || parts[0] == "" || parts[1] == "" { + return "", "", fmt.Errorf("please make sure ID is in format PATCH_GROUP,BASELINE_ID") + } + + return parts[0], parts[1], nil +} diff --git a/aws/resource_aws_ssm_patch_group_migrate.go b/aws/resource_aws_ssm_patch_group_migrate.go new file mode 100644 index 000000000000..1bc32bbea46d --- /dev/null +++ b/aws/resource_aws_ssm_patch_group_migrate.go @@ -0,0 +1,35 @@ +package aws + +import ( + "context" + "fmt" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func resourceAwsSsmPatchGroupV0() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "baseline_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "patch_group": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }, + } +} + +func resourceAwsSsmPatchGroupStateUpgradeV0(_ context.Context, rawState map[string]interface{}, meta interface{}) (map[string]interface{}, error) { + if rawState == nil { + rawState = map[string]interface{}{} + } + + rawState["id"] = fmt.Sprintf("%s,%s", rawState["patch_group"], rawState["baseline_id"]) + + return rawState, nil +} diff --git a/aws/resource_aws_ssm_patch_group_migrate_test.go b/aws/resource_aws_ssm_patch_group_migrate_test.go new file mode 100644 index 000000000000..7e9f7934690b --- /dev/null +++ b/aws/resource_aws_ssm_patch_group_migrate_test.go @@ -0,0 +1,37 @@ +package aws + +import ( + "context" + "fmt" + "reflect" + "testing" +) + +func testResourceAwsSsmPatchGroupStateDataV0() map[string]interface{} { + return map[string]interface{}{ + "id": "testgroup", + "baseline_id": "pb-0c4e592064EXAMPLE", + "patch_group": "testgroup", + } +} + +func testResourceAwsSsmPatchGroupStateDataV1() map[string]interface{} { + v0 := testResourceAwsSsmPatchGroupStateDataV0() + return map[string]interface{}{ + "id": fmt.Sprintf("%s,%s", v0["patch_group"], v0["baseline_id"]), + "baseline_id": v0["baseline_id"], + "patch_group": v0["patch_group"], + } +} + +func TestResourceAWSSSMPatchGroupStateUpgradeV0(t *testing.T) { + expected := testResourceAwsSsmPatchGroupStateDataV1() + actual, err := resourceAwsSsmPatchGroupStateUpgradeV0(context.Background(), testResourceAwsSsmPatchGroupStateDataV0(), nil) + if err != nil { + t.Fatalf("error migrating state: %s", err) + } + + if !reflect.DeepEqual(expected, actual) { + t.Fatalf("\n\nexpected:\n\n%#v\n\ngot:\n\n%#v\n\n", expected, actual) + } +} diff --git a/aws/resource_aws_ssm_patch_group_test.go b/aws/resource_aws_ssm_patch_group_test.go index 06dafda10a31..f749c468eee6 100644 --- a/aws/resource_aws_ssm_patch_group_test.go +++ b/aws/resource_aws_ssm_patch_group_test.go @@ -4,98 +4,185 @@ import ( "fmt" "testing" - "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ssm" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ssm/finder" ) func TestAccAWSSSMPatchGroup_basic(t *testing.T) { - name := acctest.RandString(10) + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ssm_patch_group.patchgroup" + resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSMPatchGroupDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSSSMPatchGroupBasicConfig(name), + Config: testAccAWSSSMPatchGroupBasicConfig(rName), Check: resource.ComposeTestCheckFunc( - testAccCheckAWSSSMPatchGroupExists("aws_ssm_patch_group.patchgroup"), + testAccCheckAWSSSMPatchGroupExists(resourceName), ), }, }, }) } -func testAccCheckAWSSSMPatchGroupExists(n string) resource.TestCheckFunc { - return func(s *terraform.State) error { - rs, ok := s.RootModule().Resources[n] - if !ok { - return fmt.Errorf("Not found: %s", n) +func TestAccAWSSSMPatchGroup_disappears(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_ssm_patch_group.patchgroup" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), + Providers: testAccProviders, + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: testAccAWSSSMPatchGroupBasicConfig(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMPatchGroupExists(resourceName), + testAccCheckResourceDisappears(testAccProvider, resourceAwsSsmPatchGroup(), resourceName), + ), + ExpectNonEmptyPlan: true, + }, + }, + }) +} + +func TestAccAWSSSMPatchGroup_multipleBaselines(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName1 := "aws_ssm_patch_group.test1" + resourceName2 := "aws_ssm_patch_group.test2" + resourceName3 := "aws_ssm_patch_group.test3" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSSSMPatchGroupDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSSSMPatchGroupConfigMultipleBaselines(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSSSMPatchGroupExists(resourceName1), + testAccCheckAWSSSMPatchGroupExists(resourceName2), + testAccCheckAWSSSMPatchGroupExists(resourceName3), + ), + }, + }, + }) +} + +func testAccCheckAWSSSMPatchGroupDestroy(s *terraform.State) error { + conn := testAccProvider.Meta().(*AWSClient).ssmconn + + for _, rs := range s.RootModule().Resources { + if rs.Type != "aws_ssm_patch_group" { + continue } - if rs.Primary.ID == "" { - return fmt.Errorf("No SSM Patch Baseline ID is set") + patchGroup, baselineId, err := parseSsmPatchGroupId(rs.Primary.ID) + if err != nil { + return fmt.Errorf("error parsing SSM Patch Group ID (%s): %w", rs.Primary.ID, err) } - conn := testAccProvider.Meta().(*AWSClient).ssmconn + group, err := finder.PatchGroup(conn, patchGroup, baselineId) - resp, err := conn.DescribePatchGroups(&ssm.DescribePatchGroupsInput{}) if err != nil { - return err + return fmt.Errorf("error describing SSM Patch Group ID (%s): %w", rs.Primary.ID, err) } - for _, i := range resp.Mappings { - if *i.BaselineIdentity.BaselineId == rs.Primary.Attributes["baseline_id"] && *i.PatchGroup == rs.Primary.ID { - return nil - } + if group != nil { + return fmt.Errorf("SSM Patch Group %q still exists", rs.Primary.ID) } - - return fmt.Errorf("No AWS SSM Patch Group found") } + + return nil } -func testAccCheckAWSSSMPatchGroupDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).ssmconn +func testAccCheckAWSSSMPatchGroupExists(n string) resource.TestCheckFunc { + return func(s *terraform.State) error { + rs, ok := s.RootModule().Resources[n] + if !ok { + return fmt.Errorf("Not found: %s", n) + } - for _, rs := range s.RootModule().Resources { - if rs.Type != "aws_ssm_patch_group" { - continue + if rs.Primary.ID == "" { + return fmt.Errorf("No SSM Patch Baseline ID is set") } - resp, err := conn.DescribePatchGroups(&ssm.DescribePatchGroupsInput{}) + patchGroup, baselineId, err := parseSsmPatchGroupId(rs.Primary.ID) + if err != nil { + return fmt.Errorf("error parsing SSM Patch Group ID (%s): %w", rs.Primary.ID, err) + } + + conn := testAccProvider.Meta().(*AWSClient).ssmconn + + group, err := finder.PatchGroup(conn, patchGroup, baselineId) if err != nil { - // Verify the error is what we want - if ae, ok := err.(awserr.Error); ok && ae.Code() == "DoesNotExistException" { - continue - } - return err + return fmt.Errorf("error reading SSM Patch Group (%s): %w", rs.Primary.ID, err) } - for _, i := range resp.Mappings { - if *i.BaselineIdentity.BaselineId == rs.Primary.Attributes["baseline_id"] && *i.PatchGroup == rs.Primary.ID { - return fmt.Errorf("Expected AWS SSM Patch Group to be gone, but was still found") - } + if group == nil { + return fmt.Errorf("No SSM Patch Group found") } return nil } - - return nil } func testAccAWSSSMPatchGroupBasicConfig(rName string) string { return fmt.Sprintf(` resource "aws_ssm_patch_baseline" "foo" { - name = "patch-baseline-%s" + name = %[1]q approved_patches = ["KB123456"] } resource "aws_ssm_patch_group" "patchgroup" { baseline_id = aws_ssm_patch_baseline.foo.id - patch_group = "patch-group" + patch_group = %[1]q +} +`, rName) +} + +func testAccAWSSSMPatchGroupConfigMultipleBaselines(rName string) string { + return fmt.Sprintf(` +resource "aws_ssm_patch_baseline" "test1" { + approved_patches = ["KB123456"] + name = %[1]q + operating_system = "CENTOS" +} + +resource "aws_ssm_patch_baseline" "test2" { + approved_patches = ["KB123456"] + name = %[1]q + operating_system = "AMAZON_LINUX_2" +} + +resource "aws_ssm_patch_baseline" "test3" { + approved_patches = ["KB123456"] + name = %[1]q + operating_system = "AMAZON_LINUX" +} + +resource "aws_ssm_patch_group" "test1" { + baseline_id = aws_ssm_patch_baseline.test1.id + patch_group = %[1]q +} + +resource "aws_ssm_patch_group" "test2" { + baseline_id = aws_ssm_patch_baseline.test2.id + patch_group = %[1]q +} + +resource "aws_ssm_patch_group" "test3" { + baseline_id = aws_ssm_patch_baseline.test3.id + patch_group = %[1]q } `, rName) } diff --git a/aws/resource_aws_ssm_resource_data_sync_test.go b/aws/resource_aws_ssm_resource_data_sync_test.go index 3a0ba8024c01..0f39968fb1dc 100644 --- a/aws/resource_aws_ssm_resource_data_sync_test.go +++ b/aws/resource_aws_ssm_resource_data_sync_test.go @@ -5,6 +5,7 @@ import ( "log" "testing" + "github.com/aws/aws-sdk-go/service/ssm" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -15,6 +16,7 @@ func TestAccAWSSsmResourceDataSync_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSsmResourceDataSyncDestroy, Steps: []resource.TestStep{ @@ -39,6 +41,7 @@ func TestAccAWSSsmResourceDataSync_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ssm.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSsmResourceDataSyncDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ssoadmin_account_assignment_test.go b/aws/resource_aws_ssoadmin_account_assignment_test.go index 360dd829360c..91e73f32d22c 100644 --- a/aws/resource_aws_ssoadmin_account_assignment_test.go +++ b/aws/resource_aws_ssoadmin_account_assignment_test.go @@ -143,6 +143,7 @@ func TestAccAWSSSOAdminAccountAssignment_Basic_Group(t *testing.T) { testAccPreCheckAWSSSOAdminInstances(t) testAccPreCheckAWSIdentityStoreGroupName(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminAccountAssignmentDestroy, Steps: []resource.TestStep{ @@ -175,6 +176,7 @@ func TestAccAWSSSOAdminAccountAssignment_Basic_User(t *testing.T) { testAccPreCheckAWSSSOAdminInstances(t) testAccPreCheckAWSIdentityStoreUserName(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminAccountAssignmentDestroy, Steps: []resource.TestStep{ @@ -207,6 +209,7 @@ func TestAccAWSSSOAdminAccountAssignment_Disappears(t *testing.T) { testAccPreCheckAWSSSOAdminInstances(t) testAccPreCheckAWSIdentityStoreGroupName(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminAccountAssignmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ssoadmin_managed_policy_attachment_test.go b/aws/resource_aws_ssoadmin_managed_policy_attachment_test.go index 6f933c780b90..1397b21698da 100644 --- a/aws/resource_aws_ssoadmin_managed_policy_attachment_test.go +++ b/aws/resource_aws_ssoadmin_managed_policy_attachment_test.go @@ -20,6 +20,7 @@ func TestAccAWSSSOAdminManagedPolicyAttachment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminManagedPolicyAttachmentDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSSSOAdminManagedPolicyAttachment_forceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminManagedPolicyAttachmentDestroy, Steps: []resource.TestStep{ @@ -85,6 +87,7 @@ func TestAccAWSSSOAdminManagedPolicyAttachment_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminManagedPolicyAttachmentDestroy, Steps: []resource.TestStep{ @@ -107,6 +110,7 @@ func TestAccAWSSSOAdminManagedPolicyAttachment_disappears_permissionSet(t *testi resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminManagedPolicyAttachmentDestroy, Steps: []resource.TestStep{ @@ -130,6 +134,7 @@ func TestAccAWSSSOAdminManagedPolicyAttachment_multipleManagedPolicies(t *testin resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminManagedPolicyAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ssoadmin_permission_set_inline_policy_test.go b/aws/resource_aws_ssoadmin_permission_set_inline_policy_test.go index 6d2637af6905..ee884adefc6a 100644 --- a/aws/resource_aws_ssoadmin_permission_set_inline_policy_test.go +++ b/aws/resource_aws_ssoadmin_permission_set_inline_policy_test.go @@ -20,6 +20,7 @@ func TestAccAWSSSOAdminPermissionSetInlinePolicy_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminPermissionSetInlinePolicyDestroy, Steps: []resource.TestStep{ @@ -48,6 +49,7 @@ func TestAccAWSSSOAdminPermissionSetInlinePolicy_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminPermissionSetInlinePolicyDestroy, Steps: []resource.TestStep{ @@ -79,6 +81,7 @@ func TestAccAWSSSOAdminPermissionSetInlinePolicy_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminPermissionSetInlinePolicyDestroy, Steps: []resource.TestStep{ @@ -101,6 +104,7 @@ func TestAccAWSSSOAdminPermissionSetInlinePolicy_disappears_permissionSet(t *tes resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminPermissionSetInlinePolicyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_ssoadmin_permission_set_test.go b/aws/resource_aws_ssoadmin_permission_set_test.go index 5ed652c59070..7d4d601f5a1e 100644 --- a/aws/resource_aws_ssoadmin_permission_set_test.go +++ b/aws/resource_aws_ssoadmin_permission_set_test.go @@ -104,6 +104,7 @@ func TestAccAWSSSOAdminPermissionSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminPermissionSetDestroy, Steps: []resource.TestStep{ @@ -130,6 +131,7 @@ func TestAccAWSSSOAdminPermissionSet_tags(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminPermissionSetDestroy, Steps: []resource.TestStep{ @@ -183,6 +185,7 @@ func TestAccAWSSSOAdminPermissionSet_updateDescription(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminPermissionSetDestroy, Steps: []resource.TestStep{ @@ -215,6 +218,7 @@ func TestAccAWSSSOAdminPermissionSet_updateRelayState(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminPermissionSetDestroy, Steps: []resource.TestStep{ @@ -247,6 +251,7 @@ func TestAccAWSSSOAdminPermissionSet_updateSessionDuration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminPermissionSetDestroy, Steps: []resource.TestStep{ @@ -281,6 +286,7 @@ func TestAccAWSSSOAdminPermissionSet_relayState_updateSessionDuration(t *testing resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminPermissionSetDestroy, Steps: []resource.TestStep{ @@ -319,6 +325,7 @@ func TestAccAWSSSOAdminPermissionSet_mixedPolicyAttachments(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSSSOAdminInstances(t) }, + ErrorCheck: testAccErrorCheck(t, ssoadmin.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSSSOAdminPermissionSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_storagegateway_cache_test.go b/aws/resource_aws_storagegateway_cache_test.go index e29a156a664b..0b4fd6053aee 100644 --- a/aws/resource_aws_storagegateway_cache_test.go +++ b/aws/resource_aws_storagegateway_cache_test.go @@ -73,8 +73,9 @@ func TestAccAWSStorageGatewayCache_FileGateway(t *testing.T) { gatewayResourceName := "aws_storagegateway_gateway.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), + Providers: testAccProviders, // Storage Gateway API does not support removing caches, // but we want to ensure other resources are removed. CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, @@ -102,8 +103,9 @@ func TestAccAWSStorageGatewayCache_TapeAndVolumeGateway(t *testing.T) { gatewayResourceName := "aws_storagegateway_gateway.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), + Providers: testAccProviders, // Storage Gateway API does not support removing caches, // but we want to ensure other resources are removed. CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, diff --git a/aws/resource_aws_storagegateway_cached_iscsi_volume_test.go b/aws/resource_aws_storagegateway_cached_iscsi_volume_test.go index efa074b30ac4..fe6483aaea3f 100644 --- a/aws/resource_aws_storagegateway_cached_iscsi_volume_test.go +++ b/aws/resource_aws_storagegateway_cached_iscsi_volume_test.go @@ -75,6 +75,7 @@ func TestAccAWSStorageGatewayCachedIscsiVolume_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayCachedIscsiVolumeDestroy, Steps: []resource.TestStep{ @@ -114,6 +115,7 @@ func TestAccAWSStorageGatewayCachedIscsiVolume_kms(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayCachedIscsiVolumeDestroy, Steps: []resource.TestStep{ @@ -141,6 +143,7 @@ func TestAccAWSStorageGatewayCachedIscsiVolume_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayCachedIscsiVolumeDestroy, Steps: []resource.TestStep{ @@ -188,6 +191,7 @@ func TestAccAWSStorageGatewayCachedIscsiVolume_SnapshotId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayCachedIscsiVolumeDestroy, Steps: []resource.TestStep{ @@ -226,6 +230,7 @@ func TestAccAWSStorageGatewayCachedIscsiVolume_SourceVolumeArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayCachedIscsiVolumeDestroy, Steps: []resource.TestStep{ @@ -263,6 +268,7 @@ func TestAccAWSStorageGatewayCachedIscsiVolume_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayCachedIscsiVolumeDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_storagegateway_gateway.go b/aws/resource_aws_storagegateway_gateway.go index 54094ae29cb6..9a14e3fc0e9c 100644 --- a/aws/resource_aws_storagegateway_gateway.go +++ b/aws/resource_aws_storagegateway_gateway.go @@ -193,6 +193,10 @@ func resourceAwsStorageGatewayGateway() *schema.Resource { Computed: true, ValidateFunc: validation.StringInSlice(storagegateway.SMBSecurityStrategy_Values(), false), }, + "smb_file_share_visibility": { + Type: schema.TypeBool, + Optional: true, + }, "average_download_rate_limit_in_bits_per_sec": { Type: schema.TypeInt, Optional: true, @@ -391,6 +395,19 @@ func resourceAwsStorageGatewayGatewayCreate(d *schema.ResourceData, meta interfa } } + if v, ok := d.GetOk("smb_file_share_visibility"); ok { + input := &storagegateway.UpdateSMBFileShareVisibilityInput{ + GatewayARN: aws.String(d.Id()), + FileSharesVisible: aws.Bool(v.(bool)), + } + + log.Printf("[DEBUG] Storage Gateway Gateway %q setting SMB File Share Visibility", input) + _, err := conn.UpdateSMBFileShareVisibility(input) + if err != nil { + return fmt.Errorf("error updating Storage Gateway Gateway (%s) SMB file share visibility: %w", d.Id(), err) + } + } + bandwidthInput := &storagegateway.UpdateBandwidthRateLimitInput{ GatewayARN: aws.String(d.Id()), } @@ -526,6 +543,7 @@ func resourceAwsStorageGatewayGatewayRead(d *schema.ResourceData, meta interface d.Set("tape_drive_type", d.Get("tape_drive_type").(string)) d.Set("cloudwatch_log_group_arn", output.CloudWatchLogGroupARN) d.Set("smb_security_strategy", smbSettingsOutput.SMBSecurityStrategy) + d.Set("smb_file_share_visibility", smbSettingsOutput.FileSharesVisible) d.Set("ec2_instance_id", output.Ec2InstanceId) d.Set("endpoint_type", output.EndpointType) d.Set("host_environment", output.HostEnvironment) @@ -615,6 +633,19 @@ func resourceAwsStorageGatewayGatewayUpdate(d *schema.ResourceData, meta interfa } } + if d.HasChange("smb_file_share_visibility") { + input := &storagegateway.UpdateSMBFileShareVisibilityInput{ + GatewayARN: aws.String(d.Id()), + FileSharesVisible: aws.Bool(d.Get("smb_file_share_visibility").(bool)), + } + + log.Printf("[DEBUG] Storage Gateway Gateway %q updating SMB File Share Visibility", input) + _, err := conn.UpdateSMBFileShareVisibility(input) + if err != nil { + return fmt.Errorf("error updating Storage Gateway Gateway (%s) SMB file share visibility: %w", d.Id(), err) + } + } + if d.HasChanges("average_download_rate_limit_in_bits_per_sec", "average_upload_rate_limit_in_bits_per_sec") { diff --git a/aws/resource_aws_storagegateway_gateway_test.go b/aws/resource_aws_storagegateway_gateway_test.go index 2cd33b782a59..c81371ffd185 100644 --- a/aws/resource_aws_storagegateway_gateway_test.go +++ b/aws/resource_aws_storagegateway_gateway_test.go @@ -69,6 +69,7 @@ func TestAccAWSStorageGatewayGateway_GatewayType_Cached(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -110,6 +111,7 @@ func TestAccAWSStorageGatewayGateway_GatewayType_FileS3(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -150,6 +152,7 @@ func TestAccAWSStorageGatewayGateway_GatewayType_Stored(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -190,6 +193,7 @@ func TestAccAWSStorageGatewayGateway_GatewayType_Vtl(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -228,6 +232,7 @@ func TestAccAWSStorageGatewayGateway_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -275,6 +280,7 @@ func TestAccAWSStorageGatewayGateway_GatewayName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -310,6 +316,7 @@ func TestAccAWSStorageGatewayGateway_CloudWatchLogs(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -337,6 +344,7 @@ func TestAccAWSStorageGatewayGateway_GatewayTimezone(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -372,6 +380,7 @@ func TestAccAWSStorageGatewayGateway_GatewayVpcEndpoint(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -399,6 +408,7 @@ func TestAccAWSStorageGatewayGateway_SmbActiveDirectorySettings(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -429,6 +439,7 @@ func TestAccAWSStorageGatewayGateway_SmbActiveDirectorySettings_timeout(t *testi resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -458,6 +469,7 @@ func TestAccAWSStorageGatewayGateway_SmbGuestPassword(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -492,6 +504,7 @@ func TestAccAWSStorageGatewayGateway_SMBSecurityStrategy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -500,6 +513,7 @@ func TestAccAWSStorageGatewayGateway_SMBSecurityStrategy(t *testing.T) { Check: resource.ComposeTestCheckFunc( testAccCheckAWSStorageGatewayGatewayExists(resourceName, &gateway), resource.TestCheckResourceAttr(resourceName, "smb_security_strategy", "ClientSpecified"), + resource.TestCheckResourceAttr(resourceName, "smb_file_share_visibility", "false"), ), }, { @@ -519,6 +533,48 @@ func TestAccAWSStorageGatewayGateway_SMBSecurityStrategy(t *testing.T) { }) } +func TestAccAWSStorageGatewayGateway_SMBVisibility(t *testing.T) { + var gateway storagegateway.DescribeGatewayInformationOutput + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_storagegateway_gateway.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSStorageGatewayGatewayConfigSMBVisibility(rName, true), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSStorageGatewayGatewayExists(resourceName, &gateway), + resource.TestCheckResourceAttr(resourceName, "smb_file_share_visibility", "true"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + ImportStateVerifyIgnore: []string{"activation_key", "gateway_ip_address"}, + }, + { + Config: testAccAWSStorageGatewayGatewayConfigSMBVisibility(rName, false), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSStorageGatewayGatewayExists(resourceName, &gateway), + resource.TestCheckResourceAttr(resourceName, "smb_file_share_visibility", "false"), + ), + }, + { + Config: testAccAWSStorageGatewayGatewayConfigSMBVisibility(rName, true), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSStorageGatewayGatewayExists(resourceName, &gateway), + resource.TestCheckResourceAttr(resourceName, "smb_file_share_visibility", "true"), + ), + }, + }, + }) +} + func TestAccAWSStorageGatewayGateway_disappears(t *testing.T) { var gateway storagegateway.DescribeGatewayInformationOutput rName := acctest.RandomWithPrefix("tf-acc-test") @@ -526,6 +582,7 @@ func TestAccAWSStorageGatewayGateway_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -548,6 +605,7 @@ func TestAccAWSStorageGatewayGateway_bandwidthUpload(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -589,6 +647,7 @@ func TestAccAWSStorageGatewayGateway_bandwidthDownload(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -630,6 +689,7 @@ func TestAccAWSStorageGatewayGateway_bandwidthAll(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ @@ -1108,6 +1168,18 @@ resource "aws_storagegateway_gateway" "test" { `, rName, strategy) } +func testAccAWSStorageGatewayGatewayConfigSMBVisibility(rName string, visible bool) string { + return testAccAWSStorageGateway_FileGatewayBase(rName) + fmt.Sprintf(` +resource "aws_storagegateway_gateway" "test" { + gateway_ip_address = aws_instance.test.public_ip + gateway_name = %[1]q + gateway_timezone = "GMT" + gateway_type = "FILE_S3" + smb_file_share_visibility = %[2]t +} +`, rName, visible) +} + func testAccAWSStorageGatewayGatewayConfigTags1(rName, tagKey1, tagValue1 string) string { return testAccAWSStorageGateway_TapeAndVolumeGatewayBase(rName) + fmt.Sprintf(` resource "aws_storagegateway_gateway" "test" { diff --git a/aws/resource_aws_storagegateway_nfs_file_share_test.go b/aws/resource_aws_storagegateway_nfs_file_share_test.go index 5176a1467b4b..fa7319e0d7c8 100644 --- a/aws/resource_aws_storagegateway_nfs_file_share_test.go +++ b/aws/resource_aws_storagegateway_nfs_file_share_test.go @@ -22,6 +22,7 @@ func TestAccAWSStorageGatewayNfsFileShare_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -68,6 +69,7 @@ func TestAccAWSStorageGatewayNfsFileShare_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -115,6 +117,7 @@ func TestAccAWSStorageGatewayNfsFileShare_fileShareName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -148,6 +151,7 @@ func TestAccAWSStorageGatewayNfsFileShare_ClientList(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -192,6 +196,7 @@ func TestAccAWSStorageGatewayNfsFileShare_DefaultStorageClass(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -225,6 +230,7 @@ func TestAccAWSStorageGatewayNfsFileShare_GuessMIMETypeEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -258,6 +264,7 @@ func TestAccAWSStorageGatewayNfsFileShare_KMSEncrypted(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -290,6 +297,7 @@ func TestAccAWSStorageGatewayNfsFileShare_KMSKeyArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -332,6 +340,7 @@ func TestAccAWSStorageGatewayNfsFileShare_NFSFileShareDefaults(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -373,6 +382,7 @@ func TestAccAWSStorageGatewayNfsFileShare_ObjectACL(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -406,6 +416,7 @@ func TestAccAWSStorageGatewayNfsFileShare_ReadOnly(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -439,6 +450,7 @@ func TestAccAWSStorageGatewayNfsFileShare_RequesterPays(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -472,6 +484,7 @@ func TestAccAWSStorageGatewayNfsFileShare_Squash(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -505,6 +518,7 @@ func TestAccAWSStorageGatewayNfsFileShare_notificationPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -545,6 +559,7 @@ func TestAccAWSStorageGatewayNfsFileShare_cacheAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ @@ -588,6 +603,7 @@ func TestAccAWSStorageGatewayNfsFileShare_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayNfsFileShareDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_storagegateway_smb_file_share_test.go b/aws/resource_aws_storagegateway_smb_file_share_test.go index aa9ada6cef76..c0a27f6e37e5 100644 --- a/aws/resource_aws_storagegateway_smb_file_share_test.go +++ b/aws/resource_aws_storagegateway_smb_file_share_test.go @@ -22,6 +22,7 @@ func TestAccAWSStorageGatewaySmbFileShare_Authentication_ActiveDirectory(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -70,6 +71,7 @@ func TestAccAWSStorageGatewaySmbFileShare_Authentication_GuestAccess(t *testing. resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -116,6 +118,7 @@ func TestAccAWSStorageGatewaySmbFileShare_accessBasedEnumeration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -156,6 +159,7 @@ func TestAccAWSStorageGatewaySmbFileShare_notificationPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -196,6 +200,7 @@ func TestAccAWSStorageGatewaySmbFileShare_DefaultStorageClass(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -229,6 +234,7 @@ func TestAccAWSStorageGatewaySmbFileShare_FileShareName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -262,6 +268,7 @@ func TestAccAWSStorageGatewaySmbFileShare_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -306,6 +313,7 @@ func TestAccAWSStorageGatewaySmbFileShare_GuessMIMETypeEnabled(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -339,6 +347,7 @@ func TestAccAWSStorageGatewaySmbFileShare_InvalidUserList(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -379,6 +388,7 @@ func TestAccAWSStorageGatewaySmbFileShare_KMSEncrypted(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -411,6 +421,7 @@ func TestAccAWSStorageGatewaySmbFileShare_KMSKeyArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -453,6 +464,7 @@ func TestAccAWSStorageGatewaySmbFileShare_ObjectACL(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -486,6 +498,7 @@ func TestAccAWSStorageGatewaySmbFileShare_ReadOnly(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -519,6 +532,7 @@ func TestAccAWSStorageGatewaySmbFileShare_RequesterPays(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -552,6 +566,7 @@ func TestAccAWSStorageGatewaySmbFileShare_ValidUserList(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -592,6 +607,7 @@ func TestAccAWSStorageGatewaySmbFileShare_smb_acl(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -634,6 +650,7 @@ func TestAccAWSStorageGatewaySmbFileShare_audit(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -667,6 +684,7 @@ func TestAccAWSStorageGatewaySmbFileShare_cacheAttributes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -710,6 +728,7 @@ func TestAccAWSStorageGatewaySmbFileShare_caseSensitivity(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -750,6 +769,7 @@ func TestAccAWSStorageGatewaySmbFileShare_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ @@ -772,6 +792,7 @@ func TestAccAWSStorageGatewaySmbFileShare_AdminUserList(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewaySmbFileShareDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_storagegateway_stored_iscsi_volume_test.go b/aws/resource_aws_storagegateway_stored_iscsi_volume_test.go index f617e624e83b..9519ceea78f2 100644 --- a/aws/resource_aws_storagegateway_stored_iscsi_volume_test.go +++ b/aws/resource_aws_storagegateway_stored_iscsi_volume_test.go @@ -19,6 +19,7 @@ func TestAccAWSStorageGatewayStoredIscsiVolume_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayStoredIscsiVolumeDestroy, Steps: []resource.TestStep{ @@ -60,6 +61,7 @@ func TestAccAWSStorageGatewayStoredIscsiVolume_kms(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayStoredIscsiVolumeDestroy, Steps: []resource.TestStep{ @@ -87,6 +89,7 @@ func TestAccAWSStorageGatewayStoredIscsiVolume_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayStoredIscsiVolumeDestroy, Steps: []resource.TestStep{ @@ -134,6 +137,7 @@ func TestAccAWSStorageGatewayStoredIscsiVolume_snapshotId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayStoredIscsiVolumeDestroy, Steps: []resource.TestStep{ @@ -170,6 +174,7 @@ func TestAccAWSStorageGatewayStoredIscsiVolume_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayStoredIscsiVolumeDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_storagegateway_tape_pool_test.go b/aws/resource_aws_storagegateway_tape_pool_test.go index 2a94777c6380..095dce398bc4 100644 --- a/aws/resource_aws_storagegateway_tape_pool_test.go +++ b/aws/resource_aws_storagegateway_tape_pool_test.go @@ -19,6 +19,7 @@ func TestAccAWSStorageGatewayTapePool_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayTapePoolDestroy, Steps: []resource.TestStep{ @@ -49,6 +50,7 @@ func TestAccAWSStorageGatewayTapePool_retention(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayTapePoolDestroy, Steps: []resource.TestStep{ @@ -79,6 +81,7 @@ func TestAccAWSStorageGatewayTapePool_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayTapePoolDestroy, Steps: []resource.TestStep{ @@ -123,6 +126,7 @@ func TestAccAWSStorageGatewayTapePool_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSStorageGatewayTapePoolDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_storagegateway_upload_buffer.go b/aws/resource_aws_storagegateway_upload_buffer.go index a07ef527efa7..19d932f119ee 100644 --- a/aws/resource_aws_storagegateway_upload_buffer.go +++ b/aws/resource_aws_storagegateway_upload_buffer.go @@ -23,9 +23,18 @@ func resourceAwsStorageGatewayUploadBuffer() *schema.Resource { Schema: map[string]*schema.Schema{ "disk_id": { - Type: schema.TypeString, - Required: true, - ForceNew: true, + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ExactlyOneOf: []string{"disk_id", "disk_path"}, + }, + "disk_path": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ForceNew: true, + ExactlyOneOf: []string{"disk_id", "disk_path"}, }, "gateway_arn": { Type: schema.TypeString, @@ -40,21 +49,48 @@ func resourceAwsStorageGatewayUploadBuffer() *schema.Resource { func resourceAwsStorageGatewayUploadBufferCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).storagegatewayconn - diskID := d.Get("disk_id").(string) - gatewayARN := d.Get("gateway_arn").(string) + input := &storagegateway.AddUploadBufferInput{} + + if v, ok := d.GetOk("disk_id"); ok { + input.DiskIds = aws.StringSlice([]string{v.(string)}) + } + + // Reference: https://github.com/hashicorp/terraform-provider-aws/issues/17809 + if v, ok := d.GetOk("disk_path"); ok { + input.DiskIds = aws.StringSlice([]string{v.(string)}) + } + + if v, ok := d.GetOk("gateway_arn"); ok { + input.GatewayARN = aws.String(v.(string)) + } + + output, err := conn.AddUploadBuffer(input) + + if err != nil { + return fmt.Errorf("error adding Storage Gateway upload buffer: %w", err) + } + + if output == nil { + return fmt.Errorf("error adding Storage Gateway upload buffer: empty response") + } + + if v, ok := d.GetOk("disk_id"); ok { + d.SetId(fmt.Sprintf("%s:%s", aws.StringValue(output.GatewayARN), v.(string))) - input := &storagegateway.AddUploadBufferInput{ - DiskIds: []*string{aws.String(diskID)}, - GatewayARN: aws.String(gatewayARN), + return resourceAwsStorageGatewayUploadBufferRead(d, meta) } - log.Printf("[DEBUG] Adding Storage Gateway upload buffer: %s", input) - _, err := conn.AddUploadBuffer(input) + disk, err := finder.LocalDiskByDiskPath(conn, aws.StringValue(output.GatewayARN), aws.StringValue(input.DiskIds[0])) + if err != nil { - return fmt.Errorf("error adding Storage Gateway upload buffer: %s", err) + return fmt.Errorf("error listing Storage Gateway Local Disks after creating Upload Buffer: %w", err) + } + + if disk == nil { + return fmt.Errorf("error listing Storage Gateway Local Disks after creating Upload Buffer: disk not found") } - d.SetId(fmt.Sprintf("%s:%s", gatewayARN, diskID)) + d.SetId(fmt.Sprintf("%s:%s", aws.StringValue(output.GatewayARN), aws.StringValue(disk.DiskId))) return resourceAwsStorageGatewayUploadBufferRead(d, meta) } @@ -92,6 +128,20 @@ func resourceAwsStorageGatewayUploadBufferRead(d *schema.ResourceData, meta inte d.Set("disk_id", foundDiskID) d.Set("gateway_arn", gatewayARN) + if _, ok := d.GetOk("disk_path"); !ok { + disk, err := finder.LocalDiskByDiskId(conn, gatewayARN, aws.StringValue(foundDiskID)) + + if err != nil { + return fmt.Errorf("error listing Storage Gateway Local Disks: %w", err) + } + + if disk == nil { + return fmt.Errorf("error listing Storage Gateway Local Disks: disk not found") + } + + d.Set("disk_path", disk.DiskPath) + } + return nil } diff --git a/aws/resource_aws_storagegateway_upload_buffer_test.go b/aws/resource_aws_storagegateway_upload_buffer_test.go index 2a65867545a6..80e5502e262f 100644 --- a/aws/resource_aws_storagegateway_upload_buffer_test.go +++ b/aws/resource_aws_storagegateway_upload_buffer_test.go @@ -2,8 +2,10 @@ package aws import ( "fmt" + "regexp" "testing" + "github.com/aws/aws-sdk-go/service/storagegateway" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" @@ -73,17 +75,52 @@ func TestAccAWSStorageGatewayUploadBuffer_basic(t *testing.T) { gatewayResourceName := "aws_storagegateway_gateway.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), + Providers: testAccProviders, // Storage Gateway API does not support removing upload buffers, // but we want to ensure other resources are removed. CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, Steps: []resource.TestStep{ { - Config: testAccAWSStorageGatewayUploadBufferConfig_Basic(rName), + Config: testAccAWSStorageGatewayUploadBufferConfigDiskId(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSStorageGatewayUploadBufferExists(resourceName), resource.TestCheckResourceAttrPair(resourceName, "disk_id", localDiskDataSourceName, "id"), + resource.TestCheckResourceAttrPair(resourceName, "disk_path", localDiskDataSourceName, "disk_path"), + resource.TestCheckResourceAttrPair(resourceName, "gateway_arn", gatewayResourceName, "arn"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +// Reference: https://github.com/hashicorp/terraform-provider-aws/issues/17809 +func TestAccAWSStorageGatewayUploadBuffer_DiskPath(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_storagegateway_upload_buffer.test" + localDiskDataSourceName := "data.aws_storagegateway_local_disk.test" + gatewayResourceName := "aws_storagegateway_gateway.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), + Providers: testAccProviders, + // Storage Gateway API does not support removing upload buffers, + // but we want to ensure other resources are removed. + CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSStorageGatewayUploadBufferConfigDiskPath(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSStorageGatewayUploadBufferExists(resourceName), + resource.TestMatchResourceAttr(resourceName, "disk_id", regexp.MustCompile(`.+`)), + resource.TestCheckResourceAttrPair(resourceName, "disk_path", localDiskDataSourceName, "disk_path"), resource.TestCheckResourceAttrPair(resourceName, "gateway_arn", gatewayResourceName, "arn"), ), }, @@ -124,7 +161,7 @@ func testAccCheckAWSStorageGatewayUploadBufferExists(resourceName string) resour } } -func testAccAWSStorageGatewayUploadBufferConfig_Basic(rName string) string { +func testAccAWSStorageGatewayUploadBufferConfigDiskId(rName string) string { return testAccAWSStorageGatewayGatewayConfig_GatewayType_Stored(rName) + fmt.Sprintf(` resource "aws_ebs_volume" "test" { availability_zone = aws_instance.test.availability_zone @@ -154,3 +191,34 @@ resource "aws_storagegateway_upload_buffer" "test" { } `, rName) } + +func testAccAWSStorageGatewayUploadBufferConfigDiskPath(rName string) string { + return testAccAWSStorageGatewayGatewayConfig_GatewayType_Cached(rName) + fmt.Sprintf(` +resource "aws_ebs_volume" "test" { + availability_zone = aws_instance.test.availability_zone + size = "10" + type = "gp2" + + tags = { + Name = %[1]q + } +} + +resource "aws_volume_attachment" "test" { + device_name = "/dev/xvdc" + force_detach = true + instance_id = aws_instance.test.id + volume_id = aws_ebs_volume.test.id +} + +data "aws_storagegateway_local_disk" "test" { + disk_node = aws_volume_attachment.test.device_name + gateway_arn = aws_storagegateway_gateway.test.arn +} + +resource "aws_storagegateway_upload_buffer" "test" { + disk_path = data.aws_storagegateway_local_disk.test.disk_path + gateway_arn = aws_storagegateway_gateway.test.arn +} +`, rName) +} diff --git a/aws/resource_aws_storagegateway_working_storage_test.go b/aws/resource_aws_storagegateway_working_storage_test.go index baaf4e80e658..aaa833c0dac9 100644 --- a/aws/resource_aws_storagegateway_working_storage_test.go +++ b/aws/resource_aws_storagegateway_working_storage_test.go @@ -74,8 +74,9 @@ func TestAccAWSStorageGatewayWorkingStorage_basic(t *testing.T) { gatewayResourceName := "aws_storagegateway_gateway.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, storagegateway.EndpointsID), + Providers: testAccProviders, // Storage Gateway API does not support removing working storages, // but we want to ensure other resources are removed. CheckDestroy: testAccCheckAWSStorageGatewayGatewayDestroy, diff --git a/aws/resource_aws_subnet.go b/aws/resource_aws_subnet.go index d93e6ee12577..c36de8b53b0c 100644 --- a/aws/resource_aws_subnet.go +++ b/aws/resource_aws_subnet.go @@ -7,10 +7,13 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2/finder" "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2/waiter" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource" ) func resourceAwsSubnet() *schema.Resource { @@ -24,6 +27,8 @@ func resourceAwsSubnet() *schema.Resource { State: schema.ImportStatePassthrough, }, + CustomizeDiff: SetTagsDiff, + Timeouts: &schema.ResourceTimeout{ Create: schema.DefaultTimeout(10 * time.Minute), Delete: schema.DefaultTimeout(20 * time.Minute), @@ -111,6 +116,8 @@ func resourceAwsSubnet() *schema.Resource { "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), + "owner_id": { Type: schema.TypeString, Computed: true, @@ -121,13 +128,15 @@ func resourceAwsSubnet() *schema.Resource { func resourceAwsSubnetCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) createOpts := &ec2.CreateSubnetInput{ AvailabilityZone: aws.String(d.Get("availability_zone").(string)), AvailabilityZoneId: aws.String(d.Get("availability_zone_id").(string)), CidrBlock: aws.String(d.Get("cidr_block").(string)), VpcId: aws.String(d.Get("vpc_id").(string)), - TagSpecifications: ec2TagSpecificationsFromMap(d.Get("tags").(map[string]interface{}), ec2.ResourceTypeSubnet), + TagSpecifications: ec2TagSpecificationsFromKeyValueTags(tags, ec2.ResourceTypeSubnet), } if v, ok := d.GetOk("ipv6_cidr_block"); ok { @@ -223,25 +232,56 @@ func resourceAwsSubnetCreate(d *schema.ResourceData, meta interface{}) error { func resourceAwsSubnetRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig - resp, err := conn.DescribeSubnets(&ec2.DescribeSubnetsInput{ - SubnetIds: []*string{aws.String(d.Id())}, - }) + var subnet *ec2.Subnet - if err != nil { - if isAWSErr(err, "InvalidSubnetID.NotFound", "") { - log.Printf("[WARN] Subnet (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil + err := resource.Retry(waiter.SubnetPropagationTimeout, func() *resource.RetryError { + var err error + + subnet, err = finder.SubnetByID(conn, d.Id()) + + if d.IsNewResource() && tfawserr.ErrCodeEquals(err, "InvalidSubnetID.NotFound") { + return resource.RetryableError(err) } - return err + + if err != nil { + return resource.NonRetryableError(err) + } + + if d.IsNewResource() && subnet == nil { + return resource.RetryableError(&resource.NotFoundError{ + LastError: fmt.Errorf("EC2 Subnet (%s) not found", d.Id()), + }) + } + + return nil + }) + + if tfresource.TimedOut(err) { + subnet, err = finder.SubnetByID(conn, d.Id()) } - if resp == nil { + + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, "InvalidSubnetID.NotFound") { + log.Printf("[WARN] EC2 Subnet (%s) not found, removing from state", d.Id()) + d.SetId("") return nil } - subnet := resp.Subnets[0] + if err != nil { + return fmt.Errorf("error reading EC2 Subnet (%s): %w", d.Id(), err) + } + + if subnet == nil { + if d.IsNewResource() { + return fmt.Errorf("error reading EC2 Subnet (%s): not found after creation", d.Id()) + } + + log.Printf("[WARN] EC2 Subnet (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } d.Set("vpc_id", subnet.VpcId) d.Set("availability_zone", subnet.AvailabilityZone) @@ -267,10 +307,17 @@ func resourceAwsSubnetRead(d *schema.ResourceData, meta interface{}) error { d.Set("arn", subnet.SubnetArn) - if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(subnet.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags := keyvaluetags.Ec2KeyValueTags(subnet.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %w", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %w", err) + } + d.Set("owner_id", subnet.OwnerId) return nil @@ -279,8 +326,8 @@ func resourceAwsSubnetRead(d *schema.ResourceData, meta interface{}) error { func resourceAwsSubnetUpdate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.Ec2UpdateTags(conn, d.Id(), o, n); err != nil { return fmt.Errorf("error updating EC2 Subnet (%s) tags: %w", d.Id(), err) diff --git a/aws/resource_aws_subnet_test.go b/aws/resource_aws_subnet_test.go index fed7b085741c..042e23c6ac6e 100644 --- a/aws/resource_aws_subnet_test.go +++ b/aws/resource_aws_subnet_test.go @@ -129,6 +129,7 @@ func TestAccAWSSubnet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckSubnetDestroy, @@ -166,6 +167,7 @@ func TestAccAWSSubnet_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckSubnetDestroy, @@ -203,6 +205,335 @@ func TestAccAWSSubnet_tags(t *testing.T) { }) } +func TestAccAWSSubnet_defaultTags_providerOnly(t *testing.T) { + var providers []*schema.Provider + var subnet ec2.Subnet + resourceName := "aws_subnet.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckSubnetDestroy, + Steps: []resource.TestStep{ + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccSubnetConfig, + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags2("providerkey1", "providervalue1", "providerkey2", "providervalue2"), + testAccSubnetConfig, + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey2", "providervalue2"), + ), + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("providerkey1", "value1"), + testAccSubnetConfig, + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "value1"), + ), + }, + }, + }) +} + +func TestAccAWSSubnet_defaultTags_updateToProviderOnly(t *testing.T) { + var providers []*schema.Provider + var subnet ec2.Subnet + resourceName := "aws_subnet.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckSubnetDestroy, + Steps: []resource.TestStep{ + { + Config: testAccSubnetTagsConfig1(rName, "key1", "value1"), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("key1", "value1"), + testAccSubnetConfig, + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSSubnet_defaultTags_updateToResourceOnly(t *testing.T) { + var providers []*schema.Provider + var subnet ec2.Subnet + resourceName := "aws_subnet.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckSubnetDestroy, + Steps: []resource.TestStep{ + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("key1", "value1"), + testAccSubnetConfig, + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + Config: testAccSubnetTagsConfig1(rName, "key1", "value1"), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSSubnet_defaultTags_providerAndResource_nonOverlappingTag(t *testing.T) { + var providers []*schema.Provider + var subnet ec2.Subnet + resourceName := "aws_subnet.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckSubnetDestroy, + Steps: []resource.TestStep{ + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccSubnetTagsConfig1(rName, "resourcekey1", "resourcevalue1"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey1", "resourcevalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccSubnetTagsConfig2(rName, "resourcekey1", "resourcevalue1", "resourcekey2", "resourcevalue2"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "3"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey2", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey2", "resourcevalue2"), + ), + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("providerkey2", "providervalue2"), + testAccSubnetTagsConfig1(rName, "resourcekey3", "resourcevalue3"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey3", "resourcevalue3"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey2", "providervalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey3", "resourcevalue3"), + ), + }, + }, + }) +} + +func TestAccAWSSubnet_defaultTags_providerAndResource_overlappingTag(t *testing.T) { + var providers []*schema.Provider + var subnet ec2.Subnet + resourceName := "aws_subnet.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckSubnetDestroy, + Steps: []resource.TestStep{ + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("overlapkey1", "providervalue1"), + testAccSubnetTagsConfig1(rName, "overlapkey1", "resourcevalue1"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags2("overlapkey1", "providervalue1", "overlapkey2", "providervalue2"), + testAccSubnetTagsConfig2(rName, "overlapkey1", "resourcevalue1", "overlapkey2", "resourcevalue2"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey2", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey2", "resourcevalue2"), + ), + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("overlapkey1", "providervalue1"), + testAccSubnetTagsConfig1(rName, "overlapkey1", "resourcevalue2"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue2"), + ), + }, + }, + }) +} + +func TestAccAWSSubnet_defaultTags_providerAndResource_duplicateTag(t *testing.T) { + var providers []*schema.Provider + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("overlapkey", "overlapvalue"), + testAccSubnetTagsConfig1(rName, "overlapkey", "overlapvalue"), + ), + PlanOnly: true, + ExpectError: regexp.MustCompile(`"tags" are identical to those in the "default_tags" configuration block`), + }, + }, + }) +} + +func TestAccAWSSubnet_defaultAndIgnoreTags(t *testing.T) { + var providers []*schema.Provider + var subnet ec2.Subnet + resourceName := "aws_subnet.test" + rName := acctest.RandomWithPrefix("tf-acc-test") + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckSubnetDestroy, + Steps: []resource.TestStep{ + { + Config: testAccSubnetTagsConfig1(rName, "key1", "value1"), + Check: resource.ComposeTestCheckFunc( + testAccCheckSubnetExists(resourceName, &subnet), + testAccCheckSubnetUpdateTags(&subnet, nil, map[string]string{"defaultkey1": "defaultvalue1"}), + ), + ExpectNonEmptyPlan: true, + }, + { + Config: composeConfig( + testAccProviderConfigDefaultAndIgnoreTagsKeyPrefixes1("defaultkey1", "defaultvalue1", "defaultkey"), + testAccSubnetTagsConfig1(rName, "key1", "value1"), + ), + PlanOnly: true, + }, + { + Config: composeConfig( + testAccProviderConfigDefaultAndIgnoreTagsKeys1("defaultkey1", "defaultvalue1"), + testAccSubnetTagsConfig1(rName, "key1", "value1"), + ), + PlanOnly: true, + }, + }, + }) +} + func TestAccAWSSubnet_ignoreTags(t *testing.T) { var providers []*schema.Provider var subnet ec2.Subnet @@ -210,6 +541,7 @@ func TestAccAWSSubnet_ignoreTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -239,6 +571,7 @@ func TestAccAWSSubnet_ipv6(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckSubnetDestroy, @@ -279,6 +612,7 @@ func TestAccAWSSubnet_enableIpv6(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckSubnetDestroy, @@ -322,6 +656,7 @@ func TestAccAWSSubnet_availabilityZoneId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckSubnetDestroy, @@ -349,6 +684,7 @@ func TestAccAWSSubnet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSubnetDestroy, Steps: []resource.TestStep{ @@ -371,6 +707,7 @@ func TestAccAWSSubnet_CustomerOwnedIpv4Pool(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSubnetDestroy, Steps: []resource.TestStep{ @@ -396,6 +733,7 @@ func TestAccAWSSubnet_MapCustomerOwnedIpOnLaunch(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSubnetDestroy, Steps: []resource.TestStep{ @@ -421,6 +759,7 @@ func TestAccAWSSubnet_MapPublicIpOnLaunch(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckSubnetDestroy, Steps: []resource.TestStep{ @@ -461,6 +800,7 @@ func TestAccAWSSubnet_outpost(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSOutpostsOutposts(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckSubnetDestroy, diff --git a/aws/resource_aws_swf_domain_test.go b/aws/resource_aws_swf_domain_test.go index 1421bdb6406e..82c003a6fbb1 100644 --- a/aws/resource_aws_swf_domain_test.go +++ b/aws/resource_aws_swf_domain_test.go @@ -31,6 +31,7 @@ func TestAccAWSSwfDomain_basic(t *testing.T) { testAccPreCheck(t) testAccPreCheckSwfDomainTestingEnabled(t) }, + ErrorCheck: testAccErrorCheck(t, swf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSwfDomainDestroy, Steps: []resource.TestStep{ @@ -61,6 +62,7 @@ func TestAccAWSSwfDomain_tags(t *testing.T) { testAccPreCheck(t) testAccPreCheckSwfDomainTestingEnabled(t) }, + ErrorCheck: testAccErrorCheck(t, swf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSwfDomainDestroy, Steps: []resource.TestStep{ @@ -106,6 +108,7 @@ func TestAccAWSSwfDomain_NamePrefix(t *testing.T) { testAccPreCheck(t) testAccPreCheckSwfDomainTestingEnabled(t) }, + ErrorCheck: testAccErrorCheck(t, swf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSwfDomainDestroy, Steps: []resource.TestStep{ @@ -134,6 +137,7 @@ func TestAccAWSSwfDomain_GeneratedName(t *testing.T) { testAccPreCheck(t) testAccPreCheckSwfDomainTestingEnabled(t) }, + ErrorCheck: testAccErrorCheck(t, swf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSwfDomainDestroy, Steps: []resource.TestStep{ @@ -161,6 +165,7 @@ func TestAccAWSSwfDomain_Description(t *testing.T) { testAccPreCheck(t) testAccPreCheckSwfDomainTestingEnabled(t) }, + ErrorCheck: testAccErrorCheck(t, swf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSwfDomainDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_synthetics_canary.go b/aws/resource_aws_synthetics_canary.go index 4da90e5ed94a..eb109806e8ce 100644 --- a/aws/resource_aws_synthetics_canary.go +++ b/aws/resource_aws_synthetics_canary.go @@ -10,11 +10,14 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/service/synthetics" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + iamwaiter "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/iam/waiter" "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/synthetics/finder" "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/synthetics/waiter" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource" ) const awsMutexCanary = `aws_synthetics_canary` @@ -259,15 +262,59 @@ func resourceAwsSyntheticsCanaryCreate(d *schema.ResourceData, meta interface{}) log.Printf("[DEBUG] creating Synthetics Canary: %#v", input) - resp, err := conn.CreateCanary(input) - if err != nil { - return fmt.Errorf("error creating Synthetics Canary: %w", err) - } + // Underlying IAM eventual consistency errors can occur after the creation + // operation. The goal is only retry these types of errors up to the IAM + // timeout. Since the creation process is asynchronous and can take up to + // its own timeout, we store a stop time upfront for checking. + iamwaiterStopTime := time.Now().Add(iamwaiter.PropagationTimeout) + + // Ensure to add IAM eventual consistency timeout in case of retries + err = resource.Retry(iamwaiter.PropagationTimeout+waiter.CanaryCreatedTimeout, func() *resource.RetryError { + // Only retry IAM eventual consistency errors up to that timeout + iamwaiterRetry := time.Now().Before(iamwaiterStopTime) + + resp, err := conn.CreateCanary(input) + + if err != nil { + return resource.NonRetryableError(fmt.Errorf("error creating Synthetics Canary: %w", err)) + } - d.SetId(aws.StringValue(resp.Canary.Name)) + if resp == nil || resp.Canary == nil { + return resource.NonRetryableError(fmt.Errorf("error creating Synthetics Canary: empty response")) + } + + d.SetId(aws.StringValue(resp.Canary.Name)) + + _, err = waiter.CanaryReady(conn, d.Id()) + + if err != nil { + // This error synthesized from the Status object and not an AWS SDK Go error type + if iamwaiterRetry && strings.Contains(err.Error(), "The role defined for the function cannot be assumed by Lambda") { + return resource.RetryableError(fmt.Errorf("error waiting for Synthetics Canary (%s) creation: %w", d.Id(), err)) + } - if _, err := waiter.CanaryReady(conn, d.Id()); err != nil { - return fmt.Errorf("error waiting for Synthetics Canary (%s) creation: %w", d.Id(), err) + return resource.NonRetryableError(fmt.Errorf("error waiting for Synthetics Canary (%s) creation: %w", d.Id(), err)) + } + + return nil + }) + + if tfresource.TimedOut(err) { + resp, err := conn.CreateCanary(input) + + if err != nil { + return fmt.Errorf("error creating Synthetics Canary: %w", err) + } + + if resp == nil || resp.Canary == nil { + return fmt.Errorf("error creating Synthetics Canary: empty response") + } + + d.SetId(aws.StringValue(resp.Canary.Name)) + + if _, err = waiter.CanaryReady(conn, d.Id()); err != nil { + return fmt.Errorf("error waiting for Synthetics Canary (%s) creation: %w", d.Id(), err) + } } if v := d.Get("start_canary"); v.(bool) { diff --git a/aws/resource_aws_synthetics_canary_test.go b/aws/resource_aws_synthetics_canary_test.go index 95f6ab11bb54..2c92f457625e 100644 --- a/aws/resource_aws_synthetics_canary_test.go +++ b/aws/resource_aws_synthetics_canary_test.go @@ -80,9 +80,8 @@ func TestAccAWSSyntheticsCanary_basic(t *testing.T) { resourceName := "aws_synthetics_canary.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, synthetics.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSyntheticsCanaryDestroy, Steps: []resource.TestStep{ @@ -155,6 +154,7 @@ func TestAccAWSSyntheticsCanary_runtimeVersion(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, synthetics.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSyntheticsCanaryDestroy, Steps: []resource.TestStep{ @@ -188,9 +188,8 @@ func TestAccAWSSyntheticsCanary_startCanary(t *testing.T) { resourceName := "aws_synthetics_canary.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, synthetics.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSyntheticsCanaryDestroy, Steps: []resource.TestStep{ @@ -237,9 +236,8 @@ func TestAccAWSSyntheticsCanary_startCanary_codeChanges(t *testing.T) { resourceName := "aws_synthetics_canary.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, synthetics.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSyntheticsCanaryDestroy, Steps: []resource.TestStep{ @@ -279,9 +277,8 @@ func TestAccAWSSyntheticsCanary_s3(t *testing.T) { resourceName := "aws_synthetics_canary.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, synthetics.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSyntheticsCanaryDestroy, Steps: []resource.TestStep{ @@ -324,9 +321,8 @@ func TestAccAWSSyntheticsCanary_runConfig(t *testing.T) { resourceName := "aws_synthetics_canary.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, synthetics.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSyntheticsCanaryDestroy, Steps: []resource.TestStep{ @@ -371,9 +367,8 @@ func TestAccAWSSyntheticsCanary_runConfigTracing(t *testing.T) { resourceName := "aws_synthetics_canary.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, synthetics.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSyntheticsCanaryDestroy, Steps: []resource.TestStep{ @@ -414,9 +409,8 @@ func TestAccAWSSyntheticsCanary_vpc(t *testing.T) { resourceName := "aws_synthetics_canary.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, synthetics.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSyntheticsCanaryDestroy, Steps: []resource.TestStep{ @@ -464,9 +458,8 @@ func TestAccAWSSyntheticsCanary_tags(t *testing.T) { resourceName := "aws_synthetics_canary.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, synthetics.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSyntheticsCanaryDestroy, Steps: []resource.TestStep{ @@ -511,9 +504,8 @@ func TestAccAWSSyntheticsCanary_disappears(t *testing.T) { resourceName := "aws_synthetics_canary.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { - testAccPreCheck(t) - }, + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, synthetics.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsSyntheticsCanaryDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_transfer_server_test.go b/aws/resource_aws_transfer_server_test.go index 25d895ad6dc3..d2be51f27c74 100644 --- a/aws/resource_aws_transfer_server_test.go +++ b/aws/resource_aws_transfer_server_test.go @@ -71,6 +71,7 @@ func TestAccAWSTransferServer_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferServerDestroy, @@ -117,6 +118,7 @@ func TestAccAWSTransferServer_Vpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferServerDestroy, @@ -160,6 +162,7 @@ func TestAccAWSTransferServer_apigateway(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccAPIGatewayTypeEDGEPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferServerDestroy, @@ -189,6 +192,7 @@ func TestAccAWSTransferServer_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferServerDestroy, Steps: []resource.TestStep{ @@ -212,6 +216,7 @@ func TestAccAWSTransferServer_forcedestroy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferServerDestroy, @@ -245,6 +250,7 @@ func TestAccAWSTransferServer_vpcEndpointId(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferServerDestroy, @@ -274,6 +280,7 @@ func TestAccAWSTransferServer_hostKey(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferServerDestroy, diff --git a/aws/resource_aws_transfer_ssh_key.go b/aws/resource_aws_transfer_ssh_key.go index 0711e41cd07f..6689fc9e4fd1 100644 --- a/aws/resource_aws_transfer_ssh_key.go +++ b/aws/resource_aws_transfer_ssh_key.go @@ -97,8 +97,8 @@ func resourceAwsTransferSshKeyRead(d *schema.ResourceData, meta interface{}) err var body string for _, s := range resp.User.SshPublicKeys { - if sshKeyID == *s.SshPublicKeyId { - body = *s.SshPublicKeyBody + if sshKeyID == aws.StringValue(s.SshPublicKeyId) { + body = aws.StringValue(s.SshPublicKeyBody) } } diff --git a/aws/resource_aws_transfer_ssh_key_test.go b/aws/resource_aws_transfer_ssh_key_test.go index dbb35eadb247..9437daee8f8d 100644 --- a/aws/resource_aws_transfer_ssh_key_test.go +++ b/aws/resource_aws_transfer_ssh_key_test.go @@ -17,6 +17,7 @@ func TestAccAWSTransferSshKey_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferSshKeyDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_transfer_user_test.go b/aws/resource_aws_transfer_user_test.go index 4e02ba41fca3..2fb9d25a7f81 100644 --- a/aws/resource_aws_transfer_user_test.go +++ b/aws/resource_aws_transfer_user_test.go @@ -19,6 +19,7 @@ func TestAccAWSTransferUser_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferUserDestroy, @@ -51,6 +52,7 @@ func TestAccAWSTransferUser_modifyWithOptions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferUserDestroy, @@ -110,6 +112,7 @@ func TestAccAWSTransferUser_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferUserDestroy, Steps: []resource.TestStep{ @@ -129,6 +132,7 @@ func TestAccAWSTransferUser_disappears(t *testing.T) { func TestAccAWSTransferUser_UserName_Validation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferUserDestroy, Steps: []resource.TestStep{ @@ -169,6 +173,7 @@ func TestAccAWSTransferUser_homeDirectoryMappings(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSTransfer(t) }, + ErrorCheck: testAccErrorCheck(t, transfer.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckAWSTransferUserDestroy, diff --git a/aws/resource_aws_volume_attachment.go b/aws/resource_aws_volume_attachment.go index 6f3bdc1a4280..8d0514c9e4ac 100644 --- a/aws/resource_aws_volume_attachment.go +++ b/aws/resource_aws_volume_attachment.go @@ -176,8 +176,8 @@ func volumeAttachmentStateRefreshFunc(conn *ec2.EC2, name, volumeID, instanceID if len(resp.Volumes) > 0 { v := resp.Volumes[0] for _, a := range v.Attachments { - if a.InstanceId != nil && *a.InstanceId == instanceID { - return a, *a.State, nil + if aws.StringValue(a.InstanceId) == instanceID { + return a, aws.StringValue(a.State), nil } } } @@ -212,7 +212,7 @@ func resourceAwsVolumeAttachmentRead(d *schema.ResourceData, meta interface{}) e return fmt.Errorf("Error reading EC2 volume %s for instance: %s: %#v", d.Get("volume_id").(string), d.Get("instance_id").(string), err) } - if len(vols.Volumes) == 0 || *vols.Volumes[0].State == ec2.VolumeStateAvailable { + if len(vols.Volumes) == 0 || aws.StringValue(vols.Volumes[0].State) == ec2.VolumeStateAvailable { log.Printf("[DEBUG] Volume Attachment (%s) not found, removing from state", d.Id()) d.SetId("") } diff --git a/aws/resource_aws_volume_attachment_test.go b/aws/resource_aws_volume_attachment_test.go index 334d274c21dd..23488aa30f42 100644 --- a/aws/resource_aws_volume_attachment_test.go +++ b/aws/resource_aws_volume_attachment_test.go @@ -20,6 +20,7 @@ func TestAccAWSVolumeAttachment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVolumeAttachmentDestroy, Steps: []resource.TestStep{ @@ -50,6 +51,7 @@ func TestAccAWSVolumeAttachment_skipDestroy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVolumeAttachmentDestroy, Steps: []resource.TestStep{ @@ -108,6 +110,7 @@ func TestAccAWSVolumeAttachment_attachStopped(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVolumeAttachmentDestroy, Steps: []resource.TestStep{ @@ -143,6 +146,7 @@ func TestAccAWSVolumeAttachment_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVolumeAttachmentDestroy, Steps: []resource.TestStep{ @@ -192,6 +196,7 @@ func TestAccAWSVolumeAttachment_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVolumeAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc.go b/aws/resource_aws_vpc.go index b84b1bd87d72..d27f34f43639 100644 --- a/aws/resource_aws_vpc.go +++ b/aws/resource_aws_vpc.go @@ -10,12 +10,15 @@ import ( "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/ec2" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/customdiff" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2/finder" "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/ec2/waiter" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource" ) func resourceAwsVpc() *schema.Resource { @@ -28,7 +31,11 @@ func resourceAwsVpc() *schema.Resource { Importer: &schema.ResourceImporter{ State: resourceAwsVpcInstanceImport, }, - CustomizeDiff: resourceAwsVpcCustomizeDiff, + + CustomizeDiff: customdiff.All( + resourceAwsVpcCustomizeDiff, + SetTagsDiff, + ), SchemaVersion: 1, MigrateState: resourceAwsVpcMigrateState, @@ -120,6 +127,8 @@ func resourceAwsVpc() *schema.Resource { "tags": tagsSchema(), + "tags_all": tagsSchemaComputed(), + "owner_id": { Type: schema.TypeString, Computed: true, @@ -130,13 +139,15 @@ func resourceAwsVpc() *schema.Resource { func resourceAwsVpcCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + tags := defaultTagsConfig.MergeTags(keyvaluetags.New(d.Get("tags").(map[string]interface{}))) // Create the VPC createOpts := &ec2.CreateVpcInput{ CidrBlock: aws.String(d.Get("cidr_block").(string)), InstanceTenancy: aws.String(d.Get("instance_tenancy").(string)), AmazonProvidedIpv6CidrBlock: aws.Bool(d.Get("assign_generated_ipv6_cidr_block").(bool)), - TagSpecifications: ec2TagSpecificationsFromMap(d.Get("tags").(map[string]interface{}), ec2.ResourceTypeVpc), + TagSpecifications: ec2TagSpecificationsFromKeyValueTags(tags, ec2.ResourceTypeVpc), } log.Printf("[DEBUG] VPC create config: %#v", *createOpts) @@ -238,20 +249,57 @@ func resourceAwsVpcCreate(d *schema.ResourceData, meta interface{}) error { func resourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).ec2conn + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig - // Refresh the VPC state - vpcRaw, _, err := VPCStateRefreshFunc(conn, d.Id())() + var vpc *ec2.Vpc + + err := resource.Retry(waiter.VpcPropagationTimeout, func() *resource.RetryError { + var err error + + vpc, err = finder.VpcByID(conn, d.Id()) + + if d.IsNewResource() && tfawserr.ErrCodeEquals(err, "InvalidVpcID.NotFound") { + return resource.RetryableError(err) + } + + if err != nil { + return resource.NonRetryableError(err) + } + + if d.IsNewResource() && vpc == nil { + return resource.RetryableError(&resource.NotFoundError{ + LastError: fmt.Errorf("EC2 VPC (%s) not found", d.Id()), + }) + } + + return nil + }) + + if tfresource.TimedOut(err) { + vpc, err = finder.VpcByID(conn, d.Id()) + } + + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, "InvalidVpcID.NotFound") { + log.Printf("[WARN] EC2 VPC (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + if err != nil { - return err + return fmt.Errorf("error reading EC2 VPC (%s): %w", d.Id(), err) } - if vpcRaw == nil { + + if vpc == nil { + if d.IsNewResource() { + return fmt.Errorf("error reading EC2 VPC (%s): not found after creation", d.Id()) + } + + log.Printf("[WARN] EC2 VPC (%s) not found, removing from state", d.Id()) d.SetId("") return nil } - // VPC stuff - vpc := vpcRaw.(*ec2.Vpc) vpcid := d.Id() d.Set("cidr_block", vpc.CidrBlock) d.Set("dhcp_options_id", vpc.DhcpOptionsId) @@ -262,15 +310,22 @@ func resourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error { Partition: meta.(*AWSClient).partition, Service: ec2.ServiceName, Region: meta.(*AWSClient).region, - AccountID: meta.(*AWSClient).accountid, + AccountID: aws.StringValue(vpc.OwnerId), Resource: fmt.Sprintf("vpc/%s", d.Id()), }.String() d.Set("arn", arn) - if err := d.Set("tags", keyvaluetags.Ec2KeyValueTags(vpc.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { + tags := keyvaluetags.Ec2KeyValueTags(vpc.Tags).IgnoreAws().IgnoreConfig(ignoreTagsConfig) + + //lintignore:AWSR002 + if err := d.Set("tags", tags.RemoveDefaultConfig(defaultTagsConfig).Map()); err != nil { return fmt.Errorf("error setting tags: %s", err) } + if err := d.Set("tags_all", tags.Map()); err != nil { + return fmt.Errorf("error setting tags_all: %s", err) + } + d.Set("owner_id", vpc.OwnerId) // Make sure those values are set, if an IPv6 block exists it'll be set in the loop @@ -317,9 +372,9 @@ func resourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error { } else { classiclink_enabled := false for _, v := range respClassiclink.Vpcs { - if *v.VpcId == vpcid { + if aws.StringValue(v.VpcId) == vpcid { if v.ClassicLinkEnabled != nil { - classiclink_enabled = *v.ClassicLinkEnabled + classiclink_enabled = aws.BoolValue(v.ClassicLinkEnabled) } break } @@ -342,9 +397,9 @@ func resourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error { } else { classiclinkdns_enabled := false for _, v := range respClassiclinkDnsSupport.Vpcs { - if *v.VpcId == vpcid { + if aws.StringValue(v.VpcId) == vpcid { if v.ClassicLinkDnsSupported != nil { - classiclinkdns_enabled = *v.ClassicLinkDnsSupported + classiclinkdns_enabled = aws.BoolValue(v.ClassicLinkDnsSupported) } break } @@ -513,8 +568,8 @@ func resourceAwsVpcUpdate(d *schema.ResourceData, meta interface{}) error { } } - if d.HasChange("tags") { - o, n := d.GetChange("tags") + if d.HasChange("tags_all") { + o, n := d.GetChange("tags_all") if err := keyvaluetags.Ec2UpdateTags(conn, d.Id(), o, n); err != nil { return fmt.Errorf("error updating tags: %s", err) diff --git a/aws/resource_aws_vpc_dhcp_options.go b/aws/resource_aws_vpc_dhcp_options.go index b78b86b3ca7e..c4443c2b5606 100644 --- a/aws/resource_aws_vpc_dhcp_options.go +++ b/aws/resource_aws_vpc_dhcp_options.go @@ -195,7 +195,7 @@ func resourceAwsVpcDhcpOptionsRead(d *schema.ResourceData, meta interface{}) err Partition: meta.(*AWSClient).partition, Service: ec2.ServiceName, Region: meta.(*AWSClient).region, - AccountID: meta.(*AWSClient).accountid, + AccountID: aws.StringValue(opts.OwnerId), Resource: fmt.Sprintf("dhcp-options/%s", d.Id()), }.String() diff --git a/aws/resource_aws_vpc_dhcp_options_association_test.go b/aws/resource_aws_vpc_dhcp_options_association_test.go index a12b844974c7..01ab0d37b64d 100644 --- a/aws/resource_aws_vpc_dhcp_options_association_test.go +++ b/aws/resource_aws_vpc_dhcp_options_association_test.go @@ -17,6 +17,7 @@ func TestAccAWSDHCPOptionsAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDHCPOptionsAssociationDestroy, Steps: []resource.TestStep{ @@ -45,6 +46,7 @@ func TestAccAWSDHCPOptionsAssociation_disappears_vpc(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDHCPOptionsAssociationDestroy, Steps: []resource.TestStep{ @@ -69,6 +71,7 @@ func TestAccAWSDHCPOptionsAssociation_disappears_dhcp(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDHCPOptionsAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc_dhcp_options_test.go b/aws/resource_aws_vpc_dhcp_options_test.go index 223c2b01c053..fdf0f812bf26 100644 --- a/aws/resource_aws_vpc_dhcp_options_test.go +++ b/aws/resource_aws_vpc_dhcp_options_test.go @@ -90,6 +90,7 @@ func TestAccAWSDHCPOptions_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDHCPOptionsDestroy, Steps: []resource.TestStep{ @@ -124,6 +125,7 @@ func TestAccAWSDHCPOptions_deleteOptions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDHCPOptionsDestroy, Steps: []resource.TestStep{ @@ -146,6 +148,7 @@ func TestAccAWSDHCPOptions_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDHCPOptionsDestroy, Steps: []resource.TestStep{ @@ -190,6 +193,7 @@ func TestAccAWSDHCPOptions_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckDHCPOptionsDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc_endpoint.go b/aws/resource_aws_vpc_endpoint.go index 6cb8862a3d58..7bb0b47d3c78 100644 --- a/aws/resource_aws_vpc_endpoint.go +++ b/aws/resource_aws_vpc_endpoint.go @@ -228,7 +228,7 @@ func resourceAwsVpcEndpointRead(d *schema.ResourceData, meta interface{}) error Partition: meta.(*AWSClient).partition, Service: ec2.ServiceName, Region: meta.(*AWSClient).region, - AccountID: meta.(*AWSClient).accountid, + AccountID: aws.StringValue(vpce.OwnerId), Resource: fmt.Sprintf("vpc-endpoint/%s", d.Id()), }.String() d.Set("arn", arn) diff --git a/aws/resource_aws_vpc_endpoint_connection_notification_test.go b/aws/resource_aws_vpc_endpoint_connection_notification_test.go index 9e918d0bae80..ea8caad21238 100644 --- a/aws/resource_aws_vpc_endpoint_connection_notification_test.go +++ b/aws/resource_aws_vpc_endpoint_connection_notification_test.go @@ -18,6 +18,7 @@ func TestAccAWSVpcEndpointConnectionNotification_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointConnectionNotificationDestroy, diff --git a/aws/resource_aws_vpc_endpoint_route_table_association_test.go b/aws/resource_aws_vpc_endpoint_route_table_association_test.go index f71797c50702..4b5df4883659 100644 --- a/aws/resource_aws_vpc_endpoint_route_table_association_test.go +++ b/aws/resource_aws_vpc_endpoint_route_table_association_test.go @@ -19,6 +19,7 @@ func TestAccAWSVpcEndpointRouteTableAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointRouteTableAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc_endpoint_service_allowed_principal_test.go b/aws/resource_aws_vpc_endpoint_service_allowed_principal_test.go index 940b26256526..cf07c24a8b37 100644 --- a/aws/resource_aws_vpc_endpoint_service_allowed_principal_test.go +++ b/aws/resource_aws_vpc_endpoint_service_allowed_principal_test.go @@ -17,6 +17,7 @@ func TestAccAWSVpcEndpointServiceAllowedPrincipal_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointServiceAllowedPrincipalDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc_endpoint_service_test.go b/aws/resource_aws_vpc_endpoint_service_test.go index 56fce2961cf8..6fd842d43308 100644 --- a/aws/resource_aws_vpc_endpoint_service_test.go +++ b/aws/resource_aws_vpc_endpoint_service_test.go @@ -92,6 +92,7 @@ func TestAccAWSVpcEndpointService_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointServiceDestroy, Steps: []resource.TestStep{ @@ -125,6 +126,7 @@ func TestAccAWSVpcEndpointService_AllowedPrincipals(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointServiceDestroy, Steps: []resource.TestStep{ @@ -169,6 +171,7 @@ func TestAccAWSVpcEndpointService_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointServiceDestroy, Steps: []resource.TestStep{ @@ -191,6 +194,7 @@ func TestAccAWSVpcEndpointService_GatewayLoadBalancerArns(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckElbv2GatewayLoadBalancer(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointServiceDestroy, Steps: []resource.TestStep{ @@ -225,6 +229,7 @@ func TestAccAWSVpcEndpointService_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointServiceDestroy, Steps: []resource.TestStep{ @@ -270,6 +275,7 @@ func TestAccAWSVpcEndpointService_private_dns_name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointServiceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc_endpoint_subnet_association_test.go b/aws/resource_aws_vpc_endpoint_subnet_association_test.go index 01cff569aa25..8e6f80d16742 100644 --- a/aws/resource_aws_vpc_endpoint_subnet_association_test.go +++ b/aws/resource_aws_vpc_endpoint_subnet_association_test.go @@ -16,6 +16,7 @@ func TestAccAWSVpcEndpointSubnetAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointSubnetAssociationDestroy, Steps: []resource.TestStep{ @@ -35,6 +36,7 @@ func TestAccAWSVpcEndpointSubnetAssociation_multiple(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointSubnetAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc_endpoint_test.go b/aws/resource_aws_vpc_endpoint_test.go index 413f33afb393..22012b28c3c6 100644 --- a/aws/resource_aws_vpc_endpoint_test.go +++ b/aws/resource_aws_vpc_endpoint_test.go @@ -94,6 +94,7 @@ func TestAccAWSVpcEndpoint_gatewayBasic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointDestroy, Steps: []resource.TestStep{ @@ -132,6 +133,7 @@ func TestAccAWSVpcEndpoint_gatewayWithRouteTableAndPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointDestroy, Steps: []resource.TestStep{ @@ -225,6 +227,7 @@ func TestAccAWSVpcEndpoint_gatewayPolicy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointDestroy, Steps: []resource.TestStep{ @@ -256,6 +259,7 @@ func TestAccAWSVpcEndpoint_interfaceBasic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointDestroy, Steps: []resource.TestStep{ @@ -293,6 +297,7 @@ func TestAccAWSVpcEndpoint_interfaceWithSubnetAndSecurityGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointDestroy, Steps: []resource.TestStep{ @@ -350,6 +355,7 @@ func TestAccAWSVpcEndpoint_interfaceNonAWSServiceAcceptOnCreate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointDestroy, Steps: []resource.TestStep{ @@ -390,6 +396,7 @@ func TestAccAWSVpcEndpoint_interfaceNonAWSServiceAcceptOnUpdate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointDestroy, Steps: []resource.TestStep{ @@ -450,6 +457,7 @@ func TestAccAWSVpcEndpoint_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointDestroy, Steps: []resource.TestStep{ @@ -472,6 +480,7 @@ func TestAccAWSVpcEndpoint_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointDestroy, @@ -518,6 +527,7 @@ func TestAccAWSVpcEndpoint_VpcEndpointType_GatewayLoadBalancer(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckElbv2GatewayLoadBalancer(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcEndpointDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc_ipv4_cidr_block_association_test.go b/aws/resource_aws_vpc_ipv4_cidr_block_association_test.go index bd1e4bfd989c..f6f12ca7f465 100644 --- a/aws/resource_aws_vpc_ipv4_cidr_block_association_test.go +++ b/aws/resource_aws_vpc_ipv4_cidr_block_association_test.go @@ -16,6 +16,7 @@ func TestAccAwsVpcIpv4CidrBlockAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsVpcIpv4CidrBlockAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc_peering_connection.go b/aws/resource_aws_vpc_peering_connection.go index 61a861903e54..430ba6a1202a 100644 --- a/aws/resource_aws_vpc_peering_connection.go +++ b/aws/resource_aws_vpc_peering_connection.go @@ -143,7 +143,7 @@ func resourceAwsVPCPeeringRead(d *schema.ResourceData, meta interface{}) error { log.Printf("[DEBUG] Account ID %s, VPC PeerConn Requester %s, Accepter %s", client.accountid, *pc.RequesterVpcInfo.OwnerId, *pc.AccepterVpcInfo.OwnerId) - if (client.accountid == *pc.AccepterVpcInfo.OwnerId) && (client.accountid != *pc.RequesterVpcInfo.OwnerId) { + if (client.accountid == aws.StringValue(pc.AccepterVpcInfo.OwnerId)) && (client.accountid != aws.StringValue(pc.RequesterVpcInfo.OwnerId)) { // We're the accepter d.Set("peer_owner_id", pc.RequesterVpcInfo.OwnerId) d.Set("peer_vpc_id", pc.RequesterVpcInfo.VpcId) diff --git a/aws/resource_aws_vpc_peering_connection_accepter_test.go b/aws/resource_aws_vpc_peering_connection_accepter_test.go index 11fc8c27f388..677a86f5bf44 100644 --- a/aws/resource_aws_vpc_peering_connection_accepter_test.go +++ b/aws/resource_aws_vpc_peering_connection_accepter_test.go @@ -21,6 +21,7 @@ func TestAccAWSVPCPeeringConnectionAccepter_sameRegionSameAccount(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccAwsVPCPeeringConnectionAccepterDestroy, Steps: []resource.TestStep{ @@ -77,6 +78,7 @@ func TestAccAWSVPCPeeringConnectionAccepter_differentRegionSameAccount(t *testin testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccAwsVPCPeeringConnectionAccepterDestroy, Steps: []resource.TestStep{ @@ -122,6 +124,7 @@ func TestAccAWSVPCPeeringConnectionAccepter_sameRegionDifferentAccount(t *testin testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccAwsVPCPeeringConnectionAccepterDestroy, Steps: []resource.TestStep{ @@ -159,6 +162,7 @@ func TestAccAWSVPCPeeringConnectionAccepter_differentRegionDifferentAccount(t *t testAccMultipleRegionPreCheck(t, 2) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccAwsVPCPeeringConnectionAccepterDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc_peering_connection_options_test.go b/aws/resource_aws_vpc_peering_connection_options_test.go index 13ab3115c4fd..74a5d4cda516 100644 --- a/aws/resource_aws_vpc_peering_connection_options_test.go +++ b/aws/resource_aws_vpc_peering_connection_options_test.go @@ -18,6 +18,7 @@ func TestAccAWSVpcPeeringConnectionOptions_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSVpcPeeringConnectionDestroy, Steps: []resource.TestStep{ @@ -111,6 +112,7 @@ func TestAccAWSVpcPeeringConnectionOptions_differentRegionSameAccount(t *testing testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSVpcPeeringConnectionDestroy, Steps: []resource.TestStep{ @@ -206,6 +208,7 @@ func TestAccAWSVpcPeeringConnectionOptions_sameRegionDifferentAccount(t *testing testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSVpcPeeringConnectionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc_peering_connection_test.go b/aws/resource_aws_vpc_peering_connection_test.go index dfd7ffc986bd..38b01f1671b1 100644 --- a/aws/resource_aws_vpc_peering_connection_test.go +++ b/aws/resource_aws_vpc_peering_connection_test.go @@ -93,10 +93,8 @@ func TestAccAWSVPCPeeringConnection_basic(t *testing.T) { resourceName := "aws_vpc_peering_connection.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: resourceName, - IDRefreshIgnore: []string{"auto_accept"}, - + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSVpcPeeringConnectionDestroy, Steps: []resource.TestStep{ @@ -137,9 +135,8 @@ func TestAccAWSVPCPeeringConnection_plan(t *testing.T) { } resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - IDRefreshIgnore: []string{"auto_accept"}, - + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSVpcPeeringConnectionDestroy, Steps: []resource.TestStep{ @@ -164,10 +161,8 @@ func TestAccAWSVPCPeeringConnection_tags(t *testing.T) { resourceName := "aws_vpc_peering_connection.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: resourceName, - IDRefreshIgnore: []string{"auto_accept"}, - + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -229,10 +224,8 @@ func TestAccAWSVPCPeeringConnection_options(t *testing.T) { } resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: resourceName, - IDRefreshIgnore: []string{"auto_accept"}, - + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSVpcPeeringConnectionDestroy, Steps: []resource.TestStep{ @@ -388,9 +381,8 @@ func TestAccAWSVPCPeeringConnection_failedState(t *testing.T) { rName := fmt.Sprintf("tf-testacc-pcx-%s", acctest.RandString(17)) resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - IDRefreshIgnore: []string{"auto_accept"}, - + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSVpcPeeringConnectionDestroy, Steps: []resource.TestStep{ @@ -528,7 +520,7 @@ func TestAccAWSVPCPeeringConnection_peerRegionAutoAccept(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, - IDRefreshIgnore: []string{"auto_accept"}, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSVpcPeeringConnectionDestroy, Steps: []resource.TestStep{ @@ -551,9 +543,7 @@ func TestAccAWSVPCPeeringConnection_region(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, - IDRefreshName: resourceName, - IDRefreshIgnore: []string{"auto_accept"}, - + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAWSVpcPeeringConnectionDestroy, Steps: []resource.TestStep{ @@ -582,10 +572,8 @@ func TestAccAWSVPCPeeringConnection_accept(t *testing.T) { resourceName := "aws_vpc_peering_connection.test" resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - IDRefreshName: resourceName, - IDRefreshIgnore: []string{"auto_accept"}, - + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSVpcPeeringConnectionDestroy, Steps: []resource.TestStep{ @@ -650,6 +638,7 @@ func TestAccAWSVPCPeeringConnection_optionsNoAutoAccept(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSVpcPeeringConnectionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpc_test.go b/aws/resource_aws_vpc_test.go index d02d3480ff08..b67a40d64a2b 100644 --- a/aws/resource_aws_vpc_test.go +++ b/aws/resource_aws_vpc_test.go @@ -108,6 +108,7 @@ func TestAccAWSVpc_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -144,6 +145,7 @@ func TestAccAWSVpc_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -159,6 +161,329 @@ func TestAccAWSVpc_disappears(t *testing.T) { }) } +func TestAccAWSVpc_defaultTags_providerOnly(t *testing.T) { + var providers []*schema.Provider + var vpc ec2.Vpc + resourceName := "aws_vpc.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckVpcDestroy, + Steps: []resource.TestStep{ + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccVpcConfig, + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags2("providerkey1", "providervalue1", "providerkey2", "providervalue2"), + testAccVpcConfig, + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey2", "providervalue2"), + ), + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("providerkey1", "value1"), + testAccVpcConfig, + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "value1"), + ), + }, + }, + }) +} + +func TestAccAWSVpc_defaultTags_updateToProviderOnly(t *testing.T) { + var providers []*schema.Provider + var vpc ec2.Vpc + resourceName := "aws_vpc.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckVpcDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSVPCConfigTags1("key1", "value1"), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("key1", "value1"), + testAccVpcConfig, + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSVpc_defaultTags_updateToResourceOnly(t *testing.T) { + var providers []*schema.Provider + var vpc ec2.Vpc + resourceName := "aws_vpc.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckVpcDestroy, + Steps: []resource.TestStep{ + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("key1", "value1"), + testAccVpcConfig, + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "0"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + Config: testAccAWSVPCConfigTags1("key1", "value1"), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.key1", "value1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.key1", "value1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAWSVpc_defaultTags_providerAndResource_nonOverlappingTag(t *testing.T) { + var providers []*schema.Provider + var vpc ec2.Vpc + resourceName := "aws_vpc.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckVpcDestroy, + Steps: []resource.TestStep{ + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccAWSVPCConfigTags1("resourcekey1", "resourcevalue1"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey1", "resourcevalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("providerkey1", "providervalue1"), + testAccAWSVPCConfigTags2("resourcekey1", "resourcevalue1", "resourcekey2", "resourcevalue2"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "3"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey2", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey1", "providervalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey2", "resourcevalue2"), + ), + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("providerkey2", "providervalue2"), + testAccAWSVPCConfigTags1("resourcekey3", "resourcevalue3"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.resourcekey3", "resourcevalue3"), + resource.TestCheckResourceAttr(resourceName, "tags_all.providerkey2", "providervalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.resourcekey3", "resourcevalue3"), + ), + }, + }, + }) +} + +func TestAccAWSVpc_defaultTags_providerAndResource_overlappingTag(t *testing.T) { + var providers []*schema.Provider + var vpc ec2.Vpc + resourceName := "aws_vpc.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckVpcDestroy, + Steps: []resource.TestStep{ + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("overlapkey1", "providervalue1"), + testAccAWSVPCConfigTags1("overlapkey1", "resourcevalue1"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue1"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags2("overlapkey1", "providervalue1", "overlapkey2", "providervalue2"), + testAccAWSVPCConfigTags2("overlapkey1", "resourcevalue1", "overlapkey2", "resourcevalue2"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "2"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey2", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey2", "resourcevalue2"), + ), + }, + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("overlapkey1", "providervalue1"), + testAccAWSVPCConfigTags1("overlapkey1", "resourcevalue2"), + ), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + resource.TestCheckResourceAttr(resourceName, "tags.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags_all.%", "1"), + resource.TestCheckResourceAttr(resourceName, "tags.overlapkey1", "resourcevalue2"), + resource.TestCheckResourceAttr(resourceName, "tags_all.overlapkey1", "resourcevalue2"), + ), + }, + }, + }) +} + +func TestAccAWSVpc_defaultTags_providerAndResource_duplicateTag(t *testing.T) { + var providers []*schema.Provider + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: nil, + Steps: []resource.TestStep{ + { + Config: composeConfig( + testAccAWSProviderConfigDefaultTags_Tags1("overlapkey", "overlapvalue"), + testAccAWSVPCConfigTags1("overlapkey", "overlapvalue"), + ), + PlanOnly: true, + ExpectError: regexp.MustCompile(`"tags" are identical to those in the "default_tags" configuration block`), + }, + }, + }) +} + +func TestAccAWSVpc_defaultAndIgnoreTags(t *testing.T) { + var providers []*schema.Provider + var vpc ec2.Vpc + resourceName := "aws_vpc.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), + ProviderFactories: testAccProviderFactoriesInternal(&providers), + CheckDestroy: testAccCheckVpcDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSVPCConfigTags1("key1", "value1"), + Check: resource.ComposeTestCheckFunc( + testAccCheckVpcExists(resourceName, &vpc), + testAccCheckVpcUpdateTags(&vpc, nil, map[string]string{"defaultkey1": "defaultvalue1"}), + ), + ExpectNonEmptyPlan: true, + }, + { + Config: composeConfig( + testAccProviderConfigDefaultAndIgnoreTagsKeyPrefixes1("defaultkey1", "defaultvalue1", "defaultkey"), + testAccAWSVPCConfigTags1("key1", "value1"), + ), + PlanOnly: true, + }, + { + Config: composeConfig( + testAccProviderConfigDefaultAndIgnoreTagsKeys1("defaultkey1", "defaultvalue1"), + testAccAWSVPCConfigTags1("key1", "value1"), + ), + PlanOnly: true, + }, + }, + }) +} + func TestAccAWSVpc_ignoreTags(t *testing.T) { var providers []*schema.Provider var vpc ec2.Vpc @@ -166,6 +491,7 @@ func TestAccAWSVpc_ignoreTags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), ProviderFactories: testAccProviderFactoriesInternal(&providers), CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -195,6 +521,7 @@ func TestAccAWSVpc_AssignGeneratedIpv6CidrBlock(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -247,6 +574,7 @@ func TestAccAWSVpc_Tenancy(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -288,6 +616,7 @@ func TestAccAWSVpc_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -331,6 +660,7 @@ func TestAccAWSVpc_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -475,6 +805,7 @@ func TestAccAWSVpc_bothDnsOptionsSet(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -502,6 +833,7 @@ func TestAccAWSVpc_DisabledDnsSupport(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -527,6 +859,7 @@ func TestAccAWSVpc_classiclinkOptionSet(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ @@ -552,6 +885,7 @@ func TestAccAWSVpc_classiclinkDnsSupportOptionSet(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpcDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpn_connection_route.go b/aws/resource_aws_vpn_connection_route.go index 876e0543ec96..53a34d864bca 100644 --- a/aws/resource_aws_vpn_connection_route.go +++ b/aws/resource_aws_vpn_connection_route.go @@ -155,7 +155,7 @@ func findConnectionRoute(conn *ec2.EC2, cidrBlock, vpnConnectionId string) (*ec2 vpnConnection := resp.VpnConnections[0] for _, r := range vpnConnection.Routes { - if *r.DestinationCidrBlock == cidrBlock && *r.State != "deleted" { + if aws.StringValue(r.DestinationCidrBlock) == cidrBlock && aws.StringValue(r.State) != "deleted" { return r, nil } } diff --git a/aws/resource_aws_vpn_connection_route_test.go b/aws/resource_aws_vpn_connection_route_test.go index d1954e15569c..ae8db5c0891c 100644 --- a/aws/resource_aws_vpn_connection_route_test.go +++ b/aws/resource_aws_vpn_connection_route_test.go @@ -16,6 +16,7 @@ func TestAccAWSVpnConnectionRoute_basic(t *testing.T) { rBgpAsn := acctest.RandIntRange(64512, 65534) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccAwsVpnConnectionRouteDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpn_connection_test.go b/aws/resource_aws_vpn_connection_test.go index e94ba8204446..8f5c4a2f9929 100644 --- a/aws/resource_aws_vpn_connection_test.go +++ b/aws/resource_aws_vpn_connection_test.go @@ -99,6 +99,7 @@ func TestAccAWSVpnConnection_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccAwsVpnConnectionDestroy, @@ -139,6 +140,7 @@ func TestAccAWSVpnConnection_TransitGatewayID(t *testing.T) { testAccPreCheck(t) testAccPreCheckAWSEc2TransitGateway(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccAwsVpnConnectionDestroy, Steps: []resource.TestStep{ @@ -207,6 +209,7 @@ func TestAccAWSVpnConnection_tunnelOptions(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccAwsVpnConnectionDestroy, @@ -315,6 +318,7 @@ func TestAccAWSVpnConnection_withoutStaticRoutes(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccAwsVpnConnectionDestroy, @@ -343,6 +347,7 @@ func TestAccAWSVpnConnection_withEnableAcceleration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccAwsVpnConnectionDestroy, @@ -370,6 +375,7 @@ func TestAccAWSVpnConnection_withIpv6(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccAwsVpnConnectionDestroy, @@ -396,6 +402,7 @@ func TestAccAWSVpnConnection_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccAwsVpnConnectionDestroy, @@ -441,6 +448,7 @@ func TestAccAWSVpnConnection_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccAwsVpnConnectionDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpn_gateway_attachment_test.go b/aws/resource_aws_vpn_gateway_attachment_test.go index 8bd7068ff303..93c49bd6a6ec 100644 --- a/aws/resource_aws_vpn_gateway_attachment_test.go +++ b/aws/resource_aws_vpn_gateway_attachment_test.go @@ -19,6 +19,7 @@ func TestAccAWSVpnGatewayAttachment_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpnGatewayAttachmentDestroy, Steps: []resource.TestStep{ @@ -39,6 +40,7 @@ func TestAccAWSVpnGatewayAttachment_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpnGatewayAttachmentDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpn_gateway_route_propagation.go b/aws/resource_aws_vpn_gateway_route_propagation.go index b1cc68b6fec2..93d3031e78d3 100644 --- a/aws/resource_aws_vpn_gateway_route_propagation.go +++ b/aws/resource_aws_vpn_gateway_route_propagation.go @@ -87,7 +87,7 @@ func resourceAwsVpnGatewayRoutePropagationRead(d *schema.ResourceData, meta inte rt := rtRaw.(*ec2.RouteTable) exists := false for _, vgw := range rt.PropagatingVgws { - if *vgw.GatewayId == gwID { + if aws.StringValue(vgw.GatewayId) == gwID { exists = true } } diff --git a/aws/resource_aws_vpn_gateway_route_propagation_test.go b/aws/resource_aws_vpn_gateway_route_propagation_test.go index 4fc34aa06463..ff9f4087edb9 100644 --- a/aws/resource_aws_vpn_gateway_route_propagation_test.go +++ b/aws/resource_aws_vpn_gateway_route_propagation_test.go @@ -15,6 +15,7 @@ func TestAccAWSVPNGatewayRoutePropagation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: "aws_vpn_gateway_route_propagation.foo", Providers: testAccProviders, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_vpn_gateway_test.go b/aws/resource_aws_vpn_gateway_test.go index b6397b0fdacc..4510cb186f22 100644 --- a/aws/resource_aws_vpn_gateway_test.go +++ b/aws/resource_aws_vpn_gateway_test.go @@ -109,6 +109,7 @@ func TestAccAWSVpnGateway_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckVpnGatewayDestroy, @@ -144,6 +145,7 @@ func TestAccAWSVpnGateway_withAvailabilityZoneSetToState(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpnGatewayDestroy, Steps: []resource.TestStep{ @@ -163,12 +165,14 @@ func TestAccAWSVpnGateway_withAvailabilityZoneSetToState(t *testing.T) { }, }) } + func TestAccAWSVpnGateway_withAmazonSideAsnSetToState(t *testing.T) { var v ec2.VpnGateway resourceName := "aws_vpn_gateway.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpnGatewayDestroy, Steps: []resource.TestStep{ @@ -195,6 +199,7 @@ func TestAccAWSVpnGateway_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckVpnGatewayDestroy, Steps: []resource.TestStep{ @@ -252,6 +257,7 @@ func TestAccAWSVpnGateway_reattach(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckVpnGatewayDestroy, @@ -316,6 +322,7 @@ func TestAccAWSVpnGateway_delete(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckVpnGatewayDestroy, @@ -344,6 +351,7 @@ func TestAccAWSVpnGateway_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, ec2.EndpointsID), IDRefreshName: resourceName, Providers: testAccProviders, CheckDestroy: testAccCheckVpnGatewayDestroy, diff --git a/aws/resource_aws_waf_byte_match_set_test.go b/aws/resource_aws_waf_byte_match_set_test.go index 917c33adbc4c..d68ceaa84180 100644 --- a/aws/resource_aws_waf_byte_match_set_test.go +++ b/aws/resource_aws_waf_byte_match_set_test.go @@ -97,6 +97,7 @@ func TestAccAWSWafByteMatchSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafByteMatchSetDestroy, Steps: []resource.TestStep{ @@ -141,6 +142,7 @@ func TestAccAWSWafByteMatchSet_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafByteMatchSetDestroy, Steps: []resource.TestStep{ @@ -176,6 +178,7 @@ func TestAccAWSWafByteMatchSet_changeTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafByteMatchSetDestroy, Steps: []resource.TestStep{ @@ -243,6 +246,7 @@ func TestAccAWSWafByteMatchSet_noTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafByteMatchSetDestroy, Steps: []resource.TestStep{ @@ -270,6 +274,7 @@ func TestAccAWSWafByteMatchSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafByteMatchSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_waf_geo_match_set_test.go b/aws/resource_aws_waf_geo_match_set_test.go index 2dd04ba452e7..2646dafc1621 100644 --- a/aws/resource_aws_waf_geo_match_set_test.go +++ b/aws/resource_aws_waf_geo_match_set_test.go @@ -97,6 +97,7 @@ func TestAccAWSWafGeoMatchSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafGeoMatchSetDestroy, Steps: []resource.TestStep{ @@ -134,6 +135,7 @@ func TestAccAWSWafGeoMatchSet_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafGeoMatchSetDestroy, Steps: []resource.TestStep{ @@ -169,6 +171,7 @@ func TestAccAWSWafGeoMatchSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafGeoMatchSetDestroy, Steps: []resource.TestStep{ @@ -191,6 +194,7 @@ func TestAccAWSWafGeoMatchSet_changeConstraints(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafGeoMatchSetDestroy, Steps: []resource.TestStep{ @@ -242,6 +246,7 @@ func TestAccAWSWafGeoMatchSet_noConstraints(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafGeoMatchSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_waf_ipset_test.go b/aws/resource_aws_waf_ipset_test.go index a64d03a442f7..2adb16a2bccd 100644 --- a/aws/resource_aws_waf_ipset_test.go +++ b/aws/resource_aws_waf_ipset_test.go @@ -100,6 +100,7 @@ func TestAccAWSWafIPSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafIPSetDestroy, Steps: []resource.TestStep{ @@ -131,6 +132,7 @@ func TestAccAWSWafIPSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafIPSetDestroy, Steps: []resource.TestStep{ @@ -154,6 +156,7 @@ func TestAccAWSWafIPSet_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafIPSetDestroy, Steps: []resource.TestStep{ @@ -195,6 +198,7 @@ func TestAccAWSWafIPSet_changeDescriptors(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafIPSetDestroy, Steps: []resource.TestStep{ @@ -238,6 +242,7 @@ func TestAccAWSWafIPSet_noDescriptors(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafIPSetDestroy, Steps: []resource.TestStep{ @@ -284,6 +289,7 @@ func TestAccAWSWafIPSet_IpSetDescriptors_1000UpdateLimit(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafIPSetDestroy, Steps: []resource.TestStep{ @@ -415,6 +421,7 @@ func TestAccAWSWafIPSet_ipv6(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafIPSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_waf_rate_based_rule_test.go b/aws/resource_aws_waf_rate_based_rule_test.go index 281f47005c5b..049831b9478b 100644 --- a/aws/resource_aws_waf_rate_based_rule_test.go +++ b/aws/resource_aws_waf_rate_based_rule_test.go @@ -97,6 +97,7 @@ func TestAccAWSWafRateBasedRule_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRateBasedRuleDestroy, Steps: []resource.TestStep{ @@ -127,6 +128,7 @@ func TestAccAWSWafRateBasedRule_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafIPSetDestroy, Steps: []resource.TestStep{ @@ -164,6 +166,7 @@ func TestAccAWSWafRateBasedRule_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRateBasedRuleDestroy, Steps: []resource.TestStep{ @@ -189,6 +192,7 @@ func TestAccAWSWafRateBasedRule_changePredicates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleDestroy, Steps: []resource.TestStep{ @@ -236,6 +240,7 @@ func TestAccAWSWafRateBasedRule_changeRateLimit(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleDestroy, Steps: []resource.TestStep{ @@ -283,6 +288,7 @@ func TestAccAWSWafRateBasedRule_noPredicates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRateBasedRuleDestroy, Steps: []resource.TestStep{ @@ -310,6 +316,7 @@ func TestAccAWSWafRateBasedRule_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRateBasedRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_waf_regex_match_set_test.go b/aws/resource_aws_waf_regex_match_set_test.go index 4da2710a3e8e..22c813c75a29 100644 --- a/aws/resource_aws_waf_regex_match_set_test.go +++ b/aws/resource_aws_waf_regex_match_set_test.go @@ -124,6 +124,7 @@ func testAccAWSWafRegexMatchSet_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegexMatchSetDestroy, Steps: []resource.TestStep{ @@ -164,6 +165,7 @@ func testAccAWSWafRegexMatchSet_changePatterns(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegexMatchSetDestroy, Steps: []resource.TestStep{ @@ -215,6 +217,7 @@ func testAccAWSWafRegexMatchSet_noPatterns(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegexMatchSetDestroy, Steps: []resource.TestStep{ @@ -243,6 +246,7 @@ func testAccAWSWafRegexMatchSet_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegexMatchSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_waf_regex_pattern_set_test.go b/aws/resource_aws_waf_regex_pattern_set_test.go index a04061fa0c10..cf60a8407edc 100644 --- a/aws/resource_aws_waf_regex_pattern_set_test.go +++ b/aws/resource_aws_waf_regex_pattern_set_test.go @@ -115,6 +115,7 @@ func testAccAWSWafRegexPatternSet_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegexPatternSetDestroy, Steps: []resource.TestStep{ @@ -145,6 +146,7 @@ func testAccAWSWafRegexPatternSet_changePatterns(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegexPatternSetDestroy, Steps: []resource.TestStep{ @@ -185,6 +187,7 @@ func testAccAWSWafRegexPatternSet_noPatterns(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegexPatternSetDestroy, Steps: []resource.TestStep{ @@ -212,6 +215,7 @@ func testAccAWSWafRegexPatternSet_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegexPatternSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_waf_rule.go b/aws/resource_aws_waf_rule.go index 7802bf0e00ed..964cbb945c25 100644 --- a/aws/resource_aws_waf_rule.go +++ b/aws/resource_aws_waf_rule.go @@ -3,14 +3,22 @@ package aws import ( "fmt" "log" + "regexp" + "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" - "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/waf" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/tfresource" +) + +const ( + WafRuleDeleteTimeout = 5 * time.Minute ) func resourceAwsWafRule() *schema.Resource { @@ -33,7 +41,7 @@ func resourceAwsWafRule() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validateWafMetricName, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[0-9A-Za-z]+$`), "must contain only alphanumeric characters"), }, "predicates": { Type: schema.TypeSet, @@ -52,7 +60,7 @@ func resourceAwsWafRule() *schema.Resource { "type": { Type: schema.TypeString, Required: true, - ValidateFunc: validateWafPredicatesType(), + ValidateFunc: validation.StringInSlice(waf.PredicateType_Values(), false), }, }, }, @@ -84,9 +92,11 @@ func resourceAwsWafRuleCreate(d *schema.ResourceData, meta interface{}) error { return conn.CreateRule(params) }) + if err != nil { - return err + return fmt.Errorf("error creating WAF Rule (%s): %w", d.Get("name").(string), err) } + resp := out.(*waf.CreateRuleOutput) d.SetId(aws.StringValue(resp.Rule.RuleId)) @@ -95,7 +105,7 @@ func resourceAwsWafRuleCreate(d *schema.ResourceData, meta interface{}) error { noPredicates := []interface{}{} err := updateWafRuleResource(d.Id(), noPredicates, newPredicates, conn) if err != nil { - return fmt.Errorf("Error Updating WAF Rule: %s", err) + return fmt.Errorf("error updating WAF Rule (%s): %w", d.Id(), err) } } @@ -111,14 +121,24 @@ func resourceAwsWafRuleRead(d *schema.ResourceData, meta interface{}) error { } resp, err := conn.GetRule(params) + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, waf.ErrCodeNonexistentItemException) { + log.Printf("[WARN] WAF Rule (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } + if err != nil { - if awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == waf.ErrCodeNonexistentItemException { - log.Printf("[WARN] WAF Rule (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil + return fmt.Errorf("error reading WAF Rule (%s): %w", d.Id(), err) + } + + if resp == nil || resp.Rule == nil { + if d.IsNewResource() { + return fmt.Errorf("error reading WAF Rule (%s): not found", d.Id()) } - return err + log.Printf("[WARN] WAF Rule (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil } var predicates []map[string]interface{} @@ -143,11 +163,11 @@ func resourceAwsWafRuleRead(d *schema.ResourceData, meta interface{}) error { tags, err := keyvaluetags.WafListTags(conn, arn) if err != nil { - return fmt.Errorf("error listing tags for WAF Rule (%s): %s", arn, err) + return fmt.Errorf("error listing tags for WAF Rule (%s): %w", arn, err) } if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + return fmt.Errorf("error setting tags: %w", err) } d.Set("predicates", predicates) @@ -166,7 +186,7 @@ func resourceAwsWafRuleUpdate(d *schema.ResourceData, meta interface{}) error { err := updateWafRuleResource(d.Id(), oldP, newP, conn) if err != nil { - return fmt.Errorf("Error Updating WAF Rule: %s", err) + return fmt.Errorf("error updating WAF Rule (%s): %w", d.Id(), err) } } @@ -174,7 +194,7 @@ func resourceAwsWafRuleUpdate(d *schema.ResourceData, meta interface{}) error { o, n := d.GetChange("tags") if err := keyvaluetags.WafUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { - return fmt.Errorf("error updating tags: %s", err) + return fmt.Errorf("error updating WAF Rule (%s) tags: %w", d.Id(), err) } } @@ -189,21 +209,48 @@ func resourceAwsWafRuleDelete(d *schema.ResourceData, meta interface{}) error { noPredicates := []interface{}{} err := updateWafRuleResource(d.Id(), oldPredicates, noPredicates, conn) if err != nil { - return fmt.Errorf("Error updating WAF Rule Predicates: %s", err) + return fmt.Errorf("error updating WAF Rule (%s) predicates: %w", d.Id(), err) } } wr := newWafRetryer(conn) - _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { - req := &waf.DeleteRuleInput{ - ChangeToken: token, - RuleId: aws.String(d.Id()), + err := resource.Retry(WafRuleDeleteTimeout, func() *resource.RetryError { + var err error + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.DeleteRuleInput{ + ChangeToken: token, + RuleId: aws.String(d.Id()), + } + + return conn.DeleteRule(req) + }) + + if err != nil { + if tfawserr.ErrCodeEquals(err, waf.ErrCodeReferencedItemException) { + return resource.RetryableError(err) + } + return resource.NonRetryableError(err) } - log.Printf("[INFO] Deleting WAF Rule") - return conn.DeleteRule(req) + + return nil }) + + if tfresource.TimedOut(err) { + _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { + req := &waf.DeleteRuleInput{ + ChangeToken: token, + RuleId: aws.String(d.Id()), + } + + return conn.DeleteRule(req) + }) + } + if err != nil { - return fmt.Errorf("Error deleting WAF Rule: %s", err) + if tfawserr.ErrCodeEquals(err, waf.ErrCodeNonexistentItemException) { + return nil + } + return fmt.Errorf("error deleting WAF Rule (%s): %w", d.Id(), err) } return nil @@ -220,9 +267,6 @@ func updateWafRuleResource(id string, oldP, newP []interface{}, conn *waf.WAF) e return conn.UpdateRule(req) }) - if err != nil { - return fmt.Errorf("Error Updating WAF Rule: %s", err) - } - return nil + return err } diff --git a/aws/resource_aws_waf_rule_group_test.go b/aws/resource_aws_waf_rule_group_test.go index 16452fd813ad..3e76773659d4 100644 --- a/aws/resource_aws_waf_rule_group_test.go +++ b/aws/resource_aws_waf_rule_group_test.go @@ -100,6 +100,7 @@ func TestAccAWSWafRuleGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleGroupDestroy, Steps: []resource.TestStep{ @@ -139,6 +140,7 @@ func TestAccAWSWafRuleGroup_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleGroupDestroy, Steps: []resource.TestStep{ @@ -177,6 +179,7 @@ func TestAccAWSWafRuleGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleGroupDestroy, Steps: []resource.TestStep{ @@ -205,6 +208,7 @@ func TestAccAWSWafRuleGroup_changeActivatedRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleGroupDestroy, Steps: []resource.TestStep{ @@ -295,6 +299,7 @@ func TestAccAWSWafRuleGroup_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafWebAclDestroy, Steps: []resource.TestStep{ @@ -345,6 +350,7 @@ func TestAccAWSWafRuleGroup_noActivatedRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_waf_rule_test.go b/aws/resource_aws_waf_rule_test.go index 167192237d3c..2e31b4412777 100644 --- a/aws/resource_aws_waf_rule_test.go +++ b/aws/resource_aws_waf_rule_test.go @@ -7,12 +7,11 @@ import ( "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/waf" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/waf/lister" ) @@ -45,6 +44,10 @@ func testSweepWafRules(region string) error { } for _, rule := range page.Rules { + if rule == nil { + continue + } + id := aws.StringValue(rule.RuleId) r := resourceAwsWafRule() @@ -97,6 +100,7 @@ func TestAccAWSWafRule_basic(t *testing.T) { resourceName := "aws_waf_rule.wafrule" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleDestroy, Steps: []resource.TestStep{ @@ -127,6 +131,7 @@ func TestAccAWSWafRule_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafIPSetDestroy, Steps: []resource.TestStep{ @@ -159,6 +164,7 @@ func TestAccAWSWafRule_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleDestroy, Steps: []resource.TestStep{ @@ -166,7 +172,7 @@ func TestAccAWSWafRule_disappears(t *testing.T) { Config: testAccAWSWafRuleConfig(wafRuleName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSWafRuleExists(resourceName, &v), - testAccCheckAWSWafRuleDisappears(&v), + testAccCheckResourceDisappears(testAccProvider, resourceAwsWafRule(), resourceName), ), ExpectNonEmptyPlan: true, }, @@ -179,12 +185,12 @@ func TestAccAWSWafRule_changePredicates(t *testing.T) { var byteMatchSet waf.ByteMatchSet var before, after waf.Rule - var idx int ruleName := fmt.Sprintf("wafrule%s", acctest.RandString(5)) resourceName := "aws_waf_rule.wafrule" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleDestroy, Steps: []resource.TestStep{ @@ -195,7 +201,6 @@ func TestAccAWSWafRule_changePredicates(t *testing.T) { testAccCheckAWSWafRuleExists(resourceName, &before), resource.TestCheckResourceAttr(resourceName, "name", ruleName), resource.TestCheckResourceAttr(resourceName, "predicates.#", "1"), - computeWafRulePredicateWithIpSet(&ipset, false, "IPMatch", &idx), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "predicates.*", map[string]string{ "negated": "false", "type": "IPMatch", @@ -209,7 +214,6 @@ func TestAccAWSWafRule_changePredicates(t *testing.T) { testAccCheckAWSWafRuleExists(resourceName, &after), resource.TestCheckResourceAttr(resourceName, "name", ruleName), resource.TestCheckResourceAttr(resourceName, "predicates.#", "1"), - computeWafRulePredicateWithByteMatchSet(&byteMatchSet, true, "ByteMatch", &idx), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "predicates.*", map[string]string{ "negated": "true", "type": "ByteMatch", @@ -224,12 +228,12 @@ func TestAccAWSWafRule_geoMatchSetPredicate(t *testing.T) { var geoMatchSet waf.GeoMatchSet var v waf.Rule - var idx int ruleName := fmt.Sprintf("wafrule%s", acctest.RandString(5)) resourceName := "aws_waf_rule.wafrule" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleDestroy, Steps: []resource.TestStep{ @@ -240,7 +244,6 @@ func TestAccAWSWafRule_geoMatchSetPredicate(t *testing.T) { testAccCheckAWSWafRuleExists(resourceName, &v), resource.TestCheckResourceAttr(resourceName, "name", ruleName), resource.TestCheckResourceAttr(resourceName, "predicates.#", "1"), - computeWafRulePredicateWithGeoMatchSet(&geoMatchSet, true, "GeoMatch", &idx), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "predicates.*", map[string]string{ "negated": "true", "type": "GeoMatch", @@ -251,61 +254,30 @@ func TestAccAWSWafRule_geoMatchSetPredicate(t *testing.T) { }) } -// computeWafRulePredicateWithIpSet calculates index -// which isn't static because dataId is generated as part of the test -func computeWafRulePredicateWithIpSet(ipSet *waf.IPSet, negated bool, pType string, idx *int) resource.TestCheckFunc { - return func(s *terraform.State) error { - predicateResource := resourceAwsWafRule().Schema["predicates"].Elem.(*schema.Resource) - - m := map[string]interface{}{ - "data_id": *ipSet.IPSetId, - "negated": negated, - "type": pType, - } - - f := schema.HashResource(predicateResource) - *idx = f(m) - - return nil - } -} - -// computeWafRulePredicateWithByteMatchSet calculates index -// which isn't static because dataId is generated as part of the test -func computeWafRulePredicateWithByteMatchSet(set *waf.ByteMatchSet, negated bool, pType string, idx *int) resource.TestCheckFunc { - return func(s *terraform.State) error { - predicateResource := resourceAwsWafRule().Schema["predicates"].Elem.(*schema.Resource) - - m := map[string]interface{}{ - "data_id": *set.ByteMatchSetId, - "negated": negated, - "type": pType, - } - - f := schema.HashResource(predicateResource) - *idx = f(m) - - return nil - } -} - -// computeWafRulePredicateWithGeoMatchSet calculates index -// which isn't static because dataId is generated as part of the test -func computeWafRulePredicateWithGeoMatchSet(set *waf.GeoMatchSet, negated bool, pType string, idx *int) resource.TestCheckFunc { - return func(s *terraform.State) error { - predicateResource := resourceAwsWafRule().Schema["predicates"].Elem.(*schema.Resource) - - m := map[string]interface{}{ - "data_id": *set.GeoMatchSetId, - "negated": negated, - "type": pType, - } - - f := schema.HashResource(predicateResource) - *idx = f(m) +// TestAccAWSWafRule_webACL validates the resource's +// retry behavior when removed from a WebACL +func TestAccAWSWafRule_webACL(t *testing.T) { + var rule waf.Rule + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_waf_rule.test" - return nil - } + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSWafRuleDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAWSWafRuleConfig_referencedByWebACL(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAWSWafRuleExists(resourceName, &rule), + ), + }, + { + Config: testAccAWSWafWebAclConfig_noRules(rName), + }, + }, + }) } func TestAccAWSWafRule_noPredicates(t *testing.T) { @@ -315,6 +287,7 @@ func TestAccAWSWafRule_noPredicates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleDestroy, Steps: []resource.TestStep{ @@ -337,6 +310,7 @@ func TestAccAWSWafRule_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafWebAclDestroy, Steps: []resource.TestStep{ @@ -383,49 +357,6 @@ func TestAccAWSWafRule_Tags(t *testing.T) { }) } -func testAccCheckAWSWafRuleDisappears(v *waf.Rule) resource.TestCheckFunc { - return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).wafconn - - wr := newWafRetryer(conn) - _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { - req := &waf.UpdateRuleInput{ - ChangeToken: token, - RuleId: v.RuleId, - } - - for _, Predicate := range v.Predicates { - Predicate := &waf.RuleUpdate{ - Action: aws.String("DELETE"), - Predicate: &waf.Predicate{ - Negated: Predicate.Negated, - Type: Predicate.Type, - DataId: Predicate.DataId, - }, - } - req.Updates = append(req.Updates, Predicate) - } - - return conn.UpdateRule(req) - }) - if err != nil { - return fmt.Errorf("Error Updating WAF Rule: %s", err) - } - - _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { - opts := &waf.DeleteRuleInput{ - ChangeToken: token, - RuleId: v.RuleId, - } - return conn.DeleteRule(opts) - }) - if err != nil { - return fmt.Errorf("Error Deleting WAF Rule: %s", err) - } - return nil - } -} - func testAccCheckAWSWafRuleDestroy(s *terraform.State) error { for _, rs := range s.RootModule().Resources { if rs.Type != "aws_waf_rule" { @@ -438,20 +369,17 @@ func testAccCheckAWSWafRuleDestroy(s *terraform.State) error { RuleId: aws.String(rs.Primary.ID), }) - if err == nil { - if *resp.Rule.RuleId == rs.Primary.ID { - return fmt.Errorf("WAF Rule %s still exists", rs.Primary.ID) - } + if tfawserr.ErrCodeEquals(err, waf.ErrCodeNonexistentItemException) { + continue } - // Return nil if the Rule is already destroyed - if awsErr, ok := err.(awserr.Error); ok { - if awsErr.Code() == waf.ErrCodeNonexistentItemException { - return nil - } + if err != nil { + return fmt.Errorf("error reading WAF Rule (%s): %w", rs.Primary.ID, err) } - return err + if resp != nil && resp.Rule != nil { + return fmt.Errorf("WAF Rule (%s) still exists", rs.Primary.ID) + } } return nil @@ -505,7 +433,7 @@ func testAccPreCheckAWSWaf(t *testing.T) { func testAccAWSWafRuleConfig(name string) string { return fmt.Sprintf(` resource "aws_waf_ipset" "ipset" { - name = "%s" + name = %[1]q ip_set_descriptors { type = "IPV4" @@ -515,8 +443,8 @@ resource "aws_waf_ipset" "ipset" { resource "aws_waf_rule" "wafrule" { depends_on = [aws_waf_ipset.ipset] - name = "%s" - metric_name = "%s" + name = %[1]q + metric_name = %[1]q predicates { data_id = aws_waf_ipset.ipset.id @@ -524,13 +452,13 @@ resource "aws_waf_rule" "wafrule" { type = "IPMatch" } } -`, name, name, name) +`, name) } func testAccAWSWafRuleConfigChangeName(name string) string { return fmt.Sprintf(` resource "aws_waf_ipset" "ipset" { - name = "%s" + name = %[1]q ip_set_descriptors { type = "IPV4" @@ -540,8 +468,8 @@ resource "aws_waf_ipset" "ipset" { resource "aws_waf_rule" "wafrule" { depends_on = [aws_waf_ipset.ipset] - name = "%s" - metric_name = "%s" + name = %[1]q + metric_name = %[1]q predicates { data_id = aws_waf_ipset.ipset.id @@ -549,13 +477,13 @@ resource "aws_waf_rule" "wafrule" { type = "IPMatch" } } -`, name, name, name) +`, name) } func testAccAWSWafRuleConfig_changePredicates(name string) string { return fmt.Sprintf(` resource "aws_waf_ipset" "ipset" { - name = "%s" + name = %[1]q ip_set_descriptors { type = "IPV4" @@ -564,7 +492,7 @@ resource "aws_waf_ipset" "ipset" { } resource "aws_waf_byte_match_set" "set" { - name = "%s" + name = %[1]q byte_match_tuples { text_transformation = "NONE" @@ -579,8 +507,8 @@ resource "aws_waf_byte_match_set" "set" { } resource "aws_waf_rule" "wafrule" { - name = "%s" - metric_name = "%s" + name = %[1]q + metric_name = %[1]q predicates { data_id = aws_waf_byte_match_set.set.id @@ -588,22 +516,22 @@ resource "aws_waf_rule" "wafrule" { type = "ByteMatch" } } -`, name, name, name, name) +`, name) } func testAccAWSWafRuleConfig_noPredicates(name string) string { return fmt.Sprintf(` resource "aws_waf_rule" "wafrule" { - name = "%s" - metric_name = "%s" + name = %[1]q + metric_name = %[1]q } -`, name, name) +`, name) } func testAccAWSWafRuleConfig_geoMatchSetPredicate(name string) string { return fmt.Sprintf(` resource "aws_waf_geo_match_set" "geo_match_set" { - name = "%s" + name = %[1]q geo_match_constraint { type = "Country" @@ -612,8 +540,8 @@ resource "aws_waf_geo_match_set" "geo_match_set" { } resource "aws_waf_rule" "wafrule" { - name = "%s" - metric_name = "%s" + name = %[1]q + metric_name = %[1]q predicates { data_id = aws_waf_geo_match_set.geo_match_set.id @@ -621,13 +549,13 @@ resource "aws_waf_rule" "wafrule" { type = "GeoMatch" } } -`, name, name, name) +`, name) } func testAccAWSWafRuleConfigTags1(rName, tag1Key, tag1Value string) string { return fmt.Sprintf(` resource "aws_waf_ipset" "ipset" { - name = "%s" + name = %[1]q ip_set_descriptors { type = "IPV4" @@ -637,8 +565,8 @@ resource "aws_waf_ipset" "ipset" { resource "aws_waf_rule" "wafrule" { depends_on = [aws_waf_ipset.ipset] - name = "%s" - metric_name = "%s" + name = %[1]q + metric_name = %[1]q predicates { data_id = aws_waf_ipset.ipset.id @@ -650,13 +578,13 @@ resource "aws_waf_rule" "wafrule" { %q = %q } } -`, rName, rName, rName, tag1Key, tag1Value) +`, rName, tag1Key, tag1Value) } func testAccAWSWafRuleConfigTags2(rName, tag1Key, tag1Value, tag2Key, tag2Value string) string { return fmt.Sprintf(` resource "aws_waf_ipset" "ipset" { - name = "%s" + name = %[1]q ip_set_descriptors { type = "IPV4" @@ -666,8 +594,8 @@ resource "aws_waf_ipset" "ipset" { resource "aws_waf_rule" "wafrule" { depends_on = [aws_waf_ipset.ipset] - name = "%s" - metric_name = "%s" + name = %[1]q + metric_name = %[1]q predicates { data_id = aws_waf_ipset.ipset.id @@ -680,5 +608,60 @@ resource "aws_waf_rule" "wafrule" { %q = %q } } -`, rName, rName, rName, tag1Key, tag1Value, tag2Key, tag2Value) +`, rName, tag1Key, tag1Value, tag2Key, tag2Value) +} + +func testAccAWSWafRuleConfig_referencedByWebACL(rName string) string { + return fmt.Sprintf(` +resource "aws_waf_ipset" "test" { + name = %[1]q + + ip_set_descriptors { + type = "IPV4" + value = "192.0.7.0/24" + } +} + +resource "aws_waf_rule" "test" { + metric_name = "testrulemetric" + name = %[1]q + + predicates { + data_id = aws_waf_ipset.test.id + negated = false + type = "IPMatch" + } +} + +resource "aws_waf_web_acl" "test" { + metric_name = "testwebaclmetric" + name = %[1]q + + default_action { + type = "ALLOW" + } + + rules { + priority = 1 + rule_id = aws_waf_rule.test.id + + action { + type = "BLOCK" + } + } +} +`, rName) +} + +func testAccAWSWafWebAclConfig_noRules(rName string) string { + return fmt.Sprintf(` +resource "aws_waf_web_acl" "test" { + metric_name = "testwebaclmetric" + name = %[1]q + + default_action { + type = "ALLOW" + } +} +`, rName) } diff --git a/aws/resource_aws_waf_size_constraint_set_test.go b/aws/resource_aws_waf_size_constraint_set_test.go index 7938aeffc165..b577de19ad69 100644 --- a/aws/resource_aws_waf_size_constraint_set_test.go +++ b/aws/resource_aws_waf_size_constraint_set_test.go @@ -98,6 +98,7 @@ func TestAccAWSWafSizeConstraintSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafSizeConstraintSetDestroy, Steps: []resource.TestStep{ @@ -137,6 +138,7 @@ func TestAccAWSWafSizeConstraintSet_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafSizeConstraintSetDestroy, Steps: []resource.TestStep{ @@ -172,6 +174,7 @@ func TestAccAWSWafSizeConstraintSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafSizeConstraintSetDestroy, Steps: []resource.TestStep{ @@ -194,6 +197,7 @@ func TestAccAWSWafSizeConstraintSet_changeConstraints(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafSizeConstraintSetDestroy, Steps: []resource.TestStep{ @@ -249,6 +253,7 @@ func TestAccAWSWafSizeConstraintSet_noConstraints(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafSizeConstraintSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_waf_sql_injection_match_set.go b/aws/resource_aws_waf_sql_injection_match_set.go index 249d3781447a..3322fbf62856 100644 --- a/aws/resource_aws_waf_sql_injection_match_set.go +++ b/aws/resource_aws_waf_sql_injection_match_set.go @@ -176,7 +176,7 @@ func flattenWafSqlInjectionMatchTuples(ts []*waf.SqlInjectionMatchTuple) []inter out := make([]interface{}, len(ts)) for i, t := range ts { m := make(map[string]interface{}) - m["text_transformation"] = *t.TextTransformation + m["text_transformation"] = aws.StringValue(t.TextTransformation) m["field_to_match"] = flattenFieldToMatch(t.FieldToMatch) out[i] = m } diff --git a/aws/resource_aws_waf_sql_injection_match_set_test.go b/aws/resource_aws_waf_sql_injection_match_set_test.go index 764815d422a9..9b007fe13849 100644 --- a/aws/resource_aws_waf_sql_injection_match_set_test.go +++ b/aws/resource_aws_waf_sql_injection_match_set_test.go @@ -96,6 +96,7 @@ func TestAccAWSWafSqlInjectionMatchSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafSqlInjectionMatchSetDestroy, Steps: []resource.TestStep{ @@ -130,6 +131,7 @@ func TestAccAWSWafSqlInjectionMatchSet_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafSqlInjectionMatchSetDestroy, Steps: []resource.TestStep{ @@ -165,6 +167,7 @@ func TestAccAWSWafSqlInjectionMatchSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafSqlInjectionMatchSetDestroy, Steps: []resource.TestStep{ @@ -187,6 +190,7 @@ func TestAccAWSWafSqlInjectionMatchSet_changeTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafSqlInjectionMatchSetDestroy, Steps: []resource.TestStep{ @@ -228,6 +232,7 @@ func TestAccAWSWafSqlInjectionMatchSet_noTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafSqlInjectionMatchSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_waf_web_acl.go b/aws/resource_aws_waf_web_acl.go index e9e46f02fa38..7295cfb26f8f 100644 --- a/aws/resource_aws_waf_web_acl.go +++ b/aws/resource_aws_waf_web_acl.go @@ -3,10 +3,12 @@ package aws import ( "fmt" "log" + "regexp" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/service/waf" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" @@ -49,7 +51,7 @@ func resourceAwsWafWebAcl() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validateWafMetricName, + ValidateFunc: validation.StringMatch(regexp.MustCompile(`^[0-9A-Za-z]+$`), "must contain only alphanumeric characters"), }, "logging_configuration": { Type: schema.TypeList, @@ -125,14 +127,10 @@ func resourceAwsWafWebAcl() *schema.Resource { Required: true, }, "type": { - Type: schema.TypeString, - Optional: true, - Default: waf.WafRuleTypeRegular, - ValidateFunc: validation.StringInSlice([]string{ - waf.WafRuleTypeRegular, - waf.WafRuleTypeRateBased, - waf.WafRuleTypeGroup, - }, false), + Type: schema.TypeString, + Optional: true, + Default: waf.WafRuleTypeRegular, + ValidateFunc: validation.StringInSlice(waf.WafRuleType_Values(), false), }, "rule_id": { Type: schema.TypeString, @@ -165,9 +163,11 @@ func resourceAwsWafWebAclCreate(d *schema.ResourceData, meta interface{}) error return conn.CreateWebACL(params) }) + if err != nil { - return err + return fmt.Errorf("error creating WAF Web ACL (%s): %w", d.Get("name").(string), err) } + resp := out.(*waf.CreateWebACLOutput) d.SetId(aws.StringValue(resp.WebACL.WebACLId)) @@ -184,9 +184,8 @@ func resourceAwsWafWebAclCreate(d *schema.ResourceData, meta interface{}) error LoggingConfiguration: expandWAFLoggingConfiguration(loggingConfiguration, arn), } - log.Printf("[DEBUG] Updating WAF Web ACL (%s) Logging Configuration: %s", d.Id(), input) if _, err := conn.PutLoggingConfiguration(input); err != nil { - return fmt.Errorf("error updating WAF Web ACL (%s) Logging Configuration: %s", d.Id(), err) + return fmt.Errorf("error putting WAF Web ACL (%s) Logging Configuration: %w", d.Id(), err) } } @@ -202,8 +201,9 @@ func resourceAwsWafWebAclCreate(d *schema.ResourceData, meta interface{}) error } return conn.UpdateWebACL(req) }) + if err != nil { - return fmt.Errorf("Error Updating WAF ACL: %s", err) + return fmt.Errorf("error updating WAF Web ACL (%s): %w", d.Id(), err) } } @@ -219,53 +219,56 @@ func resourceAwsWafWebAclRead(d *schema.ResourceData, meta interface{}) error { } resp, err := conn.GetWebACL(params) - if err != nil { - if isAWSErr(err, waf.ErrCodeNonexistentItemException, "") { - log.Printf("[WARN] WAF ACL (%s) not found, removing from state", d.Id()) - d.SetId("") - return nil - } + if !d.IsNewResource() && tfawserr.ErrCodeEquals(err, waf.ErrCodeNonexistentItemException) { + log.Printf("[WARN] WAF Web ACL (%s) not found, removing from state", d.Id()) + d.SetId("") + return nil + } - return err + if err != nil { + return fmt.Errorf("error reading WAF Web ACL (%s): %w", d.Id(), err) } if resp == nil || resp.WebACL == nil { - log.Printf("[WARN] WAF ACL (%s) not found, removing from state", d.Id()) + if d.IsNewResource() { + return fmt.Errorf("error reading WAF Web ACL (%s): not found", d.Id()) + } + + log.Printf("[WARN] WAF Web ACL (%s) not found, removing from state", d.Id()) d.SetId("") return nil } d.Set("arn", resp.WebACL.WebACLArn) - arn := *resp.WebACL.WebACLArn + arn := aws.StringValue(resp.WebACL.WebACLArn) if err := d.Set("default_action", flattenWafAction(resp.WebACL.DefaultAction)); err != nil { - return fmt.Errorf("error setting default_action: %s", err) + return fmt.Errorf("error setting default_action: %w", err) } d.Set("name", resp.WebACL.Name) d.Set("metric_name", resp.WebACL.MetricName) tags, err := keyvaluetags.WafListTags(conn, arn) if err != nil { - return fmt.Errorf("error listing tags for WAF ACL (%s): %s", arn, err) + return fmt.Errorf("error listing tags for WAF Web ACL (%s): %w", arn, err) } if err := d.Set("tags", tags.IgnoreAws().IgnoreConfig(ignoreTagsConfig).Map()); err != nil { - return fmt.Errorf("error setting tags: %s", err) + return fmt.Errorf("error setting tags: %w", err) } if err := d.Set("rules", flattenWafWebAclRules(resp.WebACL.Rules)); err != nil { - return fmt.Errorf("error setting rules: %s", err) + return fmt.Errorf("error setting rules: %w", err) } getLoggingConfigurationInput := &waf.GetLoggingConfigurationInput{ - ResourceArn: aws.String(d.Get("arn").(string)), + ResourceArn: aws.String(arn), } loggingConfiguration := []interface{}{} - log.Printf("[DEBUG] Getting WAF Web ACL (%s) Logging Configuration: %s", d.Id(), getLoggingConfigurationInput) getLoggingConfigurationOutput, err := conn.GetLoggingConfiguration(getLoggingConfigurationInput) - if err != nil && !isAWSErr(err, waf.ErrCodeNonexistentItemException, "") { - return fmt.Errorf("error getting WAF Web ACL (%s) Logging Configuration: %s", d.Id(), err) + if err != nil && !tfawserr.ErrCodeEquals(err, waf.ErrCodeNonexistentItemException) { + return fmt.Errorf("error reading WAF Web ACL (%s) Logging Configuration: %w", d.Id(), err) } if getLoggingConfigurationOutput != nil { @@ -273,7 +276,7 @@ func resourceAwsWafWebAclRead(d *schema.ResourceData, meta interface{}) error { } if err := d.Set("logging_configuration", loggingConfiguration); err != nil { - return fmt.Errorf("error setting logging_configuration: %s", err) + return fmt.Errorf("error setting logging_configuration: %w", err) } return nil @@ -297,7 +300,7 @@ func resourceAwsWafWebAclUpdate(d *schema.ResourceData, meta interface{}) error return conn.UpdateWebACL(req) }) if err != nil { - return fmt.Errorf("Error Updating WAF ACL: %s", err) + return fmt.Errorf("error updating WAF Web ACL (%s): %w", d.Id(), err) } } @@ -309,18 +312,16 @@ func resourceAwsWafWebAclUpdate(d *schema.ResourceData, meta interface{}) error LoggingConfiguration: expandWAFLoggingConfiguration(loggingConfiguration, d.Get("arn").(string)), } - log.Printf("[DEBUG] Updating WAF Web ACL (%s) Logging Configuration: %s", d.Id(), input) if _, err := conn.PutLoggingConfiguration(input); err != nil { - return fmt.Errorf("error updating WAF Web ACL (%s) Logging Configuration: %s", d.Id(), err) + return fmt.Errorf("error updating WAF Web ACL (%s) Logging Configuration: %w", d.Id(), err) } } else { input := &waf.DeleteLoggingConfigurationInput{ ResourceArn: aws.String(d.Get("arn").(string)), } - log.Printf("[DEBUG] Deleting WAF Web ACL (%s) Logging Configuration: %s", d.Id(), input) if _, err := conn.DeleteLoggingConfiguration(input); err != nil { - return fmt.Errorf("error deleting WAF Web ACL (%s) Logging Configuration: %s", d.Id(), err) + return fmt.Errorf("error deleting WAF Web ACL (%s) Logging Configuration: %w", d.Id(), err) } } @@ -330,7 +331,7 @@ func resourceAwsWafWebAclUpdate(d *schema.ResourceData, meta interface{}) error o, n := d.GetChange("tags") if err := keyvaluetags.WafUpdateTags(conn, d.Get("arn").(string), o, n); err != nil { - return fmt.Errorf("error updating tags: %s", err) + return fmt.Errorf("error updating WAF Web ACL (%s) tags: %w", d.Id(), err) } } @@ -354,7 +355,7 @@ func resourceAwsWafWebAclDelete(d *schema.ResourceData, meta interface{}) error return conn.UpdateWebACL(req) }) if err != nil { - return fmt.Errorf("Error Removing WAF Regional ACL Rules: %s", err) + return fmt.Errorf("error removing WAF Web ACL (%s) rules: %w", d.Id(), err) } } @@ -365,12 +366,16 @@ func resourceAwsWafWebAclDelete(d *schema.ResourceData, meta interface{}) error WebACLId: aws.String(d.Id()), } - log.Printf("[INFO] Deleting WAF ACL") return conn.DeleteWebACL(req) }) + if err != nil { - return fmt.Errorf("Error Deleting WAF ACL: %s", err) + if tfawserr.ErrCodeEquals(err, waf.ErrCodeNonexistentItemException) { + return nil + } + return fmt.Errorf("error deleting WAF Web ACL (%s): %w", d.Id(), err) } + return nil } diff --git a/aws/resource_aws_waf_web_acl_test.go b/aws/resource_aws_waf_web_acl_test.go index fa82a5c91e76..8846f552e92e 100644 --- a/aws/resource_aws_waf_web_acl_test.go +++ b/aws/resource_aws_waf_web_acl_test.go @@ -8,9 +8,12 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/waf" + "github.com/hashicorp/aws-sdk-go-base/tfawserr" + "github.com/hashicorp/go-multierror" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/service/waf/lister" ) func init() { @@ -23,94 +26,68 @@ func init() { func testSweepWafWebAcls(region string) error { client, err := sharedClientForRegion(region) if err != nil { - return fmt.Errorf("error getting client: %s", err) + return fmt.Errorf("error getting client: %w", err) } conn := client.(*AWSClient).wafconn - input := &waf.ListWebACLsInput{} - - for { - output, err := conn.ListWebACLs(input) + var sweeperErrs *multierror.Error - if testSweepSkipSweepError(err) { - log.Printf("[WARN] Skipping WAF Regional Web ACL sweep for %s: %s", region, err) - return nil - } + input := &waf.ListWebACLsInput{} - if err != nil { - return fmt.Errorf("error listing WAF Regional Web ACLs: %s", err) + err = lister.ListWebACLsPages(conn, input, func(page *waf.ListWebACLsOutput, lastPage bool) bool { + if page == nil { + return !lastPage } - for _, webACL := range output.WebACLs { - deleteInput := &waf.DeleteWebACLInput{ - WebACLId: webACL.WebACLId, + for _, webACL := range page.WebACLs { + if webACL == nil { + continue } + id := aws.StringValue(webACL.WebACLId) - wr := newWafRetryer(conn) - _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { - deleteInput.ChangeToken = token - log.Printf("[INFO] Deleting WAF Regional Web ACL: %s", id) - return conn.DeleteWebACL(deleteInput) - }) + r := resourceAwsWafWebAcl() + d := r.Data(nil) + d.SetId(id) - if isAWSErr(err, waf.ErrCodeNonEmptyEntityException, "") { - getWebACLInput := &waf.GetWebACLInput{ - WebACLId: webACL.WebACLId, - } - - getWebACLOutput, getWebACLErr := conn.GetWebACL(getWebACLInput) - - if getWebACLErr != nil { - return fmt.Errorf("error getting WAF Regional Web ACL (%s): %s", id, getWebACLErr) - } - - var updates []*waf.WebACLUpdate - updateWebACLInput := &waf.UpdateWebACLInput{ - DefaultAction: getWebACLOutput.WebACL.DefaultAction, - Updates: updates, - WebACLId: webACL.WebACLId, - } - - for _, rule := range getWebACLOutput.WebACL.Rules { - update := &waf.WebACLUpdate{ - Action: aws.String(waf.ChangeActionDelete), - ActivatedRule: rule, - } - - updateWebACLInput.Updates = append(updateWebACLInput.Updates, update) - } - - _, updateWebACLErr := wr.RetryWithToken(func(token *string) (interface{}, error) { - updateWebACLInput.ChangeToken = token - log.Printf("[INFO] Removing Rules from WAF Regional Web ACL: %s", id) - return conn.UpdateWebACL(updateWebACLInput) - }) - - if updateWebACLErr != nil { - return fmt.Errorf("error removing rules from WAF Regional Web ACL (%s): %s", id, updateWebACLErr) - } - - _, err = wr.RetryWithToken(func(token *string) (interface{}, error) { - deleteInput.ChangeToken = token - log.Printf("[INFO] Deleting WAF Regional Web ACL: %s", id) - return conn.DeleteWebACL(deleteInput) - }) + // Need to Read first to fill in rules argument + err := r.Read(d, client) + + if err != nil { + sweeperErr := fmt.Errorf("error reading WAF Web ACL (%s): %w", id, err) + log.Printf("[ERROR] %s", sweeperErr) + sweeperErrs = multierror.Append(sweeperErrs, sweeperErr) + continue + } + + // In case it was already deleted + if d.Id() == "" { + continue } + err = r.Delete(d, client) + if err != nil { - return fmt.Errorf("error deleting WAF Regional Web ACL (%s): %s", id, err) + sweeperErr := fmt.Errorf("error deleting WAF Web ACL (%s): %w", id, err) + log.Printf("[ERROR] %s", sweeperErr) + sweeperErrs = multierror.Append(sweeperErrs, sweeperErr) + continue } } - if aws.StringValue(output.NextMarker) == "" { - break - } + return !lastPage + }) - input.NextMarker = output.NextMarker + if testSweepSkipSweepError(err) { + log.Printf("[WARN] Skipping WAF Web ACL sweep for %s: %s", region, err) + return sweeperErrs.ErrorOrNil() // In case we have completed some pages, but had errors } - return nil + if err != nil { + sweeperErrs = multierror.Append(sweeperErrs, fmt.Errorf("error describing WAF Web ACLs: %w", err)) + } + + return sweeperErrs.ErrorOrNil() } func TestAccAWSWafWebAcl_basic(t *testing.T) { @@ -120,6 +97,7 @@ func TestAccAWSWafWebAcl_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafWebAclDestroy, Steps: []resource.TestStep{ @@ -153,6 +131,7 @@ func TestAccAWSWafWebAcl_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafWebAclDestroy, Steps: []resource.TestStep{ @@ -196,6 +175,7 @@ func TestAccAWSWafWebAcl_DefaultAction(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafWebAclDestroy, Steps: []resource.TestStep{ @@ -231,6 +211,7 @@ func TestAccAWSWafWebAcl_Rules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafWebAclDestroy, Steps: []resource.TestStep{ @@ -279,6 +260,7 @@ func TestAccAWSWafWebAcl_LoggingConfiguration(t *testing.T) { testAccPreCheckAWSWaf(t) testAccPreCheckWafLoggingConfiguration(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), ProviderFactories: testAccProviderFactories, CheckDestroy: testAccCheckAWSWafWebAclDestroy, Steps: []resource.TestStep{ @@ -326,6 +308,7 @@ func TestAccAWSWafWebAcl_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafWebAclDestroy, Steps: []resource.TestStep{ @@ -333,7 +316,7 @@ func TestAccAWSWafWebAcl_disappears(t *testing.T) { Config: testAccAWSWafWebAclConfig_Required(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAWSWafWebAclExists(resourceName, &webACL), - testAccCheckAWSWafWebAclDisappears(&webACL), + testAccCheckResourceDisappears(testAccProvider, resourceAwsWafWebAcl(), resourceName), ), ExpectNonEmptyPlan: true, }, @@ -348,6 +331,7 @@ func TestAccAWSWafWebAcl_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafWebAclDestroy, Steps: []resource.TestStep{ @@ -400,26 +384,6 @@ func TestAccAWSWafWebAcl_Tags(t *testing.T) { }) } -func testAccCheckAWSWafWebAclDisappears(v *waf.WebACL) resource.TestCheckFunc { - return func(s *terraform.State) error { - conn := testAccProvider.Meta().(*AWSClient).wafconn - - wr := newWafRetryer(conn) - - _, err := wr.RetryWithToken(func(token *string) (interface{}, error) { - opts := &waf.DeleteWebACLInput{ - ChangeToken: token, - WebACLId: v.WebACLId, - } - return conn.DeleteWebACL(opts) - }) - if err != nil { - return fmt.Errorf("Error Deleting WAF ACL: %s", err) - } - return nil - } -} - func testAccCheckAWSWafWebAclDestroy(s *terraform.State) error { for _, rs := range s.RootModule().Resources { if rs.Type != "aws_waf_web_acl" { @@ -432,18 +396,17 @@ func testAccCheckAWSWafWebAclDestroy(s *terraform.State) error { WebACLId: aws.String(rs.Primary.ID), }) - if err == nil { - if *resp.WebACL.WebACLId == rs.Primary.ID { - return fmt.Errorf("WebACL %s still exists", rs.Primary.ID) - } + if tfawserr.ErrCodeEquals(err, waf.ErrCodeNonexistentItemException) { + continue } - // Return nil if the WebACL is already destroyed - if isAWSErr(err, waf.ErrCodeNonexistentItemException, "") { - continue + if err != nil { + return fmt.Errorf("error reading WAF Web ACL (%s): %w", rs.Primary.ID, err) } - return err + if resp != nil && resp.WebACL != nil { + return fmt.Errorf("WAF Web ACL (%s) still exists", rs.Primary.ID) + } } return nil @@ -481,33 +444,33 @@ func testAccCheckAWSWafWebAclExists(n string, v *waf.WebACL) resource.TestCheckF func testAccAWSWafWebAclConfig_Required(rName string) string { return fmt.Sprintf(` resource "aws_waf_web_acl" "test" { - metric_name = %q - name = %q + metric_name = %[1]q + name = %[1]q default_action { type = "ALLOW" } } -`, rName, rName) +`, rName) } func testAccAWSWafWebAclConfig_DefaultAction(rName, defaultAction string) string { return fmt.Sprintf(` resource "aws_waf_web_acl" "test" { - metric_name = %q - name = %q + metric_name = %[1]q + name = %[1]q default_action { type = %q } } -`, rName, rName, defaultAction) +`, rName, defaultAction) } func testAccAWSWafWebAclConfig_Rules_Single_Rule(rName string) string { return fmt.Sprintf(` resource "aws_waf_ipset" "test" { - name = %q + name = %[1]q ip_set_descriptors { type = "IPV4" @@ -516,8 +479,8 @@ resource "aws_waf_ipset" "test" { } resource "aws_waf_rule" "test" { - metric_name = %q - name = %q + metric_name = %[1]q + name = %[1]q predicates { data_id = aws_waf_ipset.test.id @@ -527,8 +490,8 @@ resource "aws_waf_rule" "test" { } resource "aws_waf_web_acl" "test" { - metric_name = %q - name = %q + metric_name = %[1]q + name = %[1]q default_action { type = "ALLOW" @@ -543,19 +506,19 @@ resource "aws_waf_web_acl" "test" { } } } -`, rName, rName, rName, rName, rName) +`, rName) } func testAccAWSWafWebAclConfig_Rules_Single_RuleGroup(rName string) string { return fmt.Sprintf(` resource "aws_waf_rule_group" "test" { - metric_name = %q - name = %q + metric_name = %[1]q + name = %[1]q } resource "aws_waf_web_acl" "test" { - metric_name = %q - name = %q + metric_name = %[1]q + name = %[1]q default_action { type = "ALLOW" @@ -571,13 +534,13 @@ resource "aws_waf_web_acl" "test" { } } } -`, rName, rName, rName, rName) +`, rName) } func testAccAWSWafWebAclConfig_Rules_Multiple(rName string) string { return fmt.Sprintf(` resource "aws_waf_ipset" "test" { - name = %q + name = %[1]q ip_set_descriptors { type = "IPV4" @@ -586,8 +549,8 @@ resource "aws_waf_ipset" "test" { } resource "aws_waf_rule" "test" { - metric_name = %q - name = %q + metric_name = %[1]q + name = %[1]q predicates { data_id = aws_waf_ipset.test.id @@ -597,13 +560,13 @@ resource "aws_waf_rule" "test" { } resource "aws_waf_rule_group" "test" { - metric_name = %q - name = %q + metric_name = %[1]q + name = %[1]q } resource "aws_waf_web_acl" "test" { - metric_name = %q - name = %q + metric_name = %[1]q + name = %[1]q default_action { type = "ALLOW" @@ -628,7 +591,7 @@ resource "aws_waf_web_acl" "test" { } } } -`, rName, rName, rName, rName, rName, rName, rName) +`, rName) } func testAccAWSWafWebAclConfig_Logging(rName string) string { @@ -772,8 +735,8 @@ resource "aws_kinesis_firehose_delivery_stream" "test" { func testAccAWSWafWebAclConfigTags1(rName, tag1Key, tag1Value string) string { return fmt.Sprintf(` resource "aws_waf_web_acl" "test" { - metric_name = %q - name = %q + metric_name = %[1]q + name = %[1]q default_action { type = "ALLOW" @@ -783,14 +746,14 @@ resource "aws_waf_web_acl" "test" { %q = %q } } -`, rName, rName, tag1Key, tag1Value) +`, rName, tag1Key, tag1Value) } func testAccAWSWafWebAclConfigTags2(rName, tag1Key, tag1Value, tag2Key, tag2Value string) string { return fmt.Sprintf(` resource "aws_waf_web_acl" "test" { - metric_name = %q - name = %q + metric_name = %[1]q + name = %[1]q default_action { type = "ALLOW" @@ -801,5 +764,5 @@ resource "aws_waf_web_acl" "test" { %q = %q } } -`, rName, rName, tag1Key, tag1Value, tag2Key, tag2Value) +`, rName, tag1Key, tag1Value, tag2Key, tag2Value) } diff --git a/aws/resource_aws_waf_xss_match_set_test.go b/aws/resource_aws_waf_xss_match_set_test.go index 7bde4a3b528b..ec2a494f5456 100644 --- a/aws/resource_aws_waf_xss_match_set_test.go +++ b/aws/resource_aws_waf_xss_match_set_test.go @@ -97,6 +97,7 @@ func TestAccAWSWafXssMatchSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafXssMatchSetDestroy, Steps: []resource.TestStep{ @@ -138,6 +139,7 @@ func TestAccAWSWafXssMatchSet_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafXssMatchSetDestroy, Steps: []resource.TestStep{ @@ -173,6 +175,7 @@ func TestAccAWSWafXssMatchSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafXssMatchSetDestroy, Steps: []resource.TestStep{ @@ -195,6 +198,7 @@ func TestAccAWSWafXssMatchSet_changeTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafXssMatchSetDestroy, Steps: []resource.TestStep{ @@ -254,6 +258,7 @@ func TestAccAWSWafXssMatchSet_noTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWaf(t) }, + ErrorCheck: testAccErrorCheck(t, waf.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafXssMatchSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_byte_match_set_test.go b/aws/resource_aws_wafregional_byte_match_set_test.go index 8480d3466892..2adf9e15414c 100644 --- a/aws/resource_aws_wafregional_byte_match_set_test.go +++ b/aws/resource_aws_wafregional_byte_match_set_test.go @@ -19,6 +19,7 @@ func TestAccAWSWafRegionalByteMatchSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalByteMatchSetDestroy, Steps: []resource.TestStep{ @@ -65,6 +66,7 @@ func TestAccAWSWafRegionalByteMatchSet_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalByteMatchSetDestroy, Steps: []resource.TestStep{ @@ -136,6 +138,7 @@ func TestAccAWSWafRegionalByteMatchSet_changeByteMatchTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalByteMatchSetDestroy, Steps: []resource.TestStep{ @@ -205,6 +208,7 @@ func TestAccAWSWafRegionalByteMatchSet_noByteMatchTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalByteMatchSetDestroy, Steps: []resource.TestStep{ @@ -232,6 +236,7 @@ func TestAccAWSWafRegionalByteMatchSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalByteMatchSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_geo_match_set_test.go b/aws/resource_aws_wafregional_geo_match_set_test.go index 3e51a5121508..00c2bc313ce5 100644 --- a/aws/resource_aws_wafregional_geo_match_set_test.go +++ b/aws/resource_aws_wafregional_geo_match_set_test.go @@ -19,6 +19,7 @@ func TestAccAWSWafRegionalGeoMatchSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalGeoMatchSetDestroy, Steps: []resource.TestStep{ @@ -57,6 +58,7 @@ func TestAccAWSWafRegionalGeoMatchSet_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalGeoMatchSetDestroy, Steps: []resource.TestStep{ @@ -97,6 +99,7 @@ func TestAccAWSWafRegionalGeoMatchSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalGeoMatchSetDestroy, Steps: []resource.TestStep{ @@ -119,6 +122,7 @@ func TestAccAWSWafRegionalGeoMatchSet_changeConstraints(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalGeoMatchSetDestroy, Steps: []resource.TestStep{ @@ -174,6 +178,7 @@ func TestAccAWSWafRegionalGeoMatchSet_noConstraints(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalGeoMatchSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_ipset_test.go b/aws/resource_aws_wafregional_ipset_test.go index 54b785dfcfd9..fd6e23a8be64 100644 --- a/aws/resource_aws_wafregional_ipset_test.go +++ b/aws/resource_aws_wafregional_ipset_test.go @@ -24,6 +24,7 @@ func TestAccAWSWafRegionalIPSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalIPSetDestroy, Steps: []resource.TestStep{ @@ -54,6 +55,7 @@ func TestAccAWSWafRegionalIPSet_disappears(t *testing.T) { ipsetName := fmt.Sprintf("ip-set-%s", acctest.RandString(5)) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalIPSetDestroy, Steps: []resource.TestStep{ @@ -77,6 +79,7 @@ func TestAccAWSWafRegionalIPSet_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalIPSetDestroy, Steps: []resource.TestStep{ @@ -118,6 +121,7 @@ func TestAccAWSWafRegionalIPSet_changeDescriptors(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalIPSetDestroy, Steps: []resource.TestStep{ @@ -180,6 +184,7 @@ func TestAccAWSWafRegionalIPSet_IpSetDescriptors_1000UpdateLimit(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalIPSetDestroy, Steps: []resource.TestStep{ @@ -206,6 +211,7 @@ func TestAccAWSWafRegionalIPSet_noDescriptors(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalIPSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_rate_based_rule_test.go b/aws/resource_aws_wafregional_rate_based_rule_test.go index 42aee9619e6f..60b634b87cea 100644 --- a/aws/resource_aws_wafregional_rate_based_rule_test.go +++ b/aws/resource_aws_wafregional_rate_based_rule_test.go @@ -123,6 +123,7 @@ func TestAccAWSWafRegionalRateBasedRule_basic(t *testing.T) { wafRuleName := fmt.Sprintf("wafrule%s", acctest.RandString(5)) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRateBasedRuleDestroy, Steps: []resource.TestStep{ @@ -151,6 +152,7 @@ func TestAccAWSWafRegionalRateBasedRule_tags(t *testing.T) { wafRuleName := fmt.Sprintf("wafrule%s", acctest.RandString(5)) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRateBasedRuleDestroy, Steps: []resource.TestStep{ @@ -196,6 +198,7 @@ func TestAccAWSWafRegionalRateBasedRule_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRateBasedRuleDestroy, Steps: []resource.TestStep{ @@ -233,6 +236,7 @@ func TestAccAWSWafRegionalRateBasedRule_disappears(t *testing.T) { wafRuleName := fmt.Sprintf("wafrule%s", acctest.RandString(5)) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRateBasedRuleDestroy, Steps: []resource.TestStep{ @@ -258,6 +262,7 @@ func TestAccAWSWafRegionalRateBasedRule_changePredicates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRateBasedRuleDestroy, Steps: []resource.TestStep{ @@ -305,6 +310,7 @@ func TestAccAWSWafRegionalRateBasedRule_changeRateLimit(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRateBasedRuleDestroy, Steps: []resource.TestStep{ @@ -340,6 +346,7 @@ func TestAccAWSWafRegionalRateBasedRule_noPredicates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRateBasedRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_regex_match_set_test.go b/aws/resource_aws_wafregional_regex_match_set_test.go index 8830e16133c6..054348b3aacf 100644 --- a/aws/resource_aws_wafregional_regex_match_set_test.go +++ b/aws/resource_aws_wafregional_regex_match_set_test.go @@ -120,6 +120,7 @@ func testAccAWSWafRegionalRegexMatchSet_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRegexMatchSetDestroy, Steps: []resource.TestStep{ @@ -159,6 +160,7 @@ func testAccAWSWafRegionalRegexMatchSet_changePatterns(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRegexMatchSetDestroy, Steps: []resource.TestStep{ @@ -210,6 +212,7 @@ func testAccAWSWafRegionalRegexMatchSet_noPatterns(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRegexMatchSetDestroy, Steps: []resource.TestStep{ @@ -238,6 +241,7 @@ func testAccAWSWafRegionalRegexMatchSet_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRegexMatchSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_regex_pattern_set_test.go b/aws/resource_aws_wafregional_regex_pattern_set_test.go index 326d63674ad6..42ff1e50b4ac 100644 --- a/aws/resource_aws_wafregional_regex_pattern_set_test.go +++ b/aws/resource_aws_wafregional_regex_pattern_set_test.go @@ -37,6 +37,7 @@ func testAccAWSWafRegionalRegexPatternSet_basic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRegexPatternSetDestroy, Steps: []resource.TestStep{ @@ -66,6 +67,7 @@ func testAccAWSWafRegionalRegexPatternSet_changePatterns(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRegexPatternSetDestroy, Steps: []resource.TestStep{ @@ -106,6 +108,7 @@ func testAccAWSWafRegionalRegexPatternSet_noPatterns(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRegexPatternSetDestroy, Steps: []resource.TestStep{ @@ -133,6 +136,7 @@ func testAccAWSWafRegionalRegexPatternSet_disappears(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRegexPatternSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_rule.go b/aws/resource_aws_wafregional_rule.go index 07febe60d2e9..30786c36ff03 100644 --- a/aws/resource_aws_wafregional_rule.go +++ b/aws/resource_aws_wafregional_rule.go @@ -225,9 +225,9 @@ func flattenWafPredicates(ts []*waf.Predicate) []interface{} { out := make([]interface{}, len(ts)) for i, p := range ts { m := make(map[string]interface{}) - m["negated"] = *p.Negated - m["type"] = *p.Type - m["data_id"] = *p.DataId + m["negated"] = aws.BoolValue(p.Negated) + m["type"] = aws.StringValue(p.Type) + m["data_id"] = aws.StringValue(p.DataId) out[i] = m } return out diff --git a/aws/resource_aws_wafregional_rule_group_test.go b/aws/resource_aws_wafregional_rule_group_test.go index ab71574d0917..0229d11b3bb4 100644 --- a/aws/resource_aws_wafregional_rule_group_test.go +++ b/aws/resource_aws_wafregional_rule_group_test.go @@ -71,6 +71,7 @@ func TestAccAWSWafRegionalRuleGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRuleGroupDestroy, Steps: []resource.TestStep{ @@ -110,6 +111,7 @@ func TestAccAWSWafRegionalRuleGroup_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRuleGroupDestroy, Steps: []resource.TestStep{ @@ -160,6 +162,7 @@ func TestAccAWSWafRegionalRuleGroup_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRuleGroupDestroy, Steps: []resource.TestStep{ @@ -198,6 +201,7 @@ func TestAccAWSWafRegionalRuleGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRuleGroupDestroy, Steps: []resource.TestStep{ @@ -226,6 +230,7 @@ func TestAccAWSWafRegionalRuleGroup_changeActivatedRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRuleGroupDestroy, Steps: []resource.TestStep{ @@ -292,6 +297,7 @@ func TestAccAWSWafRegionalRuleGroup_noActivatedRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRuleGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_rule_test.go b/aws/resource_aws_wafregional_rule_test.go index 6e8671aa17a4..d3e7cabde468 100644 --- a/aws/resource_aws_wafregional_rule_test.go +++ b/aws/resource_aws_wafregional_rule_test.go @@ -124,6 +124,7 @@ func TestAccAWSWafRegionalRule_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRuleDestroy, Steps: []resource.TestStep{ @@ -153,6 +154,7 @@ func TestAccAWSWafRegionalRule_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRuleDestroy, Steps: []resource.TestStep{ @@ -198,6 +200,7 @@ func TestAccAWSWafRegionalRule_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalIPSetDestroy, Steps: []resource.TestStep{ @@ -235,6 +238,7 @@ func TestAccAWSWafRegionalRule_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRuleDestroy, Steps: []resource.TestStep{ @@ -257,6 +261,7 @@ func TestAccAWSWafRegionalRule_noPredicates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalRuleDestroy, Steps: []resource.TestStep{ @@ -288,6 +293,7 @@ func TestAccAWSWafRegionalRule_changePredicates(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_size_constraint_set_test.go b/aws/resource_aws_wafregional_size_constraint_set_test.go index 89854a1646c1..3ddd7df966c5 100644 --- a/aws/resource_aws_wafregional_size_constraint_set_test.go +++ b/aws/resource_aws_wafregional_size_constraint_set_test.go @@ -19,6 +19,7 @@ func TestAccAWSWafRegionalSizeConstraintSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalSizeConstraintSetDestroy, Steps: []resource.TestStep{ @@ -59,6 +60,7 @@ func TestAccAWSWafRegionalSizeConstraintSet_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalSizeConstraintSetDestroy, Steps: []resource.TestStep{ @@ -98,6 +100,7 @@ func TestAccAWSWafRegionalSizeConstraintSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalSizeConstraintSetDestroy, Steps: []resource.TestStep{ @@ -120,6 +123,7 @@ func TestAccAWSWafRegionalSizeConstraintSet_changeConstraints(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalSizeConstraintSetDestroy, Steps: []resource.TestStep{ @@ -179,6 +183,7 @@ func TestAccAWSWafRegionalSizeConstraintSet_noConstraints(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalSizeConstraintSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_sql_injection_match_set_test.go b/aws/resource_aws_wafregional_sql_injection_match_set_test.go index aa52399177b7..c73f17751d4d 100644 --- a/aws/resource_aws_wafregional_sql_injection_match_set_test.go +++ b/aws/resource_aws_wafregional_sql_injection_match_set_test.go @@ -19,6 +19,7 @@ func TestAccAWSWafRegionalSqlInjectionMatchSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalSqlInjectionMatchSetDestroy, Steps: []resource.TestStep{ @@ -53,6 +54,7 @@ func TestAccAWSWafRegionalSqlInjectionMatchSet_changeNameForceNew(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalSqlInjectionMatchSetDestroy, Steps: []resource.TestStep{ @@ -92,6 +94,7 @@ func TestAccAWSWafRegionalSqlInjectionMatchSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalSqlInjectionMatchSetDestroy, Steps: []resource.TestStep{ @@ -114,6 +117,7 @@ func TestAccAWSWafRegionalSqlInjectionMatchSet_changeTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalSqlInjectionMatchSetDestroy, Steps: []resource.TestStep{ @@ -165,6 +169,7 @@ func TestAccAWSWafRegionalSqlInjectionMatchSet_noTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalSqlInjectionMatchSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_web_acl_association_test.go b/aws/resource_aws_wafregional_web_acl_association_test.go index 8f92d371d20b..137dc163dfbc 100644 --- a/aws/resource_aws_wafregional_web_acl_association_test.go +++ b/aws/resource_aws_wafregional_web_acl_association_test.go @@ -16,6 +16,7 @@ func TestAccAWSWafRegionalWebAclAssociation_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckWafRegionalWebAclAssociationDestroy, Steps: []resource.TestStep{ @@ -37,6 +38,7 @@ func TestAccAWSWafRegionalWebAclAssociation_basic(t *testing.T) { func TestAccAWSWafRegionalWebAclAssociation_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckWafRegionalWebAclAssociationDestroy, Steps: []resource.TestStep{ @@ -57,6 +59,7 @@ func TestAccAWSWafRegionalWebAclAssociation_multipleAssociations(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckWafRegionalWebAclAssociationDestroy, Steps: []resource.TestStep{ @@ -86,6 +89,7 @@ func TestAccAWSWafRegionalWebAclAssociation_ResourceArn_ApiGatewayStage(t *testi testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) testAccAPIGatewayTypeEDGEPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckWafRegionalWebAclAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_web_acl_test.go b/aws/resource_aws_wafregional_web_acl_test.go index ab333e39e1ec..4bbaca1413ec 100644 --- a/aws/resource_aws_wafregional_web_acl_test.go +++ b/aws/resource_aws_wafregional_web_acl_test.go @@ -122,6 +122,7 @@ func TestAccAWSWafRegionalWebAcl_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalWebAclDestroy, Steps: []resource.TestStep{ @@ -154,6 +155,7 @@ func TestAccAWSWafRegionalWebAcl_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalWebAclDestroy, Steps: []resource.TestStep{ @@ -198,6 +200,7 @@ func TestAccAWSWafRegionalWebAcl_createRateBased(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalWebAclDestroy, Steps: []resource.TestStep{ @@ -228,6 +231,7 @@ func TestAccAWSWafRegionalWebAcl_createGroup(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalWebAclDestroy, Steps: []resource.TestStep{ @@ -259,6 +263,7 @@ func TestAccAWSWafRegionalWebAcl_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalWebAclDestroy, Steps: []resource.TestStep{ @@ -301,6 +306,7 @@ func TestAccAWSWafRegionalWebAcl_changeDefaultAction(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalWebAclDestroy, Steps: []resource.TestStep{ @@ -342,6 +348,7 @@ func TestAccAWSWafRegionalWebAcl_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalWebAclDestroy, Steps: []resource.TestStep{ @@ -364,6 +371,7 @@ func TestAccAWSWafRegionalWebAcl_noRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalWebAclDestroy, Steps: []resource.TestStep{ @@ -395,6 +403,7 @@ func TestAccAWSWafRegionalWebAcl_changeRules(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalWebAclDestroy, Steps: []resource.TestStep{ @@ -439,6 +448,7 @@ func TestAccAWSWafRegionalWebAcl_LoggingConfiguration(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalWebAclDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafregional_xss_match_set_test.go b/aws/resource_aws_wafregional_xss_match_set_test.go index 6cbe35b29084..c776843fe338 100644 --- a/aws/resource_aws_wafregional_xss_match_set_test.go +++ b/aws/resource_aws_wafregional_xss_match_set_test.go @@ -19,6 +19,7 @@ func TestAccAWSWafRegionalXssMatchSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalXssMatchSetDestroy, Steps: []resource.TestStep{ @@ -59,6 +60,7 @@ func TestAccAWSWafRegionalXssMatchSet_changeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalXssMatchSetDestroy, Steps: []resource.TestStep{ @@ -94,6 +96,7 @@ func TestAccAWSWafRegionalXssMatchSet_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalXssMatchSetDestroy, Steps: []resource.TestStep{ @@ -116,6 +119,7 @@ func TestAccAWSWafRegionalXssMatchSet_changeTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalXssMatchSetDestroy, Steps: []resource.TestStep{ @@ -175,6 +179,7 @@ func TestAccAWSWafRegionalXssMatchSet_noTuples(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPartitionHasServicePreCheck(wafregional.EndpointsID, t) }, + ErrorCheck: testAccErrorCheck(t, wafregional.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafRegionalXssMatchSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafv2_ip_set_test.go b/aws/resource_aws_wafv2_ip_set_test.go index f274eefe60a9..c03de18e63f9 100644 --- a/aws/resource_aws_wafv2_ip_set_test.go +++ b/aws/resource_aws_wafv2_ip_set_test.go @@ -85,6 +85,7 @@ func TestAccAwsWafv2IPSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2IPSetDestroy, Steps: []resource.TestStep{ @@ -132,6 +133,7 @@ func TestAccAwsWafv2IPSet_Disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2IPSetDestroy, Steps: []resource.TestStep{ @@ -154,6 +156,7 @@ func TestAccAwsWafv2IPSet_IPv6(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2IPSetDestroy, Steps: []resource.TestStep{ @@ -189,6 +192,7 @@ func TestAccAwsWafv2IPSet_Minimal(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2IPSetDestroy, Steps: []resource.TestStep{ @@ -222,6 +226,7 @@ func TestAccAwsWafv2IPSet_ChangeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2IPSetDestroy, Steps: []resource.TestStep{ @@ -260,6 +265,7 @@ func TestAccAwsWafv2IPSet_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2IPSetDestroy, Steps: []resource.TestStep{ @@ -308,6 +314,7 @@ func TestAccAwsWafv2IPSet_Large(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2IPSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafv2_regex_pattern_set_test.go b/aws/resource_aws_wafv2_regex_pattern_set_test.go index f1e82cfaa576..933e953ec9a2 100644 --- a/aws/resource_aws_wafv2_regex_pattern_set_test.go +++ b/aws/resource_aws_wafv2_regex_pattern_set_test.go @@ -85,6 +85,7 @@ func TestAccAwsWafv2RegexPatternSet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2RegexPatternSetDestroy, Steps: []resource.TestStep{ @@ -144,6 +145,7 @@ func TestAccAwsWafv2RegexPatternSet_Disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2RegexPatternSetDestroy, Steps: []resource.TestStep{ @@ -166,6 +168,7 @@ func TestAccAwsWafv2RegexPatternSet_Minimal(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2RegexPatternSetDestroy, Steps: []resource.TestStep{ @@ -192,6 +195,7 @@ func TestAccAwsWafv2RegexPatternSet_ChangeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2RegexPatternSetDestroy, Steps: []resource.TestStep{ @@ -228,6 +232,7 @@ func TestAccAwsWafv2RegexPatternSet_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2RegexPatternSetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafv2_rule_group_test.go b/aws/resource_aws_wafv2_rule_group_test.go index 8bac5ed5740f..9aba6423d58c 100644 --- a/aws/resource_aws_wafv2_rule_group_test.go +++ b/aws/resource_aws_wafv2_rule_group_test.go @@ -84,6 +84,7 @@ func TestAccAwsWafv2RuleGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -121,6 +122,7 @@ func TestAccAwsWafv2RuleGroup_updateRule(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -187,6 +189,7 @@ func TestAccAwsWafv2RuleGroup_updateRuleProperties(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -358,6 +361,7 @@ func TestAccAwsWafv2RuleGroup_ByteMatchStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -420,6 +424,7 @@ func TestAccAwsWafv2RuleGroup_ByteMatchStatement_FieldToMatch(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -583,6 +588,7 @@ func TestAccAwsWafv2RuleGroup_ChangeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -629,6 +635,7 @@ func TestAccAwsWafv2RuleGroup_ChangeCapacityForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -675,6 +682,7 @@ func TestAccAwsWafv2RuleGroup_ChangeMetricNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -721,6 +729,7 @@ func TestAccAwsWafv2RuleGroup_Disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -743,6 +752,7 @@ func TestAccAwsWafv2RuleGroup_GeoMatchStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -796,6 +806,7 @@ func TestAccAwsWafv2RuleGroup_GeoMatchStatement_ForwardedIPConfig(t *testing.T) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -852,6 +863,7 @@ func TestAccAwsWafv2RuleGroup_IpSetReferenceStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -888,6 +900,7 @@ func TestAccAwsWafv2RuleGroup_IpSetReferenceStatement_IPSetForwardedIPConfig(t * resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -987,6 +1000,7 @@ func TestAccAwsWafv2RuleGroup_LogicalRuleStatements(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -1059,6 +1073,7 @@ func TestAccAwsWafv2RuleGroup_Minimal(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -1089,6 +1104,7 @@ func TestAccAwsWafv2RuleGroup_RegexPatternSetReferenceStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -1126,6 +1142,7 @@ func TestAccAwsWafv2RuleGroup_RuleAction(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -1195,6 +1212,7 @@ func TestAccAwsWafv2RuleGroup_RuleAction(t *testing.T) { }, }) } + func TestAccAwsWafv2RuleGroup_SizeConstraintStatement(t *testing.T) { var v wafv2.RuleGroup ruleGroupName := acctest.RandomWithPrefix("tf-acc-test") @@ -1202,6 +1220,7 @@ func TestAccAwsWafv2RuleGroup_SizeConstraintStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -1248,6 +1267,7 @@ func TestAccAwsWafv2RuleGroup_SizeConstraintStatement(t *testing.T) { }, }) } + func TestAccAwsWafv2RuleGroup_SqliMatchStatement(t *testing.T) { var v wafv2.RuleGroup ruleGroupName := acctest.RandomWithPrefix("tf-acc-test") @@ -1255,6 +1275,7 @@ func TestAccAwsWafv2RuleGroup_SqliMatchStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -1325,6 +1346,7 @@ func TestAccAwsWafv2RuleGroup_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ @@ -1373,6 +1395,7 @@ func TestAccAwsWafv2RuleGroup_XssMatchStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2RuleGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafv2_web_acl_association_test.go b/aws/resource_aws_wafv2_web_acl_association_test.go index a9783658182b..d8755d34ff44 100644 --- a/aws/resource_aws_wafv2_web_acl_association_test.go +++ b/aws/resource_aws_wafv2_web_acl_association_test.go @@ -22,6 +22,7 @@ func TestAccAwsWafv2WebACLAssociation_basic(t *testing.T) { testAccAPIGatewayTypeEDGEPreCheck(t) testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2WebACLAssociationDestroy, Steps: []resource.TestStep{ @@ -53,6 +54,7 @@ func TestAccAwsWafv2WebACLAssociation_Disappears(t *testing.T) { testAccAPIGatewayTypeEDGEPreCheck(t) testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWafv2WebACLAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_wafv2_web_acl_logging_configuration.go b/aws/resource_aws_wafv2_web_acl_logging_configuration.go index a1285ec62c51..83aad58827bd 100644 --- a/aws/resource_aws_wafv2_web_acl_logging_configuration.go +++ b/aws/resource_aws_wafv2_web_acl_logging_configuration.go @@ -1,12 +1,16 @@ package aws import ( + "bytes" "fmt" "log" + "regexp" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/wafv2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/hashcode" ) func resourceAwsWafv2WebACLLoggingConfiguration() *schema.Resource { @@ -34,11 +38,67 @@ func resourceAwsWafv2WebACLLoggingConfiguration() *schema.Resource { Description: "AWS Kinesis Firehose Delivery Stream ARNs", }, "redacted_fields": { - Type: schema.TypeSet, - Optional: true, - MaxItems: 100, - Elem: wafv2FieldToMatchBaseSchema(), - Description: "Parts of the request to exclude from logs", + // To allow this argument and its nested fields with Empty Schemas (e.g. "method") + // to be correctly interpreted, this argument must be of type List, + // otherwise, at apply-time a field configured as an empty block + // (e.g. body {}) will result in a nil redacted_fields attribute + Type: schema.TypeList, + Optional: true, + MaxItems: 100, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + // TODO: remove attributes marked as Deprecated + // as they are not supported by the WAFv2 API + // in the context of WebACL Logging Configurations + "all_query_arguments": wafv2EmptySchemaDeprecated(), + "body": wafv2EmptySchemaDeprecated(), + "method": wafv2EmptySchema(), + "query_string": wafv2EmptySchema(), + "single_header": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.All( + validation.StringLenBetween(1, 40), + // The value is returned in lower case by the API. + // Trying to solve it with StateFunc and/or DiffSuppressFunc resulted in hash problem of the rule field or didn't work. + validation.StringMatch(regexp.MustCompile(`^[a-z0-9-_]+$`), "must contain only lowercase alphanumeric characters, underscores, and hyphens"), + ), + }, + }, + }, + }, + "single_query_argument": { + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "name": { + Type: schema.TypeString, + Required: true, + ValidateFunc: validation.All( + validation.StringLenBetween(1, 30), + // The value is returned in lower case by the API. + // Trying to solve it with StateFunc and/or DiffSuppressFunc resulted in hash problem of the rule field or didn't work. + validation.StringMatch(regexp.MustCompile(`^[a-z0-9-_]+$`), "must contain only lowercase alphanumeric characters, underscores, and hyphens"), + ), + Deprecated: "Not supported by WAFv2 API", + }, + }, + }, + Deprecated: "Not supported by WAFv2 API", + }, + "uri_path": wafv2EmptySchema(), + }, + }, + Description: "Parts of the request to exclude from logs", + DiffSuppressFunc: suppressRedactedFieldsDiff, }, "resource_arn": { Type: schema.TypeString, @@ -60,8 +120,8 @@ func resourceAwsWafv2WebACLLoggingConfigurationPut(d *schema.ResourceData, meta ResourceArn: aws.String(resourceArn), } - if v, ok := d.GetOk("redacted_fields"); ok && v.(*schema.Set).Len() > 0 { - config.RedactedFields = expandWafv2RedactedFields(v.(*schema.Set).List()) + if v, ok := d.GetOk("redacted_fields"); ok && len(v.([]interface{})) > 0 && v.([]interface{})[0] != nil { + config.RedactedFields = expandWafv2RedactedFields(v.([]interface{})) } else { config.RedactedFields = []*wafv2.FieldToMatch{} } @@ -126,18 +186,129 @@ func resourceAwsWafv2WebACLLoggingConfigurationDelete(d *schema.ResourceData, me return nil } -func flattenWafv2RedactedFields(fields []*wafv2.FieldToMatch) []map[string]interface{} { - redactedFields := make([]map[string]interface{}, 0, len(fields)) +func expandWafv2RedactedFields(fields []interface{}) []*wafv2.FieldToMatch { + redactedFields := make([]*wafv2.FieldToMatch, 0, len(fields)) for _, field := range fields { - redactedFields = append(redactedFields, flattenWafv2FieldToMatch(field).([]interface{})[0].(map[string]interface{})) + redactedFields = append(redactedFields, expandWafv2RedactedField(field)) } return redactedFields } -func expandWafv2RedactedFields(fields []interface{}) []*wafv2.FieldToMatch { - redactedFields := make([]*wafv2.FieldToMatch, 0, len(fields)) +func expandWafv2RedactedField(field interface{}) *wafv2.FieldToMatch { + m := field.(map[string]interface{}) + + f := &wafv2.FieldToMatch{} + + // While the FieldToMatch struct allows more than 1 of its fields to be set, + // the WAFv2 API does not. In addition, in the context of Logging Configuration requests, + // the WAFv2 API only supports the following redacted fields. + // Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/14244 + if v, ok := m["method"]; ok && len(v.([]interface{})) > 0 { + f.Method = &wafv2.Method{} + } + + if v, ok := m["query_string"]; ok && len(v.([]interface{})) > 0 { + f.QueryString = &wafv2.QueryString{} + } + + if v, ok := m["single_header"]; ok && len(v.([]interface{})) > 0 { + f.SingleHeader = expandWafv2SingleHeader(m["single_header"].([]interface{})) + } + + if v, ok := m["uri_path"]; ok && len(v.([]interface{})) > 0 { + f.UriPath = &wafv2.UriPath{} + } + + return f +} + +func flattenWafv2RedactedFields(fields []*wafv2.FieldToMatch) []interface{} { + redactedFields := make([]interface{}, 0, len(fields)) for _, field := range fields { - redactedFields = append(redactedFields, expandWafv2FieldToMatch([]interface{}{field})) + redactedFields = append(redactedFields, flattenWafv2RedactedField(field)) } return redactedFields } + +func flattenWafv2RedactedField(f *wafv2.FieldToMatch) map[string]interface{} { + m := map[string]interface{}{} + + if f == nil { + return m + } + + // In the context of Logging Configuration requests, + // the WAFv2 API only supports the following redacted fields. + // Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/14244 + if f.Method != nil { + m["method"] = make([]map[string]interface{}, 1) + } + + if f.QueryString != nil { + m["query_string"] = make([]map[string]interface{}, 1) + } + + if f.SingleHeader != nil { + m["single_header"] = flattenWafv2SingleHeader(f.SingleHeader) + } + + if f.UriPath != nil { + m["uri_path"] = make([]map[string]interface{}, 1) + } + + return m +} + +// redactedFieldsHash takes a map[string]interface{} as input and generates a +// unique hashcode, taking into account keys defined in the resource's schema +// are present even if not explicitly configured +func redactedFieldsHash(v interface{}) int { + var buf bytes.Buffer + m, ok := v.(map[string]interface{}) + if !ok { + return 0 + } + if v, ok := m["method"].([]interface{}); ok && len(v) > 0 { + buf.WriteString("method-") + } + if v, ok := m["query_string"].([]interface{}); ok && len(v) > 0 { + buf.WriteString("query_string-") + } + if v, ok := m["uri_path"].([]interface{}); ok && len(v) > 0 { + buf.WriteString("uri_path-") + } + if v, ok := m["single_header"].([]interface{}); ok && len(v) > 0 { + sh, ok := v[0].(map[string]interface{}) + if ok { + if name, ok := sh["name"].(string); ok { + buf.WriteString(fmt.Sprintf("%s-", name)) + } + } + } + + return hashcode.String(buf.String()) +} + +func suppressRedactedFieldsDiff(k, old, new string, d *schema.ResourceData) bool { + o, n := d.GetChange("redacted_fields") + oList := o.([]interface{}) + nList := n.([]interface{}) + + if len(oList) == 0 && len(nList) == 0 { + return true + } + + if len(oList) == 0 && len(nList) != 0 { + // account for empty block + return nList[0] == nil + } + + if len(oList) != 0 && len(nList) == 0 { + // account for empty block + return oList[0] == nil + } + + oldSet := schema.NewSet(redactedFieldsHash, oList) + newSet := schema.NewSet(redactedFieldsHash, nList) + return oldSet.Equal(newSet) +} diff --git a/aws/resource_aws_wafv2_web_acl_logging_configuration_test.go b/aws/resource_aws_wafv2_web_acl_logging_configuration_test.go index bce42080a916..87011dd82c9d 100644 --- a/aws/resource_aws_wafv2_web_acl_logging_configuration_test.go +++ b/aws/resource_aws_wafv2_web_acl_logging_configuration_test.go @@ -19,6 +19,7 @@ func TestAccAwsWafv2WebACLLoggingConfiguration_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -40,7 +41,7 @@ func TestAccAwsWafv2WebACLLoggingConfiguration_basic(t *testing.T) { }) } -func TestAccAwsWafv2WebACLLoggingConfiguration_update(t *testing.T) { +func TestAccAwsWafv2WebACLLoggingConfiguration_updateSingleHeaderRedactedField(t *testing.T) { var v wafv2.LoggingConfiguration rName := acctest.RandomWithPrefix("tf-acc-test") resourceName := "aws_wafv2_web_acl_logging_configuration.test" @@ -48,6 +49,7 @@ func TestAccAwsWafv2WebACLLoggingConfiguration_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -61,7 +63,7 @@ func TestAccAwsWafv2WebACLLoggingConfiguration_update(t *testing.T) { ), }, { - Config: testAccAwsWafv2WebACLLoggingConfiguration_updateTwoRedactedFields(rName), + Config: testAccAwsWafv2WebACLLoggingConfiguration_updateTwoSingleHeaderRedactedFields(rName), Check: resource.ComposeTestCheckFunc( testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), @@ -76,12 +78,208 @@ func TestAccAwsWafv2WebACLLoggingConfiguration_update(t *testing.T) { ), }, { - Config: testAccAwsWafv2WebACLLoggingConfiguration_updateOneRedactedField(rName), + Config: testAccAwsWafv2WebACLLoggingConfiguration_updateSingleHeaderRedactedField(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "1"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{ + "single_header.0.name": "user-agent", + }), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +// Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/14248 +func TestAccAwsWafv2WebACLLoggingConfiguration_updateMethodRedactedField(t *testing.T) { + var v wafv2.LoggingConfiguration + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_wafv2_web_acl_logging_configuration.test" + webACLResourceName := "aws_wafv2_web_acl.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_basic(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "0"), + ), + }, + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_updateRedactedField(rName, "method"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "1"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{ + "method.#": "1", + }), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +// Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/14248 +func TestAccAwsWafv2WebACLLoggingConfiguration_updateQueryStringRedactedField(t *testing.T) { + var v wafv2.LoggingConfiguration + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_wafv2_web_acl_logging_configuration.test" + webACLResourceName := "aws_wafv2_web_acl.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_basic(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "0"), + ), + }, + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_updateRedactedField(rName, "query_string"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "1"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{ + "query_string.#": "1", + }), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +// Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/14248 +func TestAccAwsWafv2WebACLLoggingConfiguration_updateUriPathRedactedField(t *testing.T) { + var v wafv2.LoggingConfiguration + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_wafv2_web_acl_logging_configuration.test" + webACLResourceName := "aws_wafv2_web_acl.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_basic(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "0"), + ), + }, + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_updateRedactedField(rName, "uri_path"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "1"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{ + "uri_path.#": "1", + }), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +// Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/14248 +func TestAccAwsWafv2WebACLLoggingConfiguration_updateMultipleRedactedFields(t *testing.T) { + var v wafv2.LoggingConfiguration + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_wafv2_web_acl_logging_configuration.test" + webACLResourceName := "aws_wafv2_web_acl.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_updateRedactedField(rName, "uri_path"), Check: resource.ComposeTestCheckFunc( testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "1"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{ + "uri_path.#": "1", + }), + ), + }, + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_updateTwoRedactedFields(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "2"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{ + "uri_path.#": "1", + }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{ + "method.#": "1", + }), + ), + }, + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_updateThreeRedactedFields(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "3"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{ + "uri_path.#": "1", + }), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{ + "query_string.#": "1", + }), resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{ "single_header.0.name": "user-agent", }), @@ -105,6 +303,7 @@ func TestAccAwsWafv2WebACLLoggingConfiguration_changeResourceARNForceNew(t *test resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -147,6 +346,7 @@ func TestAccAwsWafv2WebACLLoggingConfiguration_changeLogDestinationConfigsForceN resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -186,6 +386,7 @@ func TestAccAwsWafv2WebACLLoggingConfiguration_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -201,6 +402,78 @@ func TestAccAwsWafv2WebACLLoggingConfiguration_disappears(t *testing.T) { }) } +func TestAccAwsWafv2WebACLLoggingConfiguration_emptyRedactedFields(t *testing.T) { + var v wafv2.LoggingConfiguration + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_wafv2_web_acl_logging_configuration.test" + webACLResourceName := "aws_wafv2_web_acl.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_emptyRedactedField(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "0"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +func TestAccAwsWafv2WebACLLoggingConfiguration_updateEmptyRedactedFields(t *testing.T) { + var v wafv2.LoggingConfiguration + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_wafv2_web_acl_logging_configuration.test" + webACLResourceName := "aws_wafv2_web_acl.test" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), + Providers: testAccProviders, + CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, + Steps: []resource.TestStep{ + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_emptyRedactedField(rName), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "0"), + ), + }, + { + Config: testAccAwsWafv2WebACLLoggingConfiguration_updateRedactedField(rName, "uri_path"), + Check: resource.ComposeTestCheckFunc( + testAccCheckAwsWafv2WebACLLoggingConfigurationExists(resourceName, &v), + resource.TestCheckResourceAttrPair(resourceName, "resource_arn", webACLResourceName, "arn"), + resource.TestCheckResourceAttr(resourceName, "log_destination_configs.#", "1"), + resource.TestCheckResourceAttr(resourceName, "redacted_fields.#", "1"), + resource.TestCheckTypeSetElemNestedAttrs(resourceName, "redacted_fields.*", map[string]string{ + "uri_path.#": "1", + }), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + func TestAccAwsWafv2WebACLLoggingConfiguration_disappears_WebAcl(t *testing.T) { var v wafv2.LoggingConfiguration rName := acctest.RandomWithPrefix("tf-acc-test") @@ -209,6 +482,7 @@ func TestAccAwsWafv2WebACLLoggingConfiguration_disappears_WebAcl(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLLoggingConfigurationDestroy, Steps: []resource.TestStep{ @@ -405,7 +679,15 @@ resource "aws_wafv2_web_acl_logging_configuration" "test" { } ` -const testAccWebACLLoggingConfigurationResourceUpdateTwoRedactedFieldsConfig = ` +const testAccWebACLLoggingConfigurationResource_emptyRedactedFieldsConfig = ` +resource "aws_wafv2_web_acl_logging_configuration" "test" { + resource_arn = aws_wafv2_web_acl.test.arn + log_destination_configs = [aws_kinesis_firehose_delivery_stream.test.arn] + redacted_fields {} +} +` + +const testAccWebACLLoggingConfigurationResource_updateTwoSingleHeaderRedactedFieldsConfig = ` resource "aws_wafv2_web_acl_logging_configuration" "test" { resource_arn = aws_wafv2_web_acl.test.arn log_destination_configs = [aws_kinesis_firehose_delivery_stream.test.arn] @@ -424,11 +706,69 @@ resource "aws_wafv2_web_acl_logging_configuration" "test" { } ` -const testAccWebACLLoggingConfigurationResourceUpdateOneRedactedFieldConfig = ` +const testAccWebACLLoggingConfigurationResource_updateSingleHeaderRedactedFieldConfig = ` +resource "aws_wafv2_web_acl_logging_configuration" "test" { + resource_arn = aws_wafv2_web_acl.test.arn + log_destination_configs = [aws_kinesis_firehose_delivery_stream.test.arn] + + redacted_fields { + single_header { + name = "user-agent" + } + } +} +` + +func testAccWebACLLoggingConfigurationResource_updateRedactedFieldConfig(field string) string { + var redactedField string + switch field { + case "method": + redactedField = `method {}` + case "query_string": + redactedField = `query_string {}` + case "uri_path": + redactedField = `uri_path {}` + } + return fmt.Sprintf(` +resource "aws_wafv2_web_acl_logging_configuration" "test" { + resource_arn = aws_wafv2_web_acl.test.arn + log_destination_configs = [aws_kinesis_firehose_delivery_stream.test.arn] + + redacted_fields { + %s + } +} +`, redactedField) +} + +const testAccWebACLLoggingConfigurationResource_updateTwoRedactedFieldsConfig = ` +resource "aws_wafv2_web_acl_logging_configuration" "test" { + resource_arn = aws_wafv2_web_acl.test.arn + log_destination_configs = [aws_kinesis_firehose_delivery_stream.test.arn] + + redacted_fields { + method {} + } + + redacted_fields { + uri_path {} + } +} +` + +const testAccWebACLLoggingConfigurationResource_updateThreeRedactedFieldsConfig = ` resource "aws_wafv2_web_acl_logging_configuration" "test" { resource_arn = aws_wafv2_web_acl.test.arn log_destination_configs = [aws_kinesis_firehose_delivery_stream.test.arn] + redacted_fields { + uri_path {} + } + + redacted_fields { + query_string {} + } + redacted_fields { single_header { name = "user-agent" @@ -451,16 +791,44 @@ func testAccAwsWafv2WebACLLoggingConfiguration_updateLogDestination(rName, rName testAccWebACLLoggingConfigurationResourceConfig) } +func testAccAwsWafv2WebACLLoggingConfiguration_updateTwoSingleHeaderRedactedFields(rName string) string { + return composeConfig( + testAccWebACLLoggingConfigurationDependenciesConfig(rName), + testAccWebACLLoggingConfigurationKinesisDependencyConfig(rName), + testAccWebACLLoggingConfigurationResource_updateTwoSingleHeaderRedactedFieldsConfig) +} + +func testAccAwsWafv2WebACLLoggingConfiguration_updateSingleHeaderRedactedField(rName string) string { + return composeConfig( + testAccWebACLLoggingConfigurationDependenciesConfig(rName), + testAccWebACLLoggingConfigurationKinesisDependencyConfig(rName), + testAccWebACLLoggingConfigurationResource_updateSingleHeaderRedactedFieldConfig) +} + +func testAccAwsWafv2WebACLLoggingConfiguration_updateRedactedField(rName, field string) string { + return composeConfig( + testAccWebACLLoggingConfigurationDependenciesConfig(rName), + testAccWebACLLoggingConfigurationKinesisDependencyConfig(rName), + testAccWebACLLoggingConfigurationResource_updateRedactedFieldConfig(field)) +} + func testAccAwsWafv2WebACLLoggingConfiguration_updateTwoRedactedFields(rName string) string { return composeConfig( testAccWebACLLoggingConfigurationDependenciesConfig(rName), testAccWebACLLoggingConfigurationKinesisDependencyConfig(rName), - testAccWebACLLoggingConfigurationResourceUpdateTwoRedactedFieldsConfig) + testAccWebACLLoggingConfigurationResource_updateTwoRedactedFieldsConfig) +} + +func testAccAwsWafv2WebACLLoggingConfiguration_updateThreeRedactedFields(rName string) string { + return composeConfig( + testAccWebACLLoggingConfigurationDependenciesConfig(rName), + testAccWebACLLoggingConfigurationKinesisDependencyConfig(rName), + testAccWebACLLoggingConfigurationResource_updateThreeRedactedFieldsConfig) } -func testAccAwsWafv2WebACLLoggingConfiguration_updateOneRedactedField(rName string) string { +func testAccAwsWafv2WebACLLoggingConfiguration_emptyRedactedField(rName string) string { return composeConfig( testAccWebACLLoggingConfigurationDependenciesConfig(rName), testAccWebACLLoggingConfigurationKinesisDependencyConfig(rName), - testAccWebACLLoggingConfigurationResourceUpdateOneRedactedFieldConfig) + testAccWebACLLoggingConfigurationResource_emptyRedactedFieldsConfig) } diff --git a/aws/resource_aws_wafv2_web_acl_test.go b/aws/resource_aws_wafv2_web_acl_test.go index bd17f41650ee..a8c29520c3c9 100644 --- a/aws/resource_aws_wafv2_web_acl_test.go +++ b/aws/resource_aws_wafv2_web_acl_test.go @@ -81,6 +81,7 @@ func TestAccAwsWafv2WebACL_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -122,6 +123,7 @@ func TestAccAwsWafv2WebACL_updateRule(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -252,6 +254,7 @@ func TestAccAwsWafv2WebACL_UpdateRuleProperties(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -456,6 +459,7 @@ func TestAccAwsWafv2WebACL_ChangeNameForceNew(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -506,6 +510,7 @@ func TestAccAwsWafv2WebACL_Disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -528,6 +533,7 @@ func TestAccAwsWafv2WebACL_ManagedRuleGroupStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -592,6 +598,7 @@ func TestAccAwsWafv2WebACL_Minimal(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -624,6 +631,7 @@ func TestAccAwsWafv2WebACL_RateBasedStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -694,6 +702,7 @@ func TestAccAwsWafv2WebACL_GeoMatchStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -783,6 +792,7 @@ func TestAccAwsWafv2WebACL_GeoMatchStatement_ForwardedIPConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -847,6 +857,7 @@ func TestAccAwsWafv2WebACL_IPSetReferenceStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -892,6 +903,7 @@ func TestAccAwsWafv2WebACL_IPSetReferenceStatement_IPSetForwardedIPConfig(t *tes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -995,6 +1007,7 @@ func TestAccAwsWafv2WebACL_RateBasedStatement_ForwardedIPConfig(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -1063,6 +1076,7 @@ func TestAccAwsWafv2WebACL_RuleGroupReferenceStatement(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -1127,6 +1141,7 @@ func TestAccAwsWafv2WebACL_Tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -1176,6 +1191,7 @@ func TestAccAwsWafv2WebACL_MaxNestedRateBasedStatements(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ @@ -1218,6 +1234,7 @@ func TestAccAwsWafv2WebACL_MaxNestedOperatorStatements(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWafv2ScopeRegional(t) }, + ErrorCheck: testAccErrorCheck(t, wafv2.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWafv2WebACLDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_worklink_fleet_test.go b/aws/resource_aws_worklink_fleet_test.go index 7f803c29d09c..d02c93c89a15 100644 --- a/aws/resource_aws_worklink_fleet_test.go +++ b/aws/resource_aws_worklink_fleet_test.go @@ -19,6 +19,7 @@ func TestAccAWSWorkLinkFleet_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWorkLink(t) }, + ErrorCheck: testAccErrorCheck(t, worklink.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWorkLinkFleetDestroy, Steps: []resource.TestStep{ @@ -46,6 +47,7 @@ func TestAccAWSWorkLinkFleet_DisplayName(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWorkLink(t) }, + ErrorCheck: testAccErrorCheck(t, worklink.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWorkLinkFleetDestroy, Steps: []resource.TestStep{ @@ -78,6 +80,7 @@ func TestAccAWSWorkLinkFleet_OptimizeForEndUserLocation(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWorkLink(t) }, + ErrorCheck: testAccErrorCheck(t, worklink.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWorkLinkFleetDestroy, Steps: []resource.TestStep{ @@ -110,6 +113,7 @@ func TestAccAWSWorkLinkFleet_AuditStreamArn(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWorkLink(t) }, + ErrorCheck: testAccErrorCheck(t, worklink.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWorkLinkFleetDestroy, Steps: []resource.TestStep{ @@ -135,6 +139,7 @@ func TestAccAWSWorkLinkFleet_Network(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWorkLink(t) }, + ErrorCheck: testAccErrorCheck(t, worklink.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWorkLinkFleetDestroy, Steps: []resource.TestStep{ @@ -178,6 +183,7 @@ func TestAccAWSWorkLinkFleet_DeviceCaCertificate(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWorkLink(t) }, + ErrorCheck: testAccErrorCheck(t, worklink.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWorkLinkFleetDestroy, Steps: []resource.TestStep{ @@ -211,6 +217,7 @@ func TestAccAWSWorkLinkFleet_IdentityProvider(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWorkLink(t) }, + ErrorCheck: testAccErrorCheck(t, worklink.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWorkLinkFleetDestroy, Steps: []resource.TestStep{ @@ -241,6 +248,7 @@ func TestAccAWSWorkLinkFleet_Disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWorkLink(t) }, + ErrorCheck: testAccErrorCheck(t, worklink.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWorkLinkFleetDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_worklink_website_certificate_authority_association_test.go b/aws/resource_aws_worklink_website_certificate_authority_association_test.go index d799a07a3389..13ed4f611995 100644 --- a/aws/resource_aws_worklink_website_certificate_authority_association_test.go +++ b/aws/resource_aws_worklink_website_certificate_authority_association_test.go @@ -19,6 +19,7 @@ func TestAccAWSWorkLinkWorkLinkWebsiteCertificateAuthorityAssociation_basic(t *t resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWorkLink(t) }, + ErrorCheck: testAccErrorCheck(t, worklink.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWorkLinkWebsiteCertificateAuthorityAssociationDestroy, Steps: []resource.TestStep{ @@ -48,6 +49,7 @@ func TestAccAWSWorkLinkWorkLinkWebsiteCertificateAuthorityAssociation_DisplayNam displayName2 := fmt.Sprintf("tf-website-certificate-%s", acctest.RandStringFromCharSet(5, acctest.CharSetAlpha)) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWorkLink(t) }, + ErrorCheck: testAccErrorCheck(t, worklink.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWorkLinkWebsiteCertificateAuthorityAssociationDestroy, Steps: []resource.TestStep{ @@ -80,6 +82,7 @@ func TestAccAWSWorkLinkWorkLinkWebsiteCertificateAuthorityAssociation_Disappears resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSWorkLink(t) }, + ErrorCheck: testAccErrorCheck(t, worklink.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSWorkLinkWebsiteCertificateAuthorityAssociationDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_workspaces_directory_test.go b/aws/resource_aws_workspaces_directory_test.go index 5cee0b8f5380..1d728e488761 100644 --- a/aws/resource_aws_workspaces_directory_test.go +++ b/aws/resource_aws_workspaces_directory_test.go @@ -67,6 +67,7 @@ func TestAccAwsWorkspacesDirectory_basic(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesDirectoryDestroy, Steps: []resource.TestStep{ @@ -130,6 +131,7 @@ func TestAccAwsWorkspacesDirectory_disappears(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesDirectoryDestroy, Steps: []resource.TestStep{ @@ -158,6 +160,7 @@ func TestAccAwsWorkspacesDirectory_subnetIds(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesDirectoryDestroy, Steps: []resource.TestStep{ @@ -190,6 +193,7 @@ func TestAccAwsWorkspacesDirectory_tags(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesDirectoryDestroy, Steps: []resource.TestStep{ @@ -240,6 +244,7 @@ func TestAccAwsWorkspacesDirectory_selfServicePermissions(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesDirectoryDestroy, Steps: []resource.TestStep{ @@ -272,6 +277,7 @@ func TestAccAwsWorkspacesDirectory_workspaceAccessProperties(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesDirectoryDestroy, Steps: []resource.TestStep{ @@ -307,6 +313,7 @@ func TestAccAwsWorkspacesDirectory_workspaceCreationProperties(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesDirectoryDestroy, Steps: []resource.TestStep{ @@ -340,6 +347,7 @@ func TestAccAwsWorkspacesDirectory_workspaceCreationProperties_customSecurityGro testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesDirectoryDestroy, Steps: []resource.TestStep{ @@ -383,6 +391,7 @@ func TestAccAwsWorkspacesDirectory_ipGroupIds(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesDirectoryDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_workspaces_ip_group.go b/aws/resource_aws_workspaces_ip_group.go index a4e813ebbae8..01752026d87e 100644 --- a/aws/resource_aws_workspaces_ip_group.go +++ b/aws/resource_aws_workspaces_ip_group.go @@ -212,12 +212,16 @@ func expandIpGroupRules(rules []interface{}) []*workspaces.IpRuleItem { func flattenIpGroupRules(rules []*workspaces.IpRuleItem) []map[string]interface{} { result := make([]map[string]interface{}, 0, len(rules)) for _, rule := range rules { - r := map[string]interface{}{ - "source": *rule.IpRule, + r := map[string]interface{}{} + + if v := rule.IpRule; v != nil { + r["source"] = aws.StringValue(v) } - if rule.RuleDesc != nil { - r["description"] = *rule.RuleDesc + + if v := rule.RuleDesc; v != nil { + r["description"] = aws.StringValue(rule.RuleDesc) } + result = append(result, r) } return result diff --git a/aws/resource_aws_workspaces_ip_group_test.go b/aws/resource_aws_workspaces_ip_group_test.go index acb4ac5bab11..8ce5cc6c5846 100644 --- a/aws/resource_aws_workspaces_ip_group_test.go +++ b/aws/resource_aws_workspaces_ip_group_test.go @@ -21,6 +21,7 @@ func TestAccAwsWorkspacesIpGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesIpGroupDestroy, Steps: []resource.TestStep{ @@ -64,6 +65,7 @@ func TestAccAwsWorkspacesIpGroup_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesIpGroupDestroy, Steps: []resource.TestStep{ @@ -109,6 +111,7 @@ func TestAccAwsWorkspacesIpGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesIpGroupDestroy, Steps: []resource.TestStep{ @@ -136,6 +139,7 @@ func TestAccAwsWorkspacesIpGroup_MultipleDirectories(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesIpGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_workspaces_workspace_test.go b/aws/resource_aws_workspaces_workspace_test.go index 50a99fcc2269..466eb148eee6 100644 --- a/aws/resource_aws_workspaces_workspace_test.go +++ b/aws/resource_aws_workspaces_workspace_test.go @@ -68,6 +68,7 @@ func TestAccAwsWorkspacesWorkspace_basic(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesWorkspaceDestroy, Steps: []resource.TestStep{ @@ -115,6 +116,7 @@ func TestAccAwsWorkspacesWorkspace_tags(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesWorkspaceDestroy, Steps: []resource.TestStep{ @@ -166,6 +168,7 @@ func TestAccAwsWorkspacesWorkspace_workspaceProperties(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesWorkspaceDestroy, Steps: []resource.TestStep{ @@ -230,6 +233,7 @@ func TestAccAwsWorkspacesWorkspace_workspaceProperties_runningModeAlwaysOn(t *te testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesWorkspaceDestroy, Steps: []resource.TestStep{ @@ -259,6 +263,7 @@ func TestAccAwsWorkspacesWorkspace_validateRootVolumeSize(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesWorkspaceDestroy, Steps: []resource.TestStep{ @@ -275,6 +280,7 @@ func TestAccAwsWorkspacesWorkspace_validateUserVolumeSize(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesWorkspaceDestroy, Steps: []resource.TestStep{ @@ -299,6 +305,7 @@ func TestAccAwsWorkspacesWorkspace_recreate(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesWorkspaceDestroy, Steps: []resource.TestStep{ @@ -332,6 +339,7 @@ func TestAccAwsWorkspacesWorkspace_timeout(t *testing.T) { testAccPreCheckAWSDirectoryServiceSimpleDirectory(t) testAccPreCheckHasIAMRole(t, "workspaces_DefaultRole") }, + ErrorCheck: testAccErrorCheck(t, workspaces.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsWorkspacesWorkspaceDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_xray_encryption_config_test.go b/aws/resource_aws_xray_encryption_config_test.go index 98f5290bd230..d5d0f5e1dbca 100644 --- a/aws/resource_aws_xray_encryption_config_test.go +++ b/aws/resource_aws_xray_encryption_config_test.go @@ -17,6 +17,7 @@ func TestAccAWSXrayEncryptionConfig_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, xray.EndpointsID), Providers: testAccProviders, CheckDestroy: nil, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_xray_group_test.go b/aws/resource_aws_xray_group_test.go index 8e194fbb2978..3e4dacc1fa75 100644 --- a/aws/resource_aws_xray_group_test.go +++ b/aws/resource_aws_xray_group_test.go @@ -19,6 +19,7 @@ func TestAccAWSXrayGroup_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, xray.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSXrayGroupDestroy, Steps: []resource.TestStep{ @@ -56,6 +57,7 @@ func TestAccAWSXrayGroup_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, xray.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSXrayGroupDestroy, Steps: []resource.TestStep{ @@ -99,6 +101,7 @@ func TestAccAWSXrayGroup_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, xray.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSXrayGroupDestroy, Steps: []resource.TestStep{ diff --git a/aws/resource_aws_xray_sampling_rule_test.go b/aws/resource_aws_xray_sampling_rule_test.go index 7f0791335034..660988d5375f 100644 --- a/aws/resource_aws_xray_sampling_rule_test.go +++ b/aws/resource_aws_xray_sampling_rule_test.go @@ -17,6 +17,7 @@ func TestAccAWSXraySamplingRule_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSXray(t) }, + ErrorCheck: testAccErrorCheck(t, xray.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSXraySamplingRuleDestroy, Steps: []resource.TestStep{ @@ -57,6 +58,7 @@ func TestAccAWSXraySamplingRule_update(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSXray(t) }, + ErrorCheck: testAccErrorCheck(t, xray.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSXraySamplingRuleDestroy, Steps: []resource.TestStep{ @@ -112,6 +114,7 @@ func TestAccAWSXraySamplingRule_tags(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSXray(t) }, + ErrorCheck: testAccErrorCheck(t, xray.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSXraySamplingRuleDestroy, Steps: []resource.TestStep{ @@ -156,6 +159,7 @@ func TestAccAWSXraySamplingRule_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSXray(t) }, + ErrorCheck: testAccErrorCheck(t, xray.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSXraySamplingRuleDestroy, Steps: []resource.TestStep{ diff --git a/aws/tags.go b/aws/tags.go index cf9ed21dfe90..d7b5f96580a9 100644 --- a/aws/tags.go +++ b/aws/tags.go @@ -1,6 +1,9 @@ package aws import ( + "context" + "fmt" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" @@ -75,3 +78,42 @@ func ec2TagSpecificationsFromMap(m map[string]interface{}, t string) []*ec2.TagS }, } } + +// ec2TagSpecificationsFromKeyValueTags returns the tag specifications for the given KeyValueTags object and resource type. +func ec2TagSpecificationsFromKeyValueTags(tags keyvaluetags.KeyValueTags, t string) []*ec2.TagSpecification { + if len(tags) == 0 { + return nil + } + + return []*ec2.TagSpecification{ + { + ResourceType: aws.String(t), + Tags: tags.IgnoreAws().Ec2Tags(), + }, + } +} + +// 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 SetTagsDiff(_ context.Context, diff *schema.ResourceDiff, meta interface{}) error { + defaultTagsConfig := meta.(*AWSClient).DefaultTagsConfig + ignoreTagsConfig := meta.(*AWSClient).IgnoreTagsConfig + + resourceTags := keyvaluetags.New(diff.Get("tags").(map[string]interface{})) + + if defaultTagsConfig.TagsEqual(resourceTags) { + return fmt.Errorf(`"tags" are identical to those in the "default_tags" configuration block of the provider: please de-duplicate and try again`) + } + + allTags := defaultTagsConfig.MergeTags(resourceTags).IgnoreConfig(ignoreTagsConfig) + + if err := diff.SetNew("tags_all", allTags.Map()); err != nil { + return fmt.Errorf("error setting new tags_all diff: %w", err) + } + + return nil +} diff --git a/aws/testdata/service/dms/oracle_wallet_certificate.pem b/aws/testdata/service/dms/oracle_wallet_certificate.pem new file mode 100644 index 000000000000..0e20b50a8265 --- /dev/null +++ b/aws/testdata/service/dms/oracle_wallet_certificate.pem @@ -0,0 +1,10 @@ +-----BEGIN CERTIFICATE----- +MIIBsTCCARoCAQAwDQYJKoZIhvcNAQEEBQAwITEfMB0GA1UEAxMWZ2JyMzAxMzkudWsub3JhY2xl +LmNvbTAeFw0xNjA1MTExMTQzMzFaFw0yNjA1MDkxMTQzMzFaMCExHzAdBgNVBAMTFmdicjMwMTM5 +LnVrLm9yYWNsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKH8G8sFS6l0llu+RMfl +7Yt+Ppw8J0PfDEDbTGP5wtsrs/22dUCipU9l+vif1VgSPLE2UPJbGM8tQzTC6UYbBtWHe4CshmvD +EVlcIMsEFvD7a5Q+P45jqNSEtV9VdbGyxaD6i5Y/Smd+B87FcQQCX54LaI9BJ8SZwmPXgDweADLf +AgMBAAEwDQYJKoZIhvcNAQEEBQADgYEAai742jfNYYTKMq2xxRygGJGn1LhpFenHvuHLBvnTup1N +nZOBwBi4VxW3CImvwONYcCEFp3E1SRswS5evlfIfruCZ1xQBoUNei3EJ6O3OdKeRRp2E+muXEtfe +U+jwUE+SzpnzfpI23Okl2vo8Q7VHrSalxE2KEhAzC1UYX7ZYp1U= +-----END CERTIFICATE----- \ No newline at end of file diff --git a/aws/validators.go b/aws/validators.go index c9270c03deeb..8b13f132b912 100644 --- a/aws/validators.go +++ b/aws/validators.go @@ -846,6 +846,7 @@ func validateIpv6CIDRBlock(cidr string) error { return nil } +// TODO Replace with tfnet.CIDRBlocksEqual. // cidrBlocksEqual returns whether or not two CIDR blocks are equal: // - Both CIDR blocks parse to an IP address and network // - The string representation of the IP addresses are equal @@ -1217,25 +1218,6 @@ func validateSfnStateMachineName(v interface{}, k string) (ws []string, errors [ return } -func validateDmsCertificateId(v interface{}, k string) (ws []string, es []error) { - val := v.(string) - - if len(val) > 255 { - es = append(es, fmt.Errorf("%q must not be longer than 255 characters", k)) - } - if !regexp.MustCompile("^[a-zA-Z][a-zA-Z0-9-]+$").MatchString(val) { - es = append(es, fmt.Errorf("%q must start with a letter, only contain alphanumeric characters and hyphens", k)) - } - if strings.Contains(val, "--") { - es = append(es, fmt.Errorf("%q must not contain consecutive hyphens", k)) - } - if strings.HasSuffix(val, "-") { - es = append(es, fmt.Errorf("%q must not end in a hyphen", k)) - } - - return -} - func validateDmsEndpointId(v interface{}, k string) (ws []string, es []error) { val := v.(string) @@ -2425,7 +2407,7 @@ var validateCloudWatchEventCustomEventBusName = validation.All( var validateCloudWatchEventBusName = validation.All( validation.StringLenBetween(1, 256), - validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9._\-]+$`), ""), + validation.StringMatch(regexp.MustCompile(`^[a-zA-Z0-9._\-/]+$`), ""), ) var validateCloudWatchEventArchiveName = validation.All( diff --git a/aws/validators_test.go b/aws/validators_test.go index 5a52fe7ae912..c7d4621495e0 100644 --- a/aws/validators_test.go +++ b/aws/validators_test.go @@ -1314,37 +1314,6 @@ func TestValidateDmsEndpointId(t *testing.T) { } } -func TestValidateDmsCertificateId(t *testing.T) { - validIds := []string{ - "tf-test-certificate-1", - "tfTestEndpoint", - } - - for _, s := range validIds { - _, errors := validateDmsCertificateId(s, "certificate_id") - if len(errors) > 0 { - t.Fatalf("%q should be a valid certificate id: %v", s, errors) - } - } - - invalidIds := []string{ - "tf_test_certificate_1", - "tf.test.certificate.1", - "tf test certificate 1", - "tf-test-certificate-1!", - "tf-test-certificate-1-", - "tf-test-certificate--1", - "tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1tf-test-certificate-1", - } - - for _, s := range invalidIds { - _, errors := validateDmsEndpointId(s, "certificate_id") - if len(errors) == 0 { - t.Fatalf("%q should not be a valid certificate id: %v", s, errors) - } - } -} - func TestValidateDmsReplicationInstanceId(t *testing.T) { validIds := []string{ "tf-test-replication-instance-1", diff --git a/aws/wafv2_helper.go b/aws/wafv2_helper.go index 40e05658afe1..32f12615529d 100644 --- a/aws/wafv2_helper.go +++ b/aws/wafv2_helper.go @@ -21,6 +21,18 @@ func wafv2EmptySchema() *schema.Schema { } } +func wafv2EmptySchemaDeprecated() *schema.Schema { + return &schema.Schema{ + Type: schema.TypeList, + Optional: true, + MaxItems: 1, + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{}, + }, + Deprecated: "Not supported by WAFv2 API", + } +} + func wafv2RootStatementSchema(level int) *schema.Schema { return &schema.Schema{ Type: schema.TypeList, diff --git a/awsproviderlint/go.mod b/awsproviderlint/go.mod index 357effe0b849..d726f48f4b50 100644 --- a/awsproviderlint/go.mod +++ b/awsproviderlint/go.mod @@ -3,8 +3,8 @@ module github.com/terraform-providers/terraform-provider-aws/awsproviderlint go 1.16 require ( - github.com/aws/aws-sdk-go v1.37.4 - github.com/bflad/tfproviderlint v0.22.0 - github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.3 - golang.org/x/tools v0.0.0-20200928201943-a0ef9b62deab + github.com/aws/aws-sdk-go v1.38.6 + github.com/bflad/tfproviderlint v0.26.0 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0 + golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb ) diff --git a/awsproviderlint/go.sum b/awsproviderlint/go.sum index af28b481f366..ab6f15db1735 100644 --- a/awsproviderlint/go.sum +++ b/awsproviderlint/go.sum @@ -11,8 +11,10 @@ cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6 cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= -cloud.google.com/go v0.61.0 h1:NLQf5e1OMspfNT1RAHOB3ublr1TW3YTXO8OiWwVjK2U= cloud.google.com/go v0.61.0/go.mod h1:XukKJg4Y7QsUu0Hxg3qQKUWR4VuWivmyMK2+rUyxAqw= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0 h1:Dg9iHVQfrhq82rUNu9ZxUDrJLaxFUe/HlCVaLyRruq8= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= @@ -42,23 +44,26 @@ github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/g github.com/andybalholm/crlf v0.0.0-20171020200849-670099aa064f/go.mod h1:k8feO4+kXDxro6ErPXBRTJ/ro2mf0SsFG8s7doP9kJE= github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c= github.com/apparentlymart/go-cidr v1.0.1/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= +github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/YjEn/vI25Lg7Gwc= github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I= github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/apparentlymart/go-textseg/v12 v12.0.0 h1:bNEQyAGak9tojivJNkoqWErVCQbjdL7GzRt3F8NvfJ0= github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.25.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.37.4 h1:tWxrpMK/oRSXVnjUzhGeCWLR00fW0WF4V4sycYPPrJ8= -github.com/aws/aws-sdk-go v1.37.4/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/aws/aws-sdk-go v1.37.0/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/aws/aws-sdk-go v1.38.6 h1:h0AKIaz/A1kEJ50HxCv7tL1GW+KbxYbp75+lZ/nvFOI= +github.com/aws/aws-sdk-go v1.38.6/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/bflad/gopaniccheck v0.1.0 h1:tJftp+bv42ouERmUMWLoUn/5bi/iQZjHPznM00cP/bU= github.com/bflad/gopaniccheck v0.1.0/go.mod h1:ZCj2vSr7EqVeDaqVsWN4n2MwdROx1YL+LFo47TSWtsA= -github.com/bflad/tfproviderlint v0.22.0 h1:rn7jBBhBE6HXY980NKP6YzCcGP1UGDNDZr6z7o5V0ZQ= -github.com/bflad/tfproviderlint v0.22.0/go.mod h1:0fdh7JywihC58Io8AZ+gpcmQtJggse0MCOXF2tMmnAQ= +github.com/bflad/tfproviderlint v0.26.0 h1:Xd+hbVlSQhKlXifpqmHPvlcnOK1lRS4IZf+cXBAUpCs= +github.com/bflad/tfproviderlint v0.26.0/go.mod h1:7Z9Pyl1Z1UWJcPBuyjN89D2NaJGpjReQb5NoaaQCthQ= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= @@ -106,6 +111,7 @@ github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFU github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -130,6 +136,7 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= @@ -158,9 +165,9 @@ github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtng github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= github.com/hashicorp/go-getter v1.4.0/go.mod h1:7qxyCd8rBfcShwsvxgIguu4KbS3l8bUCwg2Umn7RjeY= -github.com/hashicorp/go-getter v1.4.2-0.20200106182914-9813cbd4eb02/go.mod h1:7qxyCd8rBfcShwsvxgIguu4KbS3l8bUCwg2Umn7RjeY= -github.com/hashicorp/go-getter v1.5.0 h1:ciWJaeZWSMbc5OiLMpKp40MKFPqO44i0h3uyfXPBkkk= github.com/hashicorp/go-getter v1.5.0/go.mod h1:a7z7NPPfNQpJWcn4rSWFtdrSldqLdLPEF3d8nFMsSLM= +github.com/hashicorp/go-getter v1.5.2 h1:XDo8LiAcDisiqZdv0TKgz+HtX3WN7zA2JD1R1tjsabE= +github.com/hashicorp/go-getter v1.5.2/go.mod h1:orNH3BTYLu/fIxGIdLjLoAJHWMDQ/UKQr5O4m3iBuoo= github.com/hashicorp/go-hclog v0.0.0-20180709165350-ff2cf002a8dd/go.mod h1:9bjs9uLqI8l75knNv3lV1kA55veR+WUPSiKIWcQHudI= github.com/hashicorp/go-hclog v0.9.2/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ= github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= @@ -168,7 +175,6 @@ github.com/hashicorp/go-hclog v0.15.0 h1:qMuK0wxsoW4D0ddCCYwPSTm4KQv1X1ke3WmPWZ0 github.com/hashicorp/go-hclog v0.15.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-plugin v1.0.1/go.mod h1:++UyYGoz3o5w9ZzAdZxtQKrWWP+iqPBn3cQptSMzBuY= github.com/hashicorp/go-plugin v1.3.0/go.mod h1:F9eH4LrE/ZsRdbwhfjs9k9HoDUwAHnYtXdgmf1AVNs0= github.com/hashicorp/go-plugin v1.4.0 h1:b0O7rs5uiJ99Iu9HugEzsM67afboErkHUWddUSpUO3A= github.com/hashicorp/go-plugin v1.4.0/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ= @@ -186,28 +192,26 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f h1:UdxlrJz4JOnY8W+DbLISwf2B8WXEolNRA8BGCwI9jws= github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f/go.mod h1:oZtUIOe8dh44I2q6ScRibXws4Ajl+d+nod3AaR9vL5w= github.com/hashicorp/hcl/v2 v2.0.0/go.mod h1:oVVDG71tEinNGYCxinCYadcmKU9bglqW9pV3txagJ90= -github.com/hashicorp/hcl/v2 v2.3.0 h1:iRly8YaMwTBAKhn1Ybk7VSdzbnopghktCD031P8ggUE= github.com/hashicorp/hcl/v2 v2.3.0/go.mod h1:d+FwDBbOLvpAM3Z6J7gPj/VoAGkNe/gm352ZhjJ/Zv8= +github.com/hashicorp/hcl/v2 v2.8.2 h1:wmFle3D1vu0okesm8BTLVDyJ6/OL9DCLUwn0b2OptiY= +github.com/hashicorp/hcl/v2 v2.8.2/go.mod h1:bQTN5mpo+jewjJgh8jr0JUguIi7qPHUF6yIfAEN3jqY= github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= -github.com/hashicorp/terraform-config-inspect v0.0.0-20191115094559-17f92b0546e8/go.mod h1:p+ivJws3dpqbp1iP84+npOyAmTTOLMgCzrXd3GSdn/A= -github.com/hashicorp/terraform-exec v0.3.0/go.mod h1:yKWvMPtkTaHpeAmllw+1qdHZ7E5u+pAZ+x8e2jQF6gM= +github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7/go.mod h1:p+ivJws3dpqbp1iP84+npOyAmTTOLMgCzrXd3GSdn/A= +github.com/hashicorp/terraform-exec v0.10.0/go.mod h1:tOT8j1J8rP05bZBGWXfMyU3HkLi1LWyqL3Bzsc3CJjo= github.com/hashicorp/terraform-exec v0.13.0 h1:1Pth+pdWJAufJuWWjaVOVNEkoRTOjGn3hQpAqj4aPdg= github.com/hashicorp/terraform-exec v0.13.0/go.mod h1:SGhto91bVRlgXQWcJ5znSz+29UZIa8kpBbkGwQ+g9E8= -github.com/hashicorp/terraform-json v0.4.0/go.mod h1:eAbqb4w0pSlRmdvl8fOyHAi/+8jnkVYN28gJkSJrLhU= github.com/hashicorp/terraform-json v0.5.0/go.mod h1:eAbqb4w0pSlRmdvl8fOyHAi/+8jnkVYN28gJkSJrLhU= github.com/hashicorp/terraform-json v0.8.0 h1:XObQ3PgqU52YLQKEaJ08QtUshAfN3yu4u8ebSW0vztc= github.com/hashicorp/terraform-json v0.8.0/go.mod h1:3defM4kkMfttwiE7VakJDwCd4R+umhSQnvJwORXbprE= github.com/hashicorp/terraform-plugin-go v0.2.1 h1:EW/R8bB2Zbkjmugzsy1d27yS8/0454b3MtYHkzOknqA= github.com/hashicorp/terraform-plugin-go v0.2.1/go.mod h1:10V6F3taeDWVAoLlkmArKttR3IULlRWFAGtQIQTIDr4= -github.com/hashicorp/terraform-plugin-sdk v1.9.0 h1:WBHHIX/RgF6/lbfMCzx0qKl96BbQy3bexWFvDqt1bhE= -github.com/hashicorp/terraform-plugin-sdk v1.9.0/go.mod h1:C/AXwmDHqbc3h6URiHpIsVKrwV4PS0Sh0+VTaeEkShw= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.0.0/go.mod h1:xOf85UtHJ0/9/EF3eKgZFlJ6feN8sDtjQRWRHhimCUw= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.3 h1:DGnxpIYRHXQZb2TOlQ1OCEYxoRQrAcbLIcYm8kvbFuU= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.3/go.mod h1:5wrrTcxbSaQXamCDbHZTHk6yTF9OEZaOvQ9fvLXBE3o= -github.com/hashicorp/terraform-plugin-test v1.2.0/go.mod h1:QIJHYz8j+xJtdtLrFTlzQVC0ocr3rf/OjIpgZLK56Hs= -github.com/hashicorp/terraform-plugin-test/v2 v2.0.0-20200724200815-faa9931ac59e/go.mod h1:C6VALgUlvaif+PnHyRGKWPTdQkMJK4NQ20VJolxZLI0= -github.com/hashicorp/terraform-svchost v0.0.0-20191011084731-65d371908596/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= +github.com/hashicorp/terraform-plugin-sdk v1.16.1 h1:G2iK7MBT4LuNcVASPXWS1ciBUuIm8oIY0zRfCmi3xy4= +github.com/hashicorp/terraform-plugin-sdk v1.16.1/go.mod h1:KSsGcuZ1JRqnmYzz+sWIiUwNvJkzXbGRIdefwFfOdyY= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0 h1:4EHNOAjwiYCeBxY16rt2KwyRNNVsCaVO3kWBbiXfYM0= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0/go.mod h1:z+cMZ0iswzZOahBJ3XmNWgWkVnAd2bl8g+FhyyuPDH4= +github.com/hashicorp/terraform-plugin-test/v2 v2.1.3/go.mod h1:pmaUHiUtDL/8Mz3FuyZ/vRDb0LpaOWQjVRW9ORF7FHs= +github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= @@ -232,6 +236,8 @@ github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd h1:Coekwdh0v github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba/go.mod h1:ghbZscTyKdM07+Fw3KSi0hcJm+AlEUWj8QLlPtijN/M= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.11.2 h1:MiK62aErc3gIiVEtyzKfeOHgW7atJb5g/KNX5m3c2nQ= +github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -252,7 +258,6 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10= github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.1/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= @@ -297,16 +302,17 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/ulikunitz/xz v0.5.5/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8= -github.com/ulikunitz/xz v0.5.7/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ= github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmihailenco/msgpack v4.0.1+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI= github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= +github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= +github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70= github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -316,10 +322,11 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/zclconf/go-cty v1.0.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= -github.com/zclconf/go-cty v1.2.1 h1:vGMsygfmeCl4Xb6OA5U5XVAaQZ69FvoG7X2jUtQujb8= github.com/zclconf/go-cty v1.2.1/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= +github.com/zclconf/go-cty v1.7.1 h1:AvsC01GMhMLFL8CgEYdHGM+yLnnDOwhPAYcgTkeF0Gw= +github.com/zclconf/go-cty v1.7.1/go.mod h1:VDR4+I79ubFBGm1uJac1226K5yANQFHeauxPBoP54+o= github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= -github.com/zclconf/go-cty-yaml v1.0.1/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgKa8XhiVHura0= +github.com/zclconf/go-cty-yaml v1.0.2/go.mod h1:IP3Ylp0wQpYm50IHK8OZWKMu6sPJIUgKa8XhiVHura0= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -331,7 +338,6 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= @@ -397,14 +403,16 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 h1:ld7aEMNHoBnnDAX15v1T6z31v8HwR2A9FYOuAhWqkwc= +golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -413,9 +421,9 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -443,6 +451,8 @@ golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -493,8 +503,12 @@ golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20200928201943-a0ef9b62deab h1:CyH2SDm5ATQiX9gtbMYfvNNed97A9v+TJFnUX/fTaJY= -golang.org/x/tools v0.0.0-20200928201943-a0ef9b62deab/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= +golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb h1:KVWk3RW1AZlxWum4tYqegLgwJHb5oouozcGM8HfNQaw= +golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -514,8 +528,10 @@ google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/ google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= -google.golang.org/api v0.29.0 h1:BaiDisFir8O4IJxvAabCGGkQ6yCJegNQqSVoYUNAnbk= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/api v0.34.0 h1:k40adF3uR+6x/+hO5Dh4ZFUqFp67vxvbpafFiJxl10A= +google.golang.org/api v0.34.0/go.mod h1:/XrVsuzM0rZmrsbjJutiuftIzeuTQcEeaYcSk/mQ1dg= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -543,7 +559,6 @@ google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200310143817-43be25429f5a/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -551,10 +566,13 @@ google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200711021454-869866162049 h1:YFTFpQhgvrLrmxtiIncJxFXeCyq84ixuKWVCaCAi9Oc= google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d h1:92D1fum1bJLKSdr11OJ+54YeCMCGYIygTA7R/YZxH5M= +google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -566,6 +584,8 @@ google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.32.0 h1:zWTV+LMdc3kaiJMSTOFz2UgSBgx8RNQoTGiZu3fR9S0= google.golang.org/grpc v1.32.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/awsproviderlint/vendor/cloud.google.com/go/CHANGES.md b/awsproviderlint/vendor/cloud.google.com/go/CHANGES.md index 3e9fca4a749f..eff3b8a61a18 100644 --- a/awsproviderlint/vendor/cloud.google.com/go/CHANGES.md +++ b/awsproviderlint/vendor/cloud.google.com/go/CHANGES.md @@ -1,5 +1,82 @@ # Changes +## [0.65.0](https://www.github.com/googleapis/google-cloud-go/compare/v0.64.0...v0.65.0) (2020-08-27) + + +### Announcements + +The following changes will be included in an upcoming release and are not +included in this one. + +#### Default Deadlines + +By default, non-streaming methods, like Create or Get methods, will have a +default deadline applied to the context provided at call time, unless a context +deadline is already set. Streaming methods have no default deadline and will run +indefinitely, unless the context provided at call time contains a deadline. + +To opt-out of this behavior, set the environment variable +`GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE` to `true` prior to +initializing a client. This opt-out mechanism will be removed in a later +release, with a notice similar to this one ahead of its removal. + + +### Features + +* **all:** auto-regenerate gapics , refs [#2774](https://www.github.com/googleapis/google-cloud-go/issues/2774) [#2764](https://www.github.com/googleapis/google-cloud-go/issues/2764) + + +### Bug Fixes + +* **all:** correct minor typos ([#2756](https://www.github.com/googleapis/google-cloud-go/issues/2756)) ([03d78b5](https://www.github.com/googleapis/google-cloud-go/commit/03d78b5627819cb64d1f3866f90043f709e825e1)) +* **compute/metadata:** remove leading slash for Get suffix ([#2760](https://www.github.com/googleapis/google-cloud-go/issues/2760)) ([f0d605c](https://www.github.com/googleapis/google-cloud-go/commit/f0d605ccf32391a9da056a2c551158bd076c128d)) + +## [0.64.0](https://www.github.com/googleapis/google-cloud-go/compare/v0.63.0...v0.64.0) (2020-08-18) + + +### Features + +* **all:** auto-regenerate gapics , refs [#2734](https://www.github.com/googleapis/google-cloud-go/issues/2734) [#2731](https://www.github.com/googleapis/google-cloud-go/issues/2731) [#2730](https://www.github.com/googleapis/google-cloud-go/issues/2730) [#2725](https://www.github.com/googleapis/google-cloud-go/issues/2725) [#2722](https://www.github.com/googleapis/google-cloud-go/issues/2722) [#2706](https://www.github.com/googleapis/google-cloud-go/issues/2706) +* **pubsublite:** start generating v1 ([#2700](https://www.github.com/googleapis/google-cloud-go/issues/2700)) ([d2e777f](https://www.github.com/googleapis/google-cloud-go/commit/d2e777f56e08146646b3ffb7a78856795094ab4e)) + +## [0.63.0](https://www.github.com/googleapis/google-cloud-go/compare/v0.62.0...v0.63.0) (2020-08-05) + + +### Features + +* **all:** auto-regenerate gapics ([#2682](https://www.github.com/googleapis/google-cloud-go/issues/2682)) ([63bfd63](https://www.github.com/googleapis/google-cloud-go/commit/63bfd638da169e0f1f4fa4a5125da2955022dc04)) +* **analytics/admin:** start generating apiv1alpha ([#2670](https://www.github.com/googleapis/google-cloud-go/issues/2670)) ([268199e](https://www.github.com/googleapis/google-cloud-go/commit/268199e5350a64a83ecf198e0e0fa4863f00fa6c)) +* **functions/metadata:** Special-case marshaling ([#2669](https://www.github.com/googleapis/google-cloud-go/issues/2669)) ([d8d7fc6](https://www.github.com/googleapis/google-cloud-go/commit/d8d7fc66cbc42f79bec25fb0daaf53d926e3645b)) +* **gaming:** start generate apiv1 ([#2681](https://www.github.com/googleapis/google-cloud-go/issues/2681)) ([1adfd0a](https://www.github.com/googleapis/google-cloud-go/commit/1adfd0aed6b2c0e1dd0c575a5ec0f49388fa5601)) +* **internal/kokoro:** add script to test compatibility with samples ([#2637](https://www.github.com/googleapis/google-cloud-go/issues/2637)) ([f2aa76a](https://www.github.com/googleapis/google-cloud-go/commit/f2aa76a0058e86c1c33bb634d2c084b58f77ab32)) + +## v0.62.0 + +### Announcements + +- There was a breaking change to `cloud.google.com/go/dataproc/apiv1` that was + merged in [this PR](https://github.com/googleapis/google-cloud-go/pull/2606). + This fixed a broken API response for `DiagnoseCluster`. When polling on the + Long Running Operation(LRO), the API now returns + `(*dataprocpb.DiagnoseClusterResults, error)` whereas it only returned an + `error` before. + +### Changes + +- all: + - Updated all direct dependencies. + - Updated contributing guidelines to suggest allowing edits from maintainers. +- billing/budgets: + - Start generating client for apiv1beta1. +- functions: + - Start generating client for apiv1. +- notebooks: + - Start generating client apiv1beta1. +- profiler: + - update proftest to support parsing floating-point backoff durations. + - Fix the regexp used to parse backoff duration. +- Various updates to autogenerated clients. + ## v0.61.0 ### Changes @@ -1563,4 +1640,3 @@ Natural Language. [`cloud.google.com/go/preview/logging`](https://godoc.org/cloud.google.com/go/preview/logging). This client uses gRPC as its transport layer, and supports log reading, sinks and metrics. It will replace the current client at `cloud.google.com/go/logging` shortly. - diff --git a/awsproviderlint/vendor/cloud.google.com/go/CONTRIBUTING.md b/awsproviderlint/vendor/cloud.google.com/go/CONTRIBUTING.md index 109ca5c43c23..d9775744e5c3 100644 --- a/awsproviderlint/vendor/cloud.google.com/go/CONTRIBUTING.md +++ b/awsproviderlint/vendor/cloud.google.com/go/CONTRIBUTING.md @@ -21,21 +21,25 @@ `cd google-cloud-go` 1. Fork the repo. - + 1. Set your fork as a remote: `git remote add fork git@github.com:GITHUB_USERNAME/google-cloud-go.git` -1. Make changes (see [Formatting](#formatting) and [Style](#style)), commit to - your fork. +1. Make changes, commit to your fork. Commit messages should follow the - [Go project style](https://github.com/golang/go/wiki/CommitMessage). For example: + [Conventional Commits Style](https://www.conventionalcommits.org). The scope + portion should always be filled with the name of the package affected by the + changes being made. For example: ``` - functions: add gophers codelab + feat(functions): add gophers codelab ``` 1. Send a pull request with your changes. + To minimize friction, consider setting `Allow edits from maintainers` on the + PR, which will enable project committers and automation to update your PR. + 1. A maintainer will review the pull request and make comments. Prefer adding additional commits over amending and force-pushing since it can diff --git a/awsproviderlint/vendor/cloud.google.com/go/compute/metadata/metadata.go b/awsproviderlint/vendor/cloud.google.com/go/compute/metadata/metadata.go index 6b13424fd973..545bd9d379ce 100644 --- a/awsproviderlint/vendor/cloud.google.com/go/compute/metadata/metadata.go +++ b/awsproviderlint/vendor/cloud.google.com/go/compute/metadata/metadata.go @@ -296,6 +296,7 @@ func (c *Client) getETag(suffix string) (value, etag string, err error) { // being stable anyway. host = metadataIP } + suffix = strings.TrimLeft(suffix, "/") u := "http://" + host + "/computeMetadata/v1/" + suffix req, err := http.NewRequest("GET", u, nil) if err != nil { diff --git a/awsproviderlint/vendor/cloud.google.com/go/go.mod b/awsproviderlint/vendor/cloud.google.com/go/go.mod index 5bdc67a97f7e..81cd801e6e5b 100644 --- a/awsproviderlint/vendor/cloud.google.com/go/go.mod +++ b/awsproviderlint/vendor/cloud.google.com/go/go.mod @@ -4,21 +4,21 @@ go 1.11 require ( cloud.google.com/go/storage v1.10.0 - github.com/golang/mock v1.4.3 + github.com/golang/mock v1.4.4 github.com/golang/protobuf v1.4.2 - github.com/google/go-cmp v0.5.0 + github.com/google/go-cmp v0.5.1 github.com/google/martian/v3 v3.0.0 github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99 github.com/googleapis/gax-go/v2 v2.0.5 github.com/jstemmer/go-junit-report v0.9.1 go.opencensus.io v0.22.4 golang.org/x/lint v0.0.0-20200302205851-738671d3881b - golang.org/x/net v0.0.0-20200707034311-ab3426394381 + golang.org/x/net v0.0.0-20200822124328-c89045814202 golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d golang.org/x/text v0.3.3 - golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed - google.golang.org/api v0.29.0 - google.golang.org/genproto v0.0.0-20200711021454-869866162049 - google.golang.org/grpc v1.30.0 - google.golang.org/protobuf v1.25.0 // indirect + golang.org/x/tools v0.0.0-20200825202427-b303f430e36d + golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect + google.golang.org/api v0.30.0 + google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 + google.golang.org/grpc v1.31.0 ) diff --git a/awsproviderlint/vendor/cloud.google.com/go/go.sum b/awsproviderlint/vendor/cloud.google.com/go/go.sum index 3736901a5121..cac94f728376 100644 --- a/awsproviderlint/vendor/cloud.google.com/go/go.sum +++ b/awsproviderlint/vendor/cloud.google.com/go/go.sum @@ -11,6 +11,7 @@ cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6 cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= cloud.google.com/go/bigquery v1.0.1 h1:hL+ycaJpVE9M7nLoiXb/Pn10ENE2u+oddxbD8uu0ZVU= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0 h1:sAbMqjY1PEQKZBWfbu6Y6bsupJ9c4QdHnzg/VvYTLcE= @@ -78,6 +79,8 @@ github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= github.com/golang/mock v1.4.3 h1:GV+pQPG/EUUbkh47niozDcADz6go/dUwhVzdUQHIVRw= github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -111,6 +114,8 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.0 h1:/QaMHBdZ26BB3SSst0Iwl10Epc+xhTquomWX0oZEB6w= github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0 h1:pMen7vLs8nvgEYhywH3KDWJIJTeEr2ULsVWHWYHQyBs= @@ -242,6 +247,8 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrS golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381 h1:VXak5I6aEWmAXeQjA+QSZzlgNrpq9mjcfDemuexIKsU= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421 h1:Wo7BWFiOk0QRFMLYMqJGFMd9CgUAcGx7V+qEg/h5IBI= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -295,6 +302,8 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200523222454-059865788121 h1:rITEj+UZHYC927n8GT97eC3zrpzXdb/voyeOuVKS46o= golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642 h1:B6caxRw+hozq68X2MY7jEpZh/cr4/aHLv9xU8Kkadrw= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2 h1:z99zHgr7hKfrUcX/KsoJk5FJfjTceCKIp96+biqP4To= @@ -351,12 +360,17 @@ golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88 h1:4j84u0sokprDu3IdSYHJMmo golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= -golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed h1:+qzWo37K31KxduIYaBeMqJ8MUOyTayOQKpH9aDPLMSY= -golang.org/x/tools v0.0.0-20200713011307-fd294ab11aed/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d h1:szSOL78iTCl0LF1AMjhSWJj8tIM0KixlUUnBtYXsmd8= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d h1:W07d4xkoAUSNOkOzdzXCdFGxT7o2rW4q8M34tB2i//k= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0 h1:VGGbLNyPF7dvYHhcUGYBBGCRDDK0RRJAI6KCvo0CL+E= @@ -379,6 +393,8 @@ google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0M google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= google.golang.org/api v0.29.0 h1:BaiDisFir8O4IJxvAabCGGkQ6yCJegNQqSVoYUNAnbk= google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0 h1:yfrXXP61wVuLb0vBcG6qaOoIoqYEzOQS8jum51jkv2w= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -423,8 +439,11 @@ google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= -google.golang.org/genproto v0.0.0-20200711021454-869866162049 h1:YFTFpQhgvrLrmxtiIncJxFXeCyq84ixuKWVCaCAi9Oc= -google.golang.org/genproto v0.0.0-20200711021454-869866162049/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c h1:Lq4llNryJoaVFRmvrIwC/ZHH7tNt4tUYIu8+se2aayY= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987 h1:PDIOdWxZ8eRizhKa1AAvY53xsvLB1cWorMjslvY3VA8= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/grpc v1.19.0 h1:cfg4PD8YEdSFnm7qLV4++93WcmhH2nIUhMjhdCvl3j8= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1 h1:Hz2g2wirWK7H0qIIhGIqRGTuMwTE8HEKFnDZZ7lm9NU= @@ -441,8 +460,9 @@ google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.29.1 h1:EC2SB8S04d2r73uptxphDSUG+kTKVgjRPF+N3xpxRB4= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= -google.golang.org/grpc v1.30.0 h1:M5a8xTlYTxwMn5ZFkwhRabsygDY5G8TYLyQDBxJNAxE= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0 h1:T7P4R73V3SSDPhH7WW7ATbfViLtmamH0DKrP3f9AuDI= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/awsproviderlint/vendor/cloud.google.com/go/internal/.repo-metadata-full.json b/awsproviderlint/vendor/cloud.google.com/go/internal/.repo-metadata-full.json index 77368c010996..536f89cb36e8 100644 --- a/awsproviderlint/vendor/cloud.google.com/go/internal/.repo-metadata-full.json +++ b/awsproviderlint/vendor/cloud.google.com/go/internal/.repo-metadata-full.json @@ -1,4 +1,12 @@ { + "cloud.google.com/go/analytics/admin/apiv1alpha": { + "distribution_name": "cloud.google.com/go/analytics/admin/apiv1alpha", + "description": "", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://pkg.go.dev/cloud.google.com/go/analytics/admin/apiv1alpha", + "release_level": "alpha" + }, "cloud.google.com/go/asset/apiv1": { "distribution_name": "cloud.google.com/go/asset/apiv1", "description": "Cloud Asset API", @@ -143,6 +151,14 @@ "docs_url": "https://pkg.go.dev/cloud.google.com/go/billing/apiv1", "release_level": "ga" }, + "cloud.google.com/go/billing/budgets/apiv1beta1": { + "distribution_name": "cloud.google.com/go/billing/budgets/apiv1beta1", + "description": "", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://pkg.go.dev/cloud.google.com/go/billing/budgets/apiv1beta1", + "release_level": "beta" + }, "cloud.google.com/go/cloudbuild/apiv1/v2": { "distribution_name": "cloud.google.com/go/cloudbuild/apiv1/v2", "description": "Cloud Build API", @@ -303,6 +319,22 @@ "docs_url": "https://pkg.go.dev/cloud.google.com/go/firestore/apiv1/admin", "release_level": "ga" }, + "cloud.google.com/go/functions/apiv1": { + "distribution_name": "cloud.google.com/go/functions/apiv1", + "description": "", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://pkg.go.dev/cloud.google.com/go/functions/apiv1", + "release_level": "beta" + }, + "cloud.google.com/go/gaming/apiv1": { + "distribution_name": "cloud.google.com/go/gaming/apiv1", + "description": "", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://pkg.go.dev/cloud.google.com/go/gaming/apiv1", + "release_level": "beta" + }, "cloud.google.com/go/gaming/apiv1beta": { "distribution_name": "cloud.google.com/go/gaming/apiv1beta", "description": "", @@ -407,6 +439,14 @@ "docs_url": "https://pkg.go.dev/cloud.google.com/go/monitoring/dashboard/apiv1", "release_level": "beta" }, + "cloud.google.com/go/notebooks/apiv1beta1": { + "distribution_name": "cloud.google.com/go/notebooks/apiv1beta1", + "description": "Notebooks API", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://pkg.go.dev/cloud.google.com/go/notebooks/apiv1beta1", + "release_level": "beta" + }, "cloud.google.com/go/osconfig/agentendpoint/apiv1": { "distribution_name": "cloud.google.com/go/osconfig/agentendpoint/apiv1", "description": "Cloud OS Config API", @@ -471,6 +511,14 @@ "docs_url": "https://pkg.go.dev/cloud.google.com/go/policytroubleshooter/apiv1", "release_level": "beta" }, + "cloud.google.com/go/profiler": { + "distribution_name": "cloud.google.com/go/profiler", + "description": "Cloud Profiler", + "language": "Go", + "client_library_type": "manual", + "docs_url": "https://pkg.go.dev/cloud.google.com/go/profiler", + "release_level": "ga" + }, "cloud.google.com/go/pubsub": { "distribution_name": "cloud.google.com/go/pubsub", "description": "Cloud PubSub", @@ -487,6 +535,14 @@ "docs_url": "https://pkg.go.dev/cloud.google.com/go/pubsub/apiv1", "release_level": "ga" }, + "cloud.google.com/go/pubsublite/apiv1": { + "distribution_name": "cloud.google.com/go/pubsublite/apiv1", + "description": "", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://pkg.go.dev/cloud.google.com/go/pubsublite/apiv1", + "release_level": "beta" + }, "cloud.google.com/go/recaptchaenterprise/apiv1": { "distribution_name": "cloud.google.com/go/recaptchaenterprise/apiv1", "description": "reCAPTCHA Enterprise API", @@ -585,7 +641,7 @@ }, "cloud.google.com/go/securitycenter/apiv1beta1": { "distribution_name": "cloud.google.com/go/securitycenter/apiv1beta1", - "description": "Cloud Security Command Center API", + "description": "Security Command Center API", "language": "Go", "client_library_type": "generated", "docs_url": "https://pkg.go.dev/cloud.google.com/go/securitycenter/apiv1beta1", diff --git a/awsproviderlint/vendor/cloud.google.com/go/internal/version/version.go b/awsproviderlint/vendor/cloud.google.com/go/internal/version/version.go index 3328019a3afd..f3dca3d0472d 100644 --- a/awsproviderlint/vendor/cloud.google.com/go/internal/version/version.go +++ b/awsproviderlint/vendor/cloud.google.com/go/internal/version/version.go @@ -26,7 +26,7 @@ import ( // Repo is the current version of the client libraries in this // repo. It should be a date in YYYYMMDD format. -const Repo = "20200706" +const Repo = "20200817" // Go returns the Go runtime version. The returned string // has no whitespace. diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/generate.go b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/generate.go deleted file mode 100644 index 81f3a7471783..000000000000 --- a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/generate.go +++ /dev/null @@ -1,7 +0,0 @@ -package textseg - -//go:generate go run make_tables.go -output tables.go -//go:generate go run make_test_tables.go -output tables_test.go -//go:generate ruby unicode2ragel.rb --url=http://www.unicode.org/Public/9.0.0/ucd/auxiliary/GraphemeBreakProperty.txt -m GraphemeCluster -p "Prepend,CR,LF,Control,Extend,Regional_Indicator,SpacingMark,L,V,T,LV,LVT,E_Base,E_Modifier,ZWJ,Glue_After_Zwj,E_Base_GAZ" -o grapheme_clusters_table.rl -//go:generate ragel -Z grapheme_clusters.rl -//go:generate gofmt -w grapheme_clusters.go diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.go b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.go deleted file mode 100644 index 012bc690aa1a..000000000000 --- a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.go +++ /dev/null @@ -1,5276 +0,0 @@ - -// line 1 "grapheme_clusters.rl" -package textseg - -import ( - "errors" - "unicode/utf8" -) - -// Generated from grapheme_clusters.rl. DO NOT EDIT - -// line 13 "grapheme_clusters.go" -var _graphclust_actions []byte = []byte{ - 0, 1, 0, 1, 4, 1, 9, 1, 10, - 1, 11, 1, 12, 1, 13, 1, 14, - 1, 15, 1, 16, 1, 17, 1, 18, - 1, 19, 1, 20, 1, 21, 2, 1, - 7, 2, 1, 8, 2, 2, 3, 2, - 5, 1, 3, 0, 1, 8, 3, 5, - 0, 1, 3, 5, 1, 6, -} - -var _graphclust_key_offsets []int16 = []int16{ - 0, 0, 1, 3, 5, 7, 10, 15, - 17, 20, 28, 31, 33, 35, 37, 67, - 75, 77, 81, 84, 89, 94, 104, 116, - 122, 127, 137, 140, 147, 151, 159, 169, - 173, 181, 183, 191, 194, 196, 201, 203, - 210, 212, 220, 221, 242, 246, 252, 257, - 259, 263, 267, 269, 273, 275, 278, 282, - 284, 291, 293, 297, 301, 305, 307, 309, - 318, 322, 327, 329, 335, 337, 338, 340, - 341, 343, 345, 347, 349, 364, 368, 370, - 372, 377, 381, 385, 387, 389, 393, 397, - 399, 403, 410, 415, 419, 422, 423, 427, - 434, 439, 440, 441, 443, 452, 454, 477, - 481, 483, 487, 491, 492, 496, 500, 503, - 505, 510, 523, 525, 527, 529, 531, 535, - 539, 541, 543, 545, 549, 553, 557, 559, - 561, 563, 565, 566, 568, 574, 580, 586, - 588, 592, 596, 601, 604, 614, 616, 618, - 621, 623, 625, 627, 629, 632, 637, 639, - 642, 650, 653, 655, 657, 659, 690, 698, - 700, 704, 711, 723, 730, 744, 750, 768, - 779, 785, 797, 800, 809, 814, 824, 830, - 844, 850, 862, 874, 878, 880, 886, 888, - 895, 898, 906, 907, 928, 937, 945, 951, - 953, 957, 961, 966, 972, 974, 977, 990, - 995, 1009, 1011, 1020, 1027, 1038, 1048, 1056, - 1067, 1071, 1076, 1078, 1080, 1082, 1083, 1085, - 1087, 1089, 1091, 1106, 1110, 1112, 1114, 1122, - 1130, 1132, 1136, 1147, 1150, 1160, 1164, 1171, - 1179, 1185, 1188, 1189, 1193, 1200, 1205, 1206, - 1207, 1209, 1218, 1220, 1243, 1248, 1250, 1259, - 1264, 1265, 1274, 1280, 1290, 1295, 1302, 1316, - 1320, 1325, 1336, 1339, 1349, 1353, 1362, 1364, - 1372, 1379, 1385, 1392, 1396, 1398, 1400, 1402, - 1403, 1405, 1411, 1419, 1425, 1427, 1431, 1435, - 1440, 1443, 1453, 1455, 1457, 1458, 1460, 1461, - 1467, 1469, 1471, 1471, 1472, 1473, 1474, 1480, - 1482, 1484, 1484, 1490, 1492, 1497, 1502, 1504, - 1506, 1508, 1511, 1516, 1518, 1521, 1529, 1532, - 1534, 1536, 1538, 1568, 1576, 1578, 1582, 1585, - 1590, 1595, 1605, 1617, 1623, 1628, 1638, 1641, - 1648, 1652, 1660, 1670, 1674, 1682, 1684, 1692, - 1695, 1697, 1702, 1704, 1711, 1713, 1721, 1722, - 1743, 1747, 1753, 1758, 1760, 1764, 1768, 1770, - 1774, 1776, 1779, 1783, 1785, 1792, 1794, 1798, - 1802, 1806, 1808, 1810, 1819, 1823, 1828, 1830, - 1836, 1838, 1839, 1841, 1842, 1844, 1846, 1848, - 1850, 1865, 1869, 1871, 1873, 1878, 1882, 1886, - 1888, 1890, 1894, 1898, 1900, 1904, 1911, 1916, - 1920, 1923, 1924, 1928, 1935, 1940, 1941, 1942, - 1944, 1953, 1955, 1978, 1982, 1984, 1988, 1992, - 1993, 1997, 2001, 2004, 2006, 2011, 2024, 2026, - 2028, 2030, 2032, 2036, 2040, 2042, 2044, 2046, - 2050, 2054, 2058, 2060, 2062, 2064, 2066, 2067, - 2069, 2075, 2081, 2087, 2089, 2093, 2097, 2102, - 2105, 2115, 2117, 2119, 2122, 2124, 2126, 2128, - 2130, 2133, 2138, 2140, 2143, 2151, 2154, 2156, - 2158, 2160, 2191, 2199, 2201, 2205, 2212, 2224, - 2231, 2245, 2251, 2269, 2280, 2286, 2298, 2301, - 2310, 2315, 2325, 2331, 2345, 2351, 2363, 2375, - 2379, 2381, 2387, 2389, 2396, 2399, 2407, 2408, - 2429, 2438, 2446, 2452, 2454, 2458, 2462, 2467, - 2473, 2475, 2478, 2491, 2496, 2510, 2512, 2521, - 2528, 2539, 2549, 2557, 2568, 2572, 2577, 2579, - 2581, 2583, 2584, 2586, 2588, 2590, 2592, 2607, - 2611, 2613, 2615, 2623, 2631, 2633, 2637, 2648, - 2651, 2661, 2665, 2672, 2680, 2686, 2689, 2690, - 2694, 2701, 2706, 2707, 2708, 2710, 2719, 2721, - 2744, 2749, 2751, 2760, 2765, 2766, 2775, 2781, - 2791, 2796, 2803, 2817, 2821, 2826, 2837, 2840, - 2850, 2854, 2863, 2865, 2873, 2880, 2886, 2893, - 2897, 2899, 2901, 2903, 2904, 2906, 2912, 2920, - 2926, 2928, 2932, 2936, 2941, 2944, 2954, 2956, - 2958, 2959, 2961, 2962, 2968, 2970, 2972, 2972, - 2973, 2974, 2975, 2981, 2983, 2985, 2985, 2991, - 2993, 2997, 3003, 3006, 3009, 3013, 3016, 3019, - 3026, 3028, 3052, 3054, 3078, 3080, 3082, 3105, - 3107, 3109, 3110, 3112, 3114, 3116, 3122, 3124, - 3156, 3160, 3165, 3188, 3190, 3192, 3194, 3196, - 3199, 3201, 3203, 3207, 3207, 3263, 3319, 3350, - 3355, 3359, 3366, 3374, 3378, 3381, 3384, 3390, - 3392, 3412, 3418, 3423, 3425, 3427, 3430, 3432, - 3434, 3438, 3494, 3550, 3581, 3586, 3594, 3598, - 3600, 3605, 3611, 3615, 3618, 3624, 3627, 3631, - 3634, 3638, 3651, 3655, 3662, 3663, 3665, 3668, - 3678, 3698, 3705, 3709, 3716, 3726, 3733, 3736, - 3751, 3753, 3756, 3761, 3763, 3766, 3769, 3773, - 3776, 3779, 3786, 3788, 3790, 3792, 3794, 3797, - 3802, 3804, 3807, 3815, 3818, 3820, 3822, 3824, - 3854, 3862, 3864, 3868, 3871, 3876, 3881, 3891, - 3903, 3909, 3914, 3924, 3927, 3934, 3938, 3946, - 3956, 3960, 3968, 3970, 3978, 3981, 3983, 3988, - 3990, 3997, 3999, 4007, 4008, 4029, 4033, 4039, - 4044, 4046, 4050, 4054, 4056, 4060, 4062, 4065, - 4069, 4071, 4078, 4080, 4084, 4088, 4092, 4094, - 4096, 4105, 4109, 4114, 4116, 4122, 4124, 4125, - 4127, 4128, 4130, 4132, 4134, 4136, 4151, 4155, - 4157, 4159, 4164, 4168, 4172, 4174, 4176, 4180, - 4184, 4186, 4190, 4197, 4202, 4206, 4209, 4210, - 4214, 4221, 4226, 4227, 4228, 4230, 4239, 4241, - 4264, 4268, 4270, 4274, 4278, 4279, 4283, 4287, - 4290, 4292, 4297, 4310, 4312, 4314, 4316, 4318, - 4322, 4326, 4328, 4330, 4332, 4336, 4340, 4344, - 4346, 4348, 4350, 4352, 4353, 4355, 4361, 4367, - 4373, 4375, 4379, 4383, 4388, 4391, 4401, 4403, - 4405, 4408, 4410, 4412, 4414, 4416, 4419, 4424, - 4426, 4429, 4437, 4440, 4442, 4444, 4446, 4477, - 4485, 4487, 4491, 4498, 4510, 4517, 4531, 4537, - 4555, 4566, 4572, 4584, 4587, 4596, 4601, 4611, - 4617, 4631, 4637, 4649, 4661, 4665, 4667, 4673, - 4675, 4682, 4685, 4693, 4694, 4715, 4724, 4732, - 4738, 4740, 4744, 4748, 4753, 4759, 4761, 4764, - 4777, 4782, 4796, 4798, 4807, 4814, 4825, 4835, - 4843, 4854, 4858, 4863, 4865, 4867, 4869, 4870, - 4872, 4874, 4876, 4878, 4893, 4897, 4899, 4901, - 4909, 4917, 4919, 4923, 4934, 4937, 4947, 4951, - 4958, 4966, 4972, 4975, 4976, 4980, 4987, 4992, - 4993, 4994, 4996, 5005, 5007, 5030, 5035, 5037, - 5046, 5051, 5052, 5061, 5067, 5077, 5082, 5089, - 5103, 5107, 5112, 5123, 5126, 5136, 5140, 5149, - 5151, 5159, 5166, 5172, 5179, 5183, 5185, 5187, - 5189, 5190, 5192, 5198, 5206, 5212, 5214, 5218, - 5222, 5227, 5230, 5240, 5242, 5244, 5245, 5247, - 5248, 5254, 5256, 5258, 5258, 5259, 5260, 5261, - 5267, 5269, 5271, 5271, 5277, 5301, 5303, 5327, - 5329, 5331, 5354, 5356, 5358, 5359, 5361, 5363, - 5365, 5371, 5373, 5405, 5409, 5414, 5437, 5439, - 5441, 5443, 5445, 5448, 5450, 5452, 5456, 5456, - 5512, 5568, 5599, 5604, 5607, 5614, 5626, 5628, - 5630, 5632, 5635, 5640, 5642, 5645, 5653, 5656, - 5658, 5660, 5662, 5692, 5700, 5702, 5706, 5709, - 5714, 5719, 5729, 5741, 5747, 5752, 5762, 5765, - 5772, 5776, 5784, 5794, 5798, 5806, 5808, 5816, - 5819, 5821, 5826, 5828, 5835, 5837, 5845, 5846, - 5867, 5871, 5877, 5882, 5884, 5888, 5892, 5894, - 5898, 5900, 5903, 5907, 5909, 5916, 5918, 5922, - 5926, 5930, 5932, 5934, 5943, 5947, 5952, 5954, - 5956, 5958, 5959, 5961, 5963, 5965, 5967, 5982, - 5986, 5988, 5990, 5995, 5999, 6003, 6005, 6007, - 6011, 6015, 6017, 6021, 6028, 6033, 6037, 6040, - 6041, 6045, 6051, 6056, 6057, 6058, 6060, 6069, - 6071, 6094, 6098, 6100, 6104, 6108, 6109, 6113, - 6117, 6120, 6122, 6127, 6140, 6142, 6144, 6146, - 6148, 6152, 6156, 6158, 6160, 6162, 6166, 6170, - 6174, 6176, 6178, 6180, 6182, 6183, 6185, 6191, - 6197, 6203, 6205, 6209, 6213, 6218, 6221, 6231, - 6233, 6235, 6236, 6242, 6244, 6246, 6246, 6252, - 6253, 6260, 6263, 6265, 6267, 6269, 6271, 6274, - 6279, 6281, 6284, 6292, 6295, 6297, 6299, 6301, - 6332, 6340, 6342, 6346, 6353, 6365, 6372, 6386, - 6392, 6410, 6421, 6427, 6439, 6442, 6451, 6456, - 6466, 6472, 6486, 6492, 6504, 6516, 6520, 6522, - 6528, 6530, 6537, 6540, 6548, 6549, 6570, 6579, - 6587, 6593, 6595, 6599, 6603, 6608, 6614, 6616, - 6619, 6632, 6637, 6651, 6653, 6662, 6669, 6680, - 6690, 6698, 6709, 6713, 6718, 6720, 6722, 6724, - 6725, 6727, 6729, 6731, 6733, 6748, 6752, 6754, - 6756, 6764, 6772, 6774, 6778, 6789, 6792, 6802, - 6806, 6813, 6821, 6827, 6830, 6831, 6835, 6842, - 6847, 6848, 6849, 6851, 6860, 6862, 6885, 6890, - 6892, 6901, 6906, 6907, 6916, 6922, 6932, 6937, - 6944, 6958, 6962, 6967, 6978, 6981, 6991, 6995, - 7004, 7006, 7014, 7021, 7027, 7034, 7038, 7040, - 7042, 7044, 7045, 7047, 7053, 7061, 7067, 7069, - 7073, 7077, 7082, 7085, 7095, 7097, 7099, 7100, - 7102, 7103, 7109, 7111, 7113, 7113, 7114, 7115, - 7121, 7124, 7126, 7128, 7130, 7133, 7138, 7140, - 7143, 7151, 7154, 7156, 7158, 7160, 7191, 7199, - 7201, 7205, 7212, 7214, 7216, 7218, 7221, 7226, - 7228, 7231, 7239, 7242, 7244, 7246, 7248, 7278, - 7286, 7288, 7292, 7295, 7300, 7305, 7315, 7327, - 7333, 7338, 7348, 7351, 7358, 7362, 7370, 7380, - 7384, 7392, 7394, 7402, 7405, 7407, 7412, 7414, - 7421, 7423, 7431, 7432, 7453, 7457, 7463, 7468, - 7470, 7474, 7478, 7480, 7484, 7486, 7489, 7493, - 7495, 7502, 7504, 7508, 7512, 7516, 7518, 7520, - 7529, 7533, 7538, 7540, 7546, 7548, 7549, 7551, - 7552, 7554, 7556, 7558, 7560, 7575, 7579, 7581, - 7583, 7588, 7592, 7596, 7598, 7600, 7604, 7608, - 7610, 7614, 7621, 7626, 7630, 7633, 7634, 7638, - 7645, 7650, 7651, 7652, 7654, 7663, 7665, 7688, - 7692, 7694, 7698, 7702, 7703, 7707, 7711, 7714, - 7716, 7721, 7734, 7736, 7738, 7740, 7742, 7746, - 7750, 7752, 7754, 7756, 7760, 7764, 7768, 7770, - 7772, 7774, 7776, 7777, 7779, 7785, 7791, 7797, - 7799, 7803, 7807, 7812, 7815, 7825, 7827, 7829, - 7832, 7834, 7835, 7836, 7837, 7843, 7845, 7847, - 7847, 7853, 7865, 7872, 7886, 7892, 7910, 7921, - 7927, 7939, 7942, 7951, 7956, 7966, 7972, 7986, - 7992, 8004, 8016, 8020, 8022, 8028, 8030, 8037, - 8040, 8048, 8049, 8070, 8079, 8087, 8093, 8095, - 8099, 8103, 8108, 8114, 8116, 8119, 8132, 8137, - 8151, 8153, 8162, 8169, 8180, 8190, 8198, 8209, - 8213, 8218, 8220, 8222, 8224, 8225, 8227, 8229, - 8231, 8233, 8248, 8252, 8254, 8256, 8264, 8272, - 8274, 8278, 8289, 8292, 8302, 8306, 8313, 8321, - 8327, 8330, 8331, 8335, 8342, 8347, 8348, 8349, - 8351, 8360, 8362, 8385, 8390, 8392, 8401, 8406, - 8407, 8416, 8422, 8432, 8437, 8444, 8458, 8462, - 8467, 8478, 8481, 8491, 8495, 8504, 8506, 8514, - 8521, 8527, 8534, 8538, 8540, 8542, 8544, 8545, - 8547, 8553, 8561, 8567, 8569, 8573, 8577, 8582, - 8585, 8595, 8597, 8599, 8600, 8602, 8603, 8609, - 8611, 8613, 8613, 8616, 8622, 8624, 8644, 8650, - 8655, 8657, 8659, 8662, 8664, 8666, 8670, 8726, - 8782, 8817, 8822, 8830, 8832, 8832, 8834, 8838, - 8841, 8848, 8854, 8858, 8861, 8867, 8870, 8876, - 8879, 8885, 8898, 8902, 8904, 8906, 8908, 8911, - 8916, 8918, 8921, 8929, 8932, 8934, 8936, 8938, - 8968, 8976, 8978, 8982, 8985, 8990, 8995, 9005, - 9017, 9023, 9028, 9038, 9041, 9048, 9052, 9060, - 9070, 9074, 9082, 9084, 9092, 9095, 9097, 9102, - 9104, 9111, 9113, 9121, 9122, 9143, 9147, 9153, - 9158, 9160, 9164, 9168, 9170, 9174, 9176, 9179, - 9183, 9185, 9192, 9194, 9198, 9202, 9206, 9208, - 9210, 9219, 9223, 9228, 9230, 9236, 9238, 9239, - 9241, 9242, 9244, 9246, 9248, 9250, 9265, 9269, - 9271, 9273, 9278, 9282, 9286, 9288, 9290, 9294, - 9298, 9300, 9304, 9311, 9316, 9320, 9323, 9324, - 9328, 9335, 9340, 9341, 9342, 9344, 9353, 9355, - 9378, 9382, 9384, 9388, 9392, 9393, 9397, 9401, - 9404, 9406, 9411, 9424, 9426, 9428, 9430, 9432, - 9436, 9440, 9442, 9444, 9446, 9450, 9454, 9458, - 9460, 9462, 9464, 9466, 9467, 9469, 9475, 9481, - 9487, 9489, 9493, 9497, 9502, 9505, 9515, 9517, - 9519, 9522, 9524, 9526, 9528, 9530, 9533, 9538, - 9540, 9543, 9551, 9554, 9556, 9558, 9560, 9591, - 9599, 9601, 9605, 9612, 9624, 9631, 9645, 9651, - 9669, 9680, 9686, 9698, 9701, 9710, 9715, 9725, - 9731, 9745, 9751, 9763, 9775, 9779, 9781, 9787, - 9789, 9796, 9799, 9807, 9808, 9829, 9838, 9846, - 9852, 9854, 9858, 9862, 9867, 9873, 9875, 9878, - 9891, 9896, 9910, 9912, 9921, 9928, 9939, 9949, - 9957, 9968, 9972, 9977, 9979, 9981, 9983, 9984, - 9986, 9988, 9990, 9992, 10007, 10011, 10013, 10015, - 10023, 10031, 10033, 10037, 10048, 10051, 10061, 10065, - 10072, 10080, 10086, 10089, 10090, 10094, 10101, 10106, - 10107, 10108, 10110, 10119, 10121, 10144, 10149, 10151, - 10160, 10165, 10166, 10175, 10181, 10191, 10196, 10203, - 10217, 10221, 10226, 10237, 10240, 10250, 10254, 10263, - 10265, 10273, 10280, 10286, 10293, 10297, 10299, 10301, - 10303, 10304, 10306, 10312, 10320, 10326, 10328, 10332, - 10336, 10341, 10344, 10354, 10356, 10358, 10359, 10361, - 10362, 10368, 10370, 10372, 10372, 10373, 10374, 10375, - 10381, 10383, 10385, 10385, 10391, 10398, 10399, 10401, - 10404, 10414, 10434, 10441, 10445, 10452, 10462, 10469, - 10472, 10487, 10489, 10492, 10501, 10505, 10509, 10538, - 10558, 10578, 10598, 10620, 10640, 10660, 10680, 10703, - 10724, 10745, 10766, 10786, 10809, 10829, 10849, 10869, - 10890, 10911, 10932, 10952, 10972, 10992, 11012, 11032, - 11052, 11072, 11092, 11112, -} - -var _graphclust_trans_keys []byte = []byte{ - 10, 128, 255, 176, 255, 131, 137, 191, - 145, 189, 135, 129, 130, 132, 133, 144, - 154, 176, 139, 159, 150, 156, 159, 164, - 167, 168, 170, 173, 145, 176, 255, 139, - 255, 166, 176, 171, 179, 160, 161, 163, - 164, 165, 167, 169, 171, 173, 174, 175, - 176, 177, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 166, - 170, 172, 178, 150, 153, 155, 163, 165, - 167, 169, 173, 153, 155, 148, 161, 163, - 255, 189, 132, 185, 144, 152, 161, 164, - 255, 188, 129, 131, 190, 255, 133, 134, - 137, 138, 142, 150, 152, 161, 164, 255, - 131, 134, 137, 138, 142, 144, 146, 175, - 178, 180, 182, 255, 134, 138, 142, 161, - 164, 255, 188, 129, 131, 190, 191, 128, - 132, 135, 136, 139, 141, 150, 151, 162, - 163, 130, 190, 191, 151, 128, 130, 134, - 136, 138, 141, 128, 131, 190, 255, 133, - 137, 142, 148, 151, 161, 164, 255, 128, - 132, 134, 136, 138, 141, 149, 150, 162, - 163, 129, 131, 190, 255, 133, 137, 142, - 150, 152, 161, 164, 255, 130, 131, 138, - 150, 143, 148, 152, 159, 178, 179, 177, - 179, 186, 135, 142, 177, 179, 185, 187, - 188, 136, 141, 181, 183, 185, 152, 153, - 190, 191, 177, 191, 128, 132, 134, 135, - 141, 151, 153, 188, 134, 128, 129, 130, - 141, 156, 157, 158, 159, 160, 162, 164, - 168, 169, 170, 172, 173, 174, 175, 176, - 179, 183, 173, 183, 185, 190, 150, 153, - 158, 160, 177, 180, 130, 141, 157, 132, - 134, 157, 159, 146, 148, 178, 180, 146, - 147, 178, 179, 180, 255, 148, 156, 158, - 255, 139, 141, 169, 133, 134, 160, 171, - 176, 187, 151, 155, 160, 162, 191, 149, - 158, 165, 188, 176, 190, 128, 132, 180, - 255, 133, 170, 180, 255, 128, 130, 161, - 173, 166, 179, 164, 183, 173, 144, 146, - 148, 168, 178, 180, 184, 185, 128, 181, - 187, 191, 128, 131, 179, 181, 183, 140, - 141, 128, 131, 157, 179, 181, 183, 144, - 176, 164, 175, 177, 191, 160, 191, 128, - 130, 170, 175, 153, 154, 153, 154, 155, - 160, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 175, 175, 178, 180, 189, - 158, 159, 176, 177, 130, 134, 139, 163, - 167, 128, 129, 180, 255, 134, 159, 178, - 255, 166, 173, 135, 147, 128, 131, 179, - 255, 129, 164, 166, 255, 169, 182, 131, - 188, 140, 141, 176, 178, 180, 183, 184, - 190, 191, 129, 171, 175, 181, 182, 163, - 170, 172, 173, 172, 184, 190, 158, 128, - 143, 160, 175, 144, 145, 150, 155, 157, - 158, 159, 135, 139, 141, 168, 171, 189, - 160, 182, 186, 191, 129, 131, 133, 134, - 140, 143, 184, 186, 165, 166, 128, 129, - 130, 132, 133, 134, 135, 136, 139, 140, - 141, 144, 145, 146, 147, 150, 151, 152, - 153, 154, 156, 176, 178, 128, 130, 184, - 255, 135, 190, 131, 175, 187, 255, 128, - 130, 167, 180, 179, 128, 130, 179, 255, - 129, 137, 141, 255, 190, 172, 183, 159, - 170, 188, 128, 131, 190, 191, 151, 128, - 132, 135, 136, 139, 141, 162, 163, 166, - 172, 176, 180, 181, 191, 128, 134, 176, - 255, 132, 255, 175, 181, 184, 255, 129, - 155, 158, 255, 129, 255, 171, 183, 157, - 171, 175, 182, 184, 191, 146, 167, 169, - 182, 171, 172, 189, 190, 176, 180, 176, - 182, 145, 190, 143, 146, 178, 157, 158, - 133, 134, 137, 168, 169, 170, 165, 169, - 173, 178, 187, 255, 131, 132, 140, 169, - 174, 255, 130, 132, 128, 182, 187, 255, - 173, 180, 182, 255, 132, 155, 159, 161, - 175, 128, 163, 165, 128, 134, 136, 152, - 155, 161, 163, 164, 166, 170, 144, 150, - 132, 138, 145, 146, 151, 166, 169, 0, - 127, 176, 255, 131, 137, 191, 145, 189, - 135, 129, 130, 132, 133, 144, 154, 176, - 139, 159, 150, 156, 159, 164, 167, 168, - 170, 173, 145, 176, 255, 139, 255, 166, - 176, 171, 179, 160, 161, 163, 164, 165, - 166, 167, 169, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, - 168, 170, 150, 153, 155, 163, 165, 167, - 169, 173, 153, 155, 148, 161, 163, 255, - 131, 187, 189, 132, 185, 190, 255, 141, - 144, 129, 136, 145, 151, 152, 161, 162, - 163, 164, 255, 129, 188, 190, 130, 131, - 191, 255, 141, 151, 129, 132, 133, 134, - 137, 138, 142, 161, 162, 163, 164, 255, - 131, 188, 129, 130, 190, 255, 145, 181, - 129, 130, 131, 134, 135, 136, 137, 138, - 139, 141, 142, 175, 176, 177, 178, 255, - 134, 138, 141, 129, 136, 142, 161, 162, - 163, 164, 255, 129, 188, 130, 131, 190, - 191, 128, 141, 129, 132, 135, 136, 139, - 140, 150, 151, 162, 163, 130, 190, 191, - 128, 141, 151, 129, 130, 134, 136, 138, - 140, 128, 129, 131, 190, 255, 133, 137, - 129, 132, 142, 148, 151, 161, 164, 255, - 129, 188, 190, 191, 130, 131, 130, 134, - 128, 132, 135, 136, 138, 139, 140, 141, - 149, 150, 162, 163, 129, 190, 130, 131, - 191, 255, 133, 137, 141, 151, 129, 132, - 142, 161, 162, 163, 164, 255, 138, 143, - 150, 159, 144, 145, 146, 148, 152, 158, - 178, 179, 177, 179, 180, 186, 135, 142, - 177, 179, 180, 185, 187, 188, 136, 141, - 181, 183, 185, 152, 153, 190, 191, 191, - 177, 190, 128, 132, 134, 135, 141, 151, - 153, 188, 134, 128, 129, 130, 141, 156, - 157, 158, 159, 160, 162, 164, 168, 169, - 170, 172, 173, 174, 175, 176, 179, 183, - 177, 173, 183, 185, 186, 187, 188, 189, - 190, 150, 151, 152, 153, 158, 160, 177, - 180, 130, 132, 141, 157, 133, 134, 157, - 159, 146, 148, 178, 180, 146, 147, 178, - 179, 182, 180, 189, 190, 255, 134, 157, - 137, 147, 148, 255, 139, 141, 169, 133, - 134, 178, 160, 162, 163, 166, 167, 168, - 169, 171, 176, 184, 185, 187, 155, 151, - 152, 153, 154, 150, 160, 162, 191, 149, - 151, 152, 158, 165, 172, 173, 178, 179, - 188, 176, 190, 132, 181, 187, 128, 131, - 180, 188, 189, 255, 130, 133, 170, 171, - 179, 180, 255, 130, 161, 170, 128, 129, - 162, 165, 166, 167, 168, 173, 167, 173, - 166, 169, 170, 174, 175, 177, 178, 179, - 164, 171, 172, 179, 180, 181, 182, 183, - 161, 173, 180, 144, 146, 148, 168, 178, - 179, 184, 185, 128, 181, 187, 191, 128, - 131, 179, 181, 183, 140, 141, 144, 176, - 175, 177, 191, 160, 191, 128, 130, 170, - 175, 153, 154, 153, 154, 155, 160, 162, - 163, 164, 165, 166, 167, 168, 169, 170, - 171, 175, 175, 178, 180, 189, 158, 159, - 176, 177, 130, 134, 139, 167, 163, 164, - 165, 166, 132, 133, 134, 159, 160, 177, - 178, 255, 166, 173, 135, 145, 146, 147, - 131, 179, 188, 128, 130, 180, 181, 182, - 185, 186, 255, 165, 129, 255, 169, 174, - 175, 176, 177, 178, 179, 180, 181, 182, - 131, 140, 141, 188, 176, 178, 180, 183, - 184, 190, 191, 129, 171, 181, 182, 172, - 173, 174, 175, 165, 168, 172, 173, 163, - 170, 172, 184, 190, 158, 128, 143, 160, - 175, 144, 145, 150, 155, 157, 158, 159, - 135, 139, 141, 168, 171, 189, 160, 182, - 186, 191, 129, 131, 133, 134, 140, 143, - 184, 186, 165, 166, 128, 129, 130, 132, - 133, 134, 135, 136, 139, 140, 141, 144, - 145, 146, 147, 150, 151, 152, 153, 154, - 156, 176, 178, 129, 128, 130, 184, 255, - 135, 190, 130, 131, 175, 176, 178, 183, - 184, 187, 255, 172, 128, 130, 167, 180, - 179, 130, 128, 129, 179, 181, 182, 190, - 191, 255, 129, 137, 138, 140, 141, 255, - 180, 190, 172, 174, 175, 177, 178, 181, - 182, 183, 159, 160, 162, 163, 170, 188, - 190, 191, 128, 129, 130, 131, 128, 151, - 129, 132, 135, 136, 139, 141, 162, 163, - 166, 172, 176, 180, 181, 183, 184, 191, - 133, 128, 129, 130, 134, 176, 185, 189, - 177, 178, 179, 186, 187, 190, 191, 255, - 129, 132, 255, 175, 190, 176, 177, 178, - 181, 184, 187, 188, 255, 129, 155, 158, - 255, 189, 176, 178, 179, 186, 187, 190, - 191, 255, 129, 255, 172, 182, 171, 173, - 174, 175, 176, 183, 166, 157, 159, 160, - 161, 162, 171, 175, 190, 176, 182, 184, - 191, 169, 177, 180, 146, 167, 170, 182, - 171, 172, 189, 190, 176, 180, 176, 182, - 143, 146, 178, 157, 158, 133, 134, 137, - 168, 169, 170, 166, 173, 165, 169, 174, - 178, 187, 255, 131, 132, 140, 169, 174, - 255, 130, 132, 128, 182, 187, 255, 173, - 180, 182, 255, 132, 155, 159, 161, 175, - 128, 163, 165, 128, 134, 136, 152, 155, - 161, 163, 164, 166, 170, 144, 150, 132, - 138, 143, 187, 191, 160, 128, 129, 132, - 135, 133, 134, 160, 255, 192, 255, 139, - 168, 160, 128, 129, 132, 135, 133, 134, - 160, 255, 192, 255, 144, 145, 150, 155, - 157, 158, 128, 191, 173, 128, 159, 160, - 191, 156, 128, 133, 134, 191, 0, 127, - 176, 255, 131, 137, 191, 145, 189, 135, - 129, 130, 132, 133, 144, 154, 176, 139, - 159, 150, 156, 159, 164, 167, 168, 170, - 173, 145, 176, 255, 139, 255, 166, 176, - 171, 179, 160, 161, 163, 164, 165, 167, - 169, 171, 173, 174, 175, 176, 177, 179, - 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 166, 170, 172, 178, - 150, 153, 155, 163, 165, 167, 169, 173, - 153, 155, 148, 161, 163, 255, 189, 132, - 185, 144, 152, 161, 164, 255, 188, 129, - 131, 190, 255, 133, 134, 137, 138, 142, - 150, 152, 161, 164, 255, 131, 134, 137, - 138, 142, 144, 146, 175, 178, 180, 182, - 255, 134, 138, 142, 161, 164, 255, 188, - 129, 131, 190, 191, 128, 132, 135, 136, - 139, 141, 150, 151, 162, 163, 130, 190, - 191, 151, 128, 130, 134, 136, 138, 141, - 128, 131, 190, 255, 133, 137, 142, 148, - 151, 161, 164, 255, 128, 132, 134, 136, - 138, 141, 149, 150, 162, 163, 129, 131, - 190, 255, 133, 137, 142, 150, 152, 161, - 164, 255, 130, 131, 138, 150, 143, 148, - 152, 159, 178, 179, 177, 179, 186, 135, - 142, 177, 179, 185, 187, 188, 136, 141, - 181, 183, 185, 152, 153, 190, 191, 177, - 191, 128, 132, 134, 135, 141, 151, 153, - 188, 134, 128, 129, 130, 141, 156, 157, - 158, 159, 160, 162, 164, 168, 169, 170, - 172, 173, 174, 175, 176, 179, 183, 173, - 183, 185, 190, 150, 153, 158, 160, 177, - 180, 130, 141, 157, 132, 134, 157, 159, - 146, 148, 178, 180, 146, 147, 178, 179, - 180, 255, 148, 156, 158, 255, 139, 141, - 169, 133, 134, 160, 171, 176, 187, 151, - 155, 160, 162, 191, 149, 158, 165, 188, - 176, 190, 128, 132, 180, 255, 133, 170, - 180, 255, 128, 130, 161, 173, 166, 179, - 164, 183, 173, 144, 146, 148, 168, 178, - 180, 184, 185, 128, 181, 187, 191, 128, - 131, 179, 181, 183, 140, 141, 128, 131, - 157, 179, 181, 183, 144, 176, 164, 175, - 177, 191, 160, 191, 128, 130, 170, 175, - 153, 154, 153, 154, 155, 160, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, - 175, 175, 178, 180, 189, 158, 159, 176, - 177, 130, 134, 139, 163, 167, 128, 129, - 180, 255, 134, 159, 178, 255, 166, 173, - 135, 147, 128, 131, 179, 255, 129, 164, - 166, 255, 169, 182, 131, 188, 140, 141, - 176, 178, 180, 183, 184, 190, 191, 129, - 171, 175, 181, 182, 163, 170, 172, 173, - 172, 184, 190, 158, 128, 143, 160, 175, - 144, 145, 150, 155, 157, 158, 159, 135, - 139, 141, 168, 171, 189, 160, 182, 186, - 191, 129, 131, 133, 134, 140, 143, 184, - 186, 165, 166, 128, 129, 130, 132, 133, - 134, 135, 136, 139, 140, 141, 144, 145, - 146, 147, 150, 151, 152, 153, 154, 156, - 176, 178, 128, 130, 184, 255, 135, 190, - 131, 175, 187, 255, 128, 130, 167, 180, - 179, 128, 130, 179, 255, 129, 137, 141, - 255, 190, 172, 183, 159, 170, 188, 128, - 131, 190, 191, 151, 128, 132, 135, 136, - 139, 141, 162, 163, 166, 172, 176, 180, - 181, 191, 128, 134, 176, 255, 132, 255, - 175, 181, 184, 255, 129, 155, 158, 255, - 129, 255, 171, 183, 157, 171, 175, 182, - 184, 191, 146, 167, 169, 182, 171, 172, - 189, 190, 176, 180, 176, 182, 145, 190, - 143, 146, 178, 157, 158, 133, 134, 137, - 168, 169, 170, 165, 169, 173, 178, 187, - 255, 131, 132, 140, 169, 174, 255, 130, - 132, 128, 182, 187, 255, 173, 180, 182, - 255, 132, 155, 159, 161, 175, 128, 163, - 165, 128, 134, 136, 152, 155, 161, 163, - 164, 166, 170, 144, 150, 132, 138, 145, - 146, 151, 166, 169, 128, 255, 176, 255, - 131, 137, 191, 145, 189, 135, 129, 130, - 132, 133, 144, 154, 176, 139, 159, 150, - 156, 159, 164, 167, 168, 170, 173, 145, - 176, 255, 139, 255, 166, 176, 171, 179, - 160, 161, 163, 164, 165, 166, 167, 169, - 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 168, 170, 150, - 153, 155, 163, 165, 167, 169, 173, 153, - 155, 148, 161, 163, 255, 131, 187, 189, - 132, 185, 190, 255, 141, 144, 129, 136, - 145, 151, 152, 161, 162, 163, 164, 255, - 129, 188, 190, 130, 131, 191, 255, 141, - 151, 129, 132, 133, 134, 137, 138, 142, - 161, 162, 163, 164, 255, 131, 188, 129, - 130, 190, 255, 145, 181, 129, 130, 131, - 134, 135, 136, 137, 138, 139, 141, 142, - 175, 176, 177, 178, 255, 134, 138, 141, - 129, 136, 142, 161, 162, 163, 164, 255, - 129, 188, 130, 131, 190, 191, 128, 141, - 129, 132, 135, 136, 139, 140, 150, 151, - 162, 163, 130, 190, 191, 128, 141, 151, - 129, 130, 134, 136, 138, 140, 128, 129, - 131, 190, 255, 133, 137, 129, 132, 142, - 148, 151, 161, 164, 255, 129, 188, 190, - 191, 130, 131, 130, 134, 128, 132, 135, - 136, 138, 139, 140, 141, 149, 150, 162, - 163, 129, 190, 130, 131, 191, 255, 133, - 137, 141, 151, 129, 132, 142, 161, 162, - 163, 164, 255, 138, 143, 150, 159, 144, - 145, 146, 148, 152, 158, 178, 179, 177, - 179, 180, 186, 135, 142, 177, 179, 180, - 185, 187, 188, 136, 141, 181, 183, 185, - 152, 153, 190, 191, 191, 177, 190, 128, - 132, 134, 135, 141, 151, 153, 188, 134, - 128, 129, 130, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 177, 173, 183, - 185, 186, 187, 188, 189, 190, 150, 151, - 152, 153, 158, 160, 177, 180, 130, 132, - 141, 157, 133, 134, 157, 159, 146, 148, - 178, 180, 146, 147, 178, 179, 182, 180, - 189, 190, 255, 134, 157, 137, 147, 148, - 255, 139, 141, 169, 133, 134, 178, 160, - 162, 163, 166, 167, 168, 169, 171, 176, - 184, 185, 187, 155, 151, 152, 153, 154, - 150, 160, 162, 191, 149, 151, 152, 158, - 165, 172, 173, 178, 179, 188, 176, 190, - 132, 181, 187, 128, 131, 180, 188, 189, - 255, 130, 133, 170, 171, 179, 180, 255, - 130, 161, 170, 128, 129, 162, 165, 166, - 167, 168, 173, 167, 173, 166, 169, 170, - 174, 175, 177, 178, 179, 164, 171, 172, - 179, 180, 181, 182, 183, 161, 173, 180, - 144, 146, 148, 168, 178, 179, 184, 185, - 128, 181, 187, 191, 128, 131, 179, 181, - 183, 140, 141, 144, 176, 175, 177, 191, - 160, 191, 128, 130, 170, 175, 153, 154, - 153, 154, 155, 160, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 175, 175, - 178, 180, 189, 158, 159, 176, 177, 130, - 134, 139, 167, 163, 164, 165, 166, 132, - 133, 134, 159, 160, 177, 178, 255, 166, - 173, 135, 145, 146, 147, 131, 179, 188, - 128, 130, 180, 181, 182, 185, 186, 255, - 165, 129, 255, 169, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 131, 140, 141, - 188, 176, 178, 180, 183, 184, 190, 191, - 129, 171, 181, 182, 172, 173, 174, 175, - 165, 168, 172, 173, 163, 170, 172, 184, - 190, 158, 128, 143, 160, 175, 144, 145, - 150, 155, 157, 158, 159, 135, 139, 141, - 168, 171, 189, 160, 182, 186, 191, 129, - 131, 133, 134, 140, 143, 184, 186, 165, - 166, 128, 129, 130, 132, 133, 134, 135, - 136, 139, 140, 141, 144, 145, 146, 147, - 150, 151, 152, 153, 154, 156, 176, 178, - 129, 128, 130, 184, 255, 135, 190, 130, - 131, 175, 176, 178, 183, 184, 187, 255, - 172, 128, 130, 167, 180, 179, 130, 128, - 129, 179, 181, 182, 190, 191, 255, 129, - 137, 138, 140, 141, 255, 180, 190, 172, - 174, 175, 177, 178, 181, 182, 183, 159, - 160, 162, 163, 170, 188, 190, 191, 128, - 129, 130, 131, 128, 151, 129, 132, 135, - 136, 139, 141, 162, 163, 166, 172, 176, - 180, 181, 183, 184, 191, 133, 128, 129, - 130, 134, 176, 185, 189, 177, 178, 179, - 186, 187, 190, 191, 255, 129, 132, 255, - 175, 190, 176, 177, 178, 181, 184, 187, - 188, 255, 129, 155, 158, 255, 189, 176, - 178, 179, 186, 187, 190, 191, 255, 129, - 255, 172, 182, 171, 173, 174, 175, 176, - 183, 166, 157, 159, 160, 161, 162, 171, - 175, 190, 176, 182, 184, 191, 169, 177, - 180, 146, 167, 170, 182, 171, 172, 189, - 190, 176, 180, 176, 182, 143, 146, 178, - 157, 158, 133, 134, 137, 168, 169, 170, - 166, 173, 165, 169, 174, 178, 187, 255, - 131, 132, 140, 169, 174, 255, 130, 132, - 128, 182, 187, 255, 173, 180, 182, 255, - 132, 155, 159, 161, 175, 128, 163, 165, - 128, 134, 136, 152, 155, 161, 163, 164, - 166, 170, 144, 150, 132, 138, 143, 187, - 191, 160, 128, 129, 132, 135, 133, 134, - 160, 255, 192, 255, 139, 168, 160, 128, - 129, 132, 135, 133, 134, 160, 255, 192, - 255, 144, 145, 150, 155, 157, 158, 128, - 191, 160, 172, 174, 191, 128, 133, 134, - 155, 157, 191, 157, 128, 191, 143, 128, - 191, 163, 181, 128, 191, 162, 128, 191, - 142, 128, 191, 132, 133, 134, 135, 160, - 128, 191, 128, 255, 128, 129, 130, 132, - 133, 134, 141, 156, 157, 158, 159, 160, - 162, 164, 168, 169, 170, 172, 173, 174, - 175, 176, 179, 183, 160, 255, 128, 129, - 130, 133, 134, 135, 141, 156, 157, 158, - 159, 160, 162, 164, 168, 169, 170, 172, - 173, 174, 175, 176, 179, 183, 160, 255, - 168, 255, 128, 129, 130, 134, 135, 141, - 156, 157, 158, 159, 160, 162, 164, 168, - 169, 170, 172, 173, 174, 175, 176, 179, - 183, 168, 255, 192, 255, 159, 139, 187, - 158, 159, 176, 255, 135, 138, 139, 187, - 188, 255, 168, 255, 153, 154, 155, 160, - 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 175, 177, 178, 179, 180, 181, - 182, 184, 185, 186, 187, 188, 189, 191, - 176, 190, 192, 255, 135, 147, 160, 188, - 128, 156, 184, 129, 255, 128, 129, 130, - 133, 134, 141, 156, 157, 158, 159, 160, - 162, 164, 168, 169, 170, 172, 173, 174, - 175, 176, 179, 183, 158, 159, 135, 255, - 148, 176, 140, 168, 132, 160, 188, 152, - 180, 144, 172, 136, 164, 192, 255, 129, - 130, 131, 132, 133, 134, 136, 137, 138, - 139, 140, 141, 143, 144, 145, 146, 147, - 148, 150, 151, 152, 153, 154, 155, 157, - 158, 159, 160, 161, 162, 164, 165, 166, - 167, 168, 169, 171, 172, 173, 174, 175, - 176, 178, 179, 180, 181, 182, 183, 185, - 186, 187, 188, 189, 190, 128, 191, 129, - 130, 131, 132, 133, 134, 136, 137, 138, - 139, 140, 141, 143, 144, 145, 146, 147, - 148, 150, 151, 152, 153, 154, 155, 157, - 158, 159, 160, 161, 162, 164, 165, 166, - 167, 168, 169, 171, 172, 173, 174, 175, - 176, 178, 179, 180, 181, 182, 183, 185, - 186, 187, 188, 189, 190, 128, 191, 129, - 130, 131, 132, 133, 134, 136, 137, 138, - 139, 140, 141, 143, 144, 145, 146, 147, - 148, 150, 151, 152, 153, 154, 155, 157, - 158, 159, 128, 156, 160, 255, 136, 164, - 175, 176, 255, 128, 141, 143, 191, 128, - 129, 152, 155, 156, 130, 191, 140, 141, - 128, 138, 144, 167, 175, 191, 128, 159, - 176, 191, 157, 128, 191, 185, 128, 191, - 128, 137, 138, 141, 142, 191, 128, 191, - 165, 177, 178, 179, 180, 181, 182, 184, - 185, 186, 187, 188, 189, 191, 128, 175, - 176, 190, 192, 255, 128, 159, 160, 188, - 189, 191, 128, 156, 184, 129, 255, 148, - 176, 140, 168, 132, 160, 188, 152, 180, - 144, 172, 136, 164, 192, 255, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 160, 161, 162, 164, 165, 166, 167, - 168, 169, 171, 172, 173, 174, 175, 176, - 178, 179, 180, 181, 182, 183, 185, 186, - 187, 188, 189, 190, 128, 191, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 160, 161, 162, 164, 165, 166, 167, - 168, 169, 171, 172, 173, 174, 175, 176, - 178, 179, 180, 181, 182, 183, 185, 186, - 187, 188, 189, 190, 128, 191, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 128, 156, 160, 255, 136, 164, 175, - 176, 255, 135, 138, 139, 187, 188, 191, - 192, 255, 187, 191, 128, 190, 128, 190, - 188, 128, 175, 190, 191, 145, 155, 157, - 159, 128, 191, 130, 135, 128, 191, 189, - 128, 191, 128, 129, 130, 131, 132, 191, - 178, 128, 191, 128, 159, 164, 191, 133, - 128, 191, 128, 178, 187, 191, 135, 142, - 143, 145, 146, 149, 150, 153, 154, 155, - 164, 128, 191, 128, 165, 166, 191, 144, - 145, 150, 155, 157, 158, 159, 135, 166, - 191, 133, 128, 191, 128, 130, 131, 132, - 133, 137, 138, 139, 140, 191, 174, 188, - 128, 129, 130, 131, 132, 133, 134, 144, - 145, 165, 166, 169, 170, 175, 176, 184, - 185, 191, 128, 132, 170, 129, 135, 136, - 191, 181, 186, 128, 191, 144, 128, 148, - 149, 150, 151, 191, 128, 132, 133, 135, - 136, 138, 139, 143, 144, 191, 163, 128, - 179, 180, 182, 183, 191, 128, 129, 191, - 166, 176, 191, 128, 151, 152, 158, 159, - 178, 179, 185, 186, 187, 188, 190, 128, - 191, 160, 128, 191, 128, 129, 135, 132, - 134, 128, 175, 157, 128, 191, 143, 128, - 191, 163, 181, 128, 191, 162, 128, 191, - 142, 128, 191, 132, 133, 134, 135, 160, - 128, 191, 0, 127, 128, 255, 176, 255, - 131, 137, 191, 145, 189, 135, 129, 130, - 132, 133, 144, 154, 176, 139, 159, 150, - 156, 159, 164, 167, 168, 170, 173, 145, - 176, 255, 139, 255, 166, 176, 171, 179, - 160, 161, 163, 164, 165, 167, 169, 171, - 173, 174, 175, 176, 177, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 166, 170, 172, 178, 150, 153, - 155, 163, 165, 167, 169, 173, 153, 155, - 148, 161, 163, 255, 189, 132, 185, 144, - 152, 161, 164, 255, 188, 129, 131, 190, - 255, 133, 134, 137, 138, 142, 150, 152, - 161, 164, 255, 131, 134, 137, 138, 142, - 144, 146, 175, 178, 180, 182, 255, 134, - 138, 142, 161, 164, 255, 188, 129, 131, - 190, 191, 128, 132, 135, 136, 139, 141, - 150, 151, 162, 163, 130, 190, 191, 151, - 128, 130, 134, 136, 138, 141, 128, 131, - 190, 255, 133, 137, 142, 148, 151, 161, - 164, 255, 128, 132, 134, 136, 138, 141, - 149, 150, 162, 163, 129, 131, 190, 255, - 133, 137, 142, 150, 152, 161, 164, 255, - 130, 131, 138, 150, 143, 148, 152, 159, - 178, 179, 177, 179, 186, 135, 142, 177, - 179, 185, 187, 188, 136, 141, 181, 183, - 185, 152, 153, 190, 191, 177, 191, 128, - 132, 134, 135, 141, 151, 153, 188, 134, - 128, 129, 130, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 173, 183, 185, - 190, 150, 153, 158, 160, 177, 180, 130, - 141, 157, 132, 134, 157, 159, 146, 148, - 178, 180, 146, 147, 178, 179, 180, 255, - 148, 156, 158, 255, 139, 141, 169, 133, - 134, 160, 171, 176, 187, 151, 155, 160, - 162, 191, 149, 158, 165, 188, 176, 190, - 128, 132, 180, 255, 133, 170, 180, 255, - 128, 130, 161, 173, 166, 179, 164, 183, - 173, 144, 146, 148, 168, 178, 180, 184, - 185, 128, 181, 187, 191, 128, 131, 179, - 181, 183, 140, 141, 128, 131, 157, 179, - 181, 183, 144, 176, 164, 175, 177, 191, - 160, 191, 128, 130, 170, 175, 153, 154, - 153, 154, 155, 160, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 175, 175, - 178, 180, 189, 158, 159, 176, 177, 130, - 134, 139, 163, 167, 128, 129, 180, 255, - 134, 159, 178, 255, 166, 173, 135, 147, - 128, 131, 179, 255, 129, 164, 166, 255, - 169, 182, 131, 188, 140, 141, 176, 178, - 180, 183, 184, 190, 191, 129, 171, 175, - 181, 182, 163, 170, 172, 173, 172, 184, - 190, 158, 128, 143, 160, 175, 144, 145, - 150, 155, 157, 158, 159, 135, 139, 141, - 168, 171, 189, 160, 182, 186, 191, 129, - 131, 133, 134, 140, 143, 184, 186, 165, - 166, 128, 129, 130, 132, 133, 134, 135, - 136, 139, 140, 141, 144, 145, 146, 147, - 150, 151, 152, 153, 154, 156, 176, 178, - 128, 130, 184, 255, 135, 190, 131, 175, - 187, 255, 128, 130, 167, 180, 179, 128, - 130, 179, 255, 129, 137, 141, 255, 190, - 172, 183, 159, 170, 188, 128, 131, 190, - 191, 151, 128, 132, 135, 136, 139, 141, - 162, 163, 166, 172, 176, 180, 181, 191, - 128, 134, 176, 255, 132, 255, 175, 181, - 184, 255, 129, 155, 158, 255, 129, 255, - 171, 183, 157, 171, 175, 182, 184, 191, - 146, 167, 169, 182, 171, 172, 189, 190, - 176, 180, 176, 182, 145, 190, 143, 146, - 178, 157, 158, 133, 134, 137, 168, 169, - 170, 165, 169, 173, 178, 187, 255, 131, - 132, 140, 169, 174, 255, 130, 132, 128, - 182, 187, 255, 173, 180, 182, 255, 132, - 155, 159, 161, 175, 128, 163, 165, 128, - 134, 136, 152, 155, 161, 163, 164, 166, - 170, 144, 150, 132, 138, 145, 146, 151, - 166, 169, 128, 255, 176, 255, 131, 137, - 191, 145, 189, 135, 129, 130, 132, 133, - 144, 154, 176, 139, 159, 150, 156, 159, - 164, 167, 168, 170, 173, 145, 176, 255, - 139, 255, 166, 176, 171, 179, 160, 161, - 163, 164, 165, 166, 167, 169, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 168, 170, 150, 153, 155, - 163, 165, 167, 169, 173, 153, 155, 148, - 161, 163, 255, 131, 187, 189, 132, 185, - 190, 255, 141, 144, 129, 136, 145, 151, - 152, 161, 162, 163, 164, 255, 129, 188, - 190, 130, 131, 191, 255, 141, 151, 129, - 132, 133, 134, 137, 138, 142, 161, 162, - 163, 164, 255, 131, 188, 129, 130, 190, - 255, 145, 181, 129, 130, 131, 134, 135, - 136, 137, 138, 139, 141, 142, 175, 176, - 177, 178, 255, 134, 138, 141, 129, 136, - 142, 161, 162, 163, 164, 255, 129, 188, - 130, 131, 190, 191, 128, 141, 129, 132, - 135, 136, 139, 140, 150, 151, 162, 163, - 130, 190, 191, 128, 141, 151, 129, 130, - 134, 136, 138, 140, 128, 129, 131, 190, - 255, 133, 137, 129, 132, 142, 148, 151, - 161, 164, 255, 129, 188, 190, 191, 130, - 131, 130, 134, 128, 132, 135, 136, 138, - 139, 140, 141, 149, 150, 162, 163, 129, - 190, 130, 131, 191, 255, 133, 137, 141, - 151, 129, 132, 142, 161, 162, 163, 164, - 255, 138, 143, 150, 159, 144, 145, 146, - 148, 152, 158, 178, 179, 177, 179, 180, - 186, 135, 142, 177, 179, 180, 185, 187, - 188, 136, 141, 181, 183, 185, 152, 153, - 190, 191, 191, 177, 190, 128, 132, 134, - 135, 141, 151, 153, 188, 134, 128, 129, - 130, 141, 156, 157, 158, 159, 160, 162, - 164, 168, 169, 170, 172, 173, 174, 175, - 176, 179, 183, 177, 173, 183, 185, 186, - 187, 188, 189, 190, 150, 151, 152, 153, - 158, 160, 177, 180, 130, 132, 141, 157, - 133, 134, 157, 159, 146, 148, 178, 180, - 146, 147, 178, 179, 182, 180, 189, 190, - 255, 134, 157, 137, 147, 148, 255, 139, - 141, 169, 133, 134, 178, 160, 162, 163, - 166, 167, 168, 169, 171, 176, 184, 185, - 187, 155, 151, 152, 153, 154, 150, 160, - 162, 191, 149, 151, 152, 158, 165, 172, - 173, 178, 179, 188, 176, 190, 132, 181, - 187, 128, 131, 180, 188, 189, 255, 130, - 133, 170, 171, 179, 180, 255, 130, 161, - 170, 128, 129, 162, 165, 166, 167, 168, - 173, 167, 173, 166, 169, 170, 174, 175, - 177, 178, 179, 164, 171, 172, 179, 180, - 181, 182, 183, 161, 173, 180, 144, 146, - 148, 168, 178, 179, 184, 185, 128, 181, - 187, 191, 128, 131, 179, 181, 183, 140, - 141, 144, 176, 175, 177, 191, 160, 191, - 128, 130, 170, 175, 153, 154, 153, 154, - 155, 160, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 175, 175, 178, 180, - 189, 158, 159, 176, 177, 130, 134, 139, - 167, 163, 164, 165, 166, 132, 133, 134, - 159, 160, 177, 178, 255, 166, 173, 135, - 145, 146, 147, 131, 179, 188, 128, 130, - 180, 181, 182, 185, 186, 255, 165, 129, - 255, 169, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 131, 140, 141, 188, 176, - 178, 180, 183, 184, 190, 191, 129, 171, - 181, 182, 172, 173, 174, 175, 165, 168, - 172, 173, 163, 170, 172, 184, 190, 158, - 128, 143, 160, 175, 144, 145, 150, 155, - 157, 158, 159, 135, 139, 141, 168, 171, - 189, 160, 182, 186, 191, 129, 131, 133, - 134, 140, 143, 184, 186, 165, 166, 128, - 129, 130, 132, 133, 134, 135, 136, 139, - 140, 141, 144, 145, 146, 147, 150, 151, - 152, 153, 154, 156, 176, 178, 129, 128, - 130, 184, 255, 135, 190, 130, 131, 175, - 176, 178, 183, 184, 187, 255, 172, 128, - 130, 167, 180, 179, 130, 128, 129, 179, - 181, 182, 190, 191, 255, 129, 137, 138, - 140, 141, 255, 180, 190, 172, 174, 175, - 177, 178, 181, 182, 183, 159, 160, 162, - 163, 170, 188, 190, 191, 128, 129, 130, - 131, 128, 151, 129, 132, 135, 136, 139, - 141, 162, 163, 166, 172, 176, 180, 181, - 183, 184, 191, 133, 128, 129, 130, 134, - 176, 185, 189, 177, 178, 179, 186, 187, - 190, 191, 255, 129, 132, 255, 175, 190, - 176, 177, 178, 181, 184, 187, 188, 255, - 129, 155, 158, 255, 189, 176, 178, 179, - 186, 187, 190, 191, 255, 129, 255, 172, - 182, 171, 173, 174, 175, 176, 183, 166, - 157, 159, 160, 161, 162, 171, 175, 190, - 176, 182, 184, 191, 169, 177, 180, 146, - 167, 170, 182, 171, 172, 189, 190, 176, - 180, 176, 182, 143, 146, 178, 157, 158, - 133, 134, 137, 168, 169, 170, 166, 173, - 165, 169, 174, 178, 187, 255, 131, 132, - 140, 169, 174, 255, 130, 132, 128, 182, - 187, 255, 173, 180, 182, 255, 132, 155, - 159, 161, 175, 128, 163, 165, 128, 134, - 136, 152, 155, 161, 163, 164, 166, 170, - 144, 150, 132, 138, 143, 187, 191, 160, - 128, 129, 132, 135, 133, 134, 160, 255, - 192, 255, 139, 168, 160, 128, 129, 132, - 135, 133, 134, 160, 255, 192, 255, 144, - 145, 150, 155, 157, 158, 128, 129, 130, - 132, 133, 134, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 160, 255, 128, - 129, 130, 133, 134, 135, 141, 156, 157, - 158, 159, 160, 162, 164, 168, 169, 170, - 172, 173, 174, 175, 176, 179, 183, 160, - 255, 168, 255, 128, 129, 130, 134, 135, - 141, 156, 157, 158, 159, 160, 162, 164, - 168, 169, 170, 172, 173, 174, 175, 176, - 179, 183, 168, 255, 192, 255, 159, 139, - 187, 158, 159, 176, 255, 135, 138, 139, - 187, 188, 255, 168, 255, 153, 154, 155, - 160, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 175, 177, 178, 179, 180, - 181, 182, 184, 185, 186, 187, 188, 189, - 191, 176, 190, 192, 255, 135, 147, 160, - 188, 128, 156, 184, 129, 255, 128, 129, - 130, 133, 134, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 158, 159, 135, - 255, 148, 176, 140, 168, 132, 160, 188, - 152, 180, 144, 172, 136, 164, 192, 255, - 129, 130, 131, 132, 133, 134, 136, 137, - 138, 139, 140, 141, 143, 144, 145, 146, - 147, 148, 150, 151, 152, 153, 154, 155, - 157, 158, 159, 160, 161, 162, 164, 165, - 166, 167, 168, 169, 171, 172, 173, 174, - 175, 176, 178, 179, 180, 181, 182, 183, - 185, 186, 187, 188, 189, 190, 128, 191, - 129, 130, 131, 132, 133, 134, 136, 137, - 138, 139, 140, 141, 143, 144, 145, 146, - 147, 148, 150, 151, 152, 153, 154, 155, - 157, 158, 159, 160, 161, 162, 164, 165, - 166, 167, 168, 169, 171, 172, 173, 174, - 175, 176, 178, 179, 180, 181, 182, 183, - 185, 186, 187, 188, 189, 190, 128, 191, - 129, 130, 131, 132, 133, 134, 136, 137, - 138, 139, 140, 141, 143, 144, 145, 146, - 147, 148, 150, 151, 152, 153, 154, 155, - 157, 158, 159, 128, 156, 160, 255, 136, - 164, 175, 176, 255, 142, 128, 191, 128, - 129, 152, 155, 156, 130, 191, 139, 141, - 128, 140, 142, 143, 144, 167, 168, 174, - 175, 191, 128, 255, 176, 255, 131, 137, - 191, 145, 189, 135, 129, 130, 132, 133, - 144, 154, 176, 139, 159, 150, 156, 159, - 164, 167, 168, 170, 173, 145, 176, 255, - 139, 255, 166, 176, 171, 179, 160, 161, - 163, 164, 165, 167, 169, 171, 173, 174, - 175, 176, 177, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, - 166, 170, 172, 178, 150, 153, 155, 163, - 165, 167, 169, 173, 153, 155, 148, 161, - 163, 255, 189, 132, 185, 144, 152, 161, - 164, 255, 188, 129, 131, 190, 255, 133, - 134, 137, 138, 142, 150, 152, 161, 164, - 255, 131, 134, 137, 138, 142, 144, 146, - 175, 178, 180, 182, 255, 134, 138, 142, - 161, 164, 255, 188, 129, 131, 190, 191, - 128, 132, 135, 136, 139, 141, 150, 151, - 162, 163, 130, 190, 191, 151, 128, 130, - 134, 136, 138, 141, 128, 131, 190, 255, - 133, 137, 142, 148, 151, 161, 164, 255, - 128, 132, 134, 136, 138, 141, 149, 150, - 162, 163, 129, 131, 190, 255, 133, 137, - 142, 150, 152, 161, 164, 255, 130, 131, - 138, 150, 143, 148, 152, 159, 178, 179, - 177, 179, 186, 135, 142, 177, 179, 185, - 187, 188, 136, 141, 181, 183, 185, 152, - 153, 190, 191, 177, 191, 128, 132, 134, - 135, 141, 151, 153, 188, 134, 128, 129, - 130, 141, 156, 157, 158, 159, 160, 162, - 164, 168, 169, 170, 172, 173, 174, 175, - 176, 179, 183, 173, 183, 185, 190, 150, - 153, 158, 160, 177, 180, 130, 141, 157, - 132, 134, 157, 159, 146, 148, 178, 180, - 146, 147, 178, 179, 180, 255, 148, 156, - 158, 255, 139, 141, 169, 133, 134, 160, - 171, 176, 187, 151, 155, 160, 162, 191, - 149, 158, 165, 188, 176, 190, 128, 132, - 180, 255, 133, 170, 180, 255, 128, 130, - 161, 173, 166, 179, 164, 183, 173, 144, - 146, 148, 168, 178, 180, 184, 185, 128, - 181, 187, 191, 128, 131, 179, 181, 183, - 140, 141, 144, 176, 175, 177, 191, 160, - 191, 128, 130, 170, 175, 153, 154, 153, - 154, 155, 160, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 175, 175, 178, - 180, 189, 158, 159, 176, 177, 130, 134, - 139, 163, 167, 128, 129, 180, 255, 134, - 159, 178, 255, 166, 173, 135, 147, 128, - 131, 179, 255, 129, 164, 166, 255, 169, - 182, 131, 188, 140, 141, 176, 178, 180, - 183, 184, 190, 191, 129, 171, 175, 181, - 182, 163, 170, 172, 173, 172, 184, 190, - 158, 128, 143, 160, 175, 144, 145, 150, - 155, 157, 158, 135, 139, 141, 168, 171, - 189, 160, 182, 186, 191, 129, 131, 133, - 134, 140, 143, 184, 186, 165, 166, 128, - 129, 130, 132, 133, 134, 135, 136, 139, - 140, 141, 144, 145, 146, 147, 150, 151, - 152, 153, 154, 156, 176, 178, 128, 130, - 184, 255, 135, 190, 131, 175, 187, 255, - 128, 130, 167, 180, 179, 128, 130, 179, - 255, 129, 137, 141, 255, 190, 172, 183, - 159, 170, 188, 128, 131, 190, 191, 151, - 128, 132, 135, 136, 139, 141, 162, 163, - 166, 172, 176, 180, 181, 191, 128, 134, - 176, 255, 132, 255, 175, 181, 184, 255, - 129, 155, 158, 255, 129, 255, 171, 183, - 157, 171, 175, 182, 184, 191, 146, 167, - 169, 182, 171, 172, 189, 190, 176, 180, - 176, 182, 145, 190, 143, 146, 178, 157, - 158, 133, 134, 137, 168, 169, 170, 165, - 169, 173, 178, 187, 255, 131, 132, 140, - 169, 174, 255, 130, 132, 128, 182, 187, - 255, 173, 180, 182, 255, 132, 155, 159, - 161, 175, 128, 163, 165, 128, 134, 136, - 152, 155, 161, 163, 164, 166, 170, 144, - 150, 132, 138, 160, 128, 129, 132, 135, - 133, 134, 160, 255, 192, 255, 128, 131, - 157, 179, 181, 183, 164, 144, 145, 150, - 155, 157, 158, 159, 145, 146, 151, 166, - 169, 128, 255, 176, 255, 131, 137, 191, - 145, 189, 135, 129, 130, 132, 133, 144, - 154, 176, 139, 159, 150, 156, 159, 164, - 167, 168, 170, 173, 145, 176, 255, 139, - 255, 166, 176, 171, 179, 160, 161, 163, - 164, 165, 166, 167, 169, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 168, 170, 150, 153, 155, 163, - 165, 167, 169, 173, 153, 155, 148, 161, - 163, 255, 131, 187, 189, 132, 185, 190, - 255, 141, 144, 129, 136, 145, 151, 152, - 161, 162, 163, 164, 255, 129, 188, 190, - 130, 131, 191, 255, 141, 151, 129, 132, - 133, 134, 137, 138, 142, 161, 162, 163, - 164, 255, 131, 188, 129, 130, 190, 255, - 145, 181, 129, 130, 131, 134, 135, 136, - 137, 138, 139, 141, 142, 175, 176, 177, - 178, 255, 134, 138, 141, 129, 136, 142, - 161, 162, 163, 164, 255, 129, 188, 130, - 131, 190, 191, 128, 141, 129, 132, 135, - 136, 139, 140, 150, 151, 162, 163, 130, - 190, 191, 128, 141, 151, 129, 130, 134, - 136, 138, 140, 128, 129, 131, 190, 255, - 133, 137, 129, 132, 142, 148, 151, 161, - 164, 255, 129, 188, 190, 191, 130, 131, - 130, 134, 128, 132, 135, 136, 138, 139, - 140, 141, 149, 150, 162, 163, 129, 190, - 130, 131, 191, 255, 133, 137, 141, 151, - 129, 132, 142, 161, 162, 163, 164, 255, - 138, 143, 150, 159, 144, 145, 146, 148, - 152, 158, 178, 179, 177, 179, 180, 186, - 135, 142, 177, 179, 180, 185, 187, 188, - 136, 141, 181, 183, 185, 152, 153, 190, - 191, 191, 177, 190, 128, 132, 134, 135, - 141, 151, 153, 188, 134, 128, 129, 130, - 141, 156, 157, 158, 159, 160, 162, 164, - 168, 169, 170, 172, 173, 174, 175, 176, - 179, 183, 177, 173, 183, 185, 186, 187, - 188, 189, 190, 150, 151, 152, 153, 158, - 160, 177, 180, 130, 132, 141, 157, 133, - 134, 157, 159, 146, 148, 178, 180, 146, - 147, 178, 179, 182, 180, 189, 190, 255, - 134, 157, 137, 147, 148, 255, 139, 141, - 169, 133, 134, 178, 160, 162, 163, 166, - 167, 168, 169, 171, 176, 184, 185, 187, - 155, 151, 152, 153, 154, 150, 160, 162, - 191, 149, 151, 152, 158, 165, 172, 173, - 178, 179, 188, 176, 190, 132, 181, 187, - 128, 131, 180, 188, 189, 255, 130, 133, - 170, 171, 179, 180, 255, 130, 161, 170, - 128, 129, 162, 165, 166, 167, 168, 173, - 167, 173, 166, 169, 170, 174, 175, 177, - 178, 179, 164, 171, 172, 179, 180, 181, - 182, 183, 161, 173, 180, 144, 146, 148, - 168, 178, 179, 184, 185, 128, 181, 187, - 191, 128, 131, 179, 181, 183, 140, 141, - 144, 176, 175, 177, 191, 160, 191, 128, - 130, 170, 175, 153, 154, 153, 154, 155, - 160, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 175, 175, 178, 180, 189, - 158, 159, 176, 177, 130, 134, 139, 167, - 163, 164, 165, 166, 132, 133, 134, 159, - 160, 177, 178, 255, 166, 173, 135, 145, - 146, 147, 131, 179, 188, 128, 130, 180, - 181, 182, 185, 186, 255, 165, 129, 255, - 169, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 131, 140, 141, 188, 176, 178, - 180, 183, 184, 190, 191, 129, 171, 181, - 182, 172, 173, 174, 175, 165, 168, 172, - 173, 163, 170, 172, 184, 190, 158, 128, - 143, 160, 175, 144, 145, 150, 155, 157, - 158, 159, 135, 139, 141, 168, 171, 189, - 160, 182, 186, 191, 129, 131, 133, 134, - 140, 143, 184, 186, 165, 166, 128, 129, - 130, 132, 133, 134, 135, 136, 139, 140, - 141, 144, 145, 146, 147, 150, 151, 152, - 153, 154, 156, 176, 178, 129, 128, 130, - 184, 255, 135, 190, 130, 131, 175, 176, - 178, 183, 184, 187, 255, 172, 128, 130, - 167, 180, 179, 130, 128, 129, 179, 181, - 182, 190, 191, 255, 129, 137, 138, 140, - 141, 255, 180, 190, 172, 174, 175, 177, - 178, 181, 182, 183, 159, 160, 162, 163, - 170, 188, 190, 191, 128, 129, 130, 131, - 128, 151, 129, 132, 135, 136, 139, 141, - 162, 163, 166, 172, 176, 180, 181, 183, - 184, 191, 133, 128, 129, 130, 134, 176, - 185, 189, 177, 178, 179, 186, 187, 190, - 191, 255, 129, 132, 255, 175, 190, 176, - 177, 178, 181, 184, 187, 188, 255, 129, - 155, 158, 255, 189, 176, 178, 179, 186, - 187, 190, 191, 255, 129, 255, 172, 182, - 171, 173, 174, 175, 176, 183, 166, 157, - 159, 160, 161, 162, 171, 175, 190, 176, - 182, 184, 191, 169, 177, 180, 146, 167, - 170, 182, 171, 172, 189, 190, 176, 180, - 176, 182, 143, 146, 178, 157, 158, 133, - 134, 137, 168, 169, 170, 166, 173, 165, - 169, 174, 178, 187, 255, 131, 132, 140, - 169, 174, 255, 130, 132, 128, 182, 187, - 255, 173, 180, 182, 255, 132, 155, 159, - 161, 175, 128, 163, 165, 128, 134, 136, - 152, 155, 161, 163, 164, 166, 170, 144, - 150, 132, 138, 143, 187, 191, 160, 128, - 129, 132, 135, 133, 134, 160, 255, 192, - 255, 139, 168, 128, 159, 160, 175, 176, - 191, 157, 128, 191, 128, 255, 176, 255, - 131, 137, 191, 145, 189, 135, 129, 130, - 132, 133, 144, 154, 176, 139, 159, 150, - 156, 159, 164, 167, 168, 170, 173, 145, - 176, 255, 139, 255, 166, 176, 171, 179, - 160, 161, 163, 164, 165, 166, 167, 169, - 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 168, 170, 150, - 153, 155, 163, 165, 167, 169, 173, 153, - 155, 148, 161, 163, 255, 131, 187, 189, - 132, 185, 190, 255, 128, 255, 176, 255, - 131, 137, 191, 145, 189, 135, 129, 130, - 132, 133, 144, 154, 176, 139, 159, 150, - 156, 159, 164, 167, 168, 170, 173, 145, - 176, 255, 139, 255, 166, 176, 171, 179, - 160, 161, 163, 164, 165, 167, 169, 171, - 173, 174, 175, 176, 177, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 166, 170, 172, 178, 150, 153, - 155, 163, 165, 167, 169, 173, 153, 155, - 148, 161, 163, 255, 189, 132, 185, 144, - 152, 161, 164, 255, 188, 129, 131, 190, - 255, 133, 134, 137, 138, 142, 150, 152, - 161, 164, 255, 131, 134, 137, 138, 142, - 144, 146, 175, 178, 180, 182, 255, 134, - 138, 142, 161, 164, 255, 188, 129, 131, - 190, 191, 128, 132, 135, 136, 139, 141, - 150, 151, 162, 163, 130, 190, 191, 151, - 128, 130, 134, 136, 138, 141, 128, 131, - 190, 255, 133, 137, 142, 148, 151, 161, - 164, 255, 128, 132, 134, 136, 138, 141, - 149, 150, 162, 163, 129, 131, 190, 255, - 133, 137, 142, 150, 152, 161, 164, 255, - 130, 131, 138, 150, 143, 148, 152, 159, - 178, 179, 177, 179, 186, 135, 142, 177, - 179, 185, 187, 188, 136, 141, 181, 183, - 185, 152, 153, 190, 191, 177, 191, 128, - 132, 134, 135, 141, 151, 153, 188, 134, - 128, 129, 130, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 173, 183, 185, - 190, 150, 153, 158, 160, 177, 180, 130, - 141, 157, 132, 134, 157, 159, 146, 148, - 178, 180, 146, 147, 178, 179, 180, 255, - 148, 156, 158, 255, 139, 141, 169, 133, - 134, 160, 171, 176, 187, 151, 155, 160, - 162, 191, 149, 158, 165, 188, 176, 190, - 128, 132, 180, 255, 133, 170, 180, 255, - 128, 130, 161, 173, 166, 179, 164, 183, - 173, 144, 146, 148, 168, 178, 180, 184, - 185, 128, 181, 187, 191, 128, 131, 179, - 181, 183, 140, 141, 128, 131, 157, 179, - 181, 183, 144, 176, 164, 175, 177, 191, - 160, 191, 128, 130, 170, 175, 153, 154, - 153, 154, 155, 160, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 175, 175, - 178, 180, 189, 158, 159, 176, 177, 130, - 134, 139, 163, 167, 128, 129, 180, 255, - 134, 159, 178, 255, 166, 173, 135, 147, - 128, 131, 179, 255, 129, 164, 166, 255, - 169, 182, 131, 188, 140, 141, 176, 178, - 180, 183, 184, 190, 191, 129, 171, 175, - 181, 182, 163, 170, 172, 173, 172, 184, - 190, 158, 128, 143, 160, 175, 144, 145, - 150, 155, 157, 158, 159, 135, 139, 141, - 168, 171, 189, 160, 182, 186, 191, 129, - 131, 133, 134, 140, 143, 184, 186, 165, - 166, 128, 129, 130, 132, 133, 134, 135, - 136, 139, 140, 141, 144, 145, 146, 147, - 150, 151, 152, 153, 154, 156, 176, 178, - 128, 130, 184, 255, 135, 190, 131, 175, - 187, 255, 128, 130, 167, 180, 179, 128, - 130, 179, 255, 129, 137, 141, 255, 190, - 172, 183, 159, 170, 188, 128, 131, 190, - 191, 151, 128, 132, 135, 136, 139, 141, - 162, 163, 166, 172, 176, 180, 181, 191, - 128, 134, 176, 255, 132, 255, 175, 181, - 184, 255, 129, 155, 158, 255, 129, 255, - 171, 183, 157, 171, 175, 182, 184, 191, - 146, 167, 169, 182, 171, 172, 189, 190, - 176, 180, 176, 182, 145, 190, 143, 146, - 178, 157, 158, 133, 134, 137, 168, 169, - 170, 165, 169, 173, 178, 187, 255, 131, - 132, 140, 169, 174, 255, 130, 132, 128, - 182, 187, 255, 173, 180, 182, 255, 132, - 155, 159, 161, 175, 128, 163, 165, 128, - 134, 136, 152, 155, 161, 163, 164, 166, - 170, 144, 150, 132, 138, 145, 146, 151, - 166, 169, 139, 168, 160, 128, 129, 132, - 135, 133, 134, 160, 255, 192, 255, 144, - 145, 150, 155, 157, 158, 141, 144, 129, - 136, 145, 151, 152, 161, 162, 163, 164, - 255, 129, 188, 190, 130, 131, 191, 255, - 141, 151, 129, 132, 133, 134, 137, 138, - 142, 161, 162, 163, 164, 255, 131, 188, - 129, 130, 190, 255, 145, 181, 129, 130, - 131, 134, 135, 136, 137, 138, 139, 141, - 142, 175, 176, 177, 178, 255, 134, 138, - 141, 129, 136, 142, 161, 162, 163, 164, - 255, 129, 188, 130, 131, 190, 191, 128, - 141, 129, 132, 135, 136, 139, 140, 150, - 151, 162, 163, 130, 190, 191, 128, 141, - 151, 129, 130, 134, 136, 138, 140, 128, - 129, 131, 190, 255, 133, 137, 129, 132, - 142, 148, 151, 161, 164, 255, 129, 188, - 190, 191, 130, 131, 130, 134, 128, 132, - 135, 136, 138, 139, 140, 141, 149, 150, - 162, 163, 129, 190, 130, 131, 191, 255, - 133, 137, 141, 151, 129, 132, 142, 161, - 162, 163, 164, 255, 138, 143, 150, 159, - 144, 145, 146, 148, 152, 158, 178, 179, - 177, 179, 180, 186, 135, 142, 177, 179, - 180, 185, 187, 188, 136, 141, 181, 183, - 185, 152, 153, 190, 191, 191, 177, 190, - 128, 132, 134, 135, 141, 151, 153, 188, - 134, 128, 129, 130, 141, 156, 157, 158, - 159, 160, 162, 164, 168, 169, 170, 172, - 173, 174, 175, 176, 179, 183, 177, 173, - 183, 185, 186, 187, 188, 189, 190, 150, - 151, 152, 153, 158, 160, 177, 180, 130, - 132, 141, 157, 133, 134, 157, 159, 146, - 148, 178, 180, 146, 147, 178, 179, 182, - 180, 189, 190, 255, 134, 157, 137, 147, - 148, 255, 139, 141, 169, 133, 134, 178, - 160, 162, 163, 166, 167, 168, 169, 171, - 176, 184, 185, 187, 155, 151, 152, 153, - 154, 150, 160, 162, 191, 149, 151, 152, - 158, 165, 172, 173, 178, 179, 188, 176, - 190, 132, 181, 187, 128, 131, 180, 188, - 189, 255, 130, 133, 170, 171, 179, 180, - 255, 130, 161, 170, 128, 129, 162, 165, - 166, 167, 168, 173, 167, 173, 166, 169, - 170, 174, 175, 177, 178, 179, 164, 171, - 172, 179, 180, 181, 182, 183, 161, 173, - 180, 144, 146, 148, 168, 178, 179, 184, - 185, 128, 181, 187, 191, 128, 131, 179, - 181, 183, 140, 141, 144, 176, 175, 177, - 191, 160, 191, 128, 130, 170, 175, 153, - 154, 153, 154, 155, 160, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 175, - 175, 178, 180, 189, 158, 159, 176, 177, - 130, 134, 139, 167, 163, 164, 165, 166, - 132, 133, 134, 159, 160, 177, 178, 255, - 166, 173, 135, 145, 146, 147, 131, 179, - 188, 128, 130, 180, 181, 182, 185, 186, - 255, 165, 129, 255, 169, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 131, 140, - 141, 188, 176, 178, 180, 183, 184, 190, - 191, 129, 171, 181, 182, 172, 173, 174, - 175, 165, 168, 172, 173, 163, 170, 172, - 184, 190, 158, 128, 143, 160, 175, 144, - 145, 150, 155, 157, 158, 159, 135, 139, - 141, 168, 171, 189, 160, 182, 186, 191, - 129, 131, 133, 134, 140, 143, 184, 186, - 165, 166, 128, 129, 130, 132, 133, 134, - 135, 136, 139, 140, 141, 144, 145, 146, - 147, 150, 151, 152, 153, 154, 156, 176, - 178, 129, 128, 130, 184, 255, 135, 190, - 130, 131, 175, 176, 178, 183, 184, 187, - 255, 172, 128, 130, 167, 180, 179, 130, - 128, 129, 179, 181, 182, 190, 191, 255, - 129, 137, 138, 140, 141, 255, 180, 190, - 172, 174, 175, 177, 178, 181, 182, 183, - 159, 160, 162, 163, 170, 188, 190, 191, - 128, 129, 130, 131, 128, 151, 129, 132, - 135, 136, 139, 141, 162, 163, 166, 172, - 176, 180, 181, 183, 184, 191, 133, 128, - 129, 130, 134, 176, 185, 189, 177, 178, - 179, 186, 187, 190, 191, 255, 129, 132, - 255, 175, 190, 176, 177, 178, 181, 184, - 187, 188, 255, 129, 155, 158, 255, 189, - 176, 178, 179, 186, 187, 190, 191, 255, - 129, 255, 172, 182, 171, 173, 174, 175, - 176, 183, 166, 157, 159, 160, 161, 162, - 171, 175, 190, 176, 182, 184, 191, 169, - 177, 180, 146, 167, 170, 182, 171, 172, - 189, 190, 176, 180, 176, 182, 143, 146, - 178, 157, 158, 133, 134, 137, 168, 169, - 170, 166, 173, 165, 169, 174, 178, 187, - 255, 131, 132, 140, 169, 174, 255, 130, - 132, 128, 182, 187, 255, 173, 180, 182, - 255, 132, 155, 159, 161, 175, 128, 163, - 165, 128, 134, 136, 152, 155, 161, 163, - 164, 166, 170, 144, 150, 132, 138, 143, - 187, 191, 160, 128, 129, 132, 135, 133, - 134, 160, 255, 192, 255, 185, 128, 191, - 128, 137, 138, 141, 142, 191, 128, 191, - 165, 177, 178, 179, 180, 181, 182, 184, - 185, 186, 187, 188, 189, 191, 128, 175, - 176, 190, 192, 255, 128, 159, 160, 188, - 189, 191, 128, 156, 184, 129, 255, 148, - 176, 140, 168, 132, 160, 188, 152, 180, - 144, 172, 136, 164, 192, 255, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 160, 161, 162, 164, 165, 166, 167, - 168, 169, 171, 172, 173, 174, 175, 176, - 178, 179, 180, 181, 182, 183, 185, 186, - 187, 188, 189, 190, 128, 191, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 160, 161, 162, 164, 165, 166, 167, - 168, 169, 171, 172, 173, 174, 175, 176, - 178, 179, 180, 181, 182, 183, 185, 186, - 187, 188, 189, 190, 128, 191, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 160, 191, 128, 156, 161, 190, 192, - 255, 136, 164, 175, 176, 255, 135, 138, - 139, 187, 188, 191, 192, 255, 0, 127, - 192, 255, 187, 191, 128, 190, 191, 128, - 190, 188, 128, 175, 176, 189, 190, 191, - 145, 155, 157, 159, 128, 191, 130, 135, - 128, 191, 189, 128, 191, 128, 129, 130, - 131, 132, 191, 178, 128, 191, 128, 159, - 160, 163, 164, 191, 133, 128, 191, 128, - 178, 179, 186, 187, 191, 135, 142, 143, - 145, 146, 149, 150, 153, 154, 155, 164, - 128, 191, 128, 165, 166, 191, 128, 255, - 176, 255, 131, 137, 191, 145, 189, 135, - 129, 130, 132, 133, 144, 154, 176, 139, - 159, 150, 156, 159, 164, 167, 168, 170, - 173, 145, 176, 255, 139, 255, 166, 176, - 171, 179, 160, 161, 163, 164, 165, 167, - 169, 171, 173, 174, 175, 176, 177, 179, - 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 166, 170, 172, 178, - 150, 153, 155, 163, 165, 167, 169, 173, - 153, 155, 148, 161, 163, 255, 189, 132, - 185, 144, 152, 161, 164, 255, 188, 129, - 131, 190, 255, 133, 134, 137, 138, 142, - 150, 152, 161, 164, 255, 131, 134, 137, - 138, 142, 144, 146, 175, 178, 180, 182, - 255, 134, 138, 142, 161, 164, 255, 188, - 129, 131, 190, 191, 128, 132, 135, 136, - 139, 141, 150, 151, 162, 163, 130, 190, - 191, 151, 128, 130, 134, 136, 138, 141, - 128, 131, 190, 255, 133, 137, 142, 148, - 151, 161, 164, 255, 128, 132, 134, 136, - 138, 141, 149, 150, 162, 163, 129, 131, - 190, 255, 133, 137, 142, 150, 152, 161, - 164, 255, 130, 131, 138, 150, 143, 148, - 152, 159, 178, 179, 177, 179, 186, 135, - 142, 177, 179, 185, 187, 188, 136, 141, - 181, 183, 185, 152, 153, 190, 191, 177, - 191, 128, 132, 134, 135, 141, 151, 153, - 188, 134, 128, 129, 130, 141, 156, 157, - 158, 159, 160, 162, 164, 168, 169, 170, - 172, 173, 174, 175, 176, 179, 183, 173, - 183, 185, 190, 150, 153, 158, 160, 177, - 180, 130, 141, 157, 132, 134, 157, 159, - 146, 148, 178, 180, 146, 147, 178, 179, - 180, 255, 148, 156, 158, 255, 139, 141, - 169, 133, 134, 160, 171, 176, 187, 151, - 155, 160, 162, 191, 149, 158, 165, 188, - 176, 190, 128, 132, 180, 255, 133, 170, - 180, 255, 128, 130, 161, 173, 166, 179, - 164, 183, 173, 144, 146, 148, 168, 178, - 180, 184, 185, 128, 181, 187, 191, 128, - 131, 179, 181, 183, 140, 141, 128, 131, - 157, 179, 181, 183, 144, 176, 164, 175, - 177, 191, 160, 191, 128, 130, 170, 175, - 153, 154, 153, 154, 155, 160, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, - 175, 175, 178, 180, 189, 158, 159, 176, - 177, 130, 134, 139, 163, 167, 128, 129, - 180, 255, 134, 159, 178, 255, 166, 173, - 135, 147, 128, 131, 179, 255, 129, 164, - 166, 255, 169, 182, 131, 188, 140, 141, - 176, 178, 180, 183, 184, 190, 191, 129, - 171, 175, 181, 182, 163, 170, 172, 173, - 172, 184, 190, 158, 128, 143, 160, 175, - 144, 145, 150, 155, 157, 158, 159, 135, - 139, 141, 168, 171, 189, 160, 182, 186, - 191, 129, 131, 133, 134, 140, 143, 184, - 186, 165, 166, 128, 129, 130, 132, 133, - 134, 135, 136, 139, 140, 141, 144, 145, - 146, 147, 150, 151, 152, 153, 154, 156, - 176, 178, 128, 130, 184, 255, 135, 190, - 131, 175, 187, 255, 128, 130, 167, 180, - 179, 128, 130, 179, 255, 129, 137, 141, - 255, 190, 172, 183, 159, 170, 188, 128, - 131, 190, 191, 151, 128, 132, 135, 136, - 139, 141, 162, 163, 166, 172, 176, 180, - 181, 191, 128, 134, 176, 255, 132, 255, - 175, 181, 184, 255, 129, 155, 158, 255, - 129, 255, 171, 183, 157, 171, 175, 182, - 184, 191, 146, 167, 169, 182, 171, 172, - 189, 190, 176, 180, 176, 182, 145, 190, - 143, 146, 178, 157, 158, 133, 134, 137, - 168, 169, 170, 165, 169, 173, 178, 187, - 255, 131, 132, 140, 169, 174, 255, 130, - 132, 128, 182, 187, 255, 173, 180, 182, - 255, 132, 155, 159, 161, 175, 128, 163, - 165, 128, 134, 136, 152, 155, 161, 163, - 164, 166, 170, 144, 150, 132, 138, 145, - 146, 151, 166, 169, 128, 255, 176, 255, - 131, 137, 191, 145, 189, 135, 129, 130, - 132, 133, 144, 154, 176, 139, 159, 150, - 156, 159, 164, 167, 168, 170, 173, 145, - 176, 255, 139, 255, 166, 176, 171, 179, - 160, 161, 163, 164, 165, 166, 167, 169, - 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 168, 170, 150, - 153, 155, 163, 165, 167, 169, 173, 153, - 155, 148, 161, 163, 255, 131, 187, 189, - 132, 185, 190, 255, 141, 144, 129, 136, - 145, 151, 152, 161, 162, 163, 164, 255, - 129, 188, 190, 130, 131, 191, 255, 141, - 151, 129, 132, 133, 134, 137, 138, 142, - 161, 162, 163, 164, 255, 131, 188, 129, - 130, 190, 255, 145, 181, 129, 130, 131, - 134, 135, 136, 137, 138, 139, 141, 142, - 175, 176, 177, 178, 255, 134, 138, 141, - 129, 136, 142, 161, 162, 163, 164, 255, - 129, 188, 130, 131, 190, 191, 128, 141, - 129, 132, 135, 136, 139, 140, 150, 151, - 162, 163, 130, 190, 191, 128, 141, 151, - 129, 130, 134, 136, 138, 140, 128, 129, - 131, 190, 255, 133, 137, 129, 132, 142, - 148, 151, 161, 164, 255, 129, 188, 190, - 191, 130, 131, 130, 134, 128, 132, 135, - 136, 138, 139, 140, 141, 149, 150, 162, - 163, 129, 190, 130, 131, 191, 255, 133, - 137, 141, 151, 129, 132, 142, 161, 162, - 163, 164, 255, 138, 143, 150, 159, 144, - 145, 146, 148, 152, 158, 178, 179, 177, - 179, 180, 186, 135, 142, 177, 179, 180, - 185, 187, 188, 136, 141, 181, 183, 185, - 152, 153, 190, 191, 191, 177, 190, 128, - 132, 134, 135, 141, 151, 153, 188, 134, - 128, 129, 130, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 177, 173, 183, - 185, 186, 187, 188, 189, 190, 150, 151, - 152, 153, 158, 160, 177, 180, 130, 132, - 141, 157, 133, 134, 157, 159, 146, 148, - 178, 180, 146, 147, 178, 179, 182, 180, - 189, 190, 255, 134, 157, 137, 147, 148, - 255, 139, 141, 169, 133, 134, 178, 160, - 162, 163, 166, 167, 168, 169, 171, 176, - 184, 185, 187, 155, 151, 152, 153, 154, - 150, 160, 162, 191, 149, 151, 152, 158, - 165, 172, 173, 178, 179, 188, 176, 190, - 132, 181, 187, 128, 131, 180, 188, 189, - 255, 130, 133, 170, 171, 179, 180, 255, - 130, 161, 170, 128, 129, 162, 165, 166, - 167, 168, 173, 167, 173, 166, 169, 170, - 174, 175, 177, 178, 179, 164, 171, 172, - 179, 180, 181, 182, 183, 161, 173, 180, - 144, 146, 148, 168, 178, 179, 184, 185, - 128, 181, 187, 191, 128, 131, 179, 181, - 183, 140, 141, 144, 176, 175, 177, 191, - 160, 191, 128, 130, 170, 175, 153, 154, - 153, 154, 155, 160, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 175, 175, - 178, 180, 189, 158, 159, 176, 177, 130, - 134, 139, 167, 163, 164, 165, 166, 132, - 133, 134, 159, 160, 177, 178, 255, 166, - 173, 135, 145, 146, 147, 131, 179, 188, - 128, 130, 180, 181, 182, 185, 186, 255, - 165, 129, 255, 169, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 131, 140, 141, - 188, 176, 178, 180, 183, 184, 190, 191, - 129, 171, 181, 182, 172, 173, 174, 175, - 165, 168, 172, 173, 163, 170, 172, 184, - 190, 158, 128, 143, 160, 175, 144, 145, - 150, 155, 157, 158, 159, 135, 139, 141, - 168, 171, 189, 160, 182, 186, 191, 129, - 131, 133, 134, 140, 143, 184, 186, 165, - 166, 128, 129, 130, 132, 133, 134, 135, - 136, 139, 140, 141, 144, 145, 146, 147, - 150, 151, 152, 153, 154, 156, 176, 178, - 129, 128, 130, 184, 255, 135, 190, 130, - 131, 175, 176, 178, 183, 184, 187, 255, - 172, 128, 130, 167, 180, 179, 130, 128, - 129, 179, 181, 182, 190, 191, 255, 129, - 137, 138, 140, 141, 255, 180, 190, 172, - 174, 175, 177, 178, 181, 182, 183, 159, - 160, 162, 163, 170, 188, 190, 191, 128, - 129, 130, 131, 128, 151, 129, 132, 135, - 136, 139, 141, 162, 163, 166, 172, 176, - 180, 181, 183, 184, 191, 133, 128, 129, - 130, 134, 176, 185, 189, 177, 178, 179, - 186, 187, 190, 191, 255, 129, 132, 255, - 175, 190, 176, 177, 178, 181, 184, 187, - 188, 255, 129, 155, 158, 255, 189, 176, - 178, 179, 186, 187, 190, 191, 255, 129, - 255, 172, 182, 171, 173, 174, 175, 176, - 183, 166, 157, 159, 160, 161, 162, 171, - 175, 190, 176, 182, 184, 191, 169, 177, - 180, 146, 167, 170, 182, 171, 172, 189, - 190, 176, 180, 176, 182, 143, 146, 178, - 157, 158, 133, 134, 137, 168, 169, 170, - 166, 173, 165, 169, 174, 178, 187, 255, - 131, 132, 140, 169, 174, 255, 130, 132, - 128, 182, 187, 255, 173, 180, 182, 255, - 132, 155, 159, 161, 175, 128, 163, 165, - 128, 134, 136, 152, 155, 161, 163, 164, - 166, 170, 144, 150, 132, 138, 143, 187, - 191, 160, 128, 129, 132, 135, 133, 134, - 160, 255, 192, 255, 139, 168, 160, 128, - 129, 132, 135, 133, 134, 160, 255, 192, - 255, 144, 145, 150, 155, 157, 158, 144, - 145, 150, 155, 157, 158, 159, 135, 166, - 191, 133, 128, 191, 128, 130, 131, 132, - 133, 137, 138, 139, 140, 191, 174, 188, - 128, 129, 130, 131, 132, 133, 134, 144, - 145, 165, 166, 169, 170, 175, 176, 184, - 185, 191, 128, 132, 170, 129, 135, 136, - 191, 181, 186, 128, 191, 144, 128, 148, - 149, 150, 151, 191, 128, 132, 133, 135, - 136, 138, 139, 143, 144, 191, 163, 128, - 179, 180, 182, 183, 191, 128, 129, 191, - 166, 176, 191, 128, 151, 152, 158, 159, - 178, 179, 185, 186, 187, 188, 190, 128, - 191, 160, 128, 191, 128, 130, 131, 135, - 191, 129, 134, 136, 190, 128, 159, 160, - 191, 128, 175, 176, 255, 10, 13, 127, - 194, 216, 219, 220, 224, 225, 226, 234, - 235, 236, 237, 239, 240, 243, 0, 31, - 128, 191, 192, 223, 227, 238, 241, 247, - 248, 255, 204, 205, 210, 214, 215, 216, - 217, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 234, 239, 240, 243, 204, 205, - 210, 214, 215, 216, 217, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 234, 239, - 240, 243, 204, 205, 210, 214, 215, 216, - 217, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 234, 239, 240, 243, 194, 216, - 219, 220, 224, 225, 226, 234, 235, 236, - 237, 239, 240, 243, 32, 126, 192, 223, - 227, 238, 241, 247, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 235, 236, 237, 239, 240, 243, 204, - 205, 210, 214, 215, 216, 217, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 234, - 237, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 237, 239, 240, - 243, 204, 205, 210, 214, 215, 216, 217, - 219, 220, 221, 222, 223, 224, 225, 226, - 227, 234, 237, 239, 240, 243, 204, 205, - 210, 214, 215, 216, 217, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 234, 239, - 240, 243, 204, 205, 210, 214, 215, 216, - 217, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 234, 235, 236, 237, 239, 240, - 243, 204, 205, 210, 214, 215, 216, 217, - 219, 220, 221, 222, 223, 224, 225, 226, - 227, 234, 239, 240, 243, 204, 205, 210, - 214, 215, 216, 217, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 234, 239, 240, - 243, 204, 205, 210, 214, 215, 216, 217, - 219, 220, 221, 222, 223, 224, 225, 226, - 227, 234, 239, 240, 243, 204, 205, 210, - 214, 215, 216, 217, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 234, 237, 239, - 240, 243, 204, 205, 210, 214, 215, 216, - 217, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 234, 237, 239, 240, 243, 204, - 205, 210, 214, 215, 216, 217, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 234, - 237, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, -} - -var _graphclust_single_lengths []byte = []byte{ - 0, 1, 0, 0, 0, 1, 1, 0, - 1, 0, 1, 0, 0, 0, 26, 0, - 0, 0, 1, 1, 1, 0, 0, 2, - 1, 0, 1, 1, 0, 2, 0, 0, - 2, 0, 2, 1, 0, 1, 0, 3, - 0, 0, 1, 21, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 1, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 1, - 0, 5, 2, 6, 0, 1, 0, 1, - 0, 2, 0, 0, 15, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 2, 1, 1, 0, 3, 1, 0, 7, - 5, 1, 1, 0, 1, 0, 23, 0, - 0, 0, 0, 1, 0, 0, 1, 0, - 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 4, 0, 0, - 0, 0, 1, 0, 6, 0, 0, 0, - 0, 0, 1, 3, 0, 0, 0, 3, - 0, 0, 0, 0, 1, 1, 0, 1, - 0, 1, 0, 0, 0, 29, 0, 0, - 0, 3, 2, 3, 2, 2, 2, 3, - 2, 2, 3, 3, 1, 2, 4, 2, - 2, 4, 4, 2, 0, 2, 0, 3, - 1, 0, 1, 21, 1, 0, 4, 0, - 0, 0, 1, 2, 0, 1, 1, 1, - 4, 0, 3, 1, 3, 2, 0, 3, - 0, 5, 2, 0, 0, 1, 0, 2, - 0, 0, 15, 0, 0, 0, 4, 0, - 0, 0, 3, 1, 0, 4, 1, 4, - 4, 3, 1, 0, 7, 5, 1, 1, - 0, 1, 0, 23, 1, 0, 1, 1, - 1, 1, 0, 2, 1, 3, 2, 0, - 1, 3, 1, 2, 0, 1, 0, 2, - 1, 2, 3, 4, 0, 0, 0, 1, - 0, 6, 2, 0, 0, 0, 0, 1, - 3, 0, 0, 0, 1, 0, 1, 4, - 0, 0, 0, 1, 1, 1, 4, 0, - 0, 0, 6, 0, 1, 1, 0, 0, - 0, 1, 1, 0, 1, 0, 1, 0, - 0, 0, 26, 0, 0, 0, 1, 1, - 1, 0, 0, 2, 1, 0, 1, 1, - 0, 2, 0, 0, 2, 0, 2, 1, - 0, 1, 0, 3, 0, 0, 1, 21, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 1, 0, 5, 2, 6, - 0, 1, 0, 1, 0, 2, 0, 0, - 15, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 2, 1, 1, 0, - 3, 1, 0, 7, 5, 1, 1, 0, - 1, 0, 23, 0, 0, 0, 0, 1, - 0, 0, 1, 0, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 4, 0, 0, 0, 0, 1, 0, - 6, 0, 0, 0, 0, 0, 1, 3, - 0, 0, 0, 3, 0, 0, 0, 0, - 1, 1, 0, 1, 0, 1, 0, 0, - 0, 29, 0, 0, 0, 3, 2, 3, - 2, 2, 2, 3, 2, 2, 3, 3, - 1, 2, 4, 2, 2, 4, 4, 2, - 0, 2, 0, 3, 1, 0, 1, 21, - 1, 0, 4, 0, 0, 0, 1, 2, - 0, 1, 1, 1, 4, 0, 3, 1, - 3, 2, 0, 3, 0, 5, 2, 0, - 0, 1, 0, 2, 0, 0, 15, 0, - 0, 0, 4, 0, 0, 0, 3, 1, - 0, 4, 1, 4, 4, 3, 1, 0, - 7, 5, 1, 1, 0, 1, 0, 23, - 1, 0, 1, 1, 1, 1, 0, 2, - 1, 3, 2, 0, 1, 3, 1, 2, - 0, 1, 0, 2, 1, 2, 3, 4, - 0, 0, 0, 1, 0, 6, 2, 0, - 0, 0, 0, 1, 3, 0, 0, 0, - 1, 0, 1, 4, 0, 0, 0, 1, - 1, 1, 4, 0, 0, 0, 6, 0, - 0, 0, 1, 1, 2, 1, 1, 5, - 0, 24, 0, 24, 0, 0, 23, 0, - 0, 1, 0, 2, 0, 0, 0, 28, - 0, 3, 23, 2, 0, 2, 2, 3, - 2, 2, 2, 0, 54, 54, 27, 1, - 0, 5, 2, 0, 1, 1, 0, 0, - 14, 0, 3, 2, 2, 3, 2, 2, - 2, 54, 54, 27, 1, 0, 2, 0, - 1, 4, 2, 1, 0, 1, 0, 1, - 0, 11, 0, 7, 1, 0, 1, 0, - 2, 3, 2, 1, 0, 1, 1, 3, - 0, 1, 3, 0, 1, 1, 2, 1, - 1, 5, 0, 0, 0, 0, 1, 1, - 0, 1, 0, 1, 0, 0, 0, 26, - 0, 0, 0, 1, 1, 1, 0, 0, - 2, 1, 0, 1, 1, 0, 2, 0, - 0, 2, 0, 2, 1, 0, 1, 0, - 3, 0, 0, 1, 21, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 1, 0, 5, 2, 6, 0, 1, 0, - 1, 0, 2, 0, 0, 15, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 0, 2, 1, 1, 0, 3, 1, 0, - 7, 5, 1, 1, 0, 1, 0, 23, - 0, 0, 0, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 0, 1, 0, 6, 0, 0, - 0, 0, 0, 1, 3, 0, 0, 0, - 3, 0, 0, 0, 0, 1, 1, 0, - 1, 0, 1, 0, 0, 0, 29, 0, - 0, 0, 3, 2, 3, 2, 2, 2, - 3, 2, 2, 3, 3, 1, 2, 4, - 2, 2, 4, 4, 2, 0, 2, 0, - 3, 1, 0, 1, 21, 1, 0, 4, - 0, 0, 0, 1, 2, 0, 1, 1, - 1, 4, 0, 3, 1, 3, 2, 0, - 3, 0, 5, 2, 0, 0, 1, 0, - 2, 0, 0, 15, 0, 0, 0, 4, - 0, 0, 0, 3, 1, 0, 4, 1, - 4, 4, 3, 1, 0, 7, 5, 1, - 1, 0, 1, 0, 23, 1, 0, 1, - 1, 1, 1, 0, 2, 1, 3, 2, - 0, 1, 3, 1, 2, 0, 1, 0, - 2, 1, 2, 3, 4, 0, 0, 0, - 1, 0, 6, 2, 0, 0, 0, 0, - 1, 3, 0, 0, 0, 1, 0, 1, - 4, 0, 0, 0, 1, 1, 1, 4, - 0, 0, 0, 6, 24, 0, 24, 0, - 0, 23, 0, 0, 1, 0, 2, 0, - 0, 0, 28, 0, 3, 23, 2, 0, - 2, 2, 3, 2, 2, 2, 0, 54, - 54, 27, 1, 1, 5, 2, 0, 0, - 0, 1, 1, 0, 1, 0, 1, 0, - 0, 0, 26, 0, 0, 0, 1, 1, - 1, 0, 0, 2, 1, 0, 1, 1, - 0, 2, 0, 0, 2, 0, 2, 1, - 0, 1, 0, 3, 0, 0, 1, 21, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 1, 0, 5, 2, 0, - 0, 1, 0, 2, 0, 0, 15, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 2, 1, 1, 0, 3, 1, - 0, 6, 5, 1, 1, 0, 1, 0, - 23, 0, 0, 0, 0, 1, 0, 0, - 1, 0, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 4, - 0, 0, 0, 0, 1, 0, 6, 0, - 0, 0, 0, 0, 1, 3, 0, 0, - 0, 1, 4, 0, 0, 0, 6, 1, - 7, 3, 0, 0, 0, 0, 1, 1, - 0, 1, 0, 1, 0, 0, 0, 29, - 0, 0, 0, 3, 2, 3, 2, 2, - 2, 3, 2, 2, 3, 3, 1, 2, - 4, 2, 2, 4, 4, 2, 0, 2, - 0, 3, 1, 0, 1, 21, 1, 0, - 4, 0, 0, 0, 1, 2, 0, 1, - 1, 1, 4, 0, 3, 1, 3, 2, - 0, 3, 0, 5, 2, 0, 0, 1, - 0, 2, 0, 0, 15, 0, 0, 0, - 4, 0, 0, 0, 3, 1, 0, 4, - 1, 4, 4, 3, 1, 0, 7, 5, - 1, 1, 0, 1, 0, 23, 1, 0, - 1, 1, 1, 1, 0, 2, 1, 3, - 2, 0, 1, 3, 1, 2, 0, 1, - 0, 2, 1, 2, 3, 4, 0, 0, - 0, 1, 0, 6, 2, 0, 0, 0, - 0, 1, 3, 0, 0, 0, 1, 0, - 1, 4, 0, 0, 0, 1, 1, 0, - 1, 0, 0, 0, 1, 1, 0, 1, - 0, 1, 0, 0, 0, 29, 0, 0, - 0, 3, 0, 0, 0, 1, 1, 0, - 1, 0, 1, 0, 0, 0, 26, 0, - 0, 0, 1, 1, 1, 0, 0, 2, - 1, 0, 1, 1, 0, 2, 0, 0, - 2, 0, 2, 1, 0, 1, 0, 3, - 0, 0, 1, 21, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 1, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 1, - 0, 5, 2, 6, 0, 1, 0, 1, - 0, 2, 0, 0, 15, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 2, 1, 1, 0, 3, 1, 0, 7, - 5, 1, 1, 0, 1, 0, 23, 0, - 0, 0, 0, 1, 0, 0, 1, 0, - 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 4, 0, 0, - 0, 0, 1, 0, 6, 0, 0, 0, - 0, 0, 1, 3, 0, 0, 0, 3, - 0, 1, 1, 1, 4, 0, 0, 0, - 6, 2, 3, 2, 2, 2, 3, 2, - 2, 3, 3, 1, 2, 4, 2, 2, - 4, 4, 2, 0, 2, 0, 3, 1, - 0, 1, 21, 1, 0, 4, 0, 0, - 0, 1, 2, 0, 1, 1, 1, 4, - 0, 3, 1, 3, 2, 0, 3, 0, - 5, 2, 0, 0, 1, 0, 2, 0, - 0, 15, 0, 0, 0, 4, 0, 0, - 0, 3, 1, 0, 4, 1, 4, 4, - 3, 1, 0, 7, 5, 1, 1, 0, - 1, 0, 23, 1, 0, 1, 1, 1, - 1, 0, 2, 1, 3, 2, 0, 1, - 3, 1, 2, 0, 1, 0, 2, 1, - 2, 3, 4, 0, 0, 0, 1, 0, - 6, 2, 0, 0, 0, 0, 1, 3, - 0, 0, 0, 1, 0, 1, 4, 0, - 0, 0, 1, 0, 0, 14, 0, 3, - 2, 2, 3, 2, 2, 2, 54, 54, - 29, 1, 0, 0, 0, 0, 2, 1, - 1, 4, 2, 1, 0, 1, 0, 1, - 0, 11, 0, 0, 0, 0, 1, 1, - 0, 1, 0, 1, 0, 0, 0, 26, - 0, 0, 0, 1, 1, 1, 0, 0, - 2, 1, 0, 1, 1, 0, 2, 0, - 0, 2, 0, 2, 1, 0, 1, 0, - 3, 0, 0, 1, 21, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 1, 0, 5, 2, 6, 0, 1, 0, - 1, 0, 2, 0, 0, 15, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 0, 2, 1, 1, 0, 3, 1, 0, - 7, 5, 1, 1, 0, 1, 0, 23, - 0, 0, 0, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 0, 1, 0, 6, 0, 0, - 0, 0, 0, 1, 3, 0, 0, 0, - 3, 0, 0, 0, 0, 1, 1, 0, - 1, 0, 1, 0, 0, 0, 29, 0, - 0, 0, 3, 2, 3, 2, 2, 2, - 3, 2, 2, 3, 3, 1, 2, 4, - 2, 2, 4, 4, 2, 0, 2, 0, - 3, 1, 0, 1, 21, 1, 0, 4, - 0, 0, 0, 1, 2, 0, 1, 1, - 1, 4, 0, 3, 1, 3, 2, 0, - 3, 0, 5, 2, 0, 0, 1, 0, - 2, 0, 0, 15, 0, 0, 0, 4, - 0, 0, 0, 3, 1, 0, 4, 1, - 4, 4, 3, 1, 0, 7, 5, 1, - 1, 0, 1, 0, 23, 1, 0, 1, - 1, 1, 1, 0, 2, 1, 3, 2, - 0, 1, 3, 1, 2, 0, 1, 0, - 2, 1, 2, 3, 4, 0, 0, 0, - 1, 0, 6, 2, 0, 0, 0, 0, - 1, 3, 0, 0, 0, 1, 0, 1, - 4, 0, 0, 0, 1, 1, 1, 4, - 0, 0, 0, 6, 7, 1, 0, 1, - 0, 2, 3, 2, 1, 0, 1, 1, - 3, 0, 1, 5, 0, 0, 17, 20, - 20, 20, 14, 20, 20, 20, 23, 21, - 21, 21, 20, 23, 20, 20, 20, 21, - 21, 21, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, -} - -var _graphclust_range_lengths []byte = []byte{ - 0, 0, 1, 1, 1, 1, 2, 1, - 1, 4, 1, 1, 1, 1, 2, 4, - 1, 2, 1, 2, 2, 5, 6, 2, - 2, 5, 1, 3, 2, 3, 5, 2, - 3, 1, 3, 1, 1, 2, 1, 2, - 1, 4, 0, 0, 2, 3, 1, 1, - 2, 2, 1, 2, 1, 1, 2, 1, - 2, 1, 2, 2, 2, 1, 1, 4, - 2, 0, 0, 0, 1, 0, 1, 0, - 1, 0, 1, 1, 0, 2, 1, 1, - 1, 2, 2, 1, 1, 2, 2, 1, - 1, 3, 2, 2, 0, 0, 2, 0, - 0, 0, 0, 1, 4, 1, 0, 2, - 1, 2, 2, 0, 2, 2, 1, 1, - 2, 6, 1, 1, 1, 1, 2, 2, - 1, 1, 1, 2, 2, 0, 1, 1, - 1, 1, 0, 1, 0, 3, 3, 1, - 2, 2, 2, 0, 5, 1, 1, 0, - 1, 1, 1, 1, 1, 2, 1, 1, - 4, 1, 1, 1, 1, 1, 4, 1, - 2, 2, 5, 2, 6, 2, 8, 4, - 2, 5, 0, 3, 2, 4, 1, 6, - 2, 4, 4, 1, 1, 2, 1, 2, - 1, 4, 0, 0, 4, 4, 1, 1, - 2, 2, 2, 2, 1, 1, 6, 2, - 5, 1, 3, 3, 4, 4, 4, 4, - 2, 0, 0, 1, 1, 0, 1, 0, - 1, 1, 0, 2, 1, 1, 2, 4, - 1, 2, 4, 1, 5, 0, 3, 2, - 1, 0, 0, 2, 0, 0, 0, 0, - 1, 4, 1, 0, 2, 1, 4, 2, - 0, 4, 3, 4, 2, 2, 6, 2, - 2, 4, 1, 4, 2, 4, 1, 3, - 3, 2, 2, 0, 1, 1, 1, 0, - 1, 0, 3, 3, 1, 2, 2, 2, - 0, 5, 1, 1, 0, 1, 0, 1, - 1, 1, 0, 0, 0, 0, 1, 1, - 1, 0, 0, 1, 2, 2, 1, 1, - 1, 1, 2, 1, 1, 4, 1, 1, - 1, 1, 2, 4, 1, 2, 1, 2, - 2, 5, 6, 2, 2, 5, 1, 3, - 2, 3, 5, 2, 3, 1, 3, 1, - 1, 2, 1, 2, 1, 4, 0, 0, - 2, 3, 1, 1, 2, 2, 1, 2, - 1, 1, 2, 1, 2, 1, 2, 2, - 2, 1, 1, 4, 2, 0, 0, 0, - 1, 0, 1, 0, 1, 0, 1, 1, - 0, 2, 1, 1, 1, 2, 2, 1, - 1, 2, 2, 1, 1, 3, 2, 2, - 0, 0, 2, 0, 0, 0, 0, 1, - 4, 1, 0, 2, 1, 2, 2, 0, - 2, 2, 1, 1, 2, 6, 1, 1, - 1, 1, 2, 2, 1, 1, 1, 2, - 2, 0, 1, 1, 1, 1, 0, 1, - 0, 3, 3, 1, 2, 2, 2, 0, - 5, 1, 1, 0, 1, 1, 1, 1, - 1, 2, 1, 1, 4, 1, 1, 1, - 1, 1, 4, 1, 2, 2, 5, 2, - 6, 2, 8, 4, 2, 5, 0, 3, - 2, 4, 1, 6, 2, 4, 4, 1, - 1, 2, 1, 2, 1, 4, 0, 0, - 4, 4, 1, 1, 2, 2, 2, 2, - 1, 1, 6, 2, 5, 1, 3, 3, - 4, 4, 4, 4, 2, 0, 0, 1, - 1, 0, 1, 0, 1, 1, 0, 2, - 1, 1, 2, 4, 1, 2, 4, 1, - 5, 0, 3, 2, 1, 0, 0, 2, - 0, 0, 0, 0, 1, 4, 1, 0, - 2, 1, 4, 2, 0, 4, 3, 4, - 2, 2, 6, 2, 2, 4, 1, 4, - 2, 4, 1, 3, 3, 2, 2, 0, - 1, 1, 1, 0, 1, 0, 3, 3, - 1, 2, 2, 2, 0, 5, 1, 1, - 0, 1, 0, 1, 1, 1, 0, 0, - 0, 0, 1, 1, 1, 0, 0, 1, - 2, 3, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 0, 1, 1, 0, 1, - 1, 0, 1, 0, 1, 3, 1, 2, - 2, 1, 0, 0, 1, 0, 0, 0, - 0, 0, 1, 0, 1, 1, 2, 2, - 2, 1, 3, 2, 1, 1, 3, 1, - 3, 3, 1, 0, 0, 0, 0, 0, - 1, 1, 1, 2, 2, 4, 1, 1, - 2, 1, 1, 1, 3, 1, 2, 1, - 2, 1, 2, 0, 0, 1, 1, 5, - 9, 2, 1, 3, 5, 3, 1, 6, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, - 1, 1, 4, 1, 1, 1, 1, 2, - 4, 1, 2, 1, 2, 2, 5, 6, - 2, 2, 5, 1, 3, 2, 3, 5, - 2, 3, 1, 3, 1, 1, 2, 1, - 2, 1, 4, 0, 0, 2, 3, 1, - 1, 2, 2, 1, 2, 1, 1, 2, - 1, 2, 1, 2, 2, 2, 1, 1, - 4, 2, 0, 0, 0, 1, 0, 1, - 0, 1, 0, 1, 1, 0, 2, 1, - 1, 1, 2, 2, 1, 1, 2, 2, - 1, 1, 3, 2, 2, 0, 0, 2, - 0, 0, 0, 0, 1, 4, 1, 0, - 2, 1, 2, 2, 0, 2, 2, 1, - 1, 2, 6, 1, 1, 1, 1, 2, - 2, 1, 1, 1, 2, 2, 0, 1, - 1, 1, 1, 0, 1, 0, 3, 3, - 1, 2, 2, 2, 0, 5, 1, 1, - 0, 1, 1, 1, 1, 1, 2, 1, - 1, 4, 1, 1, 1, 1, 1, 4, - 1, 2, 2, 5, 2, 6, 2, 8, - 4, 2, 5, 0, 3, 2, 4, 1, - 6, 2, 4, 4, 1, 1, 2, 1, - 2, 1, 4, 0, 0, 4, 4, 1, - 1, 2, 2, 2, 2, 1, 1, 6, - 2, 5, 1, 3, 3, 4, 4, 4, - 4, 2, 0, 0, 1, 1, 0, 1, - 0, 1, 1, 0, 2, 1, 1, 2, - 4, 1, 2, 4, 1, 5, 0, 3, - 2, 1, 0, 0, 2, 0, 0, 0, - 0, 1, 4, 1, 0, 2, 1, 4, - 2, 0, 4, 3, 4, 2, 2, 6, - 2, 2, 4, 1, 4, 2, 4, 1, - 3, 3, 2, 2, 0, 1, 1, 1, - 0, 1, 0, 3, 3, 1, 2, 2, - 2, 0, 5, 1, 1, 0, 1, 0, - 1, 1, 1, 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 1, 0, 1, - 1, 0, 1, 1, 0, 1, 0, 1, - 3, 1, 2, 2, 1, 0, 0, 1, - 0, 0, 0, 0, 0, 1, 0, 1, - 1, 2, 2, 1, 1, 5, 1, 1, - 1, 1, 2, 1, 1, 4, 1, 1, - 1, 1, 2, 4, 1, 2, 1, 2, - 2, 5, 6, 2, 2, 5, 1, 3, - 2, 3, 5, 2, 3, 1, 3, 1, - 1, 2, 1, 2, 1, 4, 0, 0, - 2, 3, 1, 1, 2, 2, 1, 2, - 1, 1, 2, 1, 2, 1, 2, 2, - 2, 1, 1, 4, 2, 0, 0, 1, - 1, 0, 1, 0, 1, 1, 0, 2, - 1, 1, 1, 2, 2, 1, 1, 2, - 2, 1, 1, 3, 2, 2, 0, 0, - 2, 0, 0, 0, 0, 1, 4, 1, - 0, 2, 1, 2, 2, 0, 2, 2, - 1, 1, 2, 6, 1, 1, 1, 1, - 2, 2, 1, 1, 1, 2, 2, 0, - 1, 1, 1, 1, 0, 1, 0, 3, - 3, 1, 2, 2, 2, 0, 5, 1, - 1, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 1, 1, 1, 1, 1, 2, - 1, 1, 4, 1, 1, 1, 1, 1, - 4, 1, 2, 2, 5, 2, 6, 2, - 8, 4, 2, 5, 0, 3, 2, 4, - 1, 6, 2, 4, 4, 1, 1, 2, - 1, 2, 1, 4, 0, 0, 4, 4, - 1, 1, 2, 2, 2, 2, 1, 1, - 6, 2, 5, 1, 3, 3, 4, 4, - 4, 4, 2, 0, 0, 1, 1, 0, - 1, 0, 1, 1, 0, 2, 1, 1, - 2, 4, 1, 2, 4, 1, 5, 0, - 3, 2, 1, 0, 0, 2, 0, 0, - 0, 0, 1, 4, 1, 0, 2, 1, - 4, 2, 0, 4, 3, 4, 2, 2, - 6, 2, 2, 4, 1, 4, 2, 4, - 1, 3, 3, 2, 2, 0, 1, 1, - 1, 0, 1, 0, 3, 3, 1, 2, - 2, 2, 0, 5, 1, 1, 0, 1, - 0, 1, 1, 1, 0, 0, 0, 3, - 1, 1, 1, 1, 1, 2, 1, 1, - 4, 1, 1, 1, 1, 1, 4, 1, - 2, 2, 1, 1, 1, 1, 2, 1, - 1, 4, 1, 1, 1, 1, 2, 4, - 1, 2, 1, 2, 2, 5, 6, 2, - 2, 5, 1, 3, 2, 3, 5, 2, - 3, 1, 3, 1, 1, 2, 1, 2, - 1, 4, 0, 0, 2, 3, 1, 1, - 2, 2, 1, 2, 1, 1, 2, 1, - 2, 1, 2, 2, 2, 1, 1, 4, - 2, 0, 0, 0, 1, 0, 1, 0, - 1, 0, 1, 1, 0, 2, 1, 1, - 1, 2, 2, 1, 1, 2, 2, 1, - 1, 3, 2, 2, 0, 0, 2, 0, - 0, 0, 0, 1, 4, 1, 0, 2, - 1, 2, 2, 0, 2, 2, 1, 1, - 2, 6, 1, 1, 1, 1, 2, 2, - 1, 1, 1, 2, 2, 0, 1, 1, - 1, 1, 0, 1, 0, 3, 3, 1, - 2, 2, 2, 0, 5, 1, 1, 0, - 1, 0, 0, 0, 1, 1, 1, 0, - 0, 5, 2, 6, 2, 8, 4, 2, - 5, 0, 3, 2, 4, 1, 6, 2, - 4, 4, 1, 1, 2, 1, 2, 1, - 4, 0, 0, 4, 4, 1, 1, 2, - 2, 2, 2, 1, 1, 6, 2, 5, - 1, 3, 3, 4, 4, 4, 4, 2, - 0, 0, 1, 1, 0, 1, 0, 1, - 1, 0, 2, 1, 1, 2, 4, 1, - 2, 4, 1, 5, 0, 3, 2, 1, - 0, 0, 2, 0, 0, 0, 0, 1, - 4, 1, 0, 2, 1, 4, 2, 0, - 4, 3, 4, 2, 2, 6, 2, 2, - 4, 1, 4, 2, 4, 1, 3, 3, - 2, 2, 0, 1, 1, 1, 0, 1, - 0, 3, 3, 1, 2, 2, 2, 0, - 5, 1, 1, 0, 1, 0, 1, 1, - 1, 0, 1, 3, 1, 3, 3, 1, - 0, 0, 0, 0, 0, 1, 1, 1, - 3, 2, 4, 1, 0, 1, 1, 1, - 3, 1, 1, 1, 3, 1, 3, 1, - 3, 1, 2, 1, 1, 1, 1, 2, - 1, 1, 4, 1, 1, 1, 1, 2, - 4, 1, 2, 1, 2, 2, 5, 6, - 2, 2, 5, 1, 3, 2, 3, 5, - 2, 3, 1, 3, 1, 1, 2, 1, - 2, 1, 4, 0, 0, 2, 3, 1, - 1, 2, 2, 1, 2, 1, 1, 2, - 1, 2, 1, 2, 2, 2, 1, 1, - 4, 2, 0, 0, 0, 1, 0, 1, - 0, 1, 0, 1, 1, 0, 2, 1, - 1, 1, 2, 2, 1, 1, 2, 2, - 1, 1, 3, 2, 2, 0, 0, 2, - 0, 0, 0, 0, 1, 4, 1, 0, - 2, 1, 2, 2, 0, 2, 2, 1, - 1, 2, 6, 1, 1, 1, 1, 2, - 2, 1, 1, 1, 2, 2, 0, 1, - 1, 1, 1, 0, 1, 0, 3, 3, - 1, 2, 2, 2, 0, 5, 1, 1, - 0, 1, 1, 1, 1, 1, 2, 1, - 1, 4, 1, 1, 1, 1, 1, 4, - 1, 2, 2, 5, 2, 6, 2, 8, - 4, 2, 5, 0, 3, 2, 4, 1, - 6, 2, 4, 4, 1, 1, 2, 1, - 2, 1, 4, 0, 0, 4, 4, 1, - 1, 2, 2, 2, 2, 1, 1, 6, - 2, 5, 1, 3, 3, 4, 4, 4, - 4, 2, 0, 0, 1, 1, 0, 1, - 0, 1, 1, 0, 2, 1, 1, 2, - 4, 1, 2, 4, 1, 5, 0, 3, - 2, 1, 0, 0, 2, 0, 0, 0, - 0, 1, 4, 1, 0, 2, 1, 4, - 2, 0, 4, 3, 4, 2, 2, 6, - 2, 2, 4, 1, 4, 2, 4, 1, - 3, 3, 2, 2, 0, 1, 1, 1, - 0, 1, 0, 3, 3, 1, 2, 2, - 2, 0, 5, 1, 1, 0, 1, 0, - 1, 1, 1, 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 1, 1, - 5, 9, 2, 1, 3, 5, 3, 1, - 6, 1, 1, 2, 2, 2, 6, 0, - 0, 0, 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -} - -var _graphclust_index_offsets []int16 = []int16{ - 0, 0, 2, 4, 6, 8, 11, 15, - 17, 20, 25, 28, 30, 32, 34, 63, - 68, 70, 73, 76, 80, 84, 90, 97, - 102, 106, 112, 115, 120, 123, 129, 135, - 138, 144, 146, 152, 155, 157, 161, 163, - 169, 171, 176, 178, 200, 203, 207, 212, - 214, 217, 220, 222, 225, 227, 230, 233, - 235, 241, 243, 246, 249, 252, 254, 256, - 262, 265, 271, 274, 281, 283, 285, 287, - 289, 291, 294, 296, 298, 314, 317, 319, - 321, 326, 329, 332, 334, 336, 339, 342, - 344, 348, 353, 357, 360, 364, 366, 369, - 377, 383, 385, 387, 389, 395, 397, 421, - 424, 426, 429, 432, 434, 437, 440, 443, - 445, 449, 457, 459, 461, 463, 465, 468, - 471, 473, 475, 477, 480, 483, 488, 490, - 492, 494, 496, 498, 500, 507, 511, 515, - 517, 520, 523, 527, 531, 537, 539, 541, - 545, 547, 549, 551, 553, 556, 560, 562, - 565, 570, 573, 575, 577, 579, 610, 615, - 617, 620, 626, 634, 640, 649, 654, 665, - 673, 678, 686, 690, 697, 701, 708, 714, - 723, 728, 737, 746, 750, 752, 757, 759, - 765, 768, 773, 775, 797, 803, 808, 814, - 816, 819, 822, 826, 831, 833, 836, 844, - 848, 858, 860, 867, 872, 880, 887, 892, - 900, 903, 909, 912, 914, 916, 918, 920, - 923, 925, 927, 943, 946, 948, 950, 957, - 962, 964, 967, 975, 978, 984, 989, 994, - 1001, 1007, 1011, 1013, 1016, 1024, 1030, 1032, - 1034, 1036, 1042, 1044, 1068, 1072, 1074, 1080, - 1084, 1086, 1092, 1096, 1103, 1107, 1113, 1122, - 1125, 1129, 1137, 1140, 1147, 1150, 1156, 1158, - 1164, 1169, 1174, 1180, 1185, 1187, 1189, 1191, - 1193, 1195, 1202, 1208, 1212, 1214, 1217, 1220, - 1224, 1228, 1234, 1236, 1238, 1240, 1242, 1244, - 1250, 1252, 1254, 1255, 1257, 1259, 1261, 1267, - 1269, 1271, 1272, 1279, 1281, 1285, 1289, 1291, - 1293, 1295, 1298, 1302, 1304, 1307, 1312, 1315, - 1317, 1319, 1321, 1350, 1355, 1357, 1360, 1363, - 1367, 1371, 1377, 1384, 1389, 1393, 1399, 1402, - 1407, 1410, 1416, 1422, 1425, 1431, 1433, 1439, - 1442, 1444, 1448, 1450, 1456, 1458, 1463, 1465, - 1487, 1490, 1494, 1499, 1501, 1504, 1507, 1509, - 1512, 1514, 1517, 1520, 1522, 1528, 1530, 1533, - 1536, 1539, 1541, 1543, 1549, 1552, 1558, 1561, - 1568, 1570, 1572, 1574, 1576, 1578, 1581, 1583, - 1585, 1601, 1604, 1606, 1608, 1613, 1616, 1619, - 1621, 1623, 1626, 1629, 1631, 1635, 1640, 1644, - 1647, 1651, 1653, 1656, 1664, 1670, 1672, 1674, - 1676, 1682, 1684, 1708, 1711, 1713, 1716, 1719, - 1721, 1724, 1727, 1730, 1732, 1736, 1744, 1746, - 1748, 1750, 1752, 1755, 1758, 1760, 1762, 1764, - 1767, 1770, 1775, 1777, 1779, 1781, 1783, 1785, - 1787, 1794, 1798, 1802, 1804, 1807, 1810, 1814, - 1818, 1824, 1826, 1828, 1832, 1834, 1836, 1838, - 1840, 1843, 1847, 1849, 1852, 1857, 1860, 1862, - 1864, 1866, 1897, 1902, 1904, 1907, 1913, 1921, - 1927, 1936, 1941, 1952, 1960, 1965, 1973, 1977, - 1984, 1988, 1995, 2001, 2010, 2015, 2024, 2033, - 2037, 2039, 2044, 2046, 2052, 2055, 2060, 2062, - 2084, 2090, 2095, 2101, 2103, 2106, 2109, 2113, - 2118, 2120, 2123, 2131, 2135, 2145, 2147, 2154, - 2159, 2167, 2174, 2179, 2187, 2190, 2196, 2199, - 2201, 2203, 2205, 2207, 2210, 2212, 2214, 2230, - 2233, 2235, 2237, 2244, 2249, 2251, 2254, 2262, - 2265, 2271, 2276, 2281, 2288, 2294, 2298, 2300, - 2303, 2311, 2317, 2319, 2321, 2323, 2329, 2331, - 2355, 2359, 2361, 2367, 2371, 2373, 2379, 2383, - 2390, 2394, 2400, 2409, 2412, 2416, 2424, 2427, - 2434, 2437, 2443, 2445, 2451, 2456, 2461, 2467, - 2472, 2474, 2476, 2478, 2480, 2482, 2489, 2495, - 2499, 2501, 2504, 2507, 2511, 2515, 2521, 2523, - 2525, 2527, 2529, 2531, 2537, 2539, 2541, 2542, - 2544, 2546, 2548, 2554, 2556, 2558, 2559, 2566, - 2568, 2571, 2575, 2578, 2581, 2585, 2588, 2591, - 2598, 2600, 2625, 2627, 2652, 2654, 2656, 2680, - 2682, 2684, 2686, 2688, 2691, 2693, 2697, 2699, - 2730, 2733, 2738, 2762, 2765, 2767, 2770, 2773, - 2777, 2780, 2783, 2787, 2788, 2844, 2900, 2930, - 2934, 2937, 2944, 2950, 2953, 2956, 2959, 2963, - 2965, 2983, 2987, 2992, 2995, 2998, 3002, 3005, - 3008, 3012, 3068, 3124, 3154, 3158, 3163, 3167, - 3169, 3173, 3179, 3183, 3186, 3190, 3193, 3196, - 3199, 3202, 3215, 3218, 3226, 3228, 3230, 3233, - 3239, 3251, 3257, 3261, 3266, 3272, 3277, 3280, - 3290, 3292, 3295, 3300, 3302, 3305, 3308, 3312, - 3315, 3318, 3325, 3327, 3329, 3331, 3333, 3336, - 3340, 3342, 3345, 3350, 3353, 3355, 3357, 3359, - 3388, 3393, 3395, 3398, 3401, 3405, 3409, 3415, - 3422, 3427, 3431, 3437, 3440, 3445, 3448, 3454, - 3460, 3463, 3469, 3471, 3477, 3480, 3482, 3486, - 3488, 3494, 3496, 3501, 3503, 3525, 3528, 3532, - 3537, 3539, 3542, 3545, 3547, 3550, 3552, 3555, - 3558, 3560, 3566, 3568, 3571, 3574, 3577, 3579, - 3581, 3587, 3590, 3596, 3599, 3606, 3608, 3610, - 3612, 3614, 3616, 3619, 3621, 3623, 3639, 3642, - 3644, 3646, 3651, 3654, 3657, 3659, 3661, 3664, - 3667, 3669, 3673, 3678, 3682, 3685, 3689, 3691, - 3694, 3702, 3708, 3710, 3712, 3714, 3720, 3722, - 3746, 3749, 3751, 3754, 3757, 3759, 3762, 3765, - 3768, 3770, 3774, 3782, 3784, 3786, 3788, 3790, - 3793, 3796, 3798, 3800, 3802, 3805, 3808, 3813, - 3815, 3817, 3819, 3821, 3823, 3825, 3832, 3836, - 3840, 3842, 3845, 3848, 3852, 3856, 3862, 3864, - 3866, 3870, 3872, 3874, 3876, 3878, 3881, 3885, - 3887, 3890, 3895, 3898, 3900, 3902, 3904, 3935, - 3940, 3942, 3945, 3951, 3959, 3965, 3974, 3979, - 3990, 3998, 4003, 4011, 4015, 4022, 4026, 4033, - 4039, 4048, 4053, 4062, 4071, 4075, 4077, 4082, - 4084, 4090, 4093, 4098, 4100, 4122, 4128, 4133, - 4139, 4141, 4144, 4147, 4151, 4156, 4158, 4161, - 4169, 4173, 4183, 4185, 4192, 4197, 4205, 4212, - 4217, 4225, 4228, 4234, 4237, 4239, 4241, 4243, - 4245, 4248, 4250, 4252, 4268, 4271, 4273, 4275, - 4282, 4287, 4289, 4292, 4300, 4303, 4309, 4314, - 4319, 4326, 4332, 4336, 4338, 4341, 4349, 4355, - 4357, 4359, 4361, 4367, 4369, 4393, 4397, 4399, - 4405, 4409, 4411, 4417, 4421, 4428, 4432, 4438, - 4447, 4450, 4454, 4462, 4465, 4472, 4475, 4481, - 4483, 4489, 4494, 4499, 4505, 4510, 4512, 4514, - 4516, 4518, 4520, 4527, 4533, 4537, 4539, 4542, - 4545, 4549, 4553, 4559, 4561, 4563, 4565, 4567, - 4569, 4575, 4577, 4579, 4580, 4582, 4584, 4586, - 4592, 4594, 4596, 4597, 4604, 4629, 4631, 4656, - 4658, 4660, 4684, 4686, 4688, 4690, 4692, 4695, - 4697, 4701, 4703, 4734, 4737, 4742, 4766, 4769, - 4771, 4774, 4777, 4781, 4784, 4787, 4791, 4792, - 4848, 4904, 4934, 4938, 4941, 4948, 4956, 4958, - 4960, 4962, 4965, 4969, 4971, 4974, 4979, 4982, - 4984, 4986, 4988, 5017, 5022, 5024, 5027, 5030, - 5034, 5038, 5044, 5051, 5056, 5060, 5066, 5069, - 5074, 5077, 5083, 5089, 5092, 5098, 5100, 5106, - 5109, 5111, 5115, 5117, 5123, 5125, 5130, 5132, - 5154, 5157, 5161, 5166, 5168, 5171, 5174, 5176, - 5179, 5181, 5184, 5187, 5189, 5195, 5197, 5200, - 5203, 5206, 5208, 5210, 5216, 5219, 5225, 5228, - 5230, 5232, 5234, 5236, 5239, 5241, 5243, 5259, - 5262, 5264, 5266, 5271, 5274, 5277, 5279, 5281, - 5284, 5287, 5289, 5293, 5298, 5302, 5305, 5309, - 5311, 5314, 5321, 5327, 5329, 5331, 5333, 5339, - 5341, 5365, 5368, 5370, 5373, 5376, 5378, 5381, - 5384, 5387, 5389, 5393, 5401, 5403, 5405, 5407, - 5409, 5412, 5415, 5417, 5419, 5421, 5424, 5427, - 5432, 5434, 5436, 5438, 5440, 5442, 5444, 5451, - 5455, 5459, 5461, 5464, 5467, 5471, 5475, 5481, - 5483, 5485, 5487, 5493, 5495, 5497, 5498, 5505, - 5507, 5515, 5519, 5521, 5523, 5525, 5527, 5530, - 5534, 5536, 5539, 5544, 5547, 5549, 5551, 5553, - 5584, 5589, 5591, 5594, 5600, 5608, 5614, 5623, - 5628, 5639, 5647, 5652, 5660, 5664, 5671, 5675, - 5682, 5688, 5697, 5702, 5711, 5720, 5724, 5726, - 5731, 5733, 5739, 5742, 5747, 5749, 5771, 5777, - 5782, 5788, 5790, 5793, 5796, 5800, 5805, 5807, - 5810, 5818, 5822, 5832, 5834, 5841, 5846, 5854, - 5861, 5866, 5874, 5877, 5883, 5886, 5888, 5890, - 5892, 5894, 5897, 5899, 5901, 5917, 5920, 5922, - 5924, 5931, 5936, 5938, 5941, 5949, 5952, 5958, - 5963, 5968, 5975, 5981, 5985, 5987, 5990, 5998, - 6004, 6006, 6008, 6010, 6016, 6018, 6042, 6046, - 6048, 6054, 6058, 6060, 6066, 6070, 6077, 6081, - 6087, 6096, 6099, 6103, 6111, 6114, 6121, 6124, - 6130, 6132, 6138, 6143, 6148, 6154, 6159, 6161, - 6163, 6165, 6167, 6169, 6176, 6182, 6186, 6188, - 6191, 6194, 6198, 6202, 6208, 6210, 6212, 6214, - 6216, 6218, 6224, 6226, 6228, 6229, 6231, 6233, - 6237, 6240, 6242, 6244, 6246, 6249, 6253, 6255, - 6258, 6263, 6266, 6268, 6270, 6272, 6303, 6308, - 6310, 6313, 6319, 6321, 6323, 6325, 6328, 6332, - 6334, 6337, 6342, 6345, 6347, 6349, 6351, 6380, - 6385, 6387, 6390, 6393, 6397, 6401, 6407, 6414, - 6419, 6423, 6429, 6432, 6437, 6440, 6446, 6452, - 6455, 6461, 6463, 6469, 6472, 6474, 6478, 6480, - 6486, 6488, 6493, 6495, 6517, 6520, 6524, 6529, - 6531, 6534, 6537, 6539, 6542, 6544, 6547, 6550, - 6552, 6558, 6560, 6563, 6566, 6569, 6571, 6573, - 6579, 6582, 6588, 6591, 6598, 6600, 6602, 6604, - 6606, 6608, 6611, 6613, 6615, 6631, 6634, 6636, - 6638, 6643, 6646, 6649, 6651, 6653, 6656, 6659, - 6661, 6665, 6670, 6674, 6677, 6681, 6683, 6686, - 6694, 6700, 6702, 6704, 6706, 6712, 6714, 6738, - 6741, 6743, 6746, 6749, 6751, 6754, 6757, 6760, - 6762, 6766, 6774, 6776, 6778, 6780, 6782, 6785, - 6788, 6790, 6792, 6794, 6797, 6800, 6805, 6807, - 6809, 6811, 6813, 6815, 6817, 6824, 6828, 6832, - 6834, 6837, 6840, 6844, 6848, 6854, 6856, 6858, - 6862, 6864, 6866, 6868, 6870, 6876, 6878, 6880, - 6881, 6888, 6896, 6902, 6911, 6916, 6927, 6935, - 6940, 6948, 6952, 6959, 6963, 6970, 6976, 6985, - 6990, 6999, 7008, 7012, 7014, 7019, 7021, 7027, - 7030, 7035, 7037, 7059, 7065, 7070, 7076, 7078, - 7081, 7084, 7088, 7093, 7095, 7098, 7106, 7110, - 7120, 7122, 7129, 7134, 7142, 7149, 7154, 7162, - 7165, 7171, 7174, 7176, 7178, 7180, 7182, 7185, - 7187, 7189, 7205, 7208, 7210, 7212, 7219, 7224, - 7226, 7229, 7237, 7240, 7246, 7251, 7256, 7263, - 7269, 7273, 7275, 7278, 7286, 7292, 7294, 7296, - 7298, 7304, 7306, 7330, 7334, 7336, 7342, 7346, - 7348, 7354, 7358, 7365, 7369, 7375, 7384, 7387, - 7391, 7399, 7402, 7409, 7412, 7418, 7420, 7426, - 7431, 7436, 7442, 7447, 7449, 7451, 7453, 7455, - 7457, 7464, 7470, 7474, 7476, 7479, 7482, 7486, - 7490, 7496, 7498, 7500, 7502, 7504, 7506, 7512, - 7514, 7516, 7517, 7520, 7524, 7526, 7544, 7548, - 7553, 7556, 7559, 7563, 7566, 7569, 7573, 7629, - 7685, 7718, 7722, 7727, 7729, 7730, 7732, 7736, - 7739, 7744, 7750, 7754, 7757, 7761, 7764, 7768, - 7771, 7775, 7788, 7791, 7793, 7795, 7797, 7800, - 7804, 7806, 7809, 7814, 7817, 7819, 7821, 7823, - 7852, 7857, 7859, 7862, 7865, 7869, 7873, 7879, - 7886, 7891, 7895, 7901, 7904, 7909, 7912, 7918, - 7924, 7927, 7933, 7935, 7941, 7944, 7946, 7950, - 7952, 7958, 7960, 7965, 7967, 7989, 7992, 7996, - 8001, 8003, 8006, 8009, 8011, 8014, 8016, 8019, - 8022, 8024, 8030, 8032, 8035, 8038, 8041, 8043, - 8045, 8051, 8054, 8060, 8063, 8070, 8072, 8074, - 8076, 8078, 8080, 8083, 8085, 8087, 8103, 8106, - 8108, 8110, 8115, 8118, 8121, 8123, 8125, 8128, - 8131, 8133, 8137, 8142, 8146, 8149, 8153, 8155, - 8158, 8166, 8172, 8174, 8176, 8178, 8184, 8186, - 8210, 8213, 8215, 8218, 8221, 8223, 8226, 8229, - 8232, 8234, 8238, 8246, 8248, 8250, 8252, 8254, - 8257, 8260, 8262, 8264, 8266, 8269, 8272, 8277, - 8279, 8281, 8283, 8285, 8287, 8289, 8296, 8300, - 8304, 8306, 8309, 8312, 8316, 8320, 8326, 8328, - 8330, 8334, 8336, 8338, 8340, 8342, 8345, 8349, - 8351, 8354, 8359, 8362, 8364, 8366, 8368, 8399, - 8404, 8406, 8409, 8415, 8423, 8429, 8438, 8443, - 8454, 8462, 8467, 8475, 8479, 8486, 8490, 8497, - 8503, 8512, 8517, 8526, 8535, 8539, 8541, 8546, - 8548, 8554, 8557, 8562, 8564, 8586, 8592, 8597, - 8603, 8605, 8608, 8611, 8615, 8620, 8622, 8625, - 8633, 8637, 8647, 8649, 8656, 8661, 8669, 8676, - 8681, 8689, 8692, 8698, 8701, 8703, 8705, 8707, - 8709, 8712, 8714, 8716, 8732, 8735, 8737, 8739, - 8746, 8751, 8753, 8756, 8764, 8767, 8773, 8778, - 8783, 8790, 8796, 8800, 8802, 8805, 8813, 8819, - 8821, 8823, 8825, 8831, 8833, 8857, 8861, 8863, - 8869, 8873, 8875, 8881, 8885, 8892, 8896, 8902, - 8911, 8914, 8918, 8926, 8929, 8936, 8939, 8945, - 8947, 8953, 8958, 8963, 8969, 8974, 8976, 8978, - 8980, 8982, 8984, 8991, 8997, 9001, 9003, 9006, - 9009, 9013, 9017, 9023, 9025, 9027, 9029, 9031, - 9033, 9039, 9041, 9043, 9044, 9046, 9048, 9050, - 9056, 9058, 9060, 9061, 9068, 9076, 9078, 9080, - 9083, 9089, 9101, 9107, 9111, 9116, 9122, 9127, - 9130, 9140, 9142, 9145, 9153, 9156, 9159, 9183, - 9204, 9225, 9246, 9265, 9286, 9307, 9328, 9352, - 9374, 9396, 9418, 9439, 9463, 9484, 9505, 9526, - 9548, 9570, 9592, 9613, 9634, 9655, 9676, 9697, - 9718, 9739, 9760, 9781, -} - -var _graphclust_indicies []int16 = []int16{ - 0, 1, 3, 2, 2, 3, 3, 2, - 3, 3, 2, 3, 3, 3, 2, 3, - 2, 3, 3, 2, 3, 3, 3, 3, - 2, 3, 3, 2, 2, 3, 3, 2, - 3, 2, 4, 5, 6, 7, 8, 10, - 11, 12, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 9, 13, 2, 3, - 3, 3, 3, 2, 3, 2, 3, 3, - 2, 2, 2, 3, 2, 2, 2, 3, - 3, 3, 3, 2, 2, 2, 2, 2, - 2, 3, 2, 2, 2, 2, 2, 2, - 3, 2, 2, 2, 2, 3, 3, 3, - 3, 2, 3, 3, 3, 3, 3, 2, - 3, 3, 2, 3, 3, 3, 3, 2, - 3, 3, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 2, 3, - 3, 2, 2, 2, 2, 2, 2, 3, - 3, 2, 3, 3, 3, 3, 3, 2, - 3, 3, 2, 3, 2, 3, 3, 3, - 2, 3, 2, 3, 3, 3, 3, 3, - 2, 3, 2, 3, 3, 3, 3, 2, - 3, 2, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 2, - 3, 3, 2, 3, 3, 3, 2, 3, - 3, 3, 3, 2, 3, 2, 3, 3, - 2, 3, 3, 2, 3, 2, 2, 2, - 3, 3, 2, 3, 3, 2, 3, 3, - 2, 3, 2, 3, 3, 3, 3, 3, - 2, 3, 2, 3, 3, 2, 2, 2, - 3, 3, 3, 2, 3, 2, 3, 2, - 3, 3, 3, 3, 3, 2, 3, 3, - 2, 53, 54, 55, 56, 57, 2, 3, - 58, 2, 53, 54, 59, 55, 56, 57, - 2, 3, 2, 3, 2, 3, 2, 3, - 2, 3, 2, 60, 61, 2, 3, 2, - 3, 2, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, - 76, 2, 3, 3, 2, 3, 2, 3, - 2, 3, 3, 3, 3, 2, 3, 3, - 2, 2, 2, 3, 3, 2, 3, 2, - 3, 3, 2, 2, 2, 3, 3, 2, - 3, 3, 3, 2, 3, 3, 3, 3, - 2, 3, 3, 3, 2, 3, 3, 2, - 77, 78, 63, 2, 3, 2, 3, 3, - 2, 79, 80, 81, 82, 83, 84, 85, - 2, 86, 87, 88, 89, 90, 2, 3, - 2, 3, 2, 3, 2, 3, 3, 3, - 3, 3, 2, 3, 2, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 104, 108, - 109, 110, 111, 112, 2, 3, 3, 2, - 2, 3, 2, 2, 3, 3, 3, 2, - 3, 2, 3, 3, 2, 2, 2, 3, - 3, 3, 2, 3, 2, 3, 3, 3, - 2, 3, 3, 3, 3, 3, 3, 3, - 2, 3, 2, 3, 2, 3, 2, 2, - 3, 3, 3, 2, 2, 2, 3, 2, - 3, 3, 2, 3, 2, 3, 3, 2, - 3, 3, 2, 113, 114, 115, 116, 2, - 3, 2, 3, 2, 3, 2, 3, 2, - 117, 2, 3, 2, 118, 119, 120, 121, - 122, 123, 2, 3, 3, 3, 2, 2, - 2, 2, 3, 3, 2, 3, 3, 2, - 2, 2, 3, 3, 3, 3, 2, 124, - 125, 126, 2, 3, 3, 3, 3, 3, - 2, 3, 2, 3, 2, 127, 128, 129, - 2, 130, 2, 2, 130, 2, 130, 130, - 2, 130, 130, 2, 130, 130, 130, 2, - 130, 2, 130, 130, 2, 130, 130, 130, - 130, 2, 130, 130, 2, 2, 130, 130, - 2, 130, 2, 131, 132, 133, 134, 135, - 136, 137, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 22, 151, - 152, 153, 154, 155, 156, 157, 158, 159, - 138, 2, 130, 130, 130, 130, 2, 130, - 2, 130, 130, 2, 3, 3, 2, 2, - 3, 130, 130, 2, 130, 130, 2, 130, - 2, 3, 130, 130, 130, 3, 3, 2, - 130, 130, 130, 2, 2, 2, 130, 2, - 3, 3, 130, 130, 3, 2, 130, 130, - 130, 2, 130, 2, 130, 2, 130, 2, - 3, 2, 2, 130, 130, 2, 130, 2, - 3, 130, 130, 3, 130, 2, 3, 130, - 130, 3, 3, 130, 130, 2, 130, 130, - 3, 2, 130, 130, 130, 3, 3, 3, - 2, 130, 3, 130, 2, 2, 2, 3, - 2, 2, 2, 130, 130, 130, 3, 130, - 3, 2, 130, 130, 3, 3, 3, 130, - 130, 130, 2, 130, 130, 3, 3, 2, - 2, 2, 130, 130, 130, 2, 130, 2, - 3, 130, 130, 130, 130, 3, 130, 3, - 3, 2, 130, 3, 130, 2, 130, 2, - 130, 3, 130, 130, 2, 130, 2, 130, - 130, 130, 130, 3, 2, 3, 130, 2, - 130, 130, 130, 130, 2, 130, 2, 160, - 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 2, 3, 130, 130, - 3, 130, 2, 3, 130, 130, 130, 2, - 130, 3, 130, 130, 130, 2, 130, 2, - 130, 130, 2, 130, 130, 2, 3, 130, - 3, 2, 130, 130, 130, 2, 3, 130, - 2, 130, 130, 2, 130, 130, 3, 130, - 3, 3, 130, 2, 130, 130, 3, 2, - 130, 130, 130, 130, 3, 130, 130, 3, - 130, 2, 130, 2, 3, 3, 3, 130, - 130, 3, 2, 130, 2, 130, 2, 3, - 3, 3, 3, 130, 130, 3, 130, 2, - 3, 130, 130, 3, 130, 3, 2, 3, - 130, 3, 130, 2, 3, 130, 130, 130, - 130, 3, 130, 2, 130, 130, 2, 181, - 182, 183, 184, 185, 2, 130, 58, 2, - 130, 2, 130, 2, 130, 2, 130, 2, - 186, 187, 2, 130, 2, 130, 2, 188, - 189, 190, 191, 66, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 2, 130, - 130, 2, 130, 2, 130, 2, 130, 130, - 130, 3, 3, 130, 2, 130, 2, 130, - 2, 3, 130, 2, 130, 3, 2, 3, - 130, 130, 130, 3, 130, 3, 2, 130, - 2, 3, 130, 3, 130, 3, 130, 2, - 130, 130, 3, 130, 2, 130, 130, 130, - 130, 2, 130, 3, 3, 130, 130, 3, - 2, 130, 130, 3, 130, 3, 2, 202, - 203, 189, 2, 130, 2, 130, 130, 2, - 204, 205, 206, 207, 208, 209, 210, 2, - 211, 212, 213, 214, 215, 2, 130, 2, - 130, 2, 130, 2, 130, 130, 130, 130, - 130, 2, 130, 2, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, - 236, 237, 238, 2, 130, 3, 130, 2, - 2, 130, 3, 2, 3, 3, 2, 130, - 3, 130, 130, 2, 130, 2, 3, 130, - 3, 130, 3, 2, 2, 130, 2, 3, - 130, 130, 3, 130, 3, 130, 2, 130, - 3, 130, 2, 130, 130, 3, 130, 3, - 2, 130, 130, 3, 3, 3, 3, 130, - 130, 2, 3, 130, 2, 3, 3, 130, - 2, 130, 3, 130, 3, 130, 3, 130, - 2, 3, 2, 130, 130, 3, 3, 130, - 3, 130, 2, 2, 2, 130, 130, 3, - 130, 3, 130, 2, 2, 130, 3, 3, - 130, 3, 130, 2, 3, 130, 3, 130, - 2, 3, 3, 130, 130, 2, 3, 3, - 3, 130, 130, 2, 239, 240, 115, 241, - 2, 130, 2, 130, 2, 130, 2, 242, - 2, 130, 2, 243, 244, 245, 246, 247, - 248, 2, 3, 3, 130, 130, 130, 2, - 2, 2, 2, 130, 130, 2, 130, 130, - 2, 2, 2, 130, 130, 130, 130, 2, - 249, 250, 251, 2, 130, 130, 130, 130, - 130, 2, 130, 2, 130, 2, 252, 2, - 3, 2, 253, 2, 254, 255, 256, 258, - 257, 2, 130, 2, 2, 130, 130, 3, - 2, 3, 2, 259, 2, 260, 261, 262, - 264, 263, 2, 3, 2, 2, 3, 3, - 79, 80, 81, 82, 83, 84, 2, 3, - 1, 265, 265, 3, 1, 265, 266, 3, - 1, 267, 268, 267, 268, 268, 267, 268, - 268, 267, 268, 268, 268, 267, 268, 267, - 268, 268, 267, 268, 268, 268, 268, 267, - 268, 268, 267, 267, 268, 268, 267, 268, - 267, 269, 270, 271, 272, 273, 275, 276, - 277, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 288, 289, 290, 291, 292, 293, - 294, 295, 296, 274, 278, 267, 268, 268, - 268, 268, 267, 268, 267, 268, 268, 267, - 267, 267, 268, 267, 267, 267, 268, 268, - 268, 268, 267, 267, 267, 267, 267, 267, - 268, 267, 267, 267, 267, 267, 267, 268, - 267, 267, 267, 267, 268, 268, 268, 268, - 267, 268, 268, 268, 268, 268, 267, 268, - 268, 267, 268, 268, 268, 268, 267, 268, - 268, 267, 267, 267, 267, 267, 267, 268, - 268, 268, 268, 268, 268, 267, 268, 268, - 267, 267, 267, 267, 267, 267, 268, 268, - 267, 268, 268, 268, 268, 268, 267, 268, - 268, 267, 268, 267, 268, 268, 268, 267, - 268, 267, 268, 268, 268, 268, 268, 267, - 268, 267, 268, 268, 268, 268, 267, 268, - 267, 297, 298, 299, 300, 301, 302, 303, - 304, 305, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 267, 268, - 268, 267, 268, 268, 268, 267, 268, 268, - 268, 268, 267, 268, 267, 268, 268, 267, - 268, 268, 267, 268, 267, 267, 267, 268, - 268, 267, 268, 268, 267, 268, 268, 267, - 268, 267, 268, 268, 268, 268, 268, 267, - 268, 267, 268, 268, 267, 267, 267, 268, - 268, 268, 267, 268, 267, 268, 267, 268, - 268, 268, 268, 268, 267, 268, 268, 267, - 318, 319, 320, 321, 322, 267, 268, 323, - 267, 318, 319, 324, 320, 321, 322, 267, - 268, 267, 268, 267, 268, 267, 268, 267, - 268, 267, 325, 326, 267, 268, 267, 268, - 267, 327, 328, 329, 330, 331, 332, 333, - 334, 335, 336, 337, 338, 339, 340, 341, - 267, 268, 268, 267, 268, 267, 268, 267, - 268, 268, 268, 268, 267, 268, 268, 267, - 267, 267, 268, 268, 267, 268, 267, 268, - 268, 267, 267, 267, 268, 268, 267, 268, - 268, 268, 267, 268, 268, 268, 268, 267, - 268, 268, 268, 267, 268, 268, 267, 342, - 343, 328, 267, 268, 267, 268, 268, 267, - 344, 345, 346, 347, 348, 349, 350, 267, - 351, 352, 353, 354, 355, 267, 268, 267, - 268, 267, 268, 267, 268, 268, 268, 268, - 268, 267, 268, 267, 356, 357, 358, 359, - 360, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 369, 373, 374, - 375, 376, 377, 267, 268, 268, 267, 267, - 268, 267, 267, 268, 268, 268, 267, 268, - 267, 268, 268, 267, 267, 267, 268, 268, - 268, 267, 268, 267, 268, 268, 268, 267, - 268, 268, 268, 268, 268, 268, 268, 267, - 268, 267, 268, 267, 268, 267, 267, 268, - 268, 268, 267, 267, 267, 268, 267, 268, - 268, 267, 268, 267, 268, 268, 267, 268, - 268, 267, 378, 379, 380, 381, 267, 268, - 267, 268, 267, 268, 267, 268, 267, 382, - 267, 268, 267, 383, 384, 385, 386, 387, - 388, 267, 268, 268, 268, 267, 267, 267, - 267, 268, 268, 267, 268, 268, 267, 267, - 267, 268, 268, 268, 268, 267, 389, 390, - 391, 267, 268, 268, 268, 268, 268, 267, - 268, 267, 268, 267, 392, 393, 394, 267, - 395, 267, 395, 267, 267, 395, 395, 267, - 395, 395, 267, 395, 395, 395, 267, 395, - 267, 395, 395, 267, 395, 395, 395, 395, - 267, 395, 395, 267, 267, 395, 395, 267, - 395, 267, 396, 397, 398, 399, 400, 401, - 402, 404, 405, 406, 407, 408, 409, 410, - 411, 412, 413, 414, 415, 287, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 403, - 267, 395, 395, 395, 395, 267, 395, 267, - 395, 395, 267, 268, 268, 267, 267, 268, - 395, 395, 267, 395, 395, 267, 395, 267, - 268, 395, 395, 395, 268, 268, 267, 395, - 395, 395, 267, 267, 267, 395, 267, 268, - 268, 395, 395, 268, 267, 395, 395, 395, - 267, 395, 267, 395, 267, 395, 267, 268, - 267, 267, 395, 395, 267, 395, 267, 268, - 395, 395, 268, 395, 267, 268, 395, 395, - 268, 268, 395, 395, 267, 395, 395, 268, - 267, 395, 395, 395, 268, 268, 268, 267, - 395, 268, 395, 267, 267, 267, 268, 267, - 267, 267, 395, 395, 395, 268, 395, 268, - 267, 395, 395, 268, 268, 268, 395, 395, - 395, 267, 395, 395, 268, 268, 267, 267, - 267, 395, 395, 395, 267, 395, 267, 268, - 395, 395, 395, 395, 268, 395, 268, 268, - 267, 395, 268, 395, 267, 395, 267, 395, - 268, 395, 395, 267, 395, 267, 395, 395, - 395, 395, 268, 267, 268, 395, 267, 395, - 395, 395, 395, 267, 395, 267, 425, 426, - 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, - 443, 444, 445, 267, 268, 395, 395, 268, - 395, 267, 268, 395, 395, 395, 267, 395, - 268, 395, 395, 395, 267, 395, 267, 395, - 395, 267, 395, 395, 267, 268, 395, 268, - 267, 395, 395, 395, 267, 268, 395, 267, - 395, 395, 267, 395, 395, 268, 395, 268, - 268, 395, 267, 395, 395, 268, 267, 395, - 395, 395, 395, 268, 395, 395, 268, 395, - 267, 395, 267, 268, 268, 268, 395, 395, - 268, 267, 395, 267, 395, 267, 268, 268, - 268, 268, 395, 395, 268, 395, 267, 268, - 395, 395, 268, 395, 268, 267, 268, 395, - 268, 395, 267, 268, 395, 395, 395, 395, - 268, 395, 267, 395, 395, 267, 446, 447, - 448, 449, 450, 267, 395, 323, 267, 395, - 267, 395, 267, 395, 267, 395, 267, 451, - 452, 267, 395, 267, 395, 267, 453, 454, - 455, 456, 331, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 267, 395, 395, - 267, 395, 267, 395, 267, 395, 395, 395, - 268, 268, 395, 267, 395, 267, 395, 267, - 268, 395, 267, 395, 268, 267, 268, 395, - 395, 395, 268, 395, 268, 267, 395, 267, - 268, 395, 268, 395, 268, 395, 267, 395, - 395, 268, 395, 267, 395, 395, 395, 395, - 267, 395, 268, 268, 395, 395, 268, 267, - 395, 395, 268, 395, 268, 267, 467, 468, - 454, 267, 395, 267, 395, 395, 267, 469, - 470, 471, 472, 473, 474, 475, 267, 476, - 477, 478, 479, 480, 267, 395, 267, 395, - 267, 395, 267, 395, 395, 395, 395, 395, - 267, 395, 267, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 490, 491, 492, 493, - 494, 495, 496, 497, 498, 499, 500, 501, - 502, 503, 267, 395, 268, 395, 267, 267, - 395, 268, 267, 268, 268, 267, 395, 268, - 395, 395, 267, 395, 267, 268, 395, 268, - 395, 268, 267, 267, 395, 267, 268, 395, - 395, 268, 395, 268, 395, 267, 395, 268, - 395, 267, 395, 395, 268, 395, 268, 267, - 395, 395, 268, 268, 268, 268, 395, 395, - 267, 268, 395, 267, 268, 268, 395, 267, - 395, 268, 395, 268, 395, 268, 395, 267, - 268, 267, 395, 395, 268, 268, 395, 268, - 395, 267, 267, 267, 395, 395, 268, 395, - 268, 395, 267, 267, 395, 268, 268, 395, - 268, 395, 267, 268, 395, 268, 395, 267, - 268, 268, 395, 395, 267, 268, 268, 268, - 395, 395, 267, 504, 505, 380, 506, 267, - 395, 267, 395, 267, 395, 267, 507, 267, - 395, 267, 508, 509, 510, 511, 512, 513, - 267, 268, 268, 395, 395, 395, 267, 267, - 267, 267, 395, 395, 267, 395, 395, 267, - 267, 267, 395, 395, 395, 395, 267, 514, - 515, 516, 267, 395, 395, 395, 395, 395, - 267, 395, 267, 395, 267, 517, 267, 268, - 267, 518, 267, 519, 520, 521, 523, 522, - 267, 395, 267, 267, 395, 395, 268, 267, - 268, 267, 524, 267, 525, 526, 527, 529, - 528, 267, 268, 267, 267, 268, 268, 344, - 345, 346, 347, 348, 349, 267, 268, 267, - 268, 268, 267, 266, 268, 268, 267, 266, - 268, 267, 266, 268, 267, 531, 532, 530, - 267, 266, 268, 267, 266, 268, 267, 533, - 534, 535, 536, 537, 530, 267, 538, 267, - 297, 298, 299, 533, 534, 539, 300, 301, - 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, - 267, 540, 538, 297, 298, 299, 541, 535, - 536, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 267, 540, 267, 542, 540, - 297, 298, 299, 543, 536, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 267, - 542, 267, 267, 542, 544, 267, 542, 267, - 545, 546, 267, 540, 267, 267, 542, 267, - 540, 267, 540, 327, 328, 329, 330, 331, - 332, 333, 547, 335, 336, 337, 338, 339, - 340, 341, 549, 550, 551, 552, 553, 554, - 549, 550, 551, 552, 553, 554, 549, 548, - 555, 267, 268, 538, 267, 556, 556, 556, - 542, 267, 297, 298, 299, 541, 539, 300, - 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, - 317, 267, 545, 557, 267, 267, 540, 556, - 556, 542, 556, 556, 542, 556, 556, 556, - 542, 556, 556, 542, 556, 556, 542, 556, - 556, 267, 542, 542, 551, 552, 553, 554, - 548, 549, 551, 552, 553, 554, 548, 549, - 551, 552, 553, 554, 548, 549, 551, 552, - 553, 554, 548, 549, 551, 552, 553, 554, - 548, 549, 551, 552, 553, 554, 548, 549, - 551, 552, 553, 554, 548, 549, 551, 552, - 553, 554, 548, 549, 551, 552, 553, 554, - 548, 549, 550, 555, 552, 553, 554, 548, - 549, 550, 552, 553, 554, 548, 549, 550, - 552, 553, 554, 548, 549, 550, 552, 553, - 554, 548, 549, 550, 552, 553, 554, 548, - 549, 550, 552, 553, 554, 548, 549, 550, - 552, 553, 554, 548, 549, 550, 552, 553, - 554, 548, 549, 550, 552, 553, 554, 548, - 549, 550, 551, 555, 553, 554, 548, 549, - 550, 551, 553, 554, 548, 549, 550, 551, - 553, 554, 548, 549, 550, 551, 553, 554, - 548, 549, 550, 551, 553, 558, 557, 552, - 267, 555, 556, 267, 540, 542, 268, 268, - 267, 559, 560, 561, 562, 563, 530, 267, - 268, 323, 268, 268, 268, 267, 268, 268, - 267, 395, 268, 267, 395, 268, 267, 268, - 395, 268, 267, 530, 267, 564, 566, 567, - 568, 569, 570, 571, 566, 567, 568, 569, - 570, 571, 566, 530, 565, 555, 267, 268, - 538, 268, 267, 540, 540, 540, 542, 267, - 540, 540, 542, 540, 540, 542, 540, 540, - 540, 542, 540, 540, 542, 540, 540, 542, - 540, 540, 267, 542, 568, 569, 570, 571, - 565, 566, 568, 569, 570, 571, 565, 566, - 568, 569, 570, 571, 565, 566, 568, 569, - 570, 571, 565, 566, 568, 569, 570, 571, - 565, 566, 568, 569, 570, 571, 565, 566, - 568, 569, 570, 571, 565, 566, 568, 569, - 570, 571, 565, 566, 568, 569, 570, 571, - 565, 566, 567, 555, 569, 570, 571, 565, - 566, 567, 569, 570, 571, 565, 566, 567, - 569, 570, 571, 565, 566, 567, 569, 570, - 571, 565, 566, 567, 569, 570, 571, 565, - 566, 567, 569, 570, 571, 565, 566, 567, - 569, 570, 571, 565, 566, 567, 569, 570, - 571, 565, 566, 567, 569, 570, 571, 565, - 566, 567, 568, 555, 570, 571, 565, 566, - 567, 568, 570, 571, 565, 566, 567, 568, - 570, 571, 565, 566, 567, 568, 570, 571, - 565, 566, 567, 568, 570, 572, 573, 569, - 267, 555, 540, 268, 540, 542, 268, 542, - 268, 267, 540, 574, 575, 530, 267, 268, - 267, 268, 268, 268, 267, 577, 578, 579, - 580, 576, 267, 581, 582, 530, 267, 266, - 268, 267, 268, 266, 268, 267, 583, 530, - 267, 268, 268, 267, 584, 530, 267, 268, - 268, 267, 585, 586, 587, 588, 589, 590, - 591, 592, 593, 594, 595, 530, 267, 268, - 596, 267, 344, 345, 346, 347, 348, 349, - 597, 267, 598, 267, 268, 267, 395, 268, - 267, 268, 395, 268, 395, 268, 267, 395, - 395, 268, 395, 268, 395, 268, 395, 268, - 395, 268, 267, 268, 268, 395, 395, 268, - 267, 395, 395, 268, 267, 395, 268, 395, - 268, 267, 268, 395, 268, 395, 268, 267, - 395, 268, 395, 268, 267, 395, 268, 267, - 395, 395, 268, 268, 395, 268, 395, 268, - 395, 267, 576, 267, 599, 576, 267, 322, - 530, 600, 530, 267, 268, 267, 266, 3, - 1, 266, 3, 1, 602, 603, 601, 1, - 266, 3, 1, 266, 3, 1, 604, 605, - 606, 607, 608, 601, 1, 609, 610, 612, - 611, 611, 612, 612, 611, 612, 612, 611, - 612, 612, 612, 611, 612, 611, 612, 612, - 611, 612, 612, 612, 612, 611, 612, 612, - 611, 611, 612, 612, 611, 612, 611, 613, - 614, 615, 616, 617, 619, 620, 621, 623, - 624, 625, 626, 627, 628, 629, 630, 631, - 632, 633, 634, 635, 636, 637, 638, 639, - 640, 618, 622, 611, 612, 612, 612, 612, - 611, 612, 611, 612, 612, 611, 611, 611, - 612, 611, 611, 611, 612, 612, 612, 612, - 611, 611, 611, 611, 611, 611, 612, 611, - 611, 611, 611, 611, 611, 612, 611, 611, - 611, 611, 612, 612, 612, 612, 611, 612, - 612, 612, 612, 612, 611, 612, 612, 611, - 612, 612, 612, 612, 611, 612, 612, 611, - 611, 611, 611, 611, 611, 612, 612, 612, - 612, 612, 612, 611, 612, 612, 611, 611, - 611, 611, 611, 611, 612, 612, 611, 612, - 612, 612, 612, 612, 611, 612, 612, 611, - 612, 611, 612, 612, 612, 611, 612, 611, - 612, 612, 612, 612, 612, 611, 612, 611, - 612, 612, 612, 612, 611, 612, 611, 641, - 642, 643, 644, 645, 646, 647, 648, 649, - 650, 651, 652, 653, 654, 655, 656, 657, - 658, 659, 660, 661, 611, 612, 612, 611, - 612, 612, 612, 611, 612, 612, 612, 612, - 611, 612, 611, 612, 612, 611, 612, 612, - 611, 612, 611, 611, 611, 612, 612, 611, - 612, 612, 611, 612, 612, 611, 612, 611, - 612, 612, 612, 612, 612, 611, 612, 611, - 612, 612, 611, 611, 611, 612, 612, 612, - 611, 612, 611, 612, 611, 612, 612, 612, - 612, 612, 611, 612, 612, 611, 662, 663, - 664, 665, 666, 611, 612, 667, 611, 662, - 663, 668, 664, 665, 666, 611, 612, 611, - 612, 611, 612, 611, 612, 611, 612, 611, - 669, 670, 611, 612, 611, 612, 611, 671, - 672, 673, 674, 675, 676, 677, 678, 679, - 680, 681, 682, 683, 684, 685, 611, 612, - 612, 611, 612, 611, 612, 611, 612, 612, - 612, 612, 611, 612, 612, 611, 611, 611, - 612, 612, 611, 612, 611, 612, 612, 611, - 611, 611, 612, 612, 611, 612, 612, 612, - 611, 612, 612, 612, 612, 611, 612, 612, - 612, 611, 612, 612, 611, 686, 687, 672, - 611, 612, 611, 612, 612, 611, 688, 689, - 690, 691, 692, 693, 694, 611, 695, 696, - 697, 698, 699, 611, 612, 611, 612, 611, - 612, 611, 612, 612, 612, 612, 612, 611, - 612, 611, 700, 701, 702, 703, 704, 705, - 706, 707, 708, 709, 710, 711, 712, 713, - 714, 715, 716, 713, 717, 718, 719, 720, - 721, 611, 612, 612, 611, 611, 612, 611, - 611, 612, 612, 612, 611, 612, 611, 612, - 612, 611, 611, 611, 612, 612, 612, 611, - 612, 611, 612, 612, 612, 611, 612, 612, - 612, 612, 612, 612, 612, 611, 612, 611, - 612, 611, 612, 611, 611, 612, 612, 612, - 611, 611, 611, 612, 611, 612, 612, 611, - 612, 611, 612, 612, 611, 612, 612, 611, - 722, 723, 724, 725, 611, 612, 611, 612, - 611, 612, 611, 612, 611, 726, 611, 612, - 611, 727, 728, 729, 730, 731, 732, 611, - 612, 612, 612, 611, 611, 611, 611, 612, - 612, 611, 612, 612, 611, 611, 611, 612, - 612, 612, 612, 611, 733, 734, 735, 611, - 612, 612, 612, 612, 612, 611, 612, 611, - 612, 611, 736, 737, 738, 611, 739, 611, - 739, 611, 611, 739, 739, 611, 739, 739, - 611, 739, 739, 739, 611, 739, 611, 739, - 739, 611, 739, 739, 739, 739, 611, 739, - 739, 611, 611, 739, 739, 611, 739, 611, - 740, 741, 742, 743, 744, 745, 746, 748, - 749, 750, 751, 752, 753, 754, 755, 756, - 757, 758, 759, 631, 760, 761, 762, 763, - 764, 765, 766, 767, 768, 747, 611, 739, - 739, 739, 739, 611, 739, 611, 739, 739, - 611, 612, 612, 611, 611, 612, 739, 739, - 611, 739, 739, 611, 739, 611, 612, 739, - 739, 739, 612, 612, 611, 739, 739, 739, - 611, 611, 611, 739, 611, 612, 612, 739, - 739, 612, 611, 739, 739, 739, 611, 739, - 611, 739, 611, 739, 611, 612, 611, 611, - 739, 739, 611, 739, 611, 612, 739, 739, - 612, 739, 611, 612, 739, 739, 612, 612, - 739, 739, 611, 739, 739, 612, 611, 739, - 739, 739, 612, 612, 612, 611, 739, 612, - 739, 611, 611, 611, 612, 611, 611, 611, - 739, 739, 739, 612, 739, 612, 611, 739, - 739, 612, 612, 612, 739, 739, 739, 611, - 739, 739, 612, 612, 611, 611, 611, 739, - 739, 739, 611, 739, 611, 612, 739, 739, - 739, 739, 612, 739, 612, 612, 611, 739, - 612, 739, 611, 739, 611, 739, 612, 739, - 739, 611, 739, 611, 739, 739, 739, 739, - 612, 611, 612, 739, 611, 739, 739, 739, - 739, 611, 739, 611, 769, 770, 771, 772, - 773, 774, 775, 776, 777, 778, 779, 780, - 781, 782, 783, 784, 785, 786, 787, 788, - 789, 611, 612, 739, 739, 612, 739, 611, - 612, 739, 739, 739, 611, 739, 612, 739, - 739, 739, 611, 739, 611, 739, 739, 611, - 739, 739, 611, 612, 739, 612, 611, 739, - 739, 739, 611, 612, 739, 611, 739, 739, - 611, 739, 739, 612, 739, 612, 612, 739, - 611, 739, 739, 612, 611, 739, 739, 739, - 739, 612, 739, 739, 612, 739, 611, 739, - 611, 612, 612, 612, 739, 739, 612, 611, - 739, 611, 739, 611, 612, 612, 612, 612, - 739, 739, 612, 739, 611, 612, 739, 739, - 612, 739, 612, 611, 612, 739, 612, 739, - 611, 612, 739, 739, 739, 739, 612, 739, - 611, 739, 739, 611, 790, 791, 792, 793, - 794, 611, 739, 667, 611, 739, 611, 739, - 611, 739, 611, 739, 611, 795, 796, 611, - 739, 611, 739, 611, 797, 798, 799, 800, - 675, 801, 802, 803, 804, 805, 806, 807, - 808, 809, 810, 611, 739, 739, 611, 739, - 611, 739, 611, 739, 739, 739, 612, 612, - 739, 611, 739, 611, 739, 611, 612, 739, - 611, 739, 612, 611, 612, 739, 739, 739, - 612, 739, 612, 611, 739, 611, 612, 739, - 612, 739, 612, 739, 611, 739, 739, 612, - 739, 611, 739, 739, 739, 739, 611, 739, - 612, 612, 739, 739, 612, 611, 739, 739, - 612, 739, 612, 611, 811, 812, 798, 611, - 739, 611, 739, 739, 611, 813, 814, 815, - 816, 817, 818, 819, 611, 820, 821, 822, - 823, 824, 611, 739, 611, 739, 611, 739, - 611, 739, 739, 739, 739, 739, 611, 739, - 611, 825, 826, 827, 828, 829, 830, 831, - 832, 833, 834, 835, 836, 837, 838, 839, - 840, 841, 842, 843, 844, 845, 846, 847, - 611, 739, 612, 739, 611, 611, 739, 612, - 611, 612, 612, 611, 739, 612, 739, 739, - 611, 739, 611, 612, 739, 612, 739, 612, - 611, 611, 739, 611, 612, 739, 739, 612, - 739, 612, 739, 611, 739, 612, 739, 611, - 739, 739, 612, 739, 612, 611, 739, 739, - 612, 612, 612, 612, 739, 739, 611, 612, - 739, 611, 612, 612, 739, 611, 739, 612, - 739, 612, 739, 612, 739, 611, 612, 611, - 739, 739, 612, 612, 739, 612, 739, 611, - 611, 611, 739, 739, 612, 739, 612, 739, - 611, 611, 739, 612, 612, 739, 612, 739, - 611, 612, 739, 612, 739, 611, 612, 612, - 739, 739, 611, 612, 612, 612, 739, 739, - 611, 848, 849, 724, 850, 611, 739, 611, - 739, 611, 739, 611, 851, 611, 739, 611, - 852, 853, 854, 855, 856, 857, 611, 612, - 612, 739, 739, 739, 611, 611, 611, 611, - 739, 739, 611, 739, 739, 611, 611, 611, - 739, 739, 739, 739, 611, 858, 859, 860, - 611, 739, 739, 739, 739, 739, 611, 739, - 611, 739, 611, 861, 611, 612, 611, 862, - 611, 863, 864, 865, 867, 866, 611, 739, - 611, 611, 739, 739, 612, 611, 612, 611, - 868, 611, 869, 870, 871, 873, 872, 611, - 612, 611, 611, 612, 612, 688, 689, 690, - 691, 692, 693, 611, 641, 642, 643, 604, - 605, 874, 644, 645, 646, 647, 648, 649, - 650, 651, 652, 653, 654, 655, 656, 657, - 658, 659, 660, 661, 611, 875, 610, 641, - 642, 643, 876, 606, 607, 644, 645, 646, - 647, 648, 649, 650, 651, 652, 653, 654, - 655, 656, 657, 658, 659, 660, 661, 611, - 875, 611, 877, 875, 641, 642, 643, 878, - 607, 644, 645, 646, 647, 648, 649, 650, - 651, 652, 653, 654, 655, 656, 657, 658, - 659, 660, 661, 611, 877, 611, 609, 877, - 879, 611, 877, 611, 880, 881, 611, 875, - 611, 611, 877, 611, 875, 611, 875, 671, - 672, 673, 674, 675, 676, 677, 882, 679, - 680, 681, 682, 683, 684, 685, 884, 885, - 886, 887, 888, 889, 884, 885, 886, 887, - 888, 889, 884, 883, 890, 611, 612, 610, - 611, 891, 891, 891, 877, 611, 641, 642, - 643, 876, 874, 644, 645, 646, 647, 648, - 649, 650, 651, 652, 653, 654, 655, 656, - 657, 658, 659, 660, 661, 611, 880, 892, - 611, 611, 875, 891, 891, 877, 891, 891, - 877, 891, 891, 891, 877, 891, 891, 877, - 891, 891, 877, 891, 891, 611, 877, 877, - 886, 887, 888, 889, 883, 884, 886, 887, - 888, 889, 883, 884, 886, 887, 888, 889, - 883, 884, 886, 887, 888, 889, 883, 884, - 886, 887, 888, 889, 883, 884, 886, 887, - 888, 889, 883, 884, 886, 887, 888, 889, - 883, 884, 886, 887, 888, 889, 883, 884, - 886, 887, 888, 889, 883, 884, 885, 890, - 887, 888, 889, 883, 884, 885, 887, 888, - 889, 883, 884, 885, 887, 888, 889, 883, - 884, 885, 887, 888, 889, 883, 884, 885, - 887, 888, 889, 883, 884, 885, 887, 888, - 889, 883, 884, 885, 887, 888, 889, 883, - 884, 885, 887, 888, 889, 883, 884, 885, - 887, 888, 889, 883, 884, 885, 886, 890, - 888, 889, 883, 884, 885, 886, 888, 889, - 883, 884, 885, 886, 888, 889, 883, 884, - 885, 886, 888, 889, 883, 884, 885, 886, - 888, 893, 892, 887, 611, 890, 891, 611, - 875, 877, 265, 3, 1, 894, 895, 896, - 897, 898, 601, 1, 265, 899, 3, 265, - 3, 265, 3, 1, 901, 900, 900, 901, - 901, 900, 901, 901, 900, 901, 901, 901, - 900, 901, 900, 901, 901, 900, 901, 901, - 901, 901, 900, 901, 901, 900, 900, 901, - 901, 900, 901, 900, 902, 903, 904, 905, - 906, 908, 909, 910, 912, 913, 914, 915, - 916, 917, 918, 919, 920, 921, 922, 923, - 924, 925, 926, 927, 928, 929, 907, 911, - 900, 901, 901, 901, 901, 900, 901, 900, - 901, 901, 900, 900, 900, 901, 900, 900, - 900, 901, 901, 901, 901, 900, 900, 900, - 900, 900, 900, 901, 900, 900, 900, 900, - 900, 900, 901, 900, 900, 900, 900, 901, - 901, 901, 901, 900, 901, 901, 901, 901, - 901, 900, 901, 901, 900, 901, 901, 901, - 901, 900, 901, 901, 900, 900, 900, 900, - 900, 900, 901, 901, 901, 901, 901, 901, - 900, 901, 901, 900, 900, 900, 900, 900, - 900, 901, 901, 900, 901, 901, 901, 901, - 901, 900, 901, 901, 900, 901, 900, 901, - 901, 901, 900, 901, 900, 901, 901, 901, - 901, 901, 900, 901, 900, 901, 901, 901, - 901, 900, 901, 900, 930, 931, 932, 933, - 934, 935, 936, 937, 938, 939, 940, 941, - 942, 943, 944, 945, 946, 947, 948, 949, - 950, 900, 901, 901, 900, 901, 901, 901, - 900, 901, 901, 901, 901, 900, 901, 900, - 901, 901, 900, 901, 901, 900, 901, 900, - 900, 900, 901, 901, 900, 901, 901, 900, - 901, 901, 900, 901, 900, 901, 901, 901, - 901, 901, 900, 901, 900, 901, 901, 900, - 900, 900, 901, 901, 901, 900, 901, 900, - 901, 900, 901, 901, 901, 901, 901, 900, - 901, 901, 900, 951, 952, 953, 954, 955, - 900, 901, 899, 900, 901, 900, 901, 900, - 901, 900, 901, 900, 956, 957, 900, 901, - 900, 901, 900, 958, 959, 960, 961, 962, - 963, 964, 965, 966, 967, 968, 969, 970, - 971, 972, 900, 901, 901, 900, 901, 900, - 901, 900, 901, 901, 901, 901, 900, 901, - 901, 900, 900, 900, 901, 901, 900, 901, - 900, 901, 901, 900, 900, 900, 901, 901, - 900, 901, 901, 901, 900, 901, 901, 901, - 901, 900, 901, 901, 901, 900, 901, 901, - 900, 973, 974, 959, 900, 901, 900, 901, - 901, 900, 975, 976, 977, 978, 979, 980, - 900, 981, 982, 983, 984, 985, 900, 901, - 900, 901, 900, 901, 900, 901, 901, 901, - 901, 901, 900, 901, 900, 986, 987, 988, - 989, 990, 991, 992, 993, 994, 995, 996, - 997, 998, 999, 1000, 1001, 1002, 999, 1003, - 1004, 1005, 1006, 1007, 900, 901, 901, 900, - 900, 901, 900, 900, 901, 901, 901, 900, - 901, 900, 901, 901, 900, 900, 900, 901, - 901, 901, 900, 901, 900, 901, 901, 901, - 900, 901, 901, 901, 901, 901, 901, 901, - 900, 901, 900, 901, 900, 901, 900, 900, - 901, 901, 901, 900, 900, 900, 901, 900, - 901, 901, 900, 901, 900, 901, 901, 900, - 901, 901, 900, 1008, 1009, 1010, 1011, 900, - 901, 900, 901, 900, 901, 900, 901, 900, - 1012, 900, 901, 900, 1013, 1014, 1015, 1016, - 1017, 1018, 900, 901, 901, 901, 900, 900, - 900, 900, 901, 901, 900, 901, 901, 900, - 900, 900, 901, 901, 901, 901, 900, 1019, - 1020, 1021, 900, 901, 901, 901, 901, 901, - 900, 901, 900, 901, 900, 1022, 900, 1023, - 1024, 1025, 1027, 1026, 900, 901, 900, 900, - 901, 901, 951, 952, 1028, 953, 954, 955, - 900, 901, 900, 975, 976, 977, 978, 979, - 980, 1029, 900, 1030, 1031, 1032, 900, 1033, - 900, 1033, 900, 900, 1033, 1033, 900, 1033, - 1033, 900, 1033, 1033, 1033, 900, 1033, 900, - 1033, 1033, 900, 1033, 1033, 1033, 1033, 900, - 1033, 1033, 900, 900, 1033, 1033, 900, 1033, - 900, 1034, 1035, 1036, 1037, 1038, 1039, 1040, - 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, - 1050, 1051, 1052, 1053, 920, 1054, 1055, 1056, - 1057, 1058, 1059, 1060, 1061, 1062, 1041, 900, - 1033, 1033, 1033, 1033, 900, 1033, 900, 1033, - 1033, 900, 901, 901, 900, 900, 901, 1033, - 1033, 900, 1033, 1033, 900, 1033, 900, 901, - 1033, 1033, 1033, 901, 901, 900, 1033, 1033, - 1033, 900, 900, 900, 1033, 900, 901, 901, - 1033, 1033, 901, 900, 1033, 1033, 1033, 900, - 1033, 900, 1033, 900, 1033, 900, 901, 900, - 900, 1033, 1033, 900, 1033, 900, 901, 1033, - 1033, 901, 1033, 900, 901, 1033, 1033, 901, - 901, 1033, 1033, 900, 1033, 1033, 901, 900, - 1033, 1033, 1033, 901, 901, 901, 900, 1033, - 901, 1033, 900, 900, 900, 901, 900, 900, - 900, 1033, 1033, 1033, 901, 1033, 901, 900, - 1033, 1033, 901, 901, 901, 1033, 1033, 1033, - 900, 1033, 1033, 901, 901, 900, 900, 900, - 1033, 1033, 1033, 900, 1033, 900, 901, 1033, - 1033, 1033, 1033, 901, 1033, 901, 901, 900, - 1033, 901, 1033, 900, 1033, 900, 1033, 901, - 1033, 1033, 900, 1033, 900, 1033, 1033, 1033, - 1033, 901, 900, 901, 1033, 900, 1033, 1033, - 1033, 1033, 900, 1033, 900, 1063, 1064, 1065, - 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, - 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, - 1082, 1083, 900, 901, 1033, 1033, 901, 1033, - 900, 901, 1033, 1033, 1033, 900, 1033, 901, - 1033, 1033, 1033, 900, 1033, 900, 1033, 1033, - 900, 1033, 1033, 900, 901, 1033, 901, 900, - 1033, 1033, 1033, 900, 901, 1033, 900, 1033, - 1033, 900, 1033, 1033, 901, 1033, 901, 901, - 1033, 900, 1033, 1033, 901, 900, 1033, 1033, - 1033, 1033, 901, 1033, 1033, 901, 1033, 900, - 1033, 900, 901, 901, 901, 1033, 1033, 901, - 900, 1033, 900, 1033, 900, 901, 901, 901, - 901, 1033, 1033, 901, 1033, 900, 901, 1033, - 1033, 901, 1033, 901, 900, 901, 1033, 901, - 1033, 900, 901, 1033, 1033, 1033, 1033, 901, - 1033, 900, 1033, 1033, 900, 1084, 1085, 1086, - 1087, 1088, 900, 1033, 899, 900, 1033, 900, - 1033, 900, 1033, 900, 1033, 900, 1089, 1090, - 900, 1033, 900, 1033, 900, 1091, 1092, 1093, - 1094, 962, 1095, 1096, 1097, 1098, 1099, 1100, - 1101, 1102, 1103, 1104, 900, 1033, 1033, 900, - 1033, 900, 1033, 900, 1033, 1033, 1033, 901, - 901, 1033, 900, 1033, 900, 1033, 900, 901, - 1033, 900, 1033, 901, 900, 901, 1033, 1033, - 1033, 901, 1033, 901, 900, 1033, 900, 901, - 1033, 901, 1033, 901, 1033, 900, 1033, 1033, - 901, 1033, 900, 1033, 1033, 1033, 1033, 900, - 1033, 901, 901, 1033, 1033, 901, 900, 1033, - 1033, 901, 1033, 901, 900, 1105, 1106, 1092, - 900, 1033, 900, 1033, 1033, 900, 1107, 1108, - 1109, 1110, 1111, 1112, 1113, 900, 1114, 1115, - 1116, 1117, 1118, 900, 1033, 900, 1033, 900, - 1033, 900, 1033, 1033, 1033, 1033, 1033, 900, - 1033, 900, 1119, 1120, 1121, 1122, 1123, 1124, - 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, - 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, - 1141, 900, 1033, 901, 1033, 900, 900, 1033, - 901, 900, 901, 901, 900, 1033, 901, 1033, - 1033, 900, 1033, 900, 901, 1033, 901, 1033, - 901, 900, 900, 1033, 900, 901, 1033, 1033, - 901, 1033, 901, 1033, 900, 1033, 901, 1033, - 900, 1033, 1033, 901, 1033, 901, 900, 1033, - 1033, 901, 901, 901, 901, 1033, 1033, 900, - 901, 1033, 900, 901, 901, 1033, 900, 1033, - 901, 1033, 901, 1033, 901, 1033, 900, 901, - 900, 1033, 1033, 901, 901, 1033, 901, 1033, - 900, 900, 900, 1033, 1033, 901, 1033, 901, - 1033, 900, 900, 1033, 901, 901, 1033, 901, - 1033, 900, 901, 1033, 901, 1033, 900, 901, - 901, 1033, 1033, 900, 901, 901, 901, 1033, - 1033, 900, 1142, 1143, 1010, 1144, 900, 1033, - 900, 1033, 900, 1033, 900, 1145, 900, 1033, - 900, 1146, 1147, 1148, 1149, 1150, 1151, 900, - 901, 901, 1033, 1033, 1033, 900, 900, 900, - 900, 1033, 1033, 900, 1033, 1033, 900, 900, - 900, 1033, 1033, 1033, 1033, 900, 1152, 1153, - 1154, 900, 1033, 1033, 1033, 1033, 1033, 900, - 1033, 900, 1033, 900, 1155, 900, 901, 900, - 1156, 900, 1157, 1158, 1159, 1161, 1160, 900, - 1033, 900, 900, 1033, 1033, 901, 900, 901, - 900, 3, 265, 3, 1, 1162, 3, 1, - 1162, 1163, 1163, 1162, 1162, 1163, 1162, 1162, - 1163, 1162, 1162, 1162, 1163, 1162, 1163, 1162, - 1162, 1163, 1162, 1162, 1162, 1162, 1163, 1162, - 1162, 1163, 1163, 1162, 1162, 1163, 1162, 1163, - 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1172, - 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, - 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, - 1189, 1190, 1191, 1192, 1193, 1171, 1163, 1162, - 1162, 1162, 1162, 1163, 1162, 1163, 1162, 1162, - 1163, 1194, 1194, 1163, 1163, 1194, 1162, 1194, - 1163, 1163, 1194, 1194, 1163, 1194, 1194, 1163, - 1194, 1194, 1194, 1163, 1194, 1163, 1194, 1194, - 1163, 1194, 1194, 1194, 1194, 1163, 1194, 1194, - 1163, 1163, 1194, 1194, 1163, 1194, 1163, 1195, - 1196, 1197, 1198, 1199, 1201, 1202, 1203, 1205, - 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1184, - 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, - 1221, 1200, 1204, 1163, 1194, 1194, 1194, 1194, - 1163, 1194, 1163, 1194, 1194, 1163, 1163, 1163, - 1194, 1163, 1163, 1163, 1194, 1194, 1194, 1194, - 1163, 1163, 1163, 1163, 1163, 1163, 1194, 1163, - 1163, 1163, 1163, 1163, 1163, 1194, 1163, 1163, - 1163, 1163, 1194, 1194, 1194, 1194, 1163, 1194, - 1194, 1194, 1194, 1194, 1163, 1194, 1194, 1163, - 1194, 1194, 1194, 1194, 1163, 1194, 1194, 1163, - 1163, 1163, 1163, 1163, 1163, 1194, 1194, 1194, - 1194, 1194, 1194, 1163, 1194, 1194, 1163, 1163, - 1163, 1163, 1163, 1163, 1194, 1194, 1163, 1194, - 1194, 1194, 1194, 1194, 1163, 1194, 1194, 1163, - 1194, 1163, 1194, 1194, 1194, 1163, 1194, 1163, - 1194, 1194, 1194, 1194, 1194, 1163, 1194, 1163, - 1194, 1194, 1194, 1194, 1163, 1194, 1163, 1222, - 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, - 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, - 1239, 1240, 1241, 1242, 1163, 1194, 1194, 1163, - 1194, 1194, 1194, 1163, 1194, 1194, 1194, 1194, - 1163, 1194, 1163, 1194, 1194, 1163, 1194, 1194, - 1163, 1194, 1163, 1163, 1163, 1194, 1194, 1163, - 1194, 1194, 1163, 1194, 1194, 1163, 1194, 1163, - 1194, 1194, 1194, 1194, 1194, 1163, 1194, 1163, - 1194, 1194, 1163, 1163, 1163, 1194, 1194, 1194, - 1163, 1194, 1163, 1194, 1163, 1194, 1194, 1194, - 1194, 1194, 1163, 1194, 1194, 1163, 1243, 1244, - 1245, 1246, 1247, 1163, 1194, 1248, 1163, 1243, - 1244, 1249, 1245, 1246, 1247, 1163, 1194, 1163, - 1194, 1163, 1194, 1163, 1194, 1163, 1194, 1163, - 1250, 1251, 1163, 1194, 1163, 1194, 1163, 1252, - 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, - 1261, 1262, 1263, 1264, 1265, 1266, 1163, 1194, - 1194, 1163, 1194, 1163, 1194, 1163, 1194, 1194, - 1194, 1194, 1163, 1194, 1194, 1163, 1163, 1163, - 1194, 1194, 1163, 1194, 1163, 1194, 1194, 1163, - 1163, 1163, 1194, 1194, 1163, 1194, 1194, 1194, - 1163, 1194, 1194, 1194, 1194, 1163, 1194, 1194, - 1194, 1163, 1194, 1194, 1163, 1267, 1268, 1253, - 1163, 1194, 1163, 1194, 1194, 1163, 1269, 1270, - 1271, 1272, 1273, 1274, 1275, 1163, 1276, 1277, - 1278, 1279, 1280, 1163, 1194, 1163, 1194, 1163, - 1194, 1163, 1194, 1194, 1194, 1194, 1194, 1163, - 1194, 1163, 1281, 1282, 1283, 1284, 1285, 1286, - 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, - 1295, 1296, 1297, 1294, 1298, 1299, 1300, 1301, - 1302, 1163, 1194, 1194, 1163, 1163, 1194, 1163, - 1163, 1194, 1194, 1194, 1163, 1194, 1163, 1194, - 1194, 1163, 1163, 1163, 1194, 1194, 1194, 1163, - 1194, 1163, 1194, 1194, 1194, 1163, 1194, 1194, - 1194, 1194, 1194, 1194, 1194, 1163, 1194, 1163, - 1194, 1163, 1194, 1163, 1163, 1194, 1194, 1194, - 1163, 1163, 1163, 1194, 1163, 1194, 1194, 1163, - 1194, 1163, 1194, 1194, 1163, 1194, 1194, 1163, - 1303, 1304, 1305, 1306, 1163, 1194, 1163, 1194, - 1163, 1194, 1163, 1194, 1163, 1307, 1163, 1194, - 1163, 1308, 1309, 1310, 1311, 1312, 1313, 1163, - 1194, 1194, 1194, 1163, 1163, 1163, 1163, 1194, - 1194, 1163, 1194, 1194, 1163, 1163, 1163, 1194, - 1194, 1194, 1194, 1163, 1314, 1315, 1316, 1163, - 1194, 1194, 1194, 1194, 1194, 1163, 1194, 1163, - 1194, 1163, 1317, 1318, 1319, 1163, 1162, 1163, - 1194, 1163, 1194, 1163, 1320, 1163, 1321, 1322, - 1323, 1325, 1324, 1163, 1194, 1163, 1163, 1194, - 1194, 1269, 1270, 1271, 1272, 1273, 1274, 1163, - 1162, 1163, 1162, 1162, 1163, 1162, 1163, 1194, - 1162, 1162, 1162, 1194, 1194, 1163, 1162, 1162, - 1162, 1163, 1163, 1163, 1162, 1163, 1194, 1194, - 1162, 1162, 1194, 1163, 1162, 1162, 1162, 1163, - 1162, 1163, 1162, 1163, 1162, 1163, 1194, 1163, - 1163, 1162, 1162, 1163, 1162, 1163, 1194, 1162, - 1162, 1194, 1162, 1163, 1194, 1162, 1162, 1194, - 1194, 1162, 1162, 1163, 1162, 1162, 1194, 1163, - 1162, 1162, 1162, 1194, 1194, 1194, 1163, 1162, - 1194, 1162, 1163, 1163, 1163, 1194, 1163, 1163, - 1163, 1162, 1162, 1162, 1194, 1162, 1194, 1163, - 1162, 1162, 1194, 1194, 1194, 1162, 1162, 1162, - 1163, 1162, 1162, 1194, 1194, 1163, 1163, 1163, - 1162, 1162, 1162, 1163, 1162, 1163, 1194, 1162, - 1162, 1162, 1162, 1194, 1162, 1194, 1194, 1163, - 1162, 1194, 1162, 1163, 1162, 1163, 1162, 1194, - 1162, 1162, 1163, 1162, 1163, 1162, 1162, 1162, - 1162, 1194, 1163, 1194, 1162, 1163, 1162, 1162, - 1162, 1162, 1163, 1162, 1163, 1326, 1327, 1328, - 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, - 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, - 1345, 1346, 1163, 1194, 1162, 1162, 1194, 1162, - 1163, 1194, 1162, 1162, 1162, 1163, 1162, 1194, - 1162, 1162, 1162, 1163, 1162, 1163, 1162, 1162, - 1163, 1162, 1162, 1163, 1194, 1162, 1194, 1163, - 1162, 1162, 1162, 1163, 1194, 1162, 1163, 1162, - 1162, 1163, 1162, 1162, 1194, 1162, 1194, 1194, - 1162, 1163, 1162, 1162, 1194, 1163, 1162, 1162, - 1162, 1162, 1194, 1162, 1162, 1194, 1162, 1163, - 1162, 1163, 1194, 1194, 1194, 1162, 1162, 1194, - 1163, 1162, 1163, 1162, 1163, 1194, 1194, 1194, - 1194, 1162, 1162, 1194, 1162, 1163, 1194, 1162, - 1162, 1194, 1162, 1194, 1163, 1194, 1162, 1194, - 1162, 1163, 1194, 1162, 1162, 1162, 1162, 1194, - 1162, 1163, 1162, 1162, 1163, 1347, 1348, 1349, - 1350, 1351, 1163, 1162, 1248, 1163, 1162, 1163, - 1162, 1163, 1162, 1163, 1162, 1163, 1352, 1353, - 1163, 1162, 1163, 1162, 1163, 1354, 1355, 1356, - 1357, 1256, 1358, 1359, 1360, 1361, 1362, 1363, - 1364, 1365, 1366, 1367, 1163, 1162, 1162, 1163, - 1162, 1163, 1162, 1163, 1162, 1162, 1162, 1194, - 1194, 1162, 1163, 1162, 1163, 1162, 1163, 1194, - 1162, 1163, 1162, 1194, 1163, 1194, 1162, 1162, - 1162, 1194, 1162, 1194, 1163, 1162, 1163, 1194, - 1162, 1194, 1162, 1194, 1162, 1163, 1162, 1162, - 1194, 1162, 1163, 1162, 1162, 1162, 1162, 1163, - 1162, 1194, 1194, 1162, 1162, 1194, 1163, 1162, - 1162, 1194, 1162, 1194, 1163, 1368, 1369, 1355, - 1163, 1162, 1163, 1162, 1162, 1163, 1370, 1371, - 1372, 1373, 1374, 1375, 1376, 1163, 1377, 1378, - 1379, 1380, 1381, 1163, 1162, 1163, 1162, 1163, - 1162, 1163, 1162, 1162, 1162, 1162, 1162, 1163, - 1162, 1163, 1382, 1383, 1384, 1385, 1386, 1387, - 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, - 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, - 1404, 1163, 1162, 1194, 1162, 1163, 1163, 1162, - 1194, 1163, 1194, 1194, 1163, 1162, 1194, 1162, - 1162, 1163, 1162, 1163, 1194, 1162, 1194, 1162, - 1194, 1163, 1163, 1162, 1163, 1194, 1162, 1162, - 1194, 1162, 1194, 1162, 1163, 1162, 1194, 1162, - 1163, 1162, 1162, 1194, 1162, 1194, 1163, 1162, - 1162, 1194, 1194, 1194, 1194, 1162, 1162, 1163, - 1194, 1162, 1163, 1194, 1194, 1162, 1163, 1162, - 1194, 1162, 1194, 1162, 1194, 1162, 1163, 1194, - 1163, 1162, 1162, 1194, 1194, 1162, 1194, 1162, - 1163, 1163, 1163, 1162, 1162, 1194, 1162, 1194, - 1162, 1163, 1163, 1162, 1194, 1194, 1162, 1194, - 1162, 1163, 1194, 1162, 1194, 1162, 1163, 1194, - 1194, 1162, 1162, 1163, 1194, 1194, 1194, 1162, - 1162, 1163, 1405, 1406, 1305, 1407, 1163, 1162, - 1163, 1162, 1163, 1162, 1163, 1408, 1163, 1162, - 1163, 1409, 1410, 1411, 1412, 1413, 1414, 1163, - 1194, 1194, 1162, 1162, 1162, 1163, 1163, 1163, - 1163, 1162, 1162, 1163, 1162, 1162, 1163, 1163, - 1163, 1162, 1162, 1162, 1162, 1163, 1415, 1416, - 1417, 1163, 1162, 1162, 1162, 1162, 1162, 1163, - 1162, 1163, 1162, 1163, 1418, 1163, 1194, 1163, - 1419, 1163, 1420, 1421, 1422, 1424, 1423, 1163, - 1162, 1163, 1163, 1162, 1162, 1162, 3, 1, - 3, 1162, 3, 1, 601, 1, 1425, 1427, - 1428, 1429, 1430, 1431, 1432, 1427, 1428, 1429, - 1430, 1431, 1432, 1427, 601, 1426, 890, 1, - 3, 610, 3, 1, 875, 875, 875, 877, - 1, 875, 875, 877, 875, 875, 877, 875, - 875, 875, 877, 875, 875, 877, 875, 875, - 877, 875, 875, 1, 877, 1429, 1430, 1431, - 1432, 1426, 1427, 1429, 1430, 1431, 1432, 1426, - 1427, 1429, 1430, 1431, 1432, 1426, 1427, 1429, - 1430, 1431, 1432, 1426, 1427, 1429, 1430, 1431, - 1432, 1426, 1427, 1429, 1430, 1431, 1432, 1426, - 1427, 1429, 1430, 1431, 1432, 1426, 1427, 1429, - 1430, 1431, 1432, 1426, 1427, 1429, 1430, 1431, - 1432, 1426, 1427, 1428, 890, 1430, 1431, 1432, - 1426, 1427, 1428, 1430, 1431, 1432, 1426, 1427, - 1428, 1430, 1431, 1432, 1426, 1427, 1428, 1430, - 1431, 1432, 1426, 1427, 1428, 1430, 1431, 1432, - 1426, 1427, 1428, 1430, 1431, 1432, 1426, 1427, - 1428, 1430, 1431, 1432, 1426, 1427, 1428, 1430, - 1431, 1432, 1426, 1427, 1428, 1430, 1431, 1432, - 1426, 1427, 1428, 1429, 890, 1431, 1432, 1426, - 1427, 1428, 1429, 1431, 1432, 1426, 1427, 1428, - 1429, 1431, 1432, 1426, 1427, 1428, 1429, 1431, - 1432, 1426, 1427, 1428, 1429, 1431, 1433, 1434, - 1435, 1437, 1430, 1436, 1, 890, 875, 3, - 875, 877, 3, 877, 3, 1, 875, 1, - 265, 265, 1, 265, 1438, 1439, 601, 1, - 265, 3, 1, 3, 3, 265, 3, 1, - 1441, 1442, 1443, 1444, 1440, 1, 1445, 1446, - 601, 1, 266, 3, 1, 3, 266, 3, - 1, 1447, 601, 1, 3, 265, 3, 1, - 1448, 601, 1, 3, 265, 3, 1, 1449, - 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, - 1458, 1459, 601, 1, 3, 1460, 1, 1462, - 1461, 1461, 1462, 1462, 1461, 1462, 1462, 1461, - 1462, 1462, 1462, 1461, 1462, 1461, 1462, 1462, - 1461, 1462, 1462, 1462, 1462, 1461, 1462, 1462, - 1461, 1461, 1462, 1462, 1461, 1462, 1461, 1463, - 1464, 1465, 1466, 1467, 1469, 1470, 1471, 1473, - 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, - 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, - 1490, 1468, 1472, 1461, 1462, 1462, 1462, 1462, - 1461, 1462, 1461, 1462, 1462, 1461, 1461, 1461, - 1462, 1461, 1461, 1461, 1462, 1462, 1462, 1462, - 1461, 1461, 1461, 1461, 1461, 1461, 1462, 1461, - 1461, 1461, 1461, 1461, 1461, 1462, 1461, 1461, - 1461, 1461, 1462, 1462, 1462, 1462, 1461, 1462, - 1462, 1462, 1462, 1462, 1461, 1462, 1462, 1461, - 1462, 1462, 1462, 1462, 1461, 1462, 1462, 1461, - 1461, 1461, 1461, 1461, 1461, 1462, 1462, 1462, - 1462, 1462, 1462, 1461, 1462, 1462, 1461, 1461, - 1461, 1461, 1461, 1461, 1462, 1462, 1461, 1462, - 1462, 1462, 1462, 1462, 1461, 1462, 1462, 1461, - 1462, 1461, 1462, 1462, 1462, 1461, 1462, 1461, - 1462, 1462, 1462, 1462, 1462, 1461, 1462, 1461, - 1462, 1462, 1462, 1462, 1461, 1462, 1461, 1491, - 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, - 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, - 1508, 1509, 1510, 1511, 1461, 1462, 1462, 1461, - 1462, 1462, 1462, 1461, 1462, 1462, 1462, 1462, - 1461, 1462, 1461, 1462, 1462, 1461, 1462, 1462, - 1461, 1462, 1461, 1461, 1461, 1462, 1462, 1461, - 1462, 1462, 1461, 1462, 1462, 1461, 1462, 1461, - 1462, 1462, 1462, 1462, 1462, 1461, 1462, 1461, - 1462, 1462, 1461, 1461, 1461, 1462, 1462, 1462, - 1461, 1462, 1461, 1462, 1461, 1462, 1462, 1462, - 1462, 1462, 1461, 1462, 1462, 1461, 1512, 1513, - 1514, 1515, 1516, 1461, 1462, 1517, 1461, 1512, - 1513, 1518, 1514, 1515, 1516, 1461, 1462, 1461, - 1462, 1461, 1462, 1461, 1462, 1461, 1462, 1461, - 1519, 1520, 1461, 1462, 1461, 1462, 1461, 1521, - 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, - 1530, 1531, 1532, 1533, 1534, 1535, 1461, 1462, - 1462, 1461, 1462, 1461, 1462, 1461, 1462, 1462, - 1462, 1462, 1461, 1462, 1462, 1461, 1461, 1461, - 1462, 1462, 1461, 1462, 1461, 1462, 1462, 1461, - 1461, 1461, 1462, 1462, 1461, 1462, 1462, 1462, - 1461, 1462, 1462, 1462, 1462, 1461, 1462, 1462, - 1462, 1461, 1462, 1462, 1461, 1536, 1537, 1522, - 1461, 1462, 1461, 1462, 1462, 1461, 1538, 1539, - 1540, 1541, 1542, 1543, 1544, 1461, 1545, 1546, - 1547, 1548, 1549, 1461, 1462, 1461, 1462, 1461, - 1462, 1461, 1462, 1462, 1462, 1462, 1462, 1461, - 1462, 1461, 1550, 1551, 1552, 1553, 1554, 1555, - 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, - 1564, 1565, 1566, 1563, 1567, 1568, 1569, 1570, - 1571, 1461, 1462, 1462, 1461, 1461, 1462, 1461, - 1461, 1462, 1462, 1462, 1461, 1462, 1461, 1462, - 1462, 1461, 1461, 1461, 1462, 1462, 1462, 1461, - 1462, 1461, 1462, 1462, 1462, 1461, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1461, 1462, 1461, - 1462, 1461, 1462, 1461, 1461, 1462, 1462, 1462, - 1461, 1461, 1461, 1462, 1461, 1462, 1462, 1461, - 1462, 1461, 1462, 1462, 1461, 1462, 1462, 1461, - 1572, 1573, 1574, 1575, 1461, 1462, 1461, 1462, - 1461, 1462, 1461, 1462, 1461, 1576, 1461, 1462, - 1461, 1577, 1578, 1579, 1580, 1581, 1582, 1461, - 1462, 1462, 1462, 1461, 1461, 1461, 1461, 1462, - 1462, 1461, 1462, 1462, 1461, 1461, 1461, 1462, - 1462, 1462, 1462, 1461, 1583, 1584, 1585, 1461, - 1462, 1462, 1462, 1462, 1462, 1461, 1462, 1461, - 1462, 1461, 1586, 1587, 1588, 1461, 1589, 1461, - 1589, 1461, 1461, 1589, 1589, 1461, 1589, 1589, - 1461, 1589, 1589, 1589, 1461, 1589, 1461, 1589, - 1589, 1461, 1589, 1589, 1589, 1589, 1461, 1589, - 1589, 1461, 1461, 1589, 1589, 1461, 1589, 1461, - 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1598, - 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, - 1607, 1608, 1609, 1481, 1610, 1611, 1612, 1613, - 1614, 1615, 1616, 1617, 1618, 1597, 1461, 1589, - 1589, 1589, 1589, 1461, 1589, 1461, 1589, 1589, - 1461, 1462, 1462, 1461, 1461, 1462, 1589, 1589, - 1461, 1589, 1589, 1461, 1589, 1461, 1462, 1589, - 1589, 1589, 1462, 1462, 1461, 1589, 1589, 1589, - 1461, 1461, 1461, 1589, 1461, 1462, 1462, 1589, - 1589, 1462, 1461, 1589, 1589, 1589, 1461, 1589, - 1461, 1589, 1461, 1589, 1461, 1462, 1461, 1461, - 1589, 1589, 1461, 1589, 1461, 1462, 1589, 1589, - 1462, 1589, 1461, 1462, 1589, 1589, 1462, 1462, - 1589, 1589, 1461, 1589, 1589, 1462, 1461, 1589, - 1589, 1589, 1462, 1462, 1462, 1461, 1589, 1462, - 1589, 1461, 1461, 1461, 1462, 1461, 1461, 1461, - 1589, 1589, 1589, 1462, 1589, 1462, 1461, 1589, - 1589, 1462, 1462, 1462, 1589, 1589, 1589, 1461, - 1589, 1589, 1462, 1462, 1461, 1461, 1461, 1589, - 1589, 1589, 1461, 1589, 1461, 1462, 1589, 1589, - 1589, 1589, 1462, 1589, 1462, 1462, 1461, 1589, - 1462, 1589, 1461, 1589, 1461, 1589, 1462, 1589, - 1589, 1461, 1589, 1461, 1589, 1589, 1589, 1589, - 1462, 1461, 1462, 1589, 1461, 1589, 1589, 1589, - 1589, 1461, 1589, 1461, 1619, 1620, 1621, 1622, - 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, - 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, - 1639, 1461, 1462, 1589, 1589, 1462, 1589, 1461, - 1462, 1589, 1589, 1589, 1461, 1589, 1462, 1589, - 1589, 1589, 1461, 1589, 1461, 1589, 1589, 1461, - 1589, 1589, 1461, 1462, 1589, 1462, 1461, 1589, - 1589, 1589, 1461, 1462, 1589, 1461, 1589, 1589, - 1461, 1589, 1589, 1462, 1589, 1462, 1462, 1589, - 1461, 1589, 1589, 1462, 1461, 1589, 1589, 1589, - 1589, 1462, 1589, 1589, 1462, 1589, 1461, 1589, - 1461, 1462, 1462, 1462, 1589, 1589, 1462, 1461, - 1589, 1461, 1589, 1461, 1462, 1462, 1462, 1462, - 1589, 1589, 1462, 1589, 1461, 1462, 1589, 1589, - 1462, 1589, 1462, 1461, 1462, 1589, 1462, 1589, - 1461, 1462, 1589, 1589, 1589, 1589, 1462, 1589, - 1461, 1589, 1589, 1461, 1640, 1641, 1642, 1643, - 1644, 1461, 1589, 1517, 1461, 1589, 1461, 1589, - 1461, 1589, 1461, 1589, 1461, 1645, 1646, 1461, - 1589, 1461, 1589, 1461, 1647, 1648, 1649, 1650, - 1525, 1651, 1652, 1653, 1654, 1655, 1656, 1657, - 1658, 1659, 1660, 1461, 1589, 1589, 1461, 1589, - 1461, 1589, 1461, 1589, 1589, 1589, 1462, 1462, - 1589, 1461, 1589, 1461, 1589, 1461, 1462, 1589, - 1461, 1589, 1462, 1461, 1462, 1589, 1589, 1589, - 1462, 1589, 1462, 1461, 1589, 1461, 1462, 1589, - 1462, 1589, 1462, 1589, 1461, 1589, 1589, 1462, - 1589, 1461, 1589, 1589, 1589, 1589, 1461, 1589, - 1462, 1462, 1589, 1589, 1462, 1461, 1589, 1589, - 1462, 1589, 1462, 1461, 1661, 1662, 1648, 1461, - 1589, 1461, 1589, 1589, 1461, 1663, 1664, 1665, - 1666, 1667, 1668, 1669, 1461, 1670, 1671, 1672, - 1673, 1674, 1461, 1589, 1461, 1589, 1461, 1589, - 1461, 1589, 1589, 1589, 1589, 1589, 1461, 1589, - 1461, 1675, 1676, 1677, 1678, 1679, 1680, 1681, - 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, - 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, - 1461, 1589, 1462, 1589, 1461, 1461, 1589, 1462, - 1461, 1462, 1462, 1461, 1589, 1462, 1589, 1589, - 1461, 1589, 1461, 1462, 1589, 1462, 1589, 1462, - 1461, 1461, 1589, 1461, 1462, 1589, 1589, 1462, - 1589, 1462, 1589, 1461, 1589, 1462, 1589, 1461, - 1589, 1589, 1462, 1589, 1462, 1461, 1589, 1589, - 1462, 1462, 1462, 1462, 1589, 1589, 1461, 1462, - 1589, 1461, 1462, 1462, 1589, 1461, 1589, 1462, - 1589, 1462, 1589, 1462, 1589, 1461, 1462, 1461, - 1589, 1589, 1462, 1462, 1589, 1462, 1589, 1461, - 1461, 1461, 1589, 1589, 1462, 1589, 1462, 1589, - 1461, 1461, 1589, 1462, 1462, 1589, 1462, 1589, - 1461, 1462, 1589, 1462, 1589, 1461, 1462, 1462, - 1589, 1589, 1461, 1462, 1462, 1462, 1589, 1589, - 1461, 1698, 1699, 1574, 1700, 1461, 1589, 1461, - 1589, 1461, 1589, 1461, 1701, 1461, 1589, 1461, - 1702, 1703, 1704, 1705, 1706, 1707, 1461, 1462, - 1462, 1589, 1589, 1589, 1461, 1461, 1461, 1461, - 1589, 1589, 1461, 1589, 1589, 1461, 1461, 1461, - 1589, 1589, 1589, 1589, 1461, 1708, 1709, 1710, - 1461, 1589, 1589, 1589, 1589, 1589, 1461, 1589, - 1461, 1589, 1461, 1711, 1461, 1462, 1461, 1712, - 1461, 1713, 1714, 1715, 1717, 1716, 1461, 1589, - 1461, 1461, 1589, 1589, 1462, 1461, 1462, 1461, - 1718, 1461, 1719, 1720, 1721, 1723, 1722, 1461, - 1462, 1461, 1461, 1462, 1462, 1538, 1539, 1540, - 1541, 1542, 1543, 1461, 1538, 1539, 1540, 1541, - 1542, 1543, 1724, 1461, 1725, 1461, 1462, 1461, - 1162, 3, 1, 3, 1162, 3, 1162, 3, - 1, 1162, 1162, 3, 1162, 3, 1162, 3, - 1162, 3, 1162, 3, 1, 3, 3, 1162, - 1162, 3, 1, 1162, 1162, 3, 1, 1162, - 3, 1162, 3, 1, 3, 1162, 3, 1162, - 3, 1, 1162, 3, 1162, 3, 1, 1162, - 3, 1, 1162, 1162, 3, 3, 1162, 3, - 1162, 3, 1162, 1, 1440, 1, 1726, 1440, - 1, 1727, 1435, 1437, 1728, 1437, 601, 1436, - 1, 265, 3, 1, 3, 265, 1, 1, - 1730, 1729, 1733, 1734, 1735, 1736, 1737, 1738, - 1739, 1741, 1742, 1743, 1744, 1745, 1746, 1748, - 1729, 1, 1732, 1740, 1747, 1, 1731, 262, - 264, 1750, 1751, 1752, 1753, 1754, 1755, 1756, - 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, - 1765, 1766, 1767, 1749, 262, 264, 1750, 1751, - 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, - 1760, 1761, 1768, 1763, 1764, 1765, 1769, 1767, - 1749, 256, 258, 1770, 1771, 1772, 1773, 1774, - 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, - 1783, 1784, 1785, 1786, 1787, 1749, 1789, 1790, - 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, - 1799, 1800, 1801, 1803, 268, 530, 576, 1802, - 1788, 527, 529, 1804, 1805, 1806, 1807, 1808, - 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, - 1817, 1818, 1819, 1820, 1821, 1788, 527, 529, - 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811, - 1812, 1813, 1814, 1815, 1822, 1817, 1818, 1819, - 1823, 1821, 1788, 521, 523, 1824, 1825, 1826, - 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, - 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1788, - 527, 529, 1804, 1805, 1806, 1807, 1808, 1809, - 1810, 1811, 1812, 1813, 1814, 1842, 1816, 1817, - 1843, 1844, 1845, 1846, 1819, 1820, 1821, 1788, - 527, 529, 1804, 1805, 1806, 1807, 1808, 1809, - 1810, 1811, 1812, 1813, 1814, 1847, 1816, 1817, - 1818, 1848, 1819, 1820, 1821, 1788, 527, 529, - 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811, - 1812, 1813, 1814, 1849, 1816, 1817, 1818, 1850, - 1819, 1820, 1821, 1788, 527, 529, 1804, 1805, - 1806, 1807, 1808, 1809, 1810, 1811, 1812, 1813, - 1814, 1851, 1816, 1817, 1818, 1852, 1819, 1820, - 1821, 1788, 527, 529, 1804, 1805, 1806, 1807, - 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, - 1816, 1817, 1818, 1819, 1853, 1821, 1788, 871, - 873, 1855, 1856, 1857, 1858, 1859, 1860, 1861, - 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, - 1870, 1871, 1872, 1873, 1874, 1875, 1854, 871, - 873, 1855, 1856, 1857, 1858, 1859, 1860, 1861, - 1862, 1863, 1864, 1865, 1876, 1867, 1868, 1877, - 1873, 1874, 1875, 1854, 871, 873, 1855, 1856, - 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, - 1865, 1876, 1878, 1868, 1877, 1873, 1879, 1875, - 1854, 865, 867, 1880, 1881, 1882, 1883, 1884, - 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, - 1893, 1894, 1895, 1896, 1897, 1854, 871, 873, - 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, - 1863, 1864, 1865, 1898, 1867, 1868, 1877, 1899, - 1873, 1874, 1875, 1854, 871, 873, 1855, 1856, - 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, - 1865, 1900, 1867, 1868, 1877, 1901, 1873, 1874, - 1875, 1854, 871, 873, 1855, 1856, 1857, 1858, - 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1902, - 1867, 1868, 1877, 1903, 1873, 1874, 1875, 1854, - 1025, 1027, 1905, 1906, 1907, 1908, 1909, 1910, - 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, - 1919, 1920, 1921, 1922, 1904, 1025, 1027, 1905, - 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, - 1914, 1915, 1916, 1923, 1918, 1919, 1920, 1924, - 1922, 1904, 1159, 1161, 1925, 1926, 1927, 1928, - 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, - 1937, 1938, 1939, 1940, 1941, 1942, 1904, 1422, - 1424, 1944, 1945, 1946, 1947, 1948, 1949, 1950, - 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, - 1959, 1960, 1961, 1943, 1323, 1325, 1962, 1963, - 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, - 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, - 1943, 1323, 1325, 1962, 1963, 1964, 1965, 1966, - 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1980, - 1975, 1976, 1977, 1981, 1979, 1943, 1721, 1723, - 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, - 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 1982, 1721, 1723, 1983, 1984, 1985, - 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, - 1994, 1995, 1996, 1997, 1998, 2001, 2000, 1982, - 1721, 1723, 1983, 1984, 1985, 1986, 1987, 1988, - 1989, 1990, 1991, 1992, 1993, 1994, 2002, 1996, - 1997, 1998, 2003, 2000, 1982, 1715, 1717, 2004, - 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, - 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, - 2021, 1982, -} - -var _graphclust_trans_targs []int16 = []int16{ - 1974, 0, 1974, 1975, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, - 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 66, 68, 70, - 71, 72, 1976, 69, 74, 75, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 93, 94, 96, - 102, 125, 130, 132, 139, 143, 97, 98, - 99, 100, 101, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, - 124, 126, 127, 128, 129, 131, 133, 134, - 135, 136, 137, 138, 140, 141, 142, 144, - 291, 292, 1977, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, - 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 210, 211, 212, - 213, 214, 216, 217, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 234, 235, 237, 243, 267, 271, - 273, 280, 284, 238, 239, 240, 241, 242, - 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 268, - 269, 270, 272, 274, 275, 276, 277, 278, - 279, 281, 282, 283, 285, 287, 288, 289, - 145, 290, 146, 294, 295, 296, 2, 297, - 3, 1974, 1978, 1974, 1979, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, - 326, 327, 328, 329, 330, 331, 332, 333, - 334, 335, 336, 337, 338, 339, 340, 341, - 342, 344, 345, 346, 347, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, 366, 368, - 370, 371, 372, 1980, 369, 374, 375, 377, - 378, 379, 380, 381, 382, 383, 384, 385, - 386, 387, 388, 389, 390, 391, 393, 394, - 396, 402, 425, 430, 432, 439, 443, 397, - 398, 399, 400, 401, 403, 404, 405, 406, - 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, - 423, 424, 426, 427, 428, 429, 431, 433, - 434, 435, 436, 437, 438, 440, 441, 442, - 444, 591, 592, 1981, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 477, - 478, 479, 480, 481, 482, 483, 484, 485, - 486, 488, 489, 490, 491, 492, 493, 494, - 495, 496, 497, 498, 499, 500, 501, 502, - 503, 504, 505, 506, 507, 508, 510, 511, - 512, 513, 514, 516, 517, 519, 520, 521, - 522, 523, 524, 525, 526, 527, 528, 529, - 530, 531, 532, 534, 535, 537, 543, 567, - 571, 573, 580, 584, 538, 539, 540, 541, - 542, 544, 545, 546, 547, 548, 549, 550, - 551, 552, 553, 554, 555, 556, 557, 558, - 559, 560, 561, 562, 563, 564, 565, 566, - 568, 569, 570, 572, 574, 575, 576, 577, - 578, 579, 581, 582, 583, 585, 587, 588, - 589, 445, 590, 446, 594, 595, 596, 302, - 597, 303, 599, 605, 606, 608, 610, 613, - 616, 640, 1982, 622, 1983, 612, 1984, 615, - 618, 620, 621, 624, 625, 629, 630, 631, - 632, 633, 634, 635, 1985, 628, 639, 642, - 643, 644, 645, 646, 649, 650, 651, 652, - 653, 654, 655, 656, 660, 661, 663, 664, - 647, 666, 669, 671, 673, 667, 668, 670, - 672, 674, 678, 679, 680, 681, 682, 683, - 684, 685, 686, 687, 1986, 676, 677, 690, - 691, 299, 695, 696, 698, 997, 1000, 1003, - 1027, 1974, 1987, 1974, 1988, 712, 713, 714, - 715, 716, 717, 718, 719, 720, 721, 722, - 723, 724, 725, 726, 727, 728, 729, 730, - 731, 732, 733, 734, 735, 736, 737, 738, - 739, 741, 742, 743, 744, 745, 746, 747, - 748, 749, 750, 751, 752, 753, 754, 755, - 756, 757, 758, 759, 760, 761, 763, 765, - 767, 768, 769, 1989, 766, 771, 772, 774, - 775, 776, 777, 778, 779, 780, 781, 782, - 783, 784, 785, 786, 787, 788, 790, 791, - 793, 799, 822, 827, 829, 836, 840, 794, - 795, 796, 797, 798, 800, 801, 802, 803, - 804, 805, 806, 807, 808, 809, 810, 811, - 812, 813, 814, 815, 816, 817, 818, 819, - 820, 821, 823, 824, 825, 826, 828, 830, - 831, 832, 833, 834, 835, 837, 838, 839, - 841, 988, 989, 1990, 855, 856, 857, 858, - 859, 860, 861, 862, 863, 864, 865, 866, - 867, 868, 869, 870, 871, 872, 873, 874, - 875, 876, 877, 878, 879, 880, 881, 882, - 883, 885, 886, 887, 888, 889, 890, 891, - 892, 893, 894, 895, 896, 897, 898, 899, - 900, 901, 902, 903, 904, 905, 907, 908, - 909, 910, 911, 913, 914, 916, 917, 918, - 919, 920, 921, 922, 923, 924, 925, 926, - 927, 928, 929, 931, 932, 934, 940, 964, - 968, 970, 977, 981, 935, 936, 937, 938, - 939, 941, 942, 943, 944, 945, 946, 947, - 948, 949, 950, 951, 952, 953, 954, 955, - 956, 957, 958, 959, 960, 961, 962, 963, - 965, 966, 967, 969, 971, 972, 973, 974, - 975, 976, 978, 979, 980, 982, 984, 985, - 986, 842, 987, 843, 991, 992, 993, 699, - 994, 700, 1009, 1991, 999, 1992, 1002, 1005, - 1007, 1008, 1011, 1012, 1016, 1017, 1018, 1019, - 1020, 1021, 1022, 1993, 1015, 1026, 1029, 1327, - 1328, 1626, 1627, 1994, 1974, 1995, 1043, 1044, - 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, - 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, - 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, - 1069, 1070, 1072, 1073, 1074, 1075, 1076, 1077, - 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, - 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1094, - 1095, 1096, 1097, 1098, 1100, 1101, 1103, 1104, - 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, - 1113, 1114, 1115, 1116, 1117, 1119, 1120, 1122, - 1128, 1151, 1156, 1158, 1165, 1123, 1124, 1125, - 1126, 1127, 1129, 1130, 1131, 1132, 1133, 1134, - 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, - 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, - 1152, 1153, 1154, 1155, 1157, 1159, 1160, 1161, - 1162, 1163, 1164, 1166, 1167, 1168, 1170, 1171, - 1172, 1030, 1173, 1031, 1175, 1177, 1178, 1325, - 1326, 1996, 1192, 1193, 1194, 1195, 1196, 1197, - 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, - 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, - 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1222, - 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, - 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, - 1239, 1240, 1241, 1242, 1244, 1245, 1246, 1247, - 1248, 1250, 1251, 1253, 1254, 1255, 1256, 1257, - 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, - 1266, 1268, 1269, 1271, 1277, 1301, 1305, 1307, - 1314, 1318, 1272, 1273, 1274, 1275, 1276, 1278, - 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, - 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, - 1295, 1296, 1297, 1298, 1299, 1300, 1302, 1303, - 1304, 1306, 1308, 1309, 1310, 1311, 1312, 1313, - 1315, 1316, 1317, 1319, 1321, 1322, 1323, 1179, - 1324, 1180, 1997, 1974, 1342, 1343, 1344, 1345, - 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, - 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, - 1377, 1513, 1514, 1515, 1516, 1517, 1518, 1519, - 1520, 1521, 1998, 1359, 1360, 1361, 1362, 1363, - 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, - 1372, 1373, 1374, 1375, 1376, 1378, 1379, 1380, - 1381, 1382, 1383, 1384, 1385, 1386, 1388, 1389, - 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, - 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, - 1406, 1407, 1408, 1410, 1412, 1414, 1415, 1416, - 1999, 1413, 1418, 1419, 1421, 1422, 1423, 1424, - 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, - 1433, 1434, 1435, 1437, 1438, 1440, 1446, 1469, - 1474, 1476, 1483, 1487, 1441, 1442, 1443, 1444, - 1445, 1447, 1448, 1449, 1450, 1451, 1452, 1453, - 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, - 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1470, - 1471, 1472, 1473, 1475, 1477, 1478, 1479, 1480, - 1481, 1482, 1484, 1485, 1486, 1488, 1489, 1490, - 1492, 1493, 1494, 1346, 1495, 1347, 1523, 1524, - 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, - 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, - 1541, 1542, 1543, 1545, 1546, 1547, 1548, 1549, - 1551, 1552, 1554, 1555, 1556, 1557, 1558, 1559, - 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, - 1569, 1570, 1572, 1578, 1602, 1606, 1608, 1615, - 1619, 1573, 1574, 1575, 1576, 1577, 1579, 1580, - 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, - 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, - 1597, 1598, 1599, 1600, 1601, 1603, 1604, 1605, - 1607, 1609, 1610, 1611, 1612, 1613, 1614, 1616, - 1617, 1618, 1620, 1622, 1623, 1624, 1329, 1625, - 1330, 1630, 1631, 1632, 1633, 1634, 1635, 1636, - 1637, 1641, 1642, 1643, 1644, 1645, 1647, 1648, - 1628, 1650, 1653, 1655, 1657, 1651, 1652, 1654, - 1656, 1658, 1959, 1960, 1961, 1962, 1963, 1964, - 1965, 1966, 1967, 1968, 2000, 1974, 2001, 1672, - 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, - 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, - 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, - 1697, 1698, 1699, 1701, 1702, 1703, 1704, 1705, - 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, - 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, - 1723, 1725, 1727, 1728, 1729, 2002, 1726, 1731, - 1732, 1734, 1735, 1736, 1737, 1738, 1739, 1740, - 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, - 1750, 1751, 1753, 1759, 1782, 1787, 1789, 1796, - 1800, 1754, 1755, 1756, 1757, 1758, 1760, 1761, - 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, - 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, - 1778, 1779, 1780, 1781, 1783, 1784, 1785, 1786, - 1788, 1790, 1791, 1792, 1793, 1794, 1795, 1797, - 1798, 1799, 1801, 1948, 1949, 2003, 1815, 1816, - 1817, 1818, 1819, 1820, 1821, 1822, 1823, 1824, - 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, - 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, - 1841, 1842, 1843, 1845, 1846, 1847, 1848, 1849, - 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, - 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, - 1867, 1868, 1869, 1870, 1871, 1873, 1874, 1876, - 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, - 1885, 1886, 1887, 1888, 1889, 1891, 1892, 1894, - 1900, 1924, 1928, 1930, 1937, 1941, 1895, 1896, - 1897, 1898, 1899, 1901, 1902, 1903, 1904, 1905, - 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, - 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, - 1922, 1923, 1925, 1926, 1927, 1929, 1931, 1932, - 1933, 1934, 1935, 1936, 1938, 1939, 1940, 1942, - 1944, 1945, 1946, 1802, 1947, 1803, 1951, 1952, - 1953, 1659, 1954, 1660, 1957, 1958, 1971, 1972, - 1973, 1974, 1, 1975, 299, 300, 301, 692, - 693, 694, 697, 1028, 1628, 1629, 1638, 1639, - 1640, 1646, 1649, 1969, 1970, 1974, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, - 14, 43, 65, 73, 76, 92, 298, 293, - 67, 95, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 187, 209, 215, - 218, 233, 236, 286, 1974, 600, 601, 602, - 603, 604, 607, 641, 648, 657, 658, 659, - 662, 665, 688, 689, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 343, - 365, 373, 376, 392, 598, 593, 367, 395, - 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 487, 509, 515, 518, 533, - 536, 586, 609, 623, 636, 637, 638, 611, - 619, 614, 617, 626, 627, 675, 1974, 701, - 702, 703, 704, 705, 706, 707, 708, 709, - 710, 711, 996, 762, 770, 1010, 1023, 1024, - 1025, 789, 995, 990, 740, 773, 764, 792, - 844, 845, 846, 847, 848, 849, 850, 851, - 852, 853, 854, 884, 906, 912, 915, 930, - 933, 983, 998, 1006, 1001, 1004, 1013, 1014, - 1974, 1032, 1033, 1034, 1035, 1036, 1037, 1038, - 1039, 1040, 1041, 1042, 1071, 1174, 1099, 1102, - 1118, 1176, 1169, 1093, 1121, 1181, 1182, 1183, - 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, - 1221, 1243, 1249, 1252, 1267, 1270, 1320, 1974, - 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, - 1339, 1340, 1341, 1522, 1544, 1550, 1553, 1568, - 1571, 1621, 1348, 1349, 1350, 1351, 1352, 1353, - 1354, 1355, 1356, 1357, 1358, 1387, 1409, 1417, - 1420, 1436, 1496, 1491, 1411, 1439, 1974, 1661, - 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, - 1670, 1671, 1700, 1722, 1730, 1733, 1749, 1956, - 1950, 1955, 1724, 1752, 1804, 1805, 1806, 1807, - 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1844, - 1866, 1872, 1875, 1890, 1893, 1943, -} - -var _graphclust_trans_actions []byte = []byte{ - 31, 0, 27, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 34, 40, 25, 40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 0, 40, 0, 40, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 29, 51, 17, 40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 51, 0, 51, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 40, 21, 40, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 40, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 19, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 40, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 40, 23, 40, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 40, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 40, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 43, 1, 47, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 15, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 13, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 9, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 11, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -} - -var _graphclust_to_state_actions []byte = []byte{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 37, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -} - -var _graphclust_from_state_actions []byte = []byte{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -} - -var _graphclust_eof_trans []int16 = []int16{ - 0, 0, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 0, 0, 0, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 0, 0, 0, 0, - 0, 0, 610, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 610, 612, 612, - 610, 612, 612, 610, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 610, 612, - 612, 612, 612, 0, 0, 0, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 0, - 0, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1750, - 1750, 1750, 1789, 1789, 1789, 1789, 1789, 1789, - 1789, 1789, 1789, 1855, 1855, 1855, 1855, 1855, - 1855, 1855, 1905, 1905, 1905, 1944, 1944, 1944, - 1983, 1983, 1983, 1983, -} - -const graphclust_start int = 1974 -const graphclust_first_final int = 1974 -const graphclust_error int = 0 - -const graphclust_en_main int = 1974 - - -// line 14 "grapheme_clusters.rl" - - -var Error = errors.New("invalid UTF8 text") - -// ScanGraphemeClusters is a split function for bufio.Scanner that splits -// on grapheme cluster boundaries. -func ScanGraphemeClusters(data []byte, atEOF bool) (int, []byte, error) { - if len(data) == 0 { - return 0, nil, nil - } - - // Ragel state - cs := 0 // Current State - p := 0 // "Pointer" into data - pe := len(data) // End-of-data "pointer" - ts := 0 - te := 0 - act := 0 - eof := pe - - // Make Go compiler happy - _ = ts - _ = te - _ = act - _ = eof - - startPos := 0 - endPos := 0 - - -// line 4976 "grapheme_clusters.go" - { - cs = graphclust_start - ts = 0 - te = 0 - act = 0 - } - -// line 4984 "grapheme_clusters.go" - { - var _klen int - var _trans int - var _acts int - var _nacts uint - var _keys int - if p == pe { - goto _test_eof - } - if cs == 0 { - goto _out - } -_resume: - _acts = int(_graphclust_from_state_actions[cs]) - _nacts = uint(_graphclust_actions[_acts]); _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _graphclust_actions[_acts - 1] { - case 4: -// line 1 "NONE" - -ts = p - -// line 5008 "grapheme_clusters.go" - } - } - - _keys = int(_graphclust_key_offsets[cs]) - _trans = int(_graphclust_index_offsets[cs]) - - _klen = int(_graphclust_single_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + _klen - 1) - for { - if _upper < _lower { - break - } - - _mid = _lower + ((_upper - _lower) >> 1) - switch { - case data[p] < _graphclust_trans_keys[_mid]: - _upper = _mid - 1 - case data[p] > _graphclust_trans_keys[_mid]: - _lower = _mid + 1 - default: - _trans += int(_mid - int(_keys)) - goto _match - } - } - _keys += _klen - _trans += _klen - } - - _klen = int(_graphclust_range_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + (_klen << 1) - 2) - for { - if _upper < _lower { - break - } - - _mid = _lower + (((_upper - _lower) >> 1) & ^1) - switch { - case data[p] < _graphclust_trans_keys[_mid]: - _upper = _mid - 2 - case data[p] > _graphclust_trans_keys[_mid + 1]: - _lower = _mid + 2 - default: - _trans += int((_mid - int(_keys)) >> 1) - goto _match - } - } - _trans += _klen - } - -_match: - _trans = int(_graphclust_indicies[_trans]) -_eof_trans: - cs = int(_graphclust_trans_targs[_trans]) - - if _graphclust_trans_actions[_trans] == 0 { - goto _again - } - - _acts = int(_graphclust_trans_actions[_trans]) - _nacts = uint(_graphclust_actions[_acts]); _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _graphclust_actions[_acts-1] { - case 0: -// line 46 "grapheme_clusters.rl" - - - startPos = p - - case 1: -// line 50 "grapheme_clusters.rl" - - - endPos = p - - case 5: -// line 1 "NONE" - -te = p+1 - - case 6: -// line 54 "grapheme_clusters.rl" - -act = 3; - case 7: -// line 54 "grapheme_clusters.rl" - -te = p+1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 8: -// line 54 "grapheme_clusters.rl" - -te = p+1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 9: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 10: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 11: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 12: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 13: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 14: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 15: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 16: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 17: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 18: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 19: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 20: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 21: -// line 1 "NONE" - - switch act { - case 0: - {cs = 0 -goto _again -} - case 3: - {p = (te) - 1 - - return endPos+1, data[startPos:endPos+1], nil - } - } - -// line 5218 "grapheme_clusters.go" - } - } - -_again: - _acts = int(_graphclust_to_state_actions[cs]) - _nacts = uint(_graphclust_actions[_acts]); _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _graphclust_actions[_acts-1] { - case 2: -// line 1 "NONE" - -ts = 0 - - case 3: -// line 1 "NONE" - -act = 0 - -// line 5238 "grapheme_clusters.go" - } - } - - if cs == 0 { - goto _out - } - p++ - if p != pe { - goto _resume - } - _test_eof: {} - if p == eof { - if _graphclust_eof_trans[cs] > 0 { - _trans = int(_graphclust_eof_trans[cs] - 1) - goto _eof_trans - } - } - - _out: {} - } - -// line 116 "grapheme_clusters.rl" - - - // If we fall out here then we were unable to complete a sequence. - // If we weren't able to complete a sequence then either we've - // reached the end of a partial buffer (so there's more data to come) - // or we have an isolated symbol that would normally be part of a - // grapheme cluster but has appeared in isolation here. - - if !atEOF { - // Request more - return 0, nil, nil - } - - // Just take the first UTF-8 sequence and return that. - _, seqLen := utf8.DecodeRune(data) - return seqLen, data[:seqLen], nil -} diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/LICENSE b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/LICENSE similarity index 100% rename from awsproviderlint/vendor/github.com/apparentlymart/go-textseg/LICENSE rename to awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/LICENSE diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/all_tokens.go b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/all_tokens.go similarity index 100% rename from awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/all_tokens.go rename to awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/all_tokens.go diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/emoji_table.rl b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/emoji_table.rl new file mode 100644 index 000000000000..1c0749c9cb5b --- /dev/null +++ b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/emoji_table.rl @@ -0,0 +1,290 @@ +# The following Ragel file was autogenerated with unicode2ragel.rb +# from: https://www.unicode.org/Public/emoji/12.0/emoji-data.txt +# +# It defines ["Extended_Pictographic"]. +# +# To use this, make sure that your alphtype is set to byte, +# and that your input is in utf8. + +%%{ + machine Emoji; + + Extended_Pictographic = + 0xC2 0xA9 #1.1 [1] (©️) copyright + | 0xC2 0xAE #1.1 [1] (®️) registered + | 0xE2 0x80 0xBC #1.1 [1] (‼️) double exclamation mark + | 0xE2 0x81 0x89 #3.0 [1] (⁉️) exclamation question mark + | 0xE2 0x84 0xA2 #1.1 [1] (™️) trade mark + | 0xE2 0x84 0xB9 #3.0 [1] (ℹ️) information + | 0xE2 0x86 0x94..0x99 #1.1 [6] (↔️..↙️) left-right arrow..down... + | 0xE2 0x86 0xA9..0xAA #1.1 [2] (↩️..↪️) right arrow curving le... + | 0xE2 0x8C 0x9A..0x9B #1.1 [2] (⌚..⌛) watch..hourglass done + | 0xE2 0x8C 0xA8 #1.1 [1] (⌨️) keyboard + | 0xE2 0x8E 0x88 #3.0 [1] (⎈) HELM SYMBOL + | 0xE2 0x8F 0x8F #4.0 [1] (⏏️) eject button + | 0xE2 0x8F 0xA9..0xB3 #6.0 [11] (⏩..⏳) fast-forward button..hou... + | 0xE2 0x8F 0xB8..0xBA #7.0 [3] (⏸️..⏺️) pause button..record b... + | 0xE2 0x93 0x82 #1.1 [1] (Ⓜ️) circled M + | 0xE2 0x96 0xAA..0xAB #1.1 [2] (▪️..▫️) black small square..wh... + | 0xE2 0x96 0xB6 #1.1 [1] (▶️) play button + | 0xE2 0x97 0x80 #1.1 [1] (◀️) reverse button + | 0xE2 0x97 0xBB..0xBE #3.2 [4] (◻️..◾) white medium square..bl... + | 0xE2 0x98 0x80..0x85 #1.1 [6] (☀️..★) sun..BLACK STAR + | 0xE2 0x98 0x87..0x92 #1.1 [12] (☇..☒) LIGHTNING..BALLOT BOX WI... + | 0xE2 0x98 0x94..0x95 #4.0 [2] (☔..☕) umbrella with rain drops... + | 0xE2 0x98 0x96..0x97 #3.2 [2] (☖..☗) WHITE SHOGI PIECE..BLACK... + | 0xE2 0x98 0x98 #4.1 [1] (☘️) shamrock + | 0xE2 0x98 0x99 #3.0 [1] (☙) REVERSED ROTATED FLORAL ... + | 0xE2 0x98 0x9A..0xFF #1.1 [86] (☚..♯) BLACK LEFT POINTING INDE... + | 0xE2 0x99 0x00..0xAF # + | 0xE2 0x99 0xB0..0xB1 #3.0 [2] (♰..♱) WEST SYRIAC CROSS..EAST ... + | 0xE2 0x99 0xB2..0xBD #3.2 [12] (♲..♽) UNIVERSAL RECYCLING SYMB... + | 0xE2 0x99 0xBE..0xBF #4.1 [2] (♾️..♿) infinity..wheelchair sy... + | 0xE2 0x9A 0x80..0x85 #3.2 [6] (⚀..⚅) DIE FACE-1..DIE FACE-6 + | 0xE2 0x9A 0x90..0x91 #4.0 [2] (⚐..⚑) WHITE FLAG..BLACK FLAG + | 0xE2 0x9A 0x92..0x9C #4.1 [11] (⚒️..⚜️) hammer and pick..fleur... + | 0xE2 0x9A 0x9D #5.1 [1] (⚝) OUTLINED WHITE STAR + | 0xE2 0x9A 0x9E..0x9F #5.2 [2] (⚞..⚟) THREE LINES CONVERGING R... + | 0xE2 0x9A 0xA0..0xA1 #4.0 [2] (⚠️..⚡) warning..high voltage + | 0xE2 0x9A 0xA2..0xB1 #4.1 [16] (⚢..⚱️) DOUBLED FEMALE SIGN..fu... + | 0xE2 0x9A 0xB2 #5.0 [1] (⚲) NEUTER + | 0xE2 0x9A 0xB3..0xBC #5.1 [10] (⚳..⚼) CERES..SESQUIQUADRATE + | 0xE2 0x9A 0xBD..0xBF #5.2 [3] (⚽..⚿) soccer ball..SQUARED KEY + | 0xE2 0x9B 0x80..0x83 #5.1 [4] (⛀..⛃) WHITE DRAUGHTS MAN..BLAC... + | 0xE2 0x9B 0x84..0x8D #5.2 [10] (⛄..⛍) snowman without snow..DI... + | 0xE2 0x9B 0x8E #6.0 [1] (⛎) Ophiuchus + | 0xE2 0x9B 0x8F..0xA1 #5.2 [19] (⛏️..⛡) pick..RESTRICTED LEFT E... + | 0xE2 0x9B 0xA2 #6.0 [1] (⛢) ASTRONOMICAL SYMBOL FOR ... + | 0xE2 0x9B 0xA3 #5.2 [1] (⛣) HEAVY CIRCLE WITH STROKE... + | 0xE2 0x9B 0xA4..0xA7 #6.0 [4] (⛤..⛧) PENTAGRAM..INVERTED PENT... + | 0xE2 0x9B 0xA8..0xBF #5.2 [24] (⛨..⛿) BLACK CROSS ON SHIELD..W... + | 0xE2 0x9C 0x80 #7.0 [1] (✀) BLACK SAFETY SCISSORS + | 0xE2 0x9C 0x81..0x84 #1.1 [4] (✁..✄) UPPER BLADE SCISSORS..WH... + | 0xE2 0x9C 0x85 #6.0 [1] (✅) check mark button + | 0xE2 0x9C 0x88..0x89 #1.1 [2] (✈️..✉️) airplane..envelope + | 0xE2 0x9C 0x8A..0x8B #6.0 [2] (✊..✋) raised fist..raised hand + | 0xE2 0x9C 0x8C..0x92 #1.1 [7] (✌️..✒️) victory hand..black nib + | 0xE2 0x9C 0x94 #1.1 [1] (✔️) check mark + | 0xE2 0x9C 0x96 #1.1 [1] (✖️) multiplication sign + | 0xE2 0x9C 0x9D #1.1 [1] (✝️) latin cross + | 0xE2 0x9C 0xA1 #1.1 [1] (✡️) star of David + | 0xE2 0x9C 0xA8 #6.0 [1] (✨) sparkles + | 0xE2 0x9C 0xB3..0xB4 #1.1 [2] (✳️..✴️) eight-spoked asterisk.... + | 0xE2 0x9D 0x84 #1.1 [1] (❄️) snowflake + | 0xE2 0x9D 0x87 #1.1 [1] (❇️) sparkle + | 0xE2 0x9D 0x8C #6.0 [1] (❌) cross mark + | 0xE2 0x9D 0x8E #6.0 [1] (❎) cross mark button + | 0xE2 0x9D 0x93..0x95 #6.0 [3] (❓..❕) question mark..white exc... + | 0xE2 0x9D 0x97 #5.2 [1] (❗) exclamation mark + | 0xE2 0x9D 0xA3..0xA7 #1.1 [5] (❣️..❧) heart exclamation..ROTA... + | 0xE2 0x9E 0x95..0x97 #6.0 [3] (➕..➗) plus sign..division sign + | 0xE2 0x9E 0xA1 #1.1 [1] (➡️) right arrow + | 0xE2 0x9E 0xB0 #6.0 [1] (➰) curly loop + | 0xE2 0x9E 0xBF #6.0 [1] (➿) double curly loop + | 0xE2 0xA4 0xB4..0xB5 #3.2 [2] (⤴️..⤵️) right arrow curving up... + | 0xE2 0xAC 0x85..0x87 #4.0 [3] (⬅️..⬇️) left arrow..down arrow + | 0xE2 0xAC 0x9B..0x9C #5.1 [2] (⬛..⬜) black large square..whit... + | 0xE2 0xAD 0x90 #5.1 [1] (⭐) star + | 0xE2 0xAD 0x95 #5.2 [1] (⭕) hollow red circle + | 0xE3 0x80 0xB0 #1.1 [1] (〰️) wavy dash + | 0xE3 0x80 0xBD #3.2 [1] (〽️) part alternation mark + | 0xE3 0x8A 0x97 #1.1 [1] (㊗️) Japanese “congratulatio... + | 0xE3 0x8A 0x99 #1.1 [1] (㊙️) Japanese “secret” button + | 0xF0 0x9F 0x80 0x80..0xAB #5.1 [44] (🀀..🀫) MAHJONG TILE EAST WIN... + | 0xF0 0x9F 0x80 0xAC..0xAF #NA [4] (🀬..🀯) ...... + | 0xF0 0x9F 0x83 0x81..0x8F #6.0 [15] (🃁..🃏) PLAYING CARD ACE OF D... + | 0xF0 0x9F 0x83 0x90 #NA [1] (🃐) + | 0xF0 0x9F 0x83 0x91..0x9F #6.0 [15] (🃑..🃟) PLAYING CARD ACE OF C... + | 0xF0 0x9F 0x83 0xA0..0xB5 #7.0 [22] (🃠..🃵) PLAYING CARD FOOL..PL... + | 0xF0 0x9F 0x83 0xB6..0xBF #NA [10] (🃶..🃿) ................... + | 0xF0 0x9F 0x8A..0x8A 0x00..0xFF # + | 0xF0 0x9F 0x8B 0x00..0xBF # + | 0xF0 0x9F 0x8C 0x80..0xA0 #6.0 [33] (🌀..🌠) cyclone..shooting star + | 0xF0 0x9F 0x8C 0xA1..0xAC #7.0 [12] (🌡️..🌬️) thermometer..wind face + | 0xF0 0x9F 0x8C 0xAD..0xAF #8.0 [3] (🌭..🌯) hot dog..burrito + | 0xF0 0x9F 0x8C 0xB0..0xB5 #6.0 [6] (🌰..🌵) chestnut..cactus + | 0xF0 0x9F 0x8C 0xB6 #7.0 [1] (🌶️) hot pepper + | 0xF0 0x9F 0x8C 0xB7..0xFF #6.0 [70] (🌷..🍼) tulip..baby bottle + | 0xF0 0x9F 0x8D 0x00..0xBC # + | 0xF0 0x9F 0x8D 0xBD #7.0 [1] (🍽️) fork and knife with plate + | 0xF0 0x9F 0x8D 0xBE..0xBF #8.0 [2] (🍾..🍿) bottle with popping c... + | 0xF0 0x9F 0x8E 0x80..0x93 #6.0 [20] (🎀..🎓) ribbon..graduation cap + | 0xF0 0x9F 0x8E 0x94..0x9F #7.0 [12] (🎔..🎟️) HEART WITH TIP ON TH... + | 0xF0 0x9F 0x8E 0xA0..0xFF #6.0 [37] (🎠..🏄) carousel horse..perso... + | 0xF0 0x9F 0x8F 0x00..0x84 # + | 0xF0 0x9F 0x8F 0x85 #7.0 [1] (🏅) sports medal + | 0xF0 0x9F 0x8F 0x86..0x8A #6.0 [5] (🏆..🏊) trophy..person swimming + | 0xF0 0x9F 0x8F 0x8B..0x8E #7.0 [4] (🏋️..🏎️) person lifting weig... + | 0xF0 0x9F 0x8F 0x8F..0x93 #8.0 [5] (🏏..🏓) cricket game..ping pong + | 0xF0 0x9F 0x8F 0x94..0x9F #7.0 [12] (🏔️..🏟️) snow-capped mountai... + | 0xF0 0x9F 0x8F 0xA0..0xB0 #6.0 [17] (🏠..🏰) house..castle + | 0xF0 0x9F 0x8F 0xB1..0xB7 #7.0 [7] (🏱..🏷️) WHITE PENNANT..label + | 0xF0 0x9F 0x8F 0xB8..0xBA #8.0 [3] (🏸..🏺) badminton..amphora + | 0xF0 0x9F 0x90 0x80..0xBE #6.0 [63] (🐀..🐾) rat..paw prints + | 0xF0 0x9F 0x90 0xBF #7.0 [1] (🐿️) chipmunk + | 0xF0 0x9F 0x91 0x80 #6.0 [1] (👀) eyes + | 0xF0 0x9F 0x91 0x81 #7.0 [1] (👁️) eye + | 0xF0 0x9F 0x91 0x82..0xFF #6.0[182] (👂..📷) ear..camera + | 0xF0 0x9F 0x92..0x92 0x00..0xFF # + | 0xF0 0x9F 0x93 0x00..0xB7 # + | 0xF0 0x9F 0x93 0xB8 #7.0 [1] (📸) camera with flash + | 0xF0 0x9F 0x93 0xB9..0xBC #6.0 [4] (📹..📼) video camera..videoca... + | 0xF0 0x9F 0x93 0xBD..0xBE #7.0 [2] (📽️..📾) film projector..PORT... + | 0xF0 0x9F 0x93 0xBF #8.0 [1] (📿) prayer beads + | 0xF0 0x9F 0x94 0x80..0xBD #6.0 [62] (🔀..🔽) shuffle tracks button... + | 0xF0 0x9F 0x95 0x86..0x8A #7.0 [5] (🕆..🕊️) WHITE LATIN CROSS..dove + | 0xF0 0x9F 0x95 0x8B..0x8F #8.0 [5] (🕋..🕏) kaaba..BOWL OF HYGIEIA + | 0xF0 0x9F 0x95 0x90..0xA7 #6.0 [24] (🕐..🕧) one o’clock..twelve-t... + | 0xF0 0x9F 0x95 0xA8..0xB9 #7.0 [18] (🕨..🕹️) RIGHT SPEAKER..joystick + | 0xF0 0x9F 0x95 0xBA #9.0 [1] (🕺) man dancing + | 0xF0 0x9F 0x95 0xBB..0xFF #7.0 [41] (🕻..🖣) LEFT HAND TELEPHONE R... + | 0xF0 0x9F 0x96 0x00..0xA3 # + | 0xF0 0x9F 0x96 0xA4 #9.0 [1] (🖤) black heart + | 0xF0 0x9F 0x96 0xA5..0xFF #7.0 [86] (🖥️..🗺️) desktop computer..w... + | 0xF0 0x9F 0x97 0x00..0xBA # + | 0xF0 0x9F 0x97 0xBB..0xBF #6.0 [5] (🗻..🗿) mount fuji..moai + | 0xF0 0x9F 0x98 0x80 #6.1 [1] (😀) grinning face + | 0xF0 0x9F 0x98 0x81..0x90 #6.0 [16] (😁..😐) beaming face with smi... + | 0xF0 0x9F 0x98 0x91 #6.1 [1] (😑) expressionless face + | 0xF0 0x9F 0x98 0x92..0x94 #6.0 [3] (😒..😔) unamused face..pensiv... + | 0xF0 0x9F 0x98 0x95 #6.1 [1] (😕) confused face + | 0xF0 0x9F 0x98 0x96 #6.0 [1] (😖) confounded face + | 0xF0 0x9F 0x98 0x97 #6.1 [1] (😗) kissing face + | 0xF0 0x9F 0x98 0x98 #6.0 [1] (😘) face blowing a kiss + | 0xF0 0x9F 0x98 0x99 #6.1 [1] (😙) kissing face with smilin... + | 0xF0 0x9F 0x98 0x9A #6.0 [1] (😚) kissing face with closed... + | 0xF0 0x9F 0x98 0x9B #6.1 [1] (😛) face with tongue + | 0xF0 0x9F 0x98 0x9C..0x9E #6.0 [3] (😜..😞) winking face with ton... + | 0xF0 0x9F 0x98 0x9F #6.1 [1] (😟) worried face + | 0xF0 0x9F 0x98 0xA0..0xA5 #6.0 [6] (😠..😥) angry face..sad but r... + | 0xF0 0x9F 0x98 0xA6..0xA7 #6.1 [2] (😦..😧) frowning face with op... + | 0xF0 0x9F 0x98 0xA8..0xAB #6.0 [4] (😨..😫) fearful face..tired face + | 0xF0 0x9F 0x98 0xAC #6.1 [1] (😬) grimacing face + | 0xF0 0x9F 0x98 0xAD #6.0 [1] (😭) loudly crying face + | 0xF0 0x9F 0x98 0xAE..0xAF #6.1 [2] (😮..😯) face with open mouth.... + | 0xF0 0x9F 0x98 0xB0..0xB3 #6.0 [4] (😰..😳) anxious face with swe... + | 0xF0 0x9F 0x98 0xB4 #6.1 [1] (😴) sleeping face + | 0xF0 0x9F 0x98 0xB5..0xFF #6.0 [12] (😵..🙀) dizzy face..weary cat + | 0xF0 0x9F 0x99 0x00..0x80 # + | 0xF0 0x9F 0x99 0x81..0x82 #7.0 [2] (🙁..🙂) slightly frowning fac... + | 0xF0 0x9F 0x99 0x83..0x84 #8.0 [2] (🙃..🙄) upside-down face..fac... + | 0xF0 0x9F 0x99 0x85..0x8F #6.0 [11] (🙅..🙏) person gesturing NO..... + | 0xF0 0x9F 0x9A 0x80..0xFF #6.0 [70] (🚀..🛅) rocket..left luggage + | 0xF0 0x9F 0x9B 0x00..0x85 # + | 0xF0 0x9F 0x9B 0x86..0x8F #7.0 [10] (🛆..🛏️) TRIANGLE WITH ROUNDE... + | 0xF0 0x9F 0x9B 0x90 #8.0 [1] (🛐) place of worship + | 0xF0 0x9F 0x9B 0x91..0x92 #9.0 [2] (🛑..🛒) stop sign..shopping cart + | 0xF0 0x9F 0x9B 0x93..0x94 #10.0 [2] (🛓..🛔) STUPA..PAGODA + | 0xF0 0x9F 0x9B 0x95 #12.0 [1] (🛕) hindu temple + | 0xF0 0x9F 0x9B 0x96..0x9F #NA [10] (🛖..🛟) ...................... + | 0xF0 0x9F 0xA4 0x8D..0x8F #12.0 [3] (🤍..🤏) white heart..pinchin... + | 0xF0 0x9F 0xA4 0x90..0x98 #8.0 [9] (🤐..🤘) zipper-mouth face..si... + | 0xF0 0x9F 0xA4 0x99..0x9E #9.0 [6] (🤙..🤞) call me hand..crossed... + | 0xF0 0x9F 0xA4 0x9F #10.0 [1] (🤟) love-you gesture + | 0xF0 0x9F 0xA4 0xA0..0xA7 #9.0 [8] (🤠..🤧) cowboy hat face..snee... + | 0xF0 0x9F 0xA4 0xA8..0xAF #10.0 [8] (🤨..🤯) face with raised eye... + | 0xF0 0x9F 0xA4 0xB0 #9.0 [1] (🤰) pregnant woman + | 0xF0 0x9F 0xA4 0xB1..0xB2 #10.0 [2] (🤱..🤲) breast-feeding..palm... + | 0xF0 0x9F 0xA4 0xB3..0xBA #9.0 [8] (🤳..🤺) selfie..person fencing + | 0xF0 0x9F 0xA4 0xBC..0xBE #9.0 [3] (🤼..🤾) people wrestling..per... + | 0xF0 0x9F 0xA4 0xBF #12.0 [1] (🤿) diving mask + | 0xF0 0x9F 0xA5 0x80..0x85 #9.0 [6] (🥀..🥅) wilted flower..goal net + | 0xF0 0x9F 0xA5 0x87..0x8B #9.0 [5] (🥇..🥋) 1st place medal..mart... + | 0xF0 0x9F 0xA5 0x8C #10.0 [1] (🥌) curling stone + | 0xF0 0x9F 0xA5 0x8D..0x8F #11.0 [3] (🥍..🥏) lacrosse..flying disc + | 0xF0 0x9F 0xA5 0x90..0x9E #9.0 [15] (🥐..🥞) croissant..pancakes + | 0xF0 0x9F 0xA5 0x9F..0xAB #10.0 [13] (🥟..🥫) dumpling..canned food + | 0xF0 0x9F 0xA5 0xAC..0xB0 #11.0 [5] (🥬..🥰) leafy green..smiling... + | 0xF0 0x9F 0xA5 0xB1 #12.0 [1] (🥱) yawning face + | 0xF0 0x9F 0xA5 0xB2 #NA [1] (🥲) + | 0xF0 0x9F 0xA5 0xB3..0xB6 #11.0 [4] (🥳..🥶) partying face..cold ... + | 0xF0 0x9F 0xA5 0xB7..0xB9 #NA [3] (🥷..🥹) ..................... + | 0xF0 0x9F 0xAB..0xBE 0x00..0xFF # + | 0xF0 0x9F 0xBF 0x00..0xBD # + ; + +}%% diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/generate.go b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/generate.go new file mode 100644 index 000000000000..9df1263484f0 --- /dev/null +++ b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/generate.go @@ -0,0 +1,8 @@ +package textseg + +//go:generate go run make_tables.go -output tables.go +//go:generate go run make_test_tables.go -output tables_test.go +//go:generate ruby unicode2ragel.rb --url=https://www.unicode.org/Public/12.0.0/ucd/auxiliary/GraphemeBreakProperty.txt -m GraphemeCluster -p "Prepend,CR,LF,Control,Extend,Regional_Indicator,SpacingMark,L,V,T,LV,LVT,ZWJ" -o grapheme_clusters_table.rl +//go:generate ruby unicode2ragel.rb --url=https://www.unicode.org/Public/emoji/12.0/emoji-data.txt -m Emoji -p "Extended_Pictographic" -o emoji_table.rl +//go:generate ragel -Z grapheme_clusters.rl +//go:generate gofmt -w grapheme_clusters.go diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/grapheme_clusters.go b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/grapheme_clusters.go new file mode 100644 index 000000000000..c389827feda0 --- /dev/null +++ b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/grapheme_clusters.go @@ -0,0 +1,4078 @@ +//line grapheme_clusters.rl:1 +package textseg + +import ( + "errors" + "unicode/utf8" +) + +// Generated from grapheme_clusters.rl. DO NOT EDIT + +//line grapheme_clusters.go:13 +var _graphclust_actions []byte = []byte{ + 0, 1, 0, 1, 4, 1, 10, 1, 11, + 1, 12, 1, 13, 1, 14, 1, 15, + 1, 16, 1, 17, 1, 18, 1, 19, + 1, 20, 1, 21, 1, 22, 2, 1, + 8, 2, 1, 9, 2, 2, 3, 2, + 5, 1, 3, 0, 1, 9, 3, 5, + 0, 1, 3, 5, 1, 6, 3, 5, + 1, 7, +} + +var _graphclust_key_offsets []int16 = []int16{ + 0, 0, 1, 3, 5, 7, 10, 15, + 17, 20, 28, 31, 33, 35, 38, 68, + 76, 78, 82, 85, 90, 95, 107, 119, + 127, 132, 142, 145, 152, 156, 164, 174, + 180, 188, 190, 198, 201, 203, 206, 208, + 215, 217, 225, 226, 247, 251, 257, 262, + 264, 268, 272, 274, 278, 280, 283, 287, + 289, 296, 298, 302, 306, 310, 312, 314, + 322, 326, 331, 333, 335, 337, 338, 340, + 342, 344, 346, 361, 365, 367, 369, 374, + 378, 384, 386, 388, 392, 396, 398, 402, + 409, 414, 418, 421, 422, 426, 433, 440, + 441, 442, 444, 453, 455, 457, 459, 491, + 495, 497, 501, 505, 508, 512, 516, 519, + 521, 527, 540, 542, 545, 547, 549, 553, + 557, 559, 561, 563, 565, 570, 576, 579, + 581, 585, 589, 596, 599, 605, 607, 611, + 613, 615, 618, 622, 623, 625, 631, 637, + 643, 645, 649, 653, 658, 663, 673, 675, + 677, 679, 680, 682, 683, 689, 691, 693, + 693, 695, 702, 704, 706, 708, 711, 716, + 718, 721, 729, 732, 734, 736, 739, 769, + 777, 779, 783, 786, 791, 796, 808, 820, + 828, 833, 843, 846, 853, 857, 865, 875, + 881, 889, 891, 899, 902, 904, 907, 909, + 916, 918, 926, 927, 948, 952, 958, 963, + 965, 969, 973, 975, 979, 981, 984, 988, + 990, 997, 999, 1003, 1007, 1011, 1013, 1015, + 1023, 1027, 1032, 1034, 1036, 1060, 1063, 1064, + 1066, 1068, 1072, 1075, 1076, 1081, 1082, 1085, + 1088, 1094, 1096, 1100, 1102, 1113, 1122, 1127, + 1129, 1133, 1135, 1137, 1138, 1140, 1143, 1146, + 1148, 1150, 1165, 1169, 1171, 1173, 1178, 1182, + 1188, 1190, 1192, 1196, 1200, 1202, 1206, 1213, + 1218, 1222, 1225, 1226, 1230, 1237, 1244, 1245, + 1246, 1248, 1257, 1259, 1261, 1263, 1295, 1299, + 1301, 1305, 1309, 1312, 1316, 1320, 1323, 1325, + 1331, 1344, 1346, 1349, 1351, 1353, 1357, 1361, + 1363, 1365, 1367, 1369, 1374, 1380, 1383, 1385, + 1389, 1393, 1400, 1403, 1409, 1411, 1415, 1417, + 1419, 1422, 1426, 1427, 1429, 1435, 1441, 1447, + 1449, 1453, 1457, 1462, 1467, 1477, 1479, 1481, + 1483, 1523, 1523, 1526, 1530, 1535, 1537, 1545, + 1547, 1549, 1551, 1553, 1555, 1557, 1559, 1563, + 1567, 1571, 1575, 1577, 1578, 1584, 1586, 1588, + 1590, 1597, 1598, 1600, 1605, 1607, 1609, 1611, + 1614, 1619, 1621, 1624, 1632, 1635, 1637, 1639, + 1642, 1672, 1680, 1682, 1686, 1689, 1694, 1699, + 1711, 1723, 1731, 1736, 1746, 1749, 1756, 1760, + 1768, 1778, 1784, 1792, 1794, 1802, 1805, 1807, + 1810, 1812, 1819, 1821, 1829, 1830, 1851, 1855, + 1861, 1866, 1868, 1872, 1876, 1878, 1882, 1884, + 1887, 1891, 1893, 1900, 1902, 1906, 1910, 1914, + 1916, 1918, 1926, 1930, 1935, 1937, 1939, 1941, + 1942, 1944, 1946, 1948, 1950, 1965, 1969, 1971, + 1973, 1978, 1982, 1988, 1990, 1992, 1996, 2000, + 2002, 2006, 2013, 2018, 2022, 2025, 2026, 2030, + 2037, 2044, 2045, 2046, 2048, 2057, 2059, 2061, + 2063, 2095, 2099, 2101, 2105, 2109, 2112, 2116, + 2120, 2123, 2125, 2131, 2144, 2146, 2149, 2151, + 2153, 2157, 2161, 2163, 2165, 2167, 2169, 2174, + 2180, 2183, 2185, 2189, 2193, 2200, 2203, 2209, + 2211, 2215, 2217, 2219, 2222, 2226, 2227, 2229, + 2235, 2241, 2247, 2249, 2253, 2257, 2262, 2267, + 2277, 2279, 2281, 2283, 2284, 2286, 2287, 2293, + 2295, 2297, 2297, 2299, 2305, 2307, 2309, 2311, + 2314, 2319, 2321, 2324, 2332, 2335, 2337, 2339, + 2342, 2372, 2380, 2382, 2386, 2389, 2394, 2399, + 2411, 2423, 2431, 2436, 2446, 2449, 2456, 2460, + 2468, 2478, 2484, 2492, 2494, 2502, 2505, 2507, + 2510, 2512, 2519, 2521, 2529, 2530, 2551, 2555, + 2561, 2566, 2568, 2572, 2576, 2578, 2582, 2584, + 2587, 2591, 2593, 2600, 2602, 2606, 2610, 2614, + 2616, 2618, 2626, 2630, 2635, 2637, 2639, 2663, + 2666, 2667, 2669, 2671, 2675, 2678, 2679, 2684, + 2685, 2688, 2691, 2697, 2699, 2703, 2705, 2716, + 2725, 2730, 2732, 2736, 2738, 2740, 2741, 2743, + 2746, 2749, 2751, 2753, 2768, 2772, 2774, 2776, + 2781, 2785, 2791, 2793, 2795, 2799, 2803, 2805, + 2809, 2816, 2821, 2825, 2828, 2829, 2833, 2840, + 2847, 2848, 2849, 2851, 2860, 2862, 2864, 2866, + 2898, 2902, 2904, 2908, 2912, 2915, 2919, 2923, + 2926, 2928, 2934, 2947, 2949, 2952, 2954, 2956, + 2960, 2964, 2966, 2968, 2970, 2972, 2977, 2983, + 2986, 2988, 2992, 2996, 3003, 3006, 3012, 3014, + 3018, 3020, 3022, 3025, 3029, 3030, 3032, 3038, + 3044, 3050, 3052, 3056, 3060, 3065, 3070, 3080, + 3082, 3084, 3086, 3126, 3126, 3129, 3133, 3138, + 3140, 3148, 3150, 3152, 3154, 3156, 3158, 3160, + 3162, 3166, 3170, 3174, 3178, 3180, 3181, 3187, + 3189, 3191, 3193, 3200, 3201, 3203, 3209, 3212, + 3215, 3219, 3222, 3225, 3232, 3234, 3258, 3260, + 3284, 3286, 3288, 3311, 3313, 3315, 3316, 3318, + 3320, 3322, 3328, 3330, 3362, 3366, 3371, 3394, + 3396, 3398, 3400, 3402, 3405, 3407, 3409, 3413, + 3413, 3469, 3525, 3556, 3561, 3565, 3587, 3596, + 3601, 3605, 3615, 3622, 3625, 3636, 3639, 3646, + 3652, 3656, 3662, 3679, 3694, 3703, 3709, 3719, + 3723, 3727, 3731, 3735, 3737, 3757, 3763, 3768, + 3770, 3772, 3775, 3777, 3779, 3783, 3839, 3895, + 3928, 3933, 3941, 3945, 3947, 3952, 3959, 3967, + 3970, 3973, 3979, 3982, 3988, 3991, 3994, 3998, + 4001, 4005, 4008, 4012, 4054, 4061, 4069, 4078, + 4082, 4089, 4091, 4093, 4103, 4107, 4111, 4115, + 4119, 4123, 4127, 4131, 4137, 4147, 4155, 4160, + 4163, 4167, 4169, 4172, 4177, 4179, 4182, 4185, + 4189, 4192, 4195, 4202, 4204, 4206, 4208, 4210, + 4213, 4218, 4220, 4223, 4231, 4234, 4236, 4238, + 4241, 4271, 4279, 4281, 4285, 4288, 4293, 4298, + 4310, 4322, 4330, 4335, 4345, 4348, 4355, 4359, + 4367, 4377, 4383, 4391, 4393, 4401, 4404, 4406, + 4409, 4411, 4418, 4420, 4428, 4429, 4450, 4454, + 4460, 4465, 4467, 4471, 4475, 4477, 4481, 4483, + 4486, 4490, 4492, 4499, 4501, 4505, 4509, 4513, + 4515, 4517, 4525, 4529, 4534, 4536, 4538, 4562, + 4565, 4566, 4568, 4570, 4574, 4577, 4578, 4583, + 4584, 4587, 4590, 4596, 4598, 4602, 4604, 4615, + 4624, 4629, 4631, 4635, 4637, 4639, 4640, 4642, + 4645, 4648, 4650, 4652, 4667, 4671, 4673, 4675, + 4680, 4684, 4690, 4692, 4694, 4698, 4702, 4704, + 4708, 4715, 4720, 4724, 4727, 4728, 4732, 4739, + 4746, 4747, 4748, 4750, 4759, 4761, 4763, 4765, + 4797, 4801, 4803, 4807, 4811, 4814, 4818, 4822, + 4825, 4827, 4833, 4846, 4848, 4851, 4853, 4855, + 4859, 4863, 4865, 4867, 4869, 4871, 4876, 4882, + 4885, 4887, 4891, 4895, 4902, 4905, 4911, 4913, + 4917, 4919, 4921, 4924, 4928, 4929, 4931, 4937, + 4943, 4949, 4951, 4955, 4959, 4964, 4969, 4979, + 4981, 4983, 4985, 5025, 5025, 5028, 5032, 5037, + 5039, 5047, 5049, 5051, 5053, 5055, 5057, 5059, + 5061, 5065, 5069, 5073, 5077, 5079, 5080, 5086, + 5088, 5090, 5092, 5099, 5100, 5102, 5126, 5128, + 5152, 5154, 5156, 5179, 5181, 5183, 5184, 5186, + 5188, 5190, 5196, 5198, 5230, 5234, 5239, 5262, + 5264, 5266, 5268, 5270, 5273, 5275, 5277, 5281, + 5281, 5337, 5393, 5424, 5429, 5432, 5454, 5467, + 5469, 5471, 5473, 5476, 5481, 5483, 5486, 5494, + 5497, 5499, 5501, 5504, 5534, 5542, 5544, 5548, + 5551, 5556, 5561, 5573, 5585, 5593, 5598, 5608, + 5611, 5618, 5622, 5630, 5640, 5646, 5654, 5656, + 5664, 5667, 5669, 5672, 5674, 5681, 5683, 5691, + 5692, 5713, 5717, 5723, 5728, 5730, 5734, 5738, + 5740, 5744, 5746, 5749, 5753, 5755, 5762, 5764, + 5768, 5772, 5776, 5778, 5780, 5788, 5792, 5797, + 5799, 5801, 5803, 5804, 5806, 5808, 5810, 5812, + 5827, 5831, 5833, 5835, 5840, 5844, 5850, 5852, + 5854, 5858, 5862, 5864, 5868, 5875, 5880, 5884, + 5887, 5888, 5892, 5899, 5906, 5907, 5908, 5910, + 5919, 5921, 5923, 5925, 5957, 5961, 5963, 5967, + 5971, 5974, 5978, 5982, 5985, 5987, 5993, 6006, + 6008, 6011, 6013, 6015, 6019, 6023, 6025, 6027, + 6029, 6031, 6036, 6042, 6045, 6047, 6051, 6055, + 6062, 6065, 6071, 6073, 6077, 6079, 6081, 6084, + 6088, 6089, 6091, 6097, 6103, 6109, 6111, 6115, + 6119, 6124, 6129, 6139, 6141, 6143, 6145, 6146, + 6148, 6149, 6155, 6157, 6159, 6159, 6166, 6170, + 6180, 6187, 6190, 6201, 6204, 6211, 6217, 6221, + 6227, 6244, 6259, 6268, 6274, 6284, 6288, 6292, + 6296, 6300, 6302, 6322, 6328, 6333, 6335, 6337, + 6340, 6342, 6344, 6348, 6404, 6460, 6493, 6498, + 6506, 6510, 6513, 6520, 6527, 6535, 6538, 6541, + 6547, 6550, 6556, 6559, 6562, 6568, 6571, 6577, + 6580, 6586, 6628, 6635, 6643, 6652, 6656, 6658, + 6660, 6662, 6665, 6670, 6672, 6675, 6683, 6686, + 6688, 6690, 6693, 6723, 6731, 6733, 6737, 6740, + 6745, 6750, 6762, 6774, 6782, 6787, 6797, 6800, + 6807, 6811, 6819, 6829, 6835, 6843, 6845, 6853, + 6856, 6858, 6861, 6863, 6870, 6872, 6880, 6881, + 6902, 6906, 6912, 6917, 6919, 6923, 6927, 6929, + 6933, 6935, 6938, 6942, 6944, 6951, 6953, 6957, + 6961, 6965, 6967, 6969, 6977, 6981, 6986, 6988, + 6990, 7014, 7017, 7018, 7020, 7022, 7026, 7029, + 7030, 7035, 7036, 7039, 7042, 7048, 7050, 7054, + 7056, 7067, 7076, 7081, 7083, 7087, 7089, 7091, + 7092, 7094, 7097, 7100, 7102, 7104, 7119, 7123, + 7125, 7127, 7132, 7136, 7142, 7144, 7146, 7150, + 7154, 7156, 7160, 7167, 7172, 7176, 7179, 7180, + 7184, 7191, 7198, 7199, 7200, 7202, 7211, 7213, + 7215, 7217, 7249, 7253, 7255, 7259, 7263, 7266, + 7270, 7274, 7277, 7279, 7285, 7298, 7300, 7303, + 7305, 7307, 7311, 7315, 7317, 7319, 7321, 7323, + 7328, 7334, 7337, 7339, 7343, 7347, 7354, 7357, + 7363, 7365, 7369, 7371, 7373, 7376, 7380, 7381, + 7383, 7389, 7395, 7401, 7403, 7407, 7411, 7416, + 7421, 7431, 7433, 7435, 7437, 7477, 7477, 7480, + 7484, 7489, 7491, 7499, 7501, 7503, 7505, 7507, + 7509, 7511, 7513, 7517, 7521, 7525, 7529, 7531, + 7532, 7538, 7540, 7542, 7544, 7551, 7552, 7554, + 7561, 7563, 7565, 7575, 7579, 7583, 7587, 7591, + 7595, 7599, 7603, 7609, 7619, 7627, 7632, 7635, + 7639, 7641, 7644, 7653, 7657, 7659, 7661, 7665, + 7665, 7695, 7715, 7735, 7756, 7779, 7799, 7819, + 7840, 7863, 7884, 7905, 7926, 7946, 7969, 7989, + 8010, 8031, 8052, 8073, 8093, 8113, 8133, +} + +var _graphclust_trans_keys []byte = []byte{ + 10, 0, 127, 176, 255, 131, 137, 191, + 145, 189, 135, 129, 130, 132, 133, 144, + 154, 176, 139, 159, 150, 156, 159, 164, + 167, 168, 170, 173, 145, 176, 255, 139, + 255, 166, 176, 189, 171, 179, 160, 161, + 163, 164, 165, 167, 169, 171, 173, 174, + 175, 176, 177, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, + 166, 170, 172, 178, 150, 153, 155, 163, + 165, 167, 169, 173, 153, 155, 147, 161, + 163, 255, 189, 132, 185, 144, 152, 161, + 164, 255, 188, 129, 131, 190, 255, 133, + 134, 137, 138, 142, 150, 152, 161, 164, + 189, 191, 255, 131, 134, 137, 138, 142, + 144, 146, 175, 178, 180, 182, 255, 134, + 138, 142, 161, 164, 185, 192, 255, 188, + 129, 131, 190, 191, 128, 132, 135, 136, + 139, 141, 150, 151, 162, 163, 130, 190, + 191, 151, 128, 130, 134, 136, 138, 141, + 128, 132, 190, 255, 133, 137, 142, 148, + 151, 161, 164, 255, 128, 132, 134, 136, + 138, 141, 149, 150, 162, 163, 128, 131, + 187, 188, 190, 255, 133, 137, 142, 150, + 152, 161, 164, 255, 130, 131, 138, 150, + 143, 148, 152, 159, 178, 179, 177, 179, + 186, 135, 142, 177, 179, 188, 136, 141, + 181, 183, 185, 152, 153, 190, 191, 177, + 191, 128, 132, 134, 135, 141, 151, 153, + 188, 134, 128, 129, 130, 141, 156, 157, + 158, 159, 160, 162, 164, 168, 169, 170, + 172, 173, 174, 175, 176, 179, 183, 173, + 183, 185, 190, 150, 153, 158, 160, 177, + 180, 130, 141, 157, 132, 134, 157, 159, + 146, 148, 178, 180, 146, 147, 178, 179, + 180, 255, 148, 156, 158, 255, 139, 141, + 169, 133, 134, 160, 171, 176, 187, 151, + 155, 160, 162, 191, 149, 158, 165, 188, + 176, 190, 128, 132, 180, 255, 133, 170, + 180, 255, 128, 130, 161, 173, 166, 179, + 164, 183, 173, 180, 144, 146, 148, 168, + 183, 185, 128, 185, 187, 191, 128, 131, + 179, 181, 183, 140, 141, 144, 176, 175, + 177, 191, 160, 191, 128, 130, 170, 175, + 153, 154, 153, 154, 155, 160, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, + 175, 175, 178, 180, 189, 158, 159, 176, + 177, 130, 134, 139, 163, 167, 128, 129, + 180, 255, 134, 159, 178, 190, 192, 255, + 166, 173, 135, 147, 128, 131, 179, 255, + 129, 164, 166, 255, 169, 182, 131, 188, + 140, 141, 176, 178, 180, 183, 184, 190, + 191, 129, 171, 175, 181, 182, 163, 170, + 172, 173, 172, 184, 190, 158, 128, 143, + 160, 175, 144, 145, 150, 155, 157, 158, + 159, 135, 139, 141, 168, 171, 180, 189, + 189, 160, 182, 186, 191, 129, 131, 133, + 134, 140, 143, 184, 186, 165, 166, 164, + 167, 134, 144, 128, 129, 130, 132, 133, + 134, 135, 136, 139, 140, 141, 144, 145, + 146, 147, 150, 151, 152, 153, 154, 156, + 160, 167, 168, 169, 170, 176, 178, 180, + 181, 182, 187, 128, 130, 184, 255, 135, + 190, 131, 175, 187, 255, 128, 130, 167, + 180, 179, 133, 134, 128, 130, 179, 255, + 129, 136, 141, 255, 190, 172, 183, 159, + 170, 128, 131, 187, 188, 190, 191, 151, + 128, 132, 135, 136, 139, 141, 162, 163, + 166, 172, 176, 180, 181, 191, 158, 128, + 134, 176, 255, 132, 255, 175, 181, 184, + 255, 129, 155, 158, 255, 129, 255, 171, + 183, 157, 171, 172, 186, 164, 145, 151, + 154, 160, 129, 138, 179, 185, 187, 190, + 135, 145, 155, 138, 153, 175, 182, 184, + 191, 146, 167, 169, 182, 186, 177, 182, + 188, 189, 191, 255, 134, 136, 255, 138, + 142, 144, 145, 147, 151, 179, 182, 171, + 172, 189, 190, 176, 180, 176, 182, 143, + 145, 255, 136, 142, 147, 255, 178, 157, + 158, 133, 134, 137, 168, 169, 170, 165, + 169, 173, 178, 187, 255, 131, 132, 140, + 169, 174, 255, 130, 132, 128, 182, 187, + 255, 173, 180, 182, 255, 132, 155, 159, + 161, 175, 128, 132, 139, 163, 165, 128, + 134, 136, 152, 155, 161, 163, 164, 166, + 170, 172, 175, 144, 150, 132, 138, 143, + 187, 191, 160, 128, 129, 132, 135, 133, + 134, 160, 255, 192, 255, 128, 191, 169, + 173, 174, 128, 159, 160, 191, 128, 255, + 176, 255, 131, 137, 191, 145, 189, 135, + 129, 130, 132, 133, 144, 154, 176, 139, + 159, 150, 156, 159, 164, 167, 168, 170, + 173, 145, 176, 255, 139, 255, 166, 176, + 189, 171, 179, 160, 161, 163, 164, 165, + 167, 169, 171, 173, 174, 175, 176, 177, + 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 166, 170, 172, + 178, 150, 153, 155, 163, 165, 167, 169, + 173, 153, 155, 147, 161, 163, 255, 189, + 132, 185, 144, 152, 161, 164, 255, 188, + 129, 131, 190, 255, 133, 134, 137, 138, + 142, 150, 152, 161, 164, 189, 191, 255, + 131, 134, 137, 138, 142, 144, 146, 175, + 178, 180, 182, 255, 134, 138, 142, 161, + 164, 185, 192, 255, 188, 129, 131, 190, + 191, 128, 132, 135, 136, 139, 141, 150, + 151, 162, 163, 130, 190, 191, 151, 128, + 130, 134, 136, 138, 141, 128, 132, 190, + 255, 133, 137, 142, 148, 151, 161, 164, + 255, 128, 132, 134, 136, 138, 141, 149, + 150, 162, 163, 128, 131, 187, 188, 190, + 255, 133, 137, 142, 150, 152, 161, 164, + 255, 130, 131, 138, 150, 143, 148, 152, + 159, 178, 179, 177, 179, 186, 135, 142, + 177, 179, 188, 136, 141, 181, 183, 185, + 152, 153, 190, 191, 177, 191, 128, 132, + 134, 135, 141, 151, 153, 188, 134, 128, + 129, 130, 141, 156, 157, 158, 159, 160, + 162, 164, 168, 169, 170, 172, 173, 174, + 175, 176, 179, 183, 173, 183, 185, 190, + 150, 153, 158, 160, 177, 180, 130, 141, + 157, 132, 134, 157, 159, 146, 148, 178, + 180, 146, 147, 178, 179, 180, 255, 148, + 156, 158, 255, 139, 141, 169, 133, 134, + 160, 171, 176, 187, 151, 155, 160, 162, + 191, 149, 158, 165, 188, 176, 190, 128, + 132, 180, 255, 133, 170, 180, 255, 128, + 130, 161, 173, 166, 179, 164, 183, 173, + 180, 144, 146, 148, 168, 183, 185, 128, + 185, 187, 191, 128, 131, 179, 181, 183, + 140, 141, 169, 174, 128, 129, 131, 132, + 134, 140, 142, 143, 147, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 164, 172, + 173, 179, 181, 183, 140, 141, 188, 137, + 144, 176, 162, 185, 148, 153, 169, 170, + 168, 154, 155, 136, 143, 169, 179, 184, + 186, 130, 182, 170, 171, 128, 187, 190, + 128, 133, 135, 146, 148, 255, 192, 255, + 128, 133, 144, 191, 128, 191, 148, 150, + 157, 161, 168, 128, 133, 136, 146, 179, + 180, 132, 135, 140, 142, 151, 147, 149, + 163, 167, 161, 176, 191, 149, 151, 180, + 181, 133, 135, 155, 156, 144, 149, 175, + 177, 191, 160, 191, 128, 130, 138, 189, + 170, 176, 153, 154, 151, 153, 153, 154, + 155, 160, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 175, 175, 178, 180, + 189, 158, 159, 176, 177, 130, 134, 139, + 163, 167, 128, 129, 180, 255, 134, 159, + 178, 190, 192, 255, 166, 173, 135, 147, + 128, 131, 179, 255, 129, 164, 166, 255, + 169, 182, 131, 188, 140, 141, 176, 178, + 180, 183, 184, 190, 191, 129, 171, 175, + 181, 182, 163, 170, 172, 173, 172, 184, + 190, 158, 128, 143, 160, 175, 144, 145, + 150, 155, 157, 158, 159, 135, 139, 141, + 168, 171, 180, 189, 189, 160, 182, 186, + 191, 129, 131, 133, 134, 140, 143, 184, + 186, 165, 166, 164, 167, 134, 144, 128, + 129, 130, 132, 133, 134, 135, 136, 139, + 140, 141, 144, 145, 146, 147, 150, 151, + 152, 153, 154, 156, 160, 167, 168, 169, + 170, 176, 178, 180, 181, 182, 187, 128, + 130, 184, 255, 135, 190, 131, 175, 187, + 255, 128, 130, 167, 180, 179, 133, 134, + 128, 130, 179, 255, 129, 136, 141, 255, + 190, 172, 183, 159, 170, 128, 131, 187, + 188, 190, 191, 151, 128, 132, 135, 136, + 139, 141, 162, 163, 166, 172, 176, 180, + 181, 191, 158, 128, 134, 176, 255, 132, + 255, 175, 181, 184, 255, 129, 155, 158, + 255, 129, 255, 171, 183, 157, 171, 172, + 186, 164, 145, 151, 154, 160, 129, 138, + 179, 185, 187, 190, 135, 145, 155, 138, + 153, 175, 182, 184, 191, 146, 167, 169, + 182, 186, 177, 182, 188, 189, 191, 255, + 134, 136, 255, 138, 142, 144, 145, 147, + 151, 179, 182, 171, 172, 189, 190, 176, + 180, 176, 182, 143, 145, 255, 136, 142, + 147, 255, 178, 157, 158, 133, 134, 137, + 168, 169, 170, 165, 169, 173, 178, 187, + 255, 131, 132, 140, 169, 174, 255, 130, + 132, 128, 182, 187, 255, 173, 180, 182, + 255, 132, 155, 159, 161, 175, 128, 132, + 139, 163, 165, 128, 134, 136, 152, 155, + 161, 163, 164, 166, 170, 172, 175, 144, + 150, 132, 138, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 141, 143, + 144, 146, 147, 148, 149, 150, 151, 153, + 155, 157, 159, 160, 161, 162, 163, 164, + 165, 169, 191, 128, 154, 166, 167, 168, + 170, 171, 190, 175, 141, 143, 172, 177, + 190, 191, 142, 145, 154, 173, 255, 166, + 255, 154, 175, 129, 143, 178, 186, 188, + 191, 137, 255, 128, 189, 134, 255, 144, + 255, 180, 191, 149, 191, 140, 143, 136, + 143, 154, 159, 136, 143, 174, 255, 140, + 186, 188, 191, 128, 133, 135, 191, 190, + 255, 160, 128, 129, 132, 135, 133, 134, + 160, 255, 128, 130, 170, 175, 144, 145, + 150, 155, 157, 158, 159, 143, 187, 191, + 156, 128, 133, 134, 191, 128, 255, 176, + 255, 131, 137, 191, 145, 189, 135, 129, + 130, 132, 133, 144, 154, 176, 139, 159, + 150, 156, 159, 164, 167, 168, 170, 173, + 145, 176, 255, 139, 255, 166, 176, 189, + 171, 179, 160, 161, 163, 164, 165, 167, + 169, 171, 173, 174, 175, 176, 177, 179, + 180, 181, 182, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 166, 170, 172, 178, + 150, 153, 155, 163, 165, 167, 169, 173, + 153, 155, 147, 161, 163, 255, 189, 132, + 185, 144, 152, 161, 164, 255, 188, 129, + 131, 190, 255, 133, 134, 137, 138, 142, + 150, 152, 161, 164, 189, 191, 255, 131, + 134, 137, 138, 142, 144, 146, 175, 178, + 180, 182, 255, 134, 138, 142, 161, 164, + 185, 192, 255, 188, 129, 131, 190, 191, + 128, 132, 135, 136, 139, 141, 150, 151, + 162, 163, 130, 190, 191, 151, 128, 130, + 134, 136, 138, 141, 128, 132, 190, 255, + 133, 137, 142, 148, 151, 161, 164, 255, + 128, 132, 134, 136, 138, 141, 149, 150, + 162, 163, 128, 131, 187, 188, 190, 255, + 133, 137, 142, 150, 152, 161, 164, 255, + 130, 131, 138, 150, 143, 148, 152, 159, + 178, 179, 177, 179, 186, 135, 142, 177, + 179, 188, 136, 141, 181, 183, 185, 152, + 153, 190, 191, 177, 191, 128, 132, 134, + 135, 141, 151, 153, 188, 134, 128, 129, + 130, 141, 156, 157, 158, 159, 160, 162, + 164, 168, 169, 170, 172, 173, 174, 175, + 176, 179, 183, 173, 183, 185, 190, 150, + 153, 158, 160, 177, 180, 130, 141, 157, + 132, 134, 157, 159, 146, 148, 178, 180, + 146, 147, 178, 179, 180, 255, 148, 156, + 158, 255, 139, 141, 169, 133, 134, 160, + 171, 176, 187, 151, 155, 160, 162, 191, + 149, 158, 165, 188, 176, 190, 128, 132, + 180, 255, 133, 170, 180, 255, 128, 130, + 161, 173, 166, 179, 164, 183, 173, 180, + 144, 146, 148, 168, 183, 185, 128, 185, + 187, 191, 128, 131, 179, 181, 183, 140, + 141, 144, 176, 175, 177, 191, 160, 191, + 128, 130, 170, 175, 153, 154, 153, 154, + 155, 160, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 175, 175, 178, 180, + 189, 158, 159, 176, 177, 130, 134, 139, + 163, 167, 128, 129, 180, 255, 134, 159, + 178, 190, 192, 255, 166, 173, 135, 147, + 128, 131, 179, 255, 129, 164, 166, 255, + 169, 182, 131, 188, 140, 141, 176, 178, + 180, 183, 184, 190, 191, 129, 171, 175, + 181, 182, 163, 170, 172, 173, 172, 184, + 190, 158, 128, 143, 160, 175, 144, 145, + 150, 155, 157, 158, 159, 135, 139, 141, + 168, 171, 180, 189, 189, 160, 182, 186, + 191, 129, 131, 133, 134, 140, 143, 184, + 186, 165, 166, 164, 167, 134, 144, 128, + 129, 130, 132, 133, 134, 135, 136, 139, + 140, 141, 144, 145, 146, 147, 150, 151, + 152, 153, 154, 156, 160, 167, 168, 169, + 170, 176, 178, 180, 181, 182, 187, 128, + 130, 184, 255, 135, 190, 131, 175, 187, + 255, 128, 130, 167, 180, 179, 133, 134, + 128, 130, 179, 255, 129, 136, 141, 255, + 190, 172, 183, 159, 170, 128, 131, 187, + 188, 190, 191, 151, 128, 132, 135, 136, + 139, 141, 162, 163, 166, 172, 176, 180, + 181, 191, 158, 128, 134, 176, 255, 132, + 255, 175, 181, 184, 255, 129, 155, 158, + 255, 129, 255, 171, 183, 157, 171, 172, + 186, 164, 145, 151, 154, 160, 129, 138, + 179, 185, 187, 190, 135, 145, 155, 138, + 153, 175, 182, 184, 191, 146, 167, 169, + 182, 186, 177, 182, 188, 189, 191, 255, + 134, 136, 255, 138, 142, 144, 145, 147, + 151, 179, 182, 171, 172, 189, 190, 176, + 180, 176, 182, 143, 145, 255, 136, 142, + 147, 255, 178, 157, 158, 133, 134, 137, + 168, 169, 170, 165, 169, 173, 178, 187, + 255, 131, 132, 140, 169, 174, 255, 130, + 132, 128, 182, 187, 255, 173, 180, 182, + 255, 132, 155, 159, 161, 175, 128, 132, + 139, 163, 165, 128, 134, 136, 152, 155, + 161, 163, 164, 166, 170, 172, 175, 144, + 150, 132, 138, 143, 187, 191, 160, 128, + 129, 132, 135, 133, 134, 160, 255, 192, + 255, 128, 191, 169, 174, 160, 172, 175, + 191, 128, 255, 176, 255, 131, 137, 191, + 145, 189, 135, 129, 130, 132, 133, 144, + 154, 176, 139, 159, 150, 156, 159, 164, + 167, 168, 170, 173, 145, 176, 255, 139, + 255, 166, 176, 189, 171, 179, 160, 161, + 163, 164, 165, 167, 169, 171, 173, 174, + 175, 176, 177, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, 190, 191, + 166, 170, 172, 178, 150, 153, 155, 163, + 165, 167, 169, 173, 153, 155, 147, 161, + 163, 255, 189, 132, 185, 144, 152, 161, + 164, 255, 188, 129, 131, 190, 255, 133, + 134, 137, 138, 142, 150, 152, 161, 164, + 189, 191, 255, 131, 134, 137, 138, 142, + 144, 146, 175, 178, 180, 182, 255, 134, + 138, 142, 161, 164, 185, 192, 255, 188, + 129, 131, 190, 191, 128, 132, 135, 136, + 139, 141, 150, 151, 162, 163, 130, 190, + 191, 151, 128, 130, 134, 136, 138, 141, + 128, 132, 190, 255, 133, 137, 142, 148, + 151, 161, 164, 255, 128, 132, 134, 136, + 138, 141, 149, 150, 162, 163, 128, 131, + 187, 188, 190, 255, 133, 137, 142, 150, + 152, 161, 164, 255, 130, 131, 138, 150, + 143, 148, 152, 159, 178, 179, 177, 179, + 186, 135, 142, 177, 179, 188, 136, 141, + 181, 183, 185, 152, 153, 190, 191, 177, + 191, 128, 132, 134, 135, 141, 151, 153, + 188, 134, 128, 129, 130, 141, 156, 157, + 158, 159, 160, 162, 164, 168, 169, 170, + 172, 173, 174, 175, 176, 179, 183, 173, + 183, 185, 190, 150, 153, 158, 160, 177, + 180, 130, 141, 157, 132, 134, 157, 159, + 146, 148, 178, 180, 146, 147, 178, 179, + 180, 255, 148, 156, 158, 255, 139, 141, + 169, 133, 134, 160, 171, 176, 187, 151, + 155, 160, 162, 191, 149, 158, 165, 188, + 176, 190, 128, 132, 180, 255, 133, 170, + 180, 255, 128, 130, 161, 173, 166, 179, + 164, 183, 173, 180, 144, 146, 148, 168, + 183, 185, 128, 185, 187, 191, 128, 131, + 179, 181, 183, 140, 141, 169, 174, 128, + 129, 131, 132, 134, 140, 142, 143, 147, + 150, 151, 152, 153, 154, 155, 156, 157, + 158, 164, 172, 173, 179, 181, 183, 140, + 141, 188, 137, 144, 176, 162, 185, 148, + 153, 169, 170, 168, 154, 155, 136, 143, + 169, 179, 184, 186, 130, 182, 170, 171, + 128, 187, 190, 128, 133, 135, 146, 148, + 255, 192, 255, 128, 133, 144, 191, 128, + 191, 148, 150, 157, 161, 168, 128, 133, + 136, 146, 179, 180, 132, 135, 140, 142, + 151, 147, 149, 163, 167, 161, 176, 191, + 149, 151, 180, 181, 133, 135, 155, 156, + 144, 149, 175, 177, 191, 160, 191, 128, + 130, 138, 189, 170, 176, 153, 154, 151, + 153, 153, 154, 155, 160, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 175, + 175, 178, 180, 189, 158, 159, 176, 177, + 130, 134, 139, 163, 167, 128, 129, 180, + 255, 134, 159, 178, 190, 192, 255, 166, + 173, 135, 147, 128, 131, 179, 255, 129, + 164, 166, 255, 169, 182, 131, 188, 140, + 141, 176, 178, 180, 183, 184, 190, 191, + 129, 171, 175, 181, 182, 163, 170, 172, + 173, 172, 184, 190, 158, 128, 143, 160, + 175, 144, 145, 150, 155, 157, 158, 159, + 135, 139, 141, 168, 171, 180, 189, 189, + 160, 182, 186, 191, 129, 131, 133, 134, + 140, 143, 184, 186, 165, 166, 164, 167, + 134, 144, 128, 129, 130, 132, 133, 134, + 135, 136, 139, 140, 141, 144, 145, 146, + 147, 150, 151, 152, 153, 154, 156, 160, + 167, 168, 169, 170, 176, 178, 180, 181, + 182, 187, 128, 130, 184, 255, 135, 190, + 131, 175, 187, 255, 128, 130, 167, 180, + 179, 133, 134, 128, 130, 179, 255, 129, + 136, 141, 255, 190, 172, 183, 159, 170, + 128, 131, 187, 188, 190, 191, 151, 128, + 132, 135, 136, 139, 141, 162, 163, 166, + 172, 176, 180, 181, 191, 158, 128, 134, + 176, 255, 132, 255, 175, 181, 184, 255, + 129, 155, 158, 255, 129, 255, 171, 183, + 157, 171, 172, 186, 164, 145, 151, 154, + 160, 129, 138, 179, 185, 187, 190, 135, + 145, 155, 138, 153, 175, 182, 184, 191, + 146, 167, 169, 182, 186, 177, 182, 188, + 189, 191, 255, 134, 136, 255, 138, 142, + 144, 145, 147, 151, 179, 182, 171, 172, + 189, 190, 176, 180, 176, 182, 143, 145, + 255, 136, 142, 147, 255, 178, 157, 158, + 133, 134, 137, 168, 169, 170, 165, 169, + 173, 178, 187, 255, 131, 132, 140, 169, + 174, 255, 130, 132, 128, 182, 187, 255, + 173, 180, 182, 255, 132, 155, 159, 161, + 175, 128, 132, 139, 163, 165, 128, 134, + 136, 152, 155, 161, 163, 164, 166, 170, + 172, 175, 144, 150, 132, 138, 129, 130, + 131, 132, 133, 134, 135, 136, 137, 138, + 139, 141, 143, 144, 146, 147, 148, 149, + 150, 151, 153, 155, 157, 159, 160, 161, + 162, 163, 164, 165, 169, 191, 128, 154, + 166, 167, 168, 170, 171, 190, 175, 141, + 143, 172, 177, 190, 191, 142, 145, 154, + 173, 255, 166, 255, 154, 175, 129, 143, + 178, 186, 188, 191, 137, 255, 128, 189, + 134, 255, 144, 255, 180, 191, 149, 191, + 140, 143, 136, 143, 154, 159, 136, 143, + 174, 255, 140, 186, 188, 191, 128, 133, + 135, 191, 190, 255, 160, 128, 129, 132, + 135, 133, 134, 160, 255, 128, 130, 170, + 175, 144, 145, 150, 155, 157, 158, 159, + 143, 187, 191, 128, 133, 134, 155, 157, + 191, 157, 128, 191, 143, 128, 191, 163, + 181, 128, 191, 162, 128, 191, 142, 128, + 191, 132, 133, 134, 135, 160, 128, 191, + 128, 255, 128, 129, 130, 132, 133, 134, + 141, 156, 157, 158, 159, 160, 162, 164, + 168, 169, 170, 172, 173, 174, 175, 176, + 179, 183, 160, 255, 128, 129, 130, 133, + 134, 135, 141, 156, 157, 158, 159, 160, + 162, 164, 168, 169, 170, 172, 173, 174, + 175, 176, 179, 183, 160, 255, 168, 255, + 128, 129, 130, 134, 135, 141, 156, 157, + 158, 159, 160, 162, 164, 168, 169, 170, + 172, 173, 174, 175, 176, 179, 183, 168, + 255, 192, 255, 159, 139, 187, 158, 159, + 176, 255, 135, 138, 139, 187, 188, 255, + 168, 255, 153, 154, 155, 160, 162, 163, + 164, 165, 166, 167, 168, 169, 170, 171, + 175, 177, 178, 179, 180, 181, 182, 184, + 185, 186, 187, 188, 189, 191, 176, 190, + 192, 255, 135, 147, 160, 188, 128, 156, + 184, 129, 255, 128, 129, 130, 133, 134, + 141, 156, 157, 158, 159, 160, 162, 164, + 168, 169, 170, 172, 173, 174, 175, 176, + 179, 183, 158, 159, 135, 255, 148, 176, + 140, 168, 132, 160, 188, 152, 180, 144, + 172, 136, 164, 192, 255, 129, 130, 131, + 132, 133, 134, 136, 137, 138, 139, 140, + 141, 143, 144, 145, 146, 147, 148, 150, + 151, 152, 153, 154, 155, 157, 158, 159, + 160, 161, 162, 164, 165, 166, 167, 168, + 169, 171, 172, 173, 174, 175, 176, 178, + 179, 180, 181, 182, 183, 185, 186, 187, + 188, 189, 190, 128, 191, 129, 130, 131, + 132, 133, 134, 136, 137, 138, 139, 140, + 141, 143, 144, 145, 146, 147, 148, 150, + 151, 152, 153, 154, 155, 157, 158, 159, + 160, 161, 162, 164, 165, 166, 167, 168, + 169, 171, 172, 173, 174, 175, 176, 178, + 179, 180, 181, 182, 183, 185, 186, 187, + 188, 189, 190, 128, 191, 129, 130, 131, + 132, 133, 134, 136, 137, 138, 139, 140, + 141, 143, 144, 145, 146, 147, 148, 150, + 151, 152, 153, 154, 155, 157, 158, 159, + 128, 156, 160, 255, 136, 164, 175, 176, + 255, 128, 141, 143, 191, 128, 129, 132, + 134, 140, 142, 143, 147, 150, 151, 152, + 153, 154, 155, 156, 157, 158, 164, 172, + 173, 130, 191, 188, 128, 138, 140, 141, + 144, 167, 175, 191, 137, 128, 159, 176, + 191, 162, 185, 128, 191, 128, 147, 148, + 153, 154, 168, 169, 170, 171, 191, 168, + 128, 153, 154, 155, 156, 191, 136, 128, + 191, 143, 128, 168, 169, 179, 180, 183, + 184, 186, 187, 191, 130, 128, 191, 182, + 128, 169, 170, 171, 172, 191, 128, 191, + 129, 186, 187, 190, 134, 147, 128, 255, + 128, 133, 134, 143, 144, 191, 147, 149, + 157, 161, 168, 128, 133, 134, 135, 136, + 150, 151, 178, 179, 180, 181, 191, 132, + 135, 140, 142, 150, 128, 146, 147, 151, + 152, 162, 163, 167, 168, 191, 161, 176, + 191, 128, 148, 149, 151, 152, 190, 128, + 179, 180, 181, 182, 191, 128, 132, 133, + 135, 136, 154, 155, 156, 157, 191, 144, + 149, 128, 191, 128, 138, 129, 191, 176, + 189, 128, 191, 151, 153, 128, 191, 128, + 191, 165, 177, 178, 179, 180, 181, 182, + 184, 185, 186, 187, 188, 189, 191, 128, + 175, 176, 190, 192, 255, 128, 159, 160, + 188, 189, 191, 128, 156, 184, 129, 255, + 148, 176, 140, 168, 132, 160, 188, 152, + 180, 144, 172, 136, 164, 192, 255, 129, + 130, 131, 132, 133, 134, 136, 137, 138, + 139, 140, 141, 143, 144, 145, 146, 147, + 148, 150, 151, 152, 153, 154, 155, 157, + 158, 159, 160, 161, 162, 164, 165, 166, + 167, 168, 169, 171, 172, 173, 174, 175, + 176, 178, 179, 180, 181, 182, 183, 185, + 186, 187, 188, 189, 190, 128, 191, 129, + 130, 131, 132, 133, 134, 136, 137, 138, + 139, 140, 141, 143, 144, 145, 146, 147, + 148, 150, 151, 152, 153, 154, 155, 157, + 158, 159, 160, 161, 162, 164, 165, 166, + 167, 168, 169, 171, 172, 173, 174, 175, + 176, 178, 179, 180, 181, 182, 183, 185, + 186, 187, 188, 189, 190, 128, 191, 129, + 130, 131, 132, 133, 134, 136, 137, 138, + 139, 140, 141, 143, 144, 145, 146, 147, + 148, 150, 151, 152, 153, 154, 155, 157, + 158, 159, 128, 156, 160, 191, 192, 255, + 136, 164, 175, 176, 255, 135, 138, 139, + 187, 188, 191, 192, 255, 187, 191, 128, + 190, 128, 190, 188, 128, 175, 190, 191, + 145, 147, 155, 157, 159, 128, 191, 130, + 131, 135, 168, 170, 181, 128, 191, 189, + 128, 191, 141, 128, 191, 128, 129, 130, + 131, 132, 191, 186, 128, 191, 128, 131, + 132, 137, 138, 191, 134, 128, 191, 144, + 128, 191, 128, 175, 185, 191, 178, 128, + 191, 128, 159, 164, 191, 133, 128, 191, + 128, 178, 187, 191, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 138, 139, 141, + 143, 144, 146, 147, 148, 149, 150, 151, + 153, 156, 157, 158, 159, 160, 161, 162, + 164, 165, 169, 191, 128, 154, 155, 163, + 166, 167, 168, 170, 171, 190, 175, 128, + 140, 141, 143, 144, 191, 128, 171, 172, + 177, 178, 189, 190, 191, 142, 128, 144, + 145, 154, 155, 172, 173, 255, 166, 191, + 192, 255, 144, 145, 150, 155, 157, 158, + 159, 135, 143, 166, 191, 128, 154, 175, + 187, 129, 143, 144, 177, 178, 191, 128, + 136, 137, 255, 187, 191, 192, 255, 128, + 189, 190, 191, 128, 133, 134, 255, 144, + 191, 192, 255, 128, 179, 180, 191, 128, + 148, 149, 191, 128, 139, 140, 143, 144, + 191, 128, 135, 136, 143, 144, 153, 154, + 159, 160, 191, 128, 135, 136, 143, 144, + 173, 174, 255, 187, 128, 139, 140, 191, + 134, 128, 191, 190, 191, 192, 255, 128, + 191, 160, 128, 191, 128, 129, 135, 132, + 134, 128, 175, 157, 128, 191, 143, 128, + 191, 163, 181, 128, 191, 162, 128, 191, + 142, 128, 191, 132, 133, 134, 135, 160, + 128, 191, 128, 255, 0, 127, 176, 255, + 131, 137, 191, 145, 189, 135, 129, 130, + 132, 133, 144, 154, 176, 139, 159, 150, + 156, 159, 164, 167, 168, 170, 173, 145, + 176, 255, 139, 255, 166, 176, 189, 171, + 179, 160, 161, 163, 164, 165, 167, 169, + 171, 173, 174, 175, 176, 177, 179, 180, + 181, 182, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 166, 170, 172, 178, 150, + 153, 155, 163, 165, 167, 169, 173, 153, + 155, 147, 161, 163, 255, 189, 132, 185, + 144, 152, 161, 164, 255, 188, 129, 131, + 190, 255, 133, 134, 137, 138, 142, 150, + 152, 161, 164, 189, 191, 255, 131, 134, + 137, 138, 142, 144, 146, 175, 178, 180, + 182, 255, 134, 138, 142, 161, 164, 185, + 192, 255, 188, 129, 131, 190, 191, 128, + 132, 135, 136, 139, 141, 150, 151, 162, + 163, 130, 190, 191, 151, 128, 130, 134, + 136, 138, 141, 128, 132, 190, 255, 133, + 137, 142, 148, 151, 161, 164, 255, 128, + 132, 134, 136, 138, 141, 149, 150, 162, + 163, 128, 131, 187, 188, 190, 255, 133, + 137, 142, 150, 152, 161, 164, 255, 130, + 131, 138, 150, 143, 148, 152, 159, 178, + 179, 177, 179, 186, 135, 142, 177, 179, + 188, 136, 141, 181, 183, 185, 152, 153, + 190, 191, 177, 191, 128, 132, 134, 135, + 141, 151, 153, 188, 134, 128, 129, 130, + 141, 156, 157, 158, 159, 160, 162, 164, + 168, 169, 170, 172, 173, 174, 175, 176, + 179, 183, 173, 183, 185, 190, 150, 153, + 158, 160, 177, 180, 130, 141, 157, 132, + 134, 157, 159, 146, 148, 178, 180, 146, + 147, 178, 179, 180, 255, 148, 156, 158, + 255, 139, 141, 169, 133, 134, 160, 171, + 176, 187, 151, 155, 160, 162, 191, 149, + 158, 165, 188, 176, 190, 128, 132, 180, + 255, 133, 170, 180, 255, 128, 130, 161, + 173, 166, 179, 164, 183, 173, 180, 144, + 146, 148, 168, 183, 185, 128, 185, 187, + 191, 128, 131, 179, 181, 183, 140, 141, + 169, 174, 128, 129, 131, 132, 134, 140, + 142, 143, 147, 150, 151, 152, 153, 154, + 155, 156, 157, 158, 164, 172, 173, 179, + 181, 183, 140, 141, 188, 137, 144, 176, + 162, 185, 148, 153, 169, 170, 168, 154, + 155, 136, 143, 169, 179, 184, 186, 130, + 182, 170, 171, 128, 187, 190, 128, 133, + 135, 146, 148, 255, 192, 255, 128, 133, + 144, 191, 128, 191, 148, 150, 157, 161, + 168, 128, 133, 136, 146, 179, 180, 132, + 135, 140, 142, 151, 147, 149, 163, 167, + 161, 176, 191, 149, 151, 180, 181, 133, + 135, 155, 156, 144, 149, 175, 177, 191, + 160, 191, 128, 130, 138, 189, 170, 176, + 153, 154, 151, 153, 153, 154, 155, 160, + 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 175, 175, 178, 180, 189, 158, + 159, 176, 177, 130, 134, 139, 163, 167, + 128, 129, 180, 255, 134, 159, 178, 190, + 192, 255, 166, 173, 135, 147, 128, 131, + 179, 255, 129, 164, 166, 255, 169, 182, + 131, 188, 140, 141, 176, 178, 180, 183, + 184, 190, 191, 129, 171, 175, 181, 182, + 163, 170, 172, 173, 172, 184, 190, 158, + 128, 143, 160, 175, 144, 145, 150, 155, + 157, 158, 159, 135, 139, 141, 168, 171, + 180, 189, 189, 160, 182, 186, 191, 129, + 131, 133, 134, 140, 143, 184, 186, 165, + 166, 164, 167, 134, 144, 128, 129, 130, + 132, 133, 134, 135, 136, 139, 140, 141, + 144, 145, 146, 147, 150, 151, 152, 153, + 154, 156, 160, 167, 168, 169, 170, 176, + 178, 180, 181, 182, 187, 128, 130, 184, + 255, 135, 190, 131, 175, 187, 255, 128, + 130, 167, 180, 179, 133, 134, 128, 130, + 179, 255, 129, 136, 141, 255, 190, 172, + 183, 159, 170, 128, 131, 187, 188, 190, + 191, 151, 128, 132, 135, 136, 139, 141, + 162, 163, 166, 172, 176, 180, 181, 191, + 158, 128, 134, 176, 255, 132, 255, 175, + 181, 184, 255, 129, 155, 158, 255, 129, + 255, 171, 183, 157, 171, 172, 186, 164, + 145, 151, 154, 160, 129, 138, 179, 185, + 187, 190, 135, 145, 155, 138, 153, 175, + 182, 184, 191, 146, 167, 169, 182, 186, + 177, 182, 188, 189, 191, 255, 134, 136, + 255, 138, 142, 144, 145, 147, 151, 179, + 182, 171, 172, 189, 190, 176, 180, 176, + 182, 143, 145, 255, 136, 142, 147, 255, + 178, 157, 158, 133, 134, 137, 168, 169, + 170, 165, 169, 173, 178, 187, 255, 131, + 132, 140, 169, 174, 255, 130, 132, 128, + 182, 187, 255, 173, 180, 182, 255, 132, + 155, 159, 161, 175, 128, 132, 139, 163, + 165, 128, 134, 136, 152, 155, 161, 163, + 164, 166, 170, 172, 175, 144, 150, 132, + 138, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 138, 139, 141, 143, 144, 146, + 147, 148, 149, 150, 151, 153, 155, 157, + 159, 160, 161, 162, 163, 164, 165, 169, + 191, 128, 154, 166, 167, 168, 170, 171, + 190, 175, 141, 143, 172, 177, 190, 191, + 142, 145, 154, 173, 255, 166, 255, 154, + 175, 129, 143, 178, 186, 188, 191, 137, + 255, 128, 189, 134, 255, 144, 255, 180, + 191, 149, 191, 140, 143, 136, 143, 154, + 159, 136, 143, 174, 255, 140, 186, 188, + 191, 128, 133, 135, 191, 190, 255, 160, + 128, 129, 132, 135, 133, 134, 160, 255, + 128, 130, 170, 175, 144, 145, 150, 155, + 157, 158, 159, 143, 187, 191, 128, 129, + 130, 132, 133, 134, 141, 156, 157, 158, + 159, 160, 162, 164, 168, 169, 170, 172, + 173, 174, 175, 176, 179, 183, 160, 255, + 128, 129, 130, 133, 134, 135, 141, 156, + 157, 158, 159, 160, 162, 164, 168, 169, + 170, 172, 173, 174, 175, 176, 179, 183, + 160, 255, 168, 255, 128, 129, 130, 134, + 135, 141, 156, 157, 158, 159, 160, 162, + 164, 168, 169, 170, 172, 173, 174, 175, + 176, 179, 183, 168, 255, 192, 255, 159, + 139, 187, 158, 159, 176, 255, 135, 138, + 139, 187, 188, 255, 168, 255, 153, 154, + 155, 160, 162, 163, 164, 165, 166, 167, + 168, 169, 170, 171, 175, 177, 178, 179, + 180, 181, 182, 184, 185, 186, 187, 188, + 189, 191, 176, 190, 192, 255, 135, 147, + 160, 188, 128, 156, 184, 129, 255, 128, + 129, 130, 133, 134, 141, 156, 157, 158, + 159, 160, 162, 164, 168, 169, 170, 172, + 173, 174, 175, 176, 179, 183, 158, 159, + 135, 255, 148, 176, 140, 168, 132, 160, + 188, 152, 180, 144, 172, 136, 164, 192, + 255, 129, 130, 131, 132, 133, 134, 136, + 137, 138, 139, 140, 141, 143, 144, 145, + 146, 147, 148, 150, 151, 152, 153, 154, + 155, 157, 158, 159, 160, 161, 162, 164, + 165, 166, 167, 168, 169, 171, 172, 173, + 174, 175, 176, 178, 179, 180, 181, 182, + 183, 185, 186, 187, 188, 189, 190, 128, + 191, 129, 130, 131, 132, 133, 134, 136, + 137, 138, 139, 140, 141, 143, 144, 145, + 146, 147, 148, 150, 151, 152, 153, 154, + 155, 157, 158, 159, 160, 161, 162, 164, + 165, 166, 167, 168, 169, 171, 172, 173, + 174, 175, 176, 178, 179, 180, 181, 182, + 183, 185, 186, 187, 188, 189, 190, 128, + 191, 129, 130, 131, 132, 133, 134, 136, + 137, 138, 139, 140, 141, 143, 144, 145, + 146, 147, 148, 150, 151, 152, 153, 154, + 155, 157, 158, 159, 128, 156, 160, 255, + 136, 164, 175, 176, 255, 142, 128, 191, + 128, 129, 132, 134, 140, 142, 143, 147, + 150, 151, 152, 153, 154, 155, 156, 157, + 158, 164, 172, 173, 130, 191, 139, 141, + 188, 128, 140, 142, 143, 144, 167, 168, + 174, 175, 191, 128, 255, 176, 255, 131, + 137, 191, 145, 189, 135, 129, 130, 132, + 133, 144, 154, 176, 139, 159, 150, 156, + 159, 164, 167, 168, 170, 173, 145, 176, + 255, 139, 255, 166, 176, 189, 171, 179, + 160, 161, 163, 164, 165, 167, 169, 171, + 173, 174, 175, 176, 177, 179, 180, 181, + 182, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 166, 170, 172, 178, 150, 153, + 155, 163, 165, 167, 169, 173, 153, 155, + 147, 161, 163, 255, 189, 132, 185, 144, + 152, 161, 164, 255, 188, 129, 131, 190, + 255, 133, 134, 137, 138, 142, 150, 152, + 161, 164, 189, 191, 255, 131, 134, 137, + 138, 142, 144, 146, 175, 178, 180, 182, + 255, 134, 138, 142, 161, 164, 185, 192, + 255, 188, 129, 131, 190, 191, 128, 132, + 135, 136, 139, 141, 150, 151, 162, 163, + 130, 190, 191, 151, 128, 130, 134, 136, + 138, 141, 128, 132, 190, 255, 133, 137, + 142, 148, 151, 161, 164, 255, 128, 132, + 134, 136, 138, 141, 149, 150, 162, 163, + 128, 131, 187, 188, 190, 255, 133, 137, + 142, 150, 152, 161, 164, 255, 130, 131, + 138, 150, 143, 148, 152, 159, 178, 179, + 177, 179, 186, 135, 142, 177, 179, 188, + 136, 141, 181, 183, 185, 152, 153, 190, + 191, 177, 191, 128, 132, 134, 135, 141, + 151, 153, 188, 134, 128, 129, 130, 141, + 156, 157, 158, 159, 160, 162, 164, 168, + 169, 170, 172, 173, 174, 175, 176, 179, + 183, 173, 183, 185, 190, 150, 153, 158, + 160, 177, 180, 130, 141, 157, 132, 134, + 157, 159, 146, 148, 178, 180, 146, 147, + 178, 179, 180, 255, 148, 156, 158, 255, + 139, 141, 169, 133, 134, 160, 171, 176, + 187, 151, 155, 160, 162, 191, 149, 158, + 165, 188, 176, 190, 128, 132, 180, 255, + 133, 170, 180, 255, 128, 130, 161, 173, + 166, 179, 164, 183, 173, 180, 144, 146, + 148, 168, 183, 185, 128, 185, 187, 191, + 128, 131, 179, 181, 183, 140, 141, 144, + 176, 175, 177, 191, 160, 191, 128, 130, + 170, 175, 153, 154, 153, 154, 155, 160, + 162, 163, 164, 165, 166, 167, 168, 169, + 170, 171, 175, 175, 178, 180, 189, 158, + 159, 176, 177, 130, 134, 139, 163, 167, + 128, 129, 180, 255, 134, 159, 178, 190, + 192, 255, 166, 173, 135, 147, 128, 131, + 179, 255, 129, 164, 166, 255, 169, 182, + 131, 188, 140, 141, 176, 178, 180, 183, + 184, 190, 191, 129, 171, 175, 181, 182, + 163, 170, 172, 173, 172, 184, 190, 158, + 128, 143, 160, 175, 144, 145, 150, 155, + 157, 158, 159, 135, 139, 141, 168, 171, + 180, 189, 189, 160, 182, 186, 191, 129, + 131, 133, 134, 140, 143, 184, 186, 165, + 166, 164, 167, 134, 144, 128, 129, 130, + 132, 133, 134, 135, 136, 139, 140, 141, + 144, 145, 146, 147, 150, 151, 152, 153, + 154, 156, 160, 167, 168, 169, 170, 176, + 178, 180, 181, 182, 187, 128, 130, 184, + 255, 135, 190, 131, 175, 187, 255, 128, + 130, 167, 180, 179, 133, 134, 128, 130, + 179, 255, 129, 136, 141, 255, 190, 172, + 183, 159, 170, 128, 131, 187, 188, 190, + 191, 151, 128, 132, 135, 136, 139, 141, + 162, 163, 166, 172, 176, 180, 181, 191, + 158, 128, 134, 176, 255, 132, 255, 175, + 181, 184, 255, 129, 155, 158, 255, 129, + 255, 171, 183, 157, 171, 172, 186, 164, + 145, 151, 154, 160, 129, 138, 179, 185, + 187, 190, 135, 145, 155, 138, 153, 175, + 182, 184, 191, 146, 167, 169, 182, 186, + 177, 182, 188, 189, 191, 255, 134, 136, + 255, 138, 142, 144, 145, 147, 151, 179, + 182, 171, 172, 189, 190, 176, 180, 176, + 182, 143, 145, 255, 136, 142, 147, 255, + 178, 157, 158, 133, 134, 137, 168, 169, + 170, 165, 169, 173, 178, 187, 255, 131, + 132, 140, 169, 174, 255, 130, 132, 128, + 182, 187, 255, 173, 180, 182, 255, 132, + 155, 159, 161, 175, 128, 132, 139, 163, + 165, 128, 134, 136, 152, 155, 161, 163, + 164, 166, 170, 172, 175, 144, 150, 132, + 138, 143, 187, 191, 160, 128, 129, 132, + 135, 133, 134, 160, 255, 192, 255, 137, + 128, 159, 160, 175, 176, 191, 162, 185, + 128, 191, 128, 147, 148, 153, 154, 168, + 169, 170, 171, 191, 168, 128, 153, 154, + 155, 156, 191, 136, 128, 191, 143, 128, + 168, 169, 179, 180, 183, 184, 186, 187, + 191, 130, 128, 191, 182, 128, 169, 170, + 171, 172, 191, 128, 191, 129, 186, 187, + 190, 134, 147, 128, 255, 128, 133, 134, + 143, 144, 191, 147, 149, 157, 161, 168, + 128, 133, 134, 135, 136, 150, 151, 178, + 179, 180, 181, 191, 132, 135, 140, 142, + 150, 128, 146, 147, 151, 152, 162, 163, + 167, 168, 191, 161, 176, 191, 128, 148, + 149, 151, 152, 190, 128, 179, 180, 181, + 182, 191, 128, 132, 133, 135, 136, 154, + 155, 156, 157, 191, 144, 149, 128, 191, + 128, 138, 129, 191, 176, 189, 128, 191, + 151, 153, 128, 191, 128, 191, 165, 177, + 178, 179, 180, 181, 182, 184, 185, 186, + 187, 188, 189, 191, 128, 175, 176, 190, + 192, 255, 128, 159, 160, 188, 189, 191, + 128, 156, 184, 129, 255, 148, 176, 140, + 168, 132, 160, 188, 152, 180, 144, 172, + 136, 164, 192, 255, 129, 130, 131, 132, + 133, 134, 136, 137, 138, 139, 140, 141, + 143, 144, 145, 146, 147, 148, 150, 151, + 152, 153, 154, 155, 157, 158, 159, 160, + 161, 162, 164, 165, 166, 167, 168, 169, + 171, 172, 173, 174, 175, 176, 178, 179, + 180, 181, 182, 183, 185, 186, 187, 188, + 189, 190, 128, 191, 129, 130, 131, 132, + 133, 134, 136, 137, 138, 139, 140, 141, + 143, 144, 145, 146, 147, 148, 150, 151, + 152, 153, 154, 155, 157, 158, 159, 160, + 161, 162, 164, 165, 166, 167, 168, 169, + 171, 172, 173, 174, 175, 176, 178, 179, + 180, 181, 182, 183, 185, 186, 187, 188, + 189, 190, 128, 191, 129, 130, 131, 132, + 133, 134, 136, 137, 138, 139, 140, 141, + 143, 144, 145, 146, 147, 148, 150, 151, + 152, 153, 154, 155, 157, 158, 159, 128, + 156, 160, 191, 192, 255, 136, 164, 175, + 176, 255, 135, 138, 139, 187, 188, 191, + 192, 255, 187, 191, 128, 190, 191, 128, + 190, 188, 128, 175, 176, 189, 190, 191, + 145, 147, 155, 157, 159, 128, 191, 130, + 131, 135, 168, 170, 181, 128, 191, 189, + 128, 191, 141, 128, 191, 128, 129, 130, + 131, 132, 191, 186, 128, 191, 128, 131, + 132, 137, 138, 191, 134, 128, 191, 144, + 128, 191, 128, 175, 176, 184, 185, 191, + 178, 128, 191, 128, 159, 160, 163, 164, + 191, 133, 128, 191, 128, 178, 179, 186, + 187, 191, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 141, 143, 144, + 146, 147, 148, 149, 150, 151, 153, 156, + 157, 158, 159, 160, 161, 162, 164, 165, + 169, 191, 128, 154, 155, 163, 166, 167, + 168, 170, 171, 190, 175, 128, 140, 141, + 143, 144, 191, 128, 171, 172, 177, 178, + 189, 190, 191, 142, 128, 144, 145, 154, + 155, 172, 173, 255, 166, 191, 192, 255, + 0, 127, 176, 255, 131, 137, 191, 145, + 189, 135, 129, 130, 132, 133, 144, 154, + 176, 139, 159, 150, 156, 159, 164, 167, + 168, 170, 173, 145, 176, 255, 139, 255, + 166, 176, 189, 171, 179, 160, 161, 163, + 164, 165, 167, 169, 171, 173, 174, 175, + 176, 177, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 166, + 170, 172, 178, 150, 153, 155, 163, 165, + 167, 169, 173, 153, 155, 147, 161, 163, + 255, 189, 132, 185, 144, 152, 161, 164, + 255, 188, 129, 131, 190, 255, 133, 134, + 137, 138, 142, 150, 152, 161, 164, 189, + 191, 255, 131, 134, 137, 138, 142, 144, + 146, 175, 178, 180, 182, 255, 134, 138, + 142, 161, 164, 185, 192, 255, 188, 129, + 131, 190, 191, 128, 132, 135, 136, 139, + 141, 150, 151, 162, 163, 130, 190, 191, + 151, 128, 130, 134, 136, 138, 141, 128, + 132, 190, 255, 133, 137, 142, 148, 151, + 161, 164, 255, 128, 132, 134, 136, 138, + 141, 149, 150, 162, 163, 128, 131, 187, + 188, 190, 255, 133, 137, 142, 150, 152, + 161, 164, 255, 130, 131, 138, 150, 143, + 148, 152, 159, 178, 179, 177, 179, 186, + 135, 142, 177, 179, 188, 136, 141, 181, + 183, 185, 152, 153, 190, 191, 177, 191, + 128, 132, 134, 135, 141, 151, 153, 188, + 134, 128, 129, 130, 141, 156, 157, 158, + 159, 160, 162, 164, 168, 169, 170, 172, + 173, 174, 175, 176, 179, 183, 173, 183, + 185, 190, 150, 153, 158, 160, 177, 180, + 130, 141, 157, 132, 134, 157, 159, 146, + 148, 178, 180, 146, 147, 178, 179, 180, + 255, 148, 156, 158, 255, 139, 141, 169, + 133, 134, 160, 171, 176, 187, 151, 155, + 160, 162, 191, 149, 158, 165, 188, 176, + 190, 128, 132, 180, 255, 133, 170, 180, + 255, 128, 130, 161, 173, 166, 179, 164, + 183, 173, 180, 144, 146, 148, 168, 183, + 185, 128, 185, 187, 191, 128, 131, 179, + 181, 183, 140, 141, 169, 174, 128, 129, + 131, 132, 134, 140, 142, 143, 147, 150, + 151, 152, 153, 154, 155, 156, 157, 158, + 164, 172, 173, 179, 181, 183, 140, 141, + 188, 137, 144, 176, 162, 185, 148, 153, + 169, 170, 168, 154, 155, 136, 143, 169, + 179, 184, 186, 130, 182, 170, 171, 128, + 187, 190, 128, 133, 135, 146, 148, 255, + 192, 255, 128, 133, 144, 191, 128, 191, + 148, 150, 157, 161, 168, 128, 133, 136, + 146, 179, 180, 132, 135, 140, 142, 151, + 147, 149, 163, 167, 161, 176, 191, 149, + 151, 180, 181, 133, 135, 155, 156, 144, + 149, 175, 177, 191, 160, 191, 128, 130, + 138, 189, 170, 176, 153, 154, 151, 153, + 153, 154, 155, 160, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 175, 175, + 178, 180, 189, 158, 159, 176, 177, 130, + 134, 139, 163, 167, 128, 129, 180, 255, + 134, 159, 178, 190, 192, 255, 166, 173, + 135, 147, 128, 131, 179, 255, 129, 164, + 166, 255, 169, 182, 131, 188, 140, 141, + 176, 178, 180, 183, 184, 190, 191, 129, + 171, 175, 181, 182, 163, 170, 172, 173, + 172, 184, 190, 158, 128, 143, 160, 175, + 144, 145, 150, 155, 157, 158, 159, 135, + 139, 141, 168, 171, 180, 189, 189, 160, + 182, 186, 191, 129, 131, 133, 134, 140, + 143, 184, 186, 165, 166, 164, 167, 134, + 144, 128, 129, 130, 132, 133, 134, 135, + 136, 139, 140, 141, 144, 145, 146, 147, + 150, 151, 152, 153, 154, 156, 160, 167, + 168, 169, 170, 176, 178, 180, 181, 182, + 187, 128, 130, 184, 255, 135, 190, 131, + 175, 187, 255, 128, 130, 167, 180, 179, + 133, 134, 128, 130, 179, 255, 129, 136, + 141, 255, 190, 172, 183, 159, 170, 128, + 131, 187, 188, 190, 191, 151, 128, 132, + 135, 136, 139, 141, 162, 163, 166, 172, + 176, 180, 181, 191, 158, 128, 134, 176, + 255, 132, 255, 175, 181, 184, 255, 129, + 155, 158, 255, 129, 255, 171, 183, 157, + 171, 172, 186, 164, 145, 151, 154, 160, + 129, 138, 179, 185, 187, 190, 135, 145, + 155, 138, 153, 175, 182, 184, 191, 146, + 167, 169, 182, 186, 177, 182, 188, 189, + 191, 255, 134, 136, 255, 138, 142, 144, + 145, 147, 151, 179, 182, 171, 172, 189, + 190, 176, 180, 176, 182, 143, 145, 255, + 136, 142, 147, 255, 178, 157, 158, 133, + 134, 137, 168, 169, 170, 165, 169, 173, + 178, 187, 255, 131, 132, 140, 169, 174, + 255, 130, 132, 128, 182, 187, 255, 173, + 180, 182, 255, 132, 155, 159, 161, 175, + 128, 132, 139, 163, 165, 128, 134, 136, + 152, 155, 161, 163, 164, 166, 170, 172, + 175, 144, 150, 132, 138, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, + 141, 143, 144, 146, 147, 148, 149, 150, + 151, 153, 155, 157, 159, 160, 161, 162, + 163, 164, 165, 169, 191, 128, 154, 166, + 167, 168, 170, 171, 190, 175, 141, 143, + 172, 177, 190, 191, 142, 145, 154, 173, + 255, 166, 255, 154, 175, 129, 143, 178, + 186, 188, 191, 137, 255, 128, 189, 134, + 255, 144, 255, 180, 191, 149, 191, 140, + 143, 136, 143, 154, 159, 136, 143, 174, + 255, 140, 186, 188, 191, 128, 133, 135, + 191, 190, 255, 160, 128, 129, 132, 135, + 133, 134, 160, 255, 128, 130, 170, 175, + 144, 145, 150, 155, 157, 158, 159, 143, + 187, 191, 144, 145, 150, 155, 157, 158, + 159, 135, 143, 166, 191, 128, 154, 175, + 187, 129, 143, 144, 177, 178, 191, 128, + 136, 137, 255, 187, 191, 192, 255, 128, + 189, 190, 191, 128, 133, 134, 255, 144, + 191, 192, 255, 128, 179, 180, 191, 128, + 148, 149, 191, 128, 139, 140, 143, 144, + 191, 128, 135, 136, 143, 144, 153, 154, + 159, 160, 191, 128, 135, 136, 143, 144, + 173, 174, 255, 187, 128, 139, 140, 191, + 134, 128, 191, 190, 191, 192, 255, 128, + 191, 160, 128, 191, 128, 130, 131, 135, + 191, 129, 134, 136, 190, 128, 159, 160, + 191, 0, 127, 192, 255, 128, 175, 176, + 255, 10, 13, 127, 194, 216, 219, 220, + 224, 225, 226, 227, 234, 235, 236, 237, + 239, 240, 243, 0, 31, 128, 191, 192, + 223, 228, 238, 241, 247, 248, 255, 204, + 205, 210, 214, 215, 216, 217, 219, 220, + 221, 222, 223, 224, 225, 226, 227, 234, + 239, 240, 243, 204, 205, 210, 214, 215, + 216, 217, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 234, 239, 240, 243, 194, + 204, 205, 210, 214, 215, 216, 217, 219, + 220, 221, 222, 223, 224, 225, 226, 227, + 234, 239, 240, 243, 194, 216, 219, 220, + 224, 225, 226, 227, 234, 235, 236, 237, + 239, 240, 243, 32, 126, 192, 223, 228, + 238, 241, 247, 204, 205, 210, 214, 215, + 216, 217, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 234, 239, 240, 243, 204, + 205, 210, 214, 215, 216, 217, 219, 220, + 221, 222, 223, 224, 225, 226, 227, 234, + 239, 240, 243, 194, 204, 205, 210, 214, + 215, 216, 217, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 234, 239, 240, 243, + 204, 205, 210, 214, 215, 216, 217, 219, + 220, 221, 222, 223, 224, 225, 226, 227, + 234, 235, 236, 237, 239, 240, 243, 204, + 205, 210, 214, 215, 216, 217, 219, 220, + 221, 222, 223, 224, 225, 226, 227, 234, + 237, 239, 240, 243, 204, 205, 210, 214, + 215, 216, 217, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 234, 237, 239, 240, + 243, 204, 205, 210, 214, 215, 216, 217, + 219, 220, 221, 222, 223, 224, 225, 226, + 227, 234, 237, 239, 240, 243, 204, 205, + 210, 214, 215, 216, 217, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 234, 239, + 240, 243, 204, 205, 210, 214, 215, 216, + 217, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 234, 235, 236, 237, 239, 240, + 243, 204, 205, 210, 214, 215, 216, 217, + 219, 220, 221, 222, 223, 224, 225, 226, + 227, 234, 239, 240, 243, 194, 204, 205, + 210, 214, 215, 216, 217, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 234, 239, + 240, 243, 204, 205, 210, 214, 215, 216, + 217, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 234, 237, 239, 240, 243, 204, + 205, 210, 214, 215, 216, 217, 219, 220, + 221, 222, 223, 224, 225, 226, 227, 234, + 237, 239, 240, 243, 204, 205, 210, 214, + 215, 216, 217, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 234, 237, 239, 240, + 243, 204, 205, 210, 214, 215, 216, 217, + 219, 220, 221, 222, 223, 224, 225, 226, + 227, 234, 239, 240, 243, 204, 205, 210, + 214, 215, 216, 217, 219, 220, 221, 222, + 223, 224, 225, 226, 227, 234, 239, 240, + 243, 204, 205, 210, 214, 215, 216, 217, + 219, 220, 221, 222, 223, 224, 225, 226, + 227, 234, 239, 240, 243, 194, 204, 205, + 210, 214, 215, 216, 217, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 234, 239, + 240, 243, +} + +var _graphclust_single_lengths []byte = []byte{ + 0, 1, 0, 0, 0, 1, 1, 0, + 1, 0, 1, 0, 0, 1, 26, 0, + 0, 0, 1, 1, 1, 0, 0, 2, + 1, 0, 1, 1, 0, 2, 0, 0, + 2, 0, 2, 1, 0, 1, 0, 3, + 0, 0, 1, 21, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 3, 0, 0, 0, 0, 0, 0, 2, + 0, 5, 0, 0, 0, 1, 0, 2, + 0, 0, 15, 0, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 0, 2, 1, + 1, 0, 3, 1, 0, 7, 7, 1, + 1, 0, 1, 0, 0, 0, 32, 0, + 0, 0, 0, 1, 0, 0, 1, 0, + 0, 1, 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 1, 0, 1, 0, + 0, 0, 1, 1, 0, 0, 4, 0, + 0, 1, 0, 1, 0, 6, 0, 0, + 0, 0, 0, 1, 5, 0, 0, 0, + 0, 1, 0, 1, 4, 0, 0, 0, + 0, 3, 0, 0, 0, 1, 1, 0, + 1, 0, 1, 0, 0, 1, 26, 0, + 0, 0, 1, 1, 1, 0, 0, 2, + 1, 0, 1, 1, 0, 2, 0, 0, + 2, 0, 2, 1, 0, 1, 0, 3, + 0, 0, 1, 21, 0, 0, 3, 0, + 0, 0, 0, 0, 0, 1, 0, 0, + 3, 0, 0, 0, 0, 0, 0, 2, + 0, 5, 2, 2, 24, 3, 1, 0, + 2, 0, 1, 1, 1, 1, 1, 1, + 0, 0, 0, 0, 5, 5, 3, 0, + 0, 2, 0, 1, 0, 3, 1, 0, + 2, 15, 0, 0, 0, 3, 0, 0, + 0, 0, 0, 0, 0, 2, 1, 1, + 0, 3, 1, 0, 7, 7, 1, 1, + 0, 1, 0, 0, 0, 32, 0, 0, + 0, 0, 1, 0, 0, 1, 0, 0, + 1, 0, 1, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 0, 1, 0, 0, + 0, 1, 1, 0, 0, 4, 0, 0, + 1, 0, 1, 0, 6, 0, 0, 0, + 0, 0, 1, 5, 0, 0, 0, 0, + 32, 0, 1, 0, 1, 0, 2, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 4, 0, 2, 0, + 7, 1, 0, 1, 0, 0, 0, 1, + 1, 0, 1, 0, 1, 0, 0, 1, + 26, 0, 0, 0, 1, 1, 1, 0, + 0, 2, 1, 0, 1, 1, 0, 2, + 0, 0, 2, 0, 2, 1, 0, 1, + 0, 3, 0, 0, 1, 21, 0, 0, + 3, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 3, 0, 0, 0, 0, 0, + 0, 2, 0, 5, 0, 0, 0, 1, + 0, 2, 0, 0, 15, 0, 0, 0, + 3, 0, 0, 0, 0, 0, 0, 0, + 2, 1, 1, 0, 3, 1, 0, 7, + 7, 1, 1, 0, 1, 0, 0, 0, + 32, 0, 0, 0, 0, 1, 0, 0, + 1, 0, 0, 1, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 0, + 1, 0, 0, 0, 1, 1, 0, 0, + 4, 0, 0, 1, 0, 1, 0, 6, + 0, 0, 0, 0, 0, 1, 5, 0, + 0, 0, 0, 1, 0, 1, 4, 0, + 0, 0, 0, 2, 0, 0, 0, 1, + 1, 0, 1, 0, 1, 0, 0, 1, + 26, 0, 0, 0, 1, 1, 1, 0, + 0, 2, 1, 0, 1, 1, 0, 2, + 0, 0, 2, 0, 2, 1, 0, 1, + 0, 3, 0, 0, 1, 21, 0, 0, + 3, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 3, 0, 0, 0, 0, 0, + 0, 2, 0, 5, 2, 2, 24, 3, + 1, 0, 2, 0, 1, 1, 1, 1, + 1, 1, 0, 0, 0, 0, 5, 5, + 3, 0, 0, 2, 0, 1, 0, 3, + 1, 0, 2, 15, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 2, + 1, 1, 0, 3, 1, 0, 7, 7, + 1, 1, 0, 1, 0, 0, 0, 32, + 0, 0, 0, 0, 1, 0, 0, 1, + 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 1, + 0, 0, 0, 1, 1, 0, 0, 4, + 0, 0, 1, 0, 1, 0, 6, 0, + 0, 0, 0, 0, 1, 5, 0, 0, + 0, 0, 32, 0, 1, 0, 1, 0, + 2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 4, 0, + 2, 0, 7, 1, 0, 0, 1, 1, + 2, 1, 1, 5, 0, 24, 0, 24, + 0, 0, 23, 0, 0, 1, 0, 2, + 0, 0, 0, 28, 0, 3, 23, 2, + 0, 2, 2, 3, 2, 2, 2, 0, + 54, 54, 27, 1, 0, 20, 1, 1, + 2, 0, 1, 1, 1, 1, 1, 2, + 2, 0, 5, 5, 3, 0, 0, 2, + 2, 2, 2, 0, 14, 0, 3, 2, + 2, 3, 2, 2, 2, 54, 54, 27, + 1, 0, 2, 0, 1, 5, 6, 1, + 1, 0, 1, 0, 1, 1, 0, 1, + 0, 1, 0, 32, 1, 0, 1, 0, + 7, 2, 0, 4, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1, 1, + 0, 0, 1, 3, 0, 1, 1, 2, + 1, 1, 5, 0, 0, 0, 0, 1, + 1, 0, 1, 0, 1, 0, 0, 1, + 26, 0, 0, 0, 1, 1, 1, 0, + 0, 2, 1, 0, 1, 1, 0, 2, + 0, 0, 2, 0, 2, 1, 0, 1, + 0, 3, 0, 0, 1, 21, 0, 0, + 3, 0, 0, 0, 0, 0, 0, 1, + 0, 0, 3, 0, 0, 0, 0, 0, + 0, 2, 0, 5, 2, 2, 24, 3, + 1, 0, 2, 0, 1, 1, 1, 1, + 1, 1, 0, 0, 0, 0, 5, 5, + 3, 0, 0, 2, 0, 1, 0, 3, + 1, 0, 2, 15, 0, 0, 0, 3, + 0, 0, 0, 0, 0, 0, 0, 2, + 1, 1, 0, 3, 1, 0, 7, 7, + 1, 1, 0, 1, 0, 0, 0, 32, + 0, 0, 0, 0, 1, 0, 0, 1, + 0, 0, 1, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 0, 1, + 0, 0, 0, 1, 1, 0, 0, 4, + 0, 0, 1, 0, 1, 0, 6, 0, + 0, 0, 0, 0, 1, 5, 0, 0, + 0, 0, 32, 0, 1, 0, 1, 0, + 2, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 4, 0, + 2, 0, 7, 1, 0, 24, 0, 24, + 0, 0, 23, 0, 0, 1, 0, 2, + 0, 0, 0, 28, 0, 3, 23, 2, + 0, 2, 2, 3, 2, 2, 2, 0, + 54, 54, 27, 1, 1, 20, 3, 0, + 0, 0, 1, 1, 0, 1, 0, 1, + 0, 0, 1, 26, 0, 0, 0, 1, + 1, 1, 0, 0, 2, 1, 0, 1, + 1, 0, 2, 0, 0, 2, 0, 2, + 1, 0, 1, 0, 3, 0, 0, 1, + 21, 0, 0, 3, 0, 0, 0, 0, + 0, 0, 1, 0, 0, 3, 0, 0, + 0, 0, 0, 0, 2, 0, 5, 0, + 0, 0, 1, 0, 2, 0, 0, 15, + 0, 0, 0, 3, 0, 0, 0, 0, + 0, 0, 0, 2, 1, 1, 0, 3, + 1, 0, 7, 7, 1, 1, 0, 1, + 0, 0, 0, 32, 0, 0, 0, 0, + 1, 0, 0, 1, 0, 0, 1, 0, + 1, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 1, 0, 0, 0, 1, + 1, 0, 0, 4, 0, 0, 1, 0, + 1, 0, 6, 0, 0, 0, 0, 0, + 1, 5, 0, 0, 0, 0, 1, 0, + 1, 4, 0, 0, 0, 1, 2, 0, + 1, 1, 1, 1, 1, 2, 2, 0, + 5, 5, 3, 0, 0, 2, 2, 2, + 2, 0, 14, 0, 3, 2, 2, 3, + 2, 2, 2, 54, 54, 27, 1, 0, + 2, 1, 1, 5, 6, 1, 1, 0, + 1, 0, 1, 1, 0, 1, 0, 1, + 0, 32, 1, 0, 1, 0, 0, 0, + 0, 1, 1, 0, 1, 0, 1, 0, + 0, 1, 26, 0, 0, 0, 1, 1, + 1, 0, 0, 2, 1, 0, 1, 1, + 0, 2, 0, 0, 2, 0, 2, 1, + 0, 1, 0, 3, 0, 0, 1, 21, + 0, 0, 3, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 3, 0, 0, 0, + 0, 0, 0, 2, 0, 5, 2, 2, + 24, 3, 1, 0, 2, 0, 1, 1, + 1, 1, 1, 1, 0, 0, 0, 0, + 5, 5, 3, 0, 0, 2, 0, 1, + 0, 3, 1, 0, 2, 15, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 0, + 0, 2, 1, 1, 0, 3, 1, 0, + 7, 7, 1, 1, 0, 1, 0, 0, + 0, 32, 0, 0, 0, 0, 1, 0, + 0, 1, 0, 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 1, + 0, 1, 0, 0, 0, 1, 1, 0, + 0, 4, 0, 0, 1, 0, 1, 0, + 6, 0, 0, 0, 0, 0, 1, 5, + 0, 0, 0, 0, 32, 0, 1, 0, + 1, 0, 2, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1, + 4, 0, 2, 0, 7, 1, 0, 7, + 2, 0, 4, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1, 1, 0, + 0, 1, 5, 0, 0, 0, 0, 0, + 18, 20, 20, 21, 15, 20, 20, 21, + 23, 21, 21, 21, 20, 23, 20, 21, + 21, 21, 21, 20, 20, 20, 21, +} + +var _graphclust_range_lengths []byte = []byte{ + 0, 0, 1, 1, 1, 1, 2, 1, + 1, 4, 1, 1, 1, 1, 2, 4, + 1, 2, 1, 2, 2, 6, 6, 3, + 2, 5, 1, 3, 2, 3, 5, 3, + 3, 1, 3, 1, 1, 1, 1, 2, + 1, 4, 0, 0, 2, 3, 1, 1, + 2, 2, 1, 2, 1, 1, 2, 1, + 2, 1, 2, 2, 2, 1, 1, 3, + 2, 0, 1, 1, 1, 0, 1, 0, + 1, 1, 0, 2, 1, 1, 1, 2, + 3, 1, 1, 2, 2, 1, 1, 3, + 2, 2, 0, 0, 2, 0, 0, 0, + 0, 1, 4, 1, 1, 1, 0, 2, + 1, 2, 2, 1, 2, 2, 1, 1, + 3, 6, 1, 1, 1, 1, 2, 2, + 1, 1, 1, 1, 2, 3, 1, 1, + 2, 2, 3, 1, 3, 1, 0, 1, + 1, 1, 2, 0, 1, 0, 3, 3, + 1, 2, 2, 2, 0, 5, 1, 1, + 1, 0, 1, 0, 1, 1, 1, 0, + 1, 2, 1, 1, 1, 1, 2, 1, + 1, 4, 1, 1, 1, 1, 2, 4, + 1, 2, 1, 2, 2, 6, 6, 3, + 2, 5, 1, 3, 2, 3, 5, 3, + 3, 1, 3, 1, 1, 1, 1, 2, + 1, 4, 0, 0, 2, 3, 1, 1, + 2, 2, 1, 2, 1, 1, 2, 1, + 2, 1, 2, 2, 2, 1, 1, 3, + 2, 0, 0, 0, 0, 0, 0, 1, + 0, 2, 1, 0, 2, 0, 1, 1, + 3, 1, 2, 1, 3, 2, 1, 1, + 2, 0, 1, 0, 1, 0, 1, 1, + 0, 0, 2, 1, 1, 1, 2, 3, + 1, 1, 2, 2, 1, 1, 3, 2, + 2, 0, 0, 2, 0, 0, 0, 0, + 1, 4, 1, 1, 1, 0, 2, 1, + 2, 2, 1, 2, 2, 1, 1, 3, + 6, 1, 1, 1, 1, 2, 2, 1, + 1, 1, 1, 2, 3, 1, 1, 2, + 2, 3, 1, 3, 1, 0, 1, 1, + 1, 2, 0, 1, 0, 3, 3, 1, + 2, 2, 2, 0, 5, 1, 1, 1, + 4, 0, 1, 2, 2, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 2, 2, + 2, 2, 1, 0, 1, 1, 0, 1, + 0, 0, 1, 2, 1, 1, 1, 1, + 2, 1, 1, 4, 1, 1, 1, 1, + 2, 4, 1, 2, 1, 2, 2, 6, + 6, 3, 2, 5, 1, 3, 2, 3, + 5, 3, 3, 1, 3, 1, 1, 1, + 1, 2, 1, 4, 0, 0, 2, 3, + 1, 1, 2, 2, 1, 2, 1, 1, + 2, 1, 2, 1, 2, 2, 2, 1, + 1, 3, 2, 0, 1, 1, 1, 0, + 1, 0, 1, 1, 0, 2, 1, 1, + 1, 2, 3, 1, 1, 2, 2, 1, + 1, 3, 2, 2, 0, 0, 2, 0, + 0, 0, 0, 1, 4, 1, 1, 1, + 0, 2, 1, 2, 2, 1, 2, 2, + 1, 1, 3, 6, 1, 1, 1, 1, + 2, 2, 1, 1, 1, 1, 2, 3, + 1, 1, 2, 2, 3, 1, 3, 1, + 0, 1, 1, 1, 2, 0, 1, 0, + 3, 3, 1, 2, 2, 2, 0, 5, + 1, 1, 1, 0, 1, 0, 1, 1, + 1, 0, 1, 2, 1, 1, 1, 1, + 2, 1, 1, 4, 1, 1, 1, 1, + 2, 4, 1, 2, 1, 2, 2, 6, + 6, 3, 2, 5, 1, 3, 2, 3, + 5, 3, 3, 1, 3, 1, 1, 1, + 1, 2, 1, 4, 0, 0, 2, 3, + 1, 1, 2, 2, 1, 2, 1, 1, + 2, 1, 2, 1, 2, 2, 2, 1, + 1, 3, 2, 0, 0, 0, 0, 0, + 0, 1, 0, 2, 1, 0, 2, 0, + 1, 1, 3, 1, 2, 1, 3, 2, + 1, 1, 2, 0, 1, 0, 1, 0, + 1, 1, 0, 0, 2, 1, 1, 1, + 2, 3, 1, 1, 2, 2, 1, 1, + 3, 2, 2, 0, 0, 2, 0, 0, + 0, 0, 1, 4, 1, 1, 1, 0, + 2, 1, 2, 2, 1, 2, 2, 1, + 1, 3, 6, 1, 1, 1, 1, 2, + 2, 1, 1, 1, 1, 2, 3, 1, + 1, 2, 2, 3, 1, 3, 1, 0, + 1, 1, 1, 2, 0, 1, 0, 3, + 3, 1, 2, 2, 2, 0, 5, 1, + 1, 1, 4, 0, 1, 2, 2, 1, + 3, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 1, 0, 1, 1, + 0, 1, 0, 0, 1, 3, 1, 1, + 1, 1, 1, 1, 1, 0, 1, 0, + 1, 1, 0, 1, 1, 0, 1, 0, + 1, 3, 1, 2, 2, 1, 0, 0, + 1, 0, 0, 0, 0, 0, 1, 0, + 1, 1, 2, 2, 2, 1, 4, 2, + 1, 5, 3, 1, 5, 1, 3, 2, + 1, 3, 6, 5, 3, 3, 5, 1, + 1, 1, 1, 1, 3, 3, 1, 0, + 0, 0, 0, 0, 1, 1, 1, 3, + 2, 4, 1, 1, 2, 1, 1, 1, + 1, 3, 1, 3, 1, 1, 2, 1, + 2, 1, 2, 5, 3, 4, 4, 2, + 0, 0, 1, 3, 2, 2, 2, 2, + 2, 2, 2, 3, 5, 4, 2, 1, + 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 2, 1, 1, 4, 1, 1, 1, 1, + 2, 4, 1, 2, 1, 2, 2, 6, + 6, 3, 2, 5, 1, 3, 2, 3, + 5, 3, 3, 1, 3, 1, 1, 1, + 1, 2, 1, 4, 0, 0, 2, 3, + 1, 1, 2, 2, 1, 2, 1, 1, + 2, 1, 2, 1, 2, 2, 2, 1, + 1, 3, 2, 0, 0, 0, 0, 0, + 0, 1, 0, 2, 1, 0, 2, 0, + 1, 1, 3, 1, 2, 1, 3, 2, + 1, 1, 2, 0, 1, 0, 1, 0, + 1, 1, 0, 0, 2, 1, 1, 1, + 2, 3, 1, 1, 2, 2, 1, 1, + 3, 2, 2, 0, 0, 2, 0, 0, + 0, 0, 1, 4, 1, 1, 1, 0, + 2, 1, 2, 2, 1, 2, 2, 1, + 1, 3, 6, 1, 1, 1, 1, 2, + 2, 1, 1, 1, 1, 2, 3, 1, + 1, 2, 2, 3, 1, 3, 1, 0, + 1, 1, 1, 2, 0, 1, 0, 3, + 3, 1, 2, 2, 2, 0, 5, 1, + 1, 1, 4, 0, 1, 2, 2, 1, + 3, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 1, 0, 1, 1, + 0, 1, 0, 0, 1, 0, 1, 0, + 1, 1, 0, 1, 1, 0, 1, 0, + 1, 3, 1, 2, 2, 1, 0, 0, + 1, 0, 0, 0, 0, 0, 1, 0, + 1, 1, 2, 2, 1, 1, 5, 1, + 1, 1, 1, 2, 1, 1, 4, 1, + 1, 1, 1, 2, 4, 1, 2, 1, + 2, 2, 6, 6, 3, 2, 5, 1, + 3, 2, 3, 5, 3, 3, 1, 3, + 1, 1, 1, 1, 2, 1, 4, 0, + 0, 2, 3, 1, 1, 2, 2, 1, + 2, 1, 1, 2, 1, 2, 1, 2, + 2, 2, 1, 1, 3, 2, 0, 1, + 1, 1, 0, 1, 0, 1, 1, 0, + 2, 1, 1, 1, 2, 3, 1, 1, + 2, 2, 1, 1, 3, 2, 2, 0, + 0, 2, 0, 0, 0, 0, 1, 4, + 1, 1, 1, 0, 2, 1, 2, 2, + 1, 2, 2, 1, 1, 3, 6, 1, + 1, 1, 1, 2, 2, 1, 1, 1, + 1, 2, 3, 1, 1, 2, 2, 3, + 1, 3, 1, 0, 1, 1, 1, 2, + 0, 1, 0, 3, 3, 1, 2, 2, + 2, 0, 5, 1, 1, 1, 0, 1, + 0, 1, 1, 1, 0, 3, 1, 5, + 3, 1, 5, 1, 3, 2, 1, 3, + 6, 5, 3, 3, 5, 1, 1, 1, + 1, 1, 3, 3, 1, 0, 0, 0, + 0, 0, 1, 1, 1, 3, 2, 4, + 1, 1, 3, 1, 1, 1, 1, 3, + 1, 3, 1, 1, 3, 1, 3, 1, + 3, 5, 3, 4, 4, 2, 1, 1, + 1, 1, 2, 1, 1, 4, 1, 1, + 1, 1, 2, 4, 1, 2, 1, 2, + 2, 6, 6, 3, 2, 5, 1, 3, + 2, 3, 5, 3, 3, 1, 3, 1, + 1, 1, 1, 2, 1, 4, 0, 0, + 2, 3, 1, 1, 2, 2, 1, 2, + 1, 1, 2, 1, 2, 1, 2, 2, + 2, 1, 1, 3, 2, 0, 0, 0, + 0, 0, 0, 1, 0, 2, 1, 0, + 2, 0, 1, 1, 3, 1, 2, 1, + 3, 2, 1, 1, 2, 0, 1, 0, + 1, 0, 1, 1, 0, 0, 2, 1, + 1, 1, 2, 3, 1, 1, 2, 2, + 1, 1, 3, 2, 2, 0, 0, 2, + 0, 0, 0, 0, 1, 4, 1, 1, + 1, 0, 2, 1, 2, 2, 1, 2, + 2, 1, 1, 3, 6, 1, 1, 1, + 1, 2, 2, 1, 1, 1, 1, 2, + 3, 1, 1, 2, 2, 3, 1, 3, + 1, 0, 1, 1, 1, 2, 0, 1, + 0, 3, 3, 1, 2, 2, 2, 0, + 5, 1, 1, 1, 4, 0, 1, 2, + 2, 1, 3, 1, 1, 1, 1, 1, + 1, 1, 2, 2, 2, 2, 1, 0, + 1, 1, 0, 1, 0, 0, 1, 0, + 0, 1, 3, 2, 2, 2, 2, 2, + 2, 2, 3, 5, 4, 2, 1, 2, + 1, 1, 2, 2, 1, 1, 2, 0, + 6, 0, 0, 0, 4, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, +} + +var _graphclust_index_offsets []int16 = []int16{ + 0, 0, 2, 4, 6, 8, 11, 15, + 17, 20, 25, 28, 30, 32, 35, 64, + 69, 71, 74, 77, 81, 85, 92, 99, + 105, 109, 115, 118, 123, 126, 132, 138, + 142, 148, 150, 156, 159, 161, 164, 166, + 172, 174, 179, 181, 203, 206, 210, 215, + 217, 220, 223, 225, 228, 230, 233, 236, + 238, 244, 246, 249, 252, 255, 257, 259, + 265, 268, 274, 276, 278, 280, 282, 284, + 287, 289, 291, 307, 310, 312, 314, 319, + 322, 326, 328, 330, 333, 336, 338, 342, + 347, 351, 354, 358, 360, 363, 371, 379, + 381, 383, 385, 391, 393, 395, 397, 430, + 433, 435, 438, 441, 444, 447, 450, 453, + 455, 459, 467, 469, 472, 474, 476, 479, + 482, 484, 486, 488, 490, 494, 498, 501, + 503, 506, 509, 514, 517, 521, 523, 528, + 530, 532, 535, 538, 540, 542, 549, 553, + 557, 559, 562, 565, 569, 575, 581, 583, + 585, 587, 589, 591, 593, 599, 601, 603, + 604, 606, 612, 614, 616, 618, 621, 625, + 627, 630, 635, 638, 640, 642, 645, 674, + 679, 681, 684, 687, 691, 695, 702, 709, + 715, 719, 725, 728, 733, 736, 742, 748, + 752, 758, 760, 766, 769, 771, 774, 776, + 782, 784, 789, 791, 813, 816, 820, 825, + 827, 830, 833, 835, 838, 840, 843, 846, + 848, 854, 856, 859, 862, 865, 867, 869, + 875, 878, 884, 887, 890, 915, 919, 921, + 923, 926, 929, 932, 934, 938, 940, 943, + 946, 950, 952, 955, 957, 966, 974, 979, + 981, 984, 987, 989, 991, 993, 997, 1000, + 1002, 1005, 1021, 1024, 1026, 1028, 1033, 1036, + 1040, 1042, 1044, 1047, 1050, 1052, 1056, 1061, + 1065, 1068, 1072, 1074, 1077, 1085, 1093, 1095, + 1097, 1099, 1105, 1107, 1109, 1111, 1144, 1147, + 1149, 1152, 1155, 1158, 1161, 1164, 1167, 1169, + 1173, 1181, 1183, 1186, 1188, 1190, 1193, 1196, + 1198, 1200, 1202, 1204, 1208, 1212, 1215, 1217, + 1220, 1223, 1228, 1231, 1235, 1237, 1242, 1244, + 1246, 1249, 1252, 1254, 1256, 1263, 1267, 1271, + 1273, 1276, 1279, 1283, 1289, 1295, 1297, 1299, + 1301, 1338, 1339, 1342, 1345, 1349, 1351, 1357, + 1359, 1361, 1363, 1365, 1367, 1369, 1371, 1374, + 1377, 1380, 1383, 1385, 1387, 1393, 1395, 1398, + 1400, 1408, 1410, 1412, 1416, 1418, 1420, 1422, + 1425, 1429, 1431, 1434, 1439, 1442, 1444, 1446, + 1449, 1478, 1483, 1485, 1488, 1491, 1495, 1499, + 1506, 1513, 1519, 1523, 1529, 1532, 1537, 1540, + 1546, 1552, 1556, 1562, 1564, 1570, 1573, 1575, + 1578, 1580, 1586, 1588, 1593, 1595, 1617, 1620, + 1624, 1629, 1631, 1634, 1637, 1639, 1642, 1644, + 1647, 1650, 1652, 1658, 1660, 1663, 1666, 1669, + 1671, 1673, 1679, 1682, 1688, 1690, 1692, 1694, + 1696, 1698, 1701, 1703, 1705, 1721, 1724, 1726, + 1728, 1733, 1736, 1740, 1742, 1744, 1747, 1750, + 1752, 1756, 1761, 1765, 1768, 1772, 1774, 1777, + 1785, 1793, 1795, 1797, 1799, 1805, 1807, 1809, + 1811, 1844, 1847, 1849, 1852, 1855, 1858, 1861, + 1864, 1867, 1869, 1873, 1881, 1883, 1886, 1888, + 1890, 1893, 1896, 1898, 1900, 1902, 1904, 1908, + 1912, 1915, 1917, 1920, 1923, 1928, 1931, 1935, + 1937, 1942, 1944, 1946, 1949, 1952, 1954, 1956, + 1963, 1967, 1971, 1973, 1976, 1979, 1983, 1989, + 1995, 1997, 1999, 2001, 2003, 2005, 2007, 2013, + 2015, 2017, 2018, 2020, 2025, 2027, 2029, 2031, + 2034, 2038, 2040, 2043, 2048, 2051, 2053, 2055, + 2058, 2087, 2092, 2094, 2097, 2100, 2104, 2108, + 2115, 2122, 2128, 2132, 2138, 2141, 2146, 2149, + 2155, 2161, 2165, 2171, 2173, 2179, 2182, 2184, + 2187, 2189, 2195, 2197, 2202, 2204, 2226, 2229, + 2233, 2238, 2240, 2243, 2246, 2248, 2251, 2253, + 2256, 2259, 2261, 2267, 2269, 2272, 2275, 2278, + 2280, 2282, 2288, 2291, 2297, 2300, 2303, 2328, + 2332, 2334, 2336, 2339, 2342, 2345, 2347, 2351, + 2353, 2356, 2359, 2363, 2365, 2368, 2370, 2379, + 2387, 2392, 2394, 2397, 2400, 2402, 2404, 2406, + 2410, 2413, 2415, 2418, 2434, 2437, 2439, 2441, + 2446, 2449, 2453, 2455, 2457, 2460, 2463, 2465, + 2469, 2474, 2478, 2481, 2485, 2487, 2490, 2498, + 2506, 2508, 2510, 2512, 2518, 2520, 2522, 2524, + 2557, 2560, 2562, 2565, 2568, 2571, 2574, 2577, + 2580, 2582, 2586, 2594, 2596, 2599, 2601, 2603, + 2606, 2609, 2611, 2613, 2615, 2617, 2621, 2625, + 2628, 2630, 2633, 2636, 2641, 2644, 2648, 2650, + 2655, 2657, 2659, 2662, 2665, 2667, 2669, 2676, + 2680, 2684, 2686, 2689, 2692, 2696, 2702, 2708, + 2710, 2712, 2714, 2751, 2752, 2755, 2758, 2762, + 2764, 2770, 2772, 2774, 2776, 2778, 2780, 2782, + 2784, 2787, 2790, 2793, 2796, 2798, 2800, 2806, + 2808, 2811, 2813, 2821, 2823, 2825, 2829, 2832, + 2835, 2839, 2842, 2845, 2852, 2854, 2879, 2881, + 2906, 2908, 2910, 2934, 2936, 2938, 2940, 2942, + 2945, 2947, 2951, 2953, 2984, 2987, 2992, 3016, + 3019, 3021, 3024, 3027, 3031, 3034, 3037, 3041, + 3042, 3098, 3154, 3184, 3188, 3191, 3213, 3219, + 3223, 3227, 3233, 3238, 3241, 3248, 3251, 3256, + 3261, 3265, 3269, 3281, 3292, 3299, 3303, 3309, + 3313, 3317, 3321, 3325, 3327, 3345, 3349, 3354, + 3357, 3360, 3364, 3367, 3370, 3374, 3430, 3486, + 3517, 3521, 3526, 3530, 3532, 3536, 3543, 3551, + 3554, 3557, 3561, 3564, 3568, 3571, 3574, 3577, + 3580, 3583, 3586, 3589, 3627, 3632, 3637, 3643, + 3646, 3654, 3657, 3659, 3667, 3670, 3673, 3676, + 3679, 3682, 3685, 3688, 3692, 3698, 3703, 3707, + 3710, 3713, 3715, 3718, 3723, 3725, 3728, 3731, + 3735, 3738, 3741, 3748, 3750, 3752, 3754, 3756, + 3759, 3763, 3765, 3768, 3773, 3776, 3778, 3780, + 3783, 3812, 3817, 3819, 3822, 3825, 3829, 3833, + 3840, 3847, 3853, 3857, 3863, 3866, 3871, 3874, + 3880, 3886, 3890, 3896, 3898, 3904, 3907, 3909, + 3912, 3914, 3920, 3922, 3927, 3929, 3951, 3954, + 3958, 3963, 3965, 3968, 3971, 3973, 3976, 3978, + 3981, 3984, 3986, 3992, 3994, 3997, 4000, 4003, + 4005, 4007, 4013, 4016, 4022, 4025, 4028, 4053, + 4057, 4059, 4061, 4064, 4067, 4070, 4072, 4076, + 4078, 4081, 4084, 4088, 4090, 4093, 4095, 4104, + 4112, 4117, 4119, 4122, 4125, 4127, 4129, 4131, + 4135, 4138, 4140, 4143, 4159, 4162, 4164, 4166, + 4171, 4174, 4178, 4180, 4182, 4185, 4188, 4190, + 4194, 4199, 4203, 4206, 4210, 4212, 4215, 4223, + 4231, 4233, 4235, 4237, 4243, 4245, 4247, 4249, + 4282, 4285, 4287, 4290, 4293, 4296, 4299, 4302, + 4305, 4307, 4311, 4319, 4321, 4324, 4326, 4328, + 4331, 4334, 4336, 4338, 4340, 4342, 4346, 4350, + 4353, 4355, 4358, 4361, 4366, 4369, 4373, 4375, + 4380, 4382, 4384, 4387, 4390, 4392, 4394, 4401, + 4405, 4409, 4411, 4414, 4417, 4421, 4427, 4433, + 4435, 4437, 4439, 4476, 4477, 4480, 4483, 4487, + 4489, 4495, 4497, 4499, 4501, 4503, 4505, 4507, + 4509, 4512, 4515, 4518, 4521, 4523, 4525, 4531, + 4533, 4536, 4538, 4546, 4548, 4550, 4575, 4577, + 4602, 4604, 4606, 4630, 4632, 4634, 4636, 4638, + 4641, 4643, 4647, 4649, 4680, 4683, 4688, 4712, + 4715, 4717, 4720, 4723, 4727, 4730, 4733, 4737, + 4738, 4794, 4850, 4880, 4884, 4887, 4909, 4918, + 4920, 4922, 4924, 4927, 4931, 4933, 4936, 4941, + 4944, 4946, 4948, 4951, 4980, 4985, 4987, 4990, + 4993, 4997, 5001, 5008, 5015, 5021, 5025, 5031, + 5034, 5039, 5042, 5048, 5054, 5058, 5064, 5066, + 5072, 5075, 5077, 5080, 5082, 5088, 5090, 5095, + 5097, 5119, 5122, 5126, 5131, 5133, 5136, 5139, + 5141, 5144, 5146, 5149, 5152, 5154, 5160, 5162, + 5165, 5168, 5171, 5173, 5175, 5181, 5184, 5190, + 5192, 5194, 5196, 5198, 5200, 5203, 5205, 5207, + 5223, 5226, 5228, 5230, 5235, 5238, 5242, 5244, + 5246, 5249, 5252, 5254, 5258, 5263, 5267, 5270, + 5274, 5276, 5279, 5287, 5295, 5297, 5299, 5301, + 5307, 5309, 5311, 5313, 5346, 5349, 5351, 5354, + 5357, 5360, 5363, 5366, 5369, 5371, 5375, 5383, + 5385, 5388, 5390, 5392, 5395, 5398, 5400, 5402, + 5404, 5406, 5410, 5414, 5417, 5419, 5422, 5425, + 5430, 5433, 5437, 5439, 5444, 5446, 5448, 5451, + 5454, 5456, 5458, 5465, 5469, 5473, 5475, 5478, + 5481, 5485, 5491, 5497, 5499, 5501, 5503, 5505, + 5507, 5509, 5515, 5517, 5519, 5520, 5525, 5529, + 5535, 5540, 5543, 5550, 5553, 5558, 5563, 5567, + 5571, 5583, 5594, 5601, 5605, 5611, 5615, 5619, + 5623, 5627, 5629, 5647, 5651, 5656, 5659, 5662, + 5666, 5669, 5672, 5676, 5732, 5788, 5819, 5823, + 5828, 5832, 5835, 5840, 5847, 5855, 5858, 5861, + 5865, 5868, 5872, 5875, 5878, 5882, 5885, 5889, + 5892, 5896, 5934, 5939, 5944, 5950, 5953, 5955, + 5957, 5959, 5962, 5966, 5968, 5971, 5976, 5979, + 5981, 5983, 5986, 6015, 6020, 6022, 6025, 6028, + 6032, 6036, 6043, 6050, 6056, 6060, 6066, 6069, + 6074, 6077, 6083, 6089, 6093, 6099, 6101, 6107, + 6110, 6112, 6115, 6117, 6123, 6125, 6130, 6132, + 6154, 6157, 6161, 6166, 6168, 6171, 6174, 6176, + 6179, 6181, 6184, 6187, 6189, 6195, 6197, 6200, + 6203, 6206, 6208, 6210, 6216, 6219, 6225, 6228, + 6231, 6256, 6260, 6262, 6264, 6267, 6270, 6273, + 6275, 6279, 6281, 6284, 6287, 6291, 6293, 6296, + 6298, 6307, 6315, 6320, 6322, 6325, 6328, 6330, + 6332, 6334, 6338, 6341, 6343, 6346, 6362, 6365, + 6367, 6369, 6374, 6377, 6381, 6383, 6385, 6388, + 6391, 6393, 6397, 6402, 6406, 6409, 6413, 6415, + 6418, 6426, 6434, 6436, 6438, 6440, 6446, 6448, + 6450, 6452, 6485, 6488, 6490, 6493, 6496, 6499, + 6502, 6505, 6508, 6510, 6514, 6522, 6524, 6527, + 6529, 6531, 6534, 6537, 6539, 6541, 6543, 6545, + 6549, 6553, 6556, 6558, 6561, 6564, 6569, 6572, + 6576, 6578, 6583, 6585, 6587, 6590, 6593, 6595, + 6597, 6604, 6608, 6612, 6614, 6617, 6620, 6624, + 6630, 6636, 6638, 6640, 6642, 6679, 6680, 6683, + 6686, 6690, 6692, 6698, 6700, 6702, 6704, 6706, + 6708, 6710, 6712, 6715, 6718, 6721, 6724, 6726, + 6728, 6734, 6736, 6739, 6741, 6749, 6751, 6753, + 6761, 6764, 6766, 6774, 6777, 6780, 6783, 6786, + 6789, 6792, 6795, 6799, 6805, 6810, 6814, 6817, + 6820, 6822, 6825, 6833, 6836, 6838, 6840, 6843, + 6844, 6869, 6890, 6911, 6933, 6953, 6974, 6995, + 7017, 7041, 7063, 7085, 7107, 7128, 7152, 7173, + 7195, 7217, 7239, 7261, 7282, 7303, 7324, +} + +var _graphclust_indicies []int16 = []int16{ + 0, 1, 2, 3, 2, 3, 3, 2, + 3, 3, 2, 3, 3, 3, 2, 3, + 2, 3, 3, 2, 3, 3, 3, 3, + 2, 3, 3, 2, 2, 3, 3, 2, + 3, 3, 2, 4, 5, 6, 7, 8, + 10, 11, 12, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 9, 13, 2, + 3, 3, 3, 3, 2, 3, 2, 3, + 3, 2, 2, 2, 3, 2, 2, 2, + 3, 3, 3, 3, 2, 2, 2, 2, + 2, 2, 2, 3, 2, 2, 2, 2, + 2, 2, 3, 2, 2, 2, 2, 2, + 3, 3, 3, 3, 2, 3, 3, 3, + 3, 3, 2, 3, 3, 2, 3, 3, + 3, 3, 2, 3, 3, 2, 2, 2, + 2, 2, 2, 3, 3, 3, 3, 3, + 3, 2, 3, 3, 3, 2, 2, 2, + 2, 2, 2, 3, 3, 2, 3, 3, + 3, 3, 3, 2, 3, 3, 2, 3, + 2, 3, 3, 2, 3, 2, 3, 3, + 3, 3, 3, 2, 3, 2, 3, 3, + 3, 3, 2, 3, 2, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 2, 3, 3, 2, 3, 3, + 3, 2, 3, 3, 3, 3, 2, 3, + 2, 3, 3, 2, 3, 3, 2, 3, + 2, 2, 2, 3, 3, 2, 3, 3, + 2, 3, 3, 2, 3, 2, 3, 3, + 3, 3, 3, 2, 3, 2, 3, 3, + 2, 2, 2, 3, 3, 3, 2, 3, + 2, 3, 2, 3, 3, 3, 3, 3, + 2, 3, 3, 2, 53, 54, 55, 56, + 57, 2, 3, 2, 3, 2, 3, 2, + 3, 2, 3, 2, 58, 59, 2, 3, + 2, 3, 2, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, 72, + 73, 74, 2, 3, 3, 2, 3, 2, + 3, 2, 3, 3, 3, 3, 2, 3, + 3, 2, 2, 2, 2, 3, 3, 2, + 3, 2, 3, 3, 2, 2, 2, 3, + 3, 2, 3, 3, 3, 2, 3, 3, + 3, 3, 2, 3, 3, 3, 2, 3, + 3, 2, 75, 76, 61, 2, 3, 2, + 3, 3, 2, 77, 78, 79, 80, 81, + 82, 83, 2, 84, 85, 86, 87, 88, + 89, 90, 2, 3, 2, 3, 2, 3, + 2, 3, 3, 3, 3, 3, 2, 3, + 2, 3, 2, 3, 2, 91, 92, 93, + 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 104, 108, + 109, 110, 111, 112, 113, 114, 115, 116, + 117, 118, 119, 120, 121, 2, 3, 3, + 2, 2, 3, 2, 2, 3, 3, 3, + 2, 3, 3, 2, 3, 3, 2, 2, + 2, 3, 3, 3, 2, 3, 2, 3, + 3, 3, 2, 3, 3, 3, 3, 3, + 3, 3, 2, 3, 2, 3, 3, 2, + 3, 2, 2, 3, 3, 3, 2, 2, + 2, 3, 2, 3, 3, 2, 3, 2, + 3, 2, 3, 3, 3, 2, 3, 3, + 3, 2, 3, 3, 2, 3, 2, 3, + 3, 2, 3, 3, 2, 3, 3, 3, + 3, 2, 2, 2, 3, 3, 3, 3, + 2, 3, 2, 122, 123, 124, 125, 2, + 3, 2, 3, 2, 3, 3, 2, 2, + 2, 3, 126, 2, 3, 2, 127, 128, + 129, 130, 131, 132, 2, 3, 3, 3, + 2, 2, 2, 2, 3, 3, 2, 3, + 3, 2, 2, 2, 3, 3, 3, 3, + 2, 133, 123, 134, 135, 136, 2, 3, + 3, 3, 3, 3, 2, 3, 2, 3, + 2, 3, 2, 137, 2, 3, 2, 138, + 2, 139, 140, 141, 143, 142, 2, 3, + 2, 2, 3, 3, 3, 1, 145, 144, + 145, 144, 3, 1, 145, 146, 147, 145, + 145, 147, 145, 145, 147, 145, 145, 145, + 147, 145, 147, 145, 145, 147, 145, 145, + 145, 145, 147, 145, 145, 147, 147, 145, + 145, 147, 145, 145, 147, 148, 149, 150, + 151, 152, 154, 155, 156, 158, 159, 160, + 161, 162, 163, 164, 165, 166, 167, 168, + 169, 170, 171, 172, 173, 174, 175, 153, + 157, 147, 145, 145, 145, 145, 147, 145, + 147, 145, 145, 147, 147, 147, 145, 147, + 147, 147, 145, 145, 145, 145, 147, 147, + 147, 147, 147, 147, 147, 145, 147, 147, + 147, 147, 147, 147, 145, 147, 147, 147, + 147, 147, 145, 145, 145, 145, 147, 145, + 145, 145, 145, 145, 147, 145, 145, 147, + 145, 145, 145, 145, 147, 145, 145, 147, + 147, 147, 147, 147, 147, 145, 145, 145, + 145, 145, 145, 147, 145, 145, 145, 147, + 147, 147, 147, 147, 147, 145, 145, 147, + 145, 145, 145, 145, 145, 147, 145, 145, + 147, 145, 147, 145, 145, 147, 145, 147, + 145, 145, 145, 145, 145, 147, 145, 147, + 145, 145, 145, 145, 147, 145, 147, 176, + 177, 178, 179, 180, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, 195, 196, 147, 145, 145, 147, + 145, 145, 145, 147, 145, 145, 145, 145, + 147, 145, 147, 145, 145, 147, 145, 145, + 147, 145, 147, 147, 147, 145, 145, 147, + 145, 145, 147, 145, 145, 147, 145, 147, + 145, 145, 145, 145, 145, 147, 145, 147, + 145, 145, 147, 147, 147, 145, 145, 145, + 147, 145, 147, 145, 147, 145, 145, 145, + 145, 145, 147, 145, 145, 147, 197, 198, + 199, 200, 201, 147, 145, 202, 147, 145, + 145, 147, 203, 204, 198, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, + 216, 217, 218, 219, 220, 221, 222, 199, + 200, 201, 147, 145, 202, 145, 147, 145, + 147, 145, 147, 145, 145, 147, 145, 145, + 147, 145, 145, 147, 145, 147, 145, 145, + 145, 147, 145, 147, 145, 145, 147, 145, + 145, 147, 145, 145, 145, 147, 146, 145, + 145, 145, 147, 145, 146, 145, 145, 145, + 145, 145, 145, 145, 145, 147, 145, 145, + 145, 145, 145, 145, 145, 147, 145, 145, + 145, 145, 147, 145, 147, 145, 145, 147, + 145, 145, 147, 145, 147, 145, 147, 145, + 147, 223, 224, 225, 147, 145, 145, 147, + 145, 147, 145, 145, 147, 226, 227, 228, + 229, 230, 231, 232, 233, 234, 235, 236, + 237, 238, 239, 240, 147, 145, 145, 147, + 145, 147, 145, 147, 145, 145, 145, 145, + 147, 145, 145, 147, 147, 147, 147, 145, + 145, 147, 145, 147, 145, 145, 147, 147, + 147, 145, 145, 147, 145, 145, 145, 147, + 145, 145, 145, 145, 147, 145, 145, 145, + 147, 145, 145, 147, 241, 242, 227, 147, + 145, 147, 145, 145, 147, 243, 244, 245, + 246, 247, 248, 249, 147, 250, 251, 252, + 253, 254, 255, 256, 147, 145, 147, 145, + 147, 145, 147, 145, 145, 145, 145, 145, + 147, 145, 147, 145, 147, 145, 147, 257, + 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, + 270, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 147, + 145, 145, 147, 147, 145, 147, 147, 145, + 145, 145, 147, 145, 145, 147, 145, 145, + 147, 147, 147, 145, 145, 145, 147, 145, + 147, 145, 145, 145, 147, 145, 145, 145, + 145, 145, 145, 145, 147, 145, 147, 145, + 145, 147, 145, 147, 147, 145, 145, 145, + 147, 147, 147, 145, 147, 145, 145, 147, + 145, 147, 145, 147, 145, 145, 145, 147, + 145, 145, 145, 147, 145, 145, 147, 145, + 147, 145, 145, 147, 145, 145, 147, 145, + 145, 145, 145, 147, 147, 147, 145, 145, + 145, 145, 147, 145, 147, 288, 289, 290, + 291, 147, 145, 147, 145, 147, 145, 145, + 147, 147, 147, 145, 292, 147, 145, 147, + 293, 294, 295, 296, 297, 298, 147, 145, + 145, 145, 147, 147, 147, 147, 145, 145, + 147, 145, 145, 147, 147, 147, 145, 145, + 145, 145, 147, 299, 289, 300, 301, 302, + 147, 145, 145, 145, 145, 145, 147, 145, + 147, 145, 147, 145, 147, 304, 214, 216, + 305, 306, 307, 308, 309, 310, 304, 214, + 214, 214, 216, 304, 214, 311, 312, 304, + 214, 313, 214, 314, 315, 316, 317, 318, + 214, 319, 320, 214, 321, 303, 216, 303, + 304, 147, 145, 145, 145, 147, 145, 145, + 147, 145, 145, 145, 147, 147, 145, 145, + 145, 145, 145, 145, 147, 145, 147, 145, + 147, 145, 147, 147, 145, 145, 147, 145, + 147, 145, 147, 145, 145, 147, 145, 145, + 147, 145, 145, 147, 145, 145, 147, 147, + 145, 322, 147, 323, 214, 303, 324, 304, + 147, 145, 147, 325, 224, 147, 145, 147, + 243, 244, 245, 246, 247, 248, 326, 147, + 327, 147, 145, 147, 144, 328, 3, 1, + 330, 329, 329, 330, 330, 329, 330, 330, + 329, 330, 330, 330, 329, 330, 329, 330, + 330, 329, 330, 330, 330, 330, 329, 330, + 330, 329, 329, 330, 330, 329, 330, 330, + 329, 331, 332, 333, 334, 335, 337, 338, + 339, 341, 342, 343, 344, 345, 346, 347, + 348, 349, 350, 351, 352, 353, 354, 355, + 356, 357, 358, 336, 340, 329, 330, 330, + 330, 330, 329, 330, 329, 330, 330, 329, + 329, 329, 330, 329, 329, 329, 330, 330, + 330, 330, 329, 329, 329, 329, 329, 329, + 329, 330, 329, 329, 329, 329, 329, 329, + 330, 329, 329, 329, 329, 329, 330, 330, + 330, 330, 329, 330, 330, 330, 330, 330, + 329, 330, 330, 329, 330, 330, 330, 330, + 329, 330, 330, 329, 329, 329, 329, 329, + 329, 330, 330, 330, 330, 330, 330, 329, + 330, 330, 330, 329, 329, 329, 329, 329, + 329, 330, 330, 329, 330, 330, 330, 330, + 330, 329, 330, 330, 329, 330, 329, 330, + 330, 329, 330, 329, 330, 330, 330, 330, + 330, 329, 330, 329, 330, 330, 330, 330, + 329, 330, 329, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 370, 371, + 372, 373, 374, 375, 376, 377, 378, 379, + 329, 330, 330, 329, 330, 330, 330, 329, + 330, 330, 330, 330, 329, 330, 329, 330, + 330, 329, 330, 330, 329, 330, 329, 329, + 329, 330, 330, 329, 330, 330, 329, 330, + 330, 329, 330, 329, 330, 330, 330, 330, + 330, 329, 330, 329, 330, 330, 329, 329, + 329, 330, 330, 330, 329, 330, 329, 330, + 329, 330, 330, 330, 330, 330, 329, 330, + 330, 329, 380, 381, 382, 383, 384, 329, + 330, 329, 330, 329, 330, 329, 330, 329, + 330, 329, 385, 386, 329, 330, 329, 330, + 329, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, 400, 401, + 329, 330, 330, 329, 330, 329, 330, 329, + 330, 330, 330, 330, 329, 330, 330, 329, + 329, 329, 329, 330, 330, 329, 330, 329, + 330, 330, 329, 329, 329, 330, 330, 329, + 330, 330, 330, 329, 330, 330, 330, 330, + 329, 330, 330, 330, 329, 330, 330, 329, + 402, 403, 388, 329, 330, 329, 330, 330, + 329, 404, 405, 406, 407, 408, 409, 410, + 329, 411, 412, 413, 414, 415, 416, 417, + 329, 330, 329, 330, 329, 330, 329, 330, + 330, 330, 330, 330, 329, 330, 329, 330, + 329, 330, 329, 418, 419, 420, 421, 422, + 423, 424, 425, 426, 427, 428, 429, 430, + 431, 432, 433, 434, 431, 435, 436, 437, + 438, 439, 440, 441, 442, 443, 444, 445, + 446, 447, 448, 329, 330, 330, 329, 329, + 330, 329, 329, 330, 330, 330, 329, 330, + 330, 329, 330, 330, 329, 329, 329, 330, + 330, 330, 329, 330, 329, 330, 330, 330, + 329, 330, 330, 330, 330, 330, 330, 330, + 329, 330, 329, 330, 330, 329, 330, 329, + 329, 330, 330, 330, 329, 329, 329, 330, + 329, 330, 330, 329, 330, 329, 330, 329, + 330, 330, 330, 329, 330, 330, 330, 329, + 330, 330, 329, 330, 329, 330, 330, 329, + 330, 330, 329, 330, 330, 330, 330, 329, + 329, 329, 330, 330, 330, 330, 329, 330, + 329, 449, 450, 451, 452, 329, 330, 329, + 330, 329, 330, 330, 329, 329, 329, 330, + 453, 329, 330, 329, 454, 455, 456, 457, + 458, 459, 329, 330, 330, 330, 329, 329, + 329, 329, 330, 330, 329, 330, 330, 329, + 329, 329, 330, 330, 330, 330, 329, 460, + 450, 461, 462, 463, 329, 330, 330, 330, + 330, 330, 329, 330, 329, 330, 329, 330, + 329, 464, 329, 330, 329, 465, 329, 466, + 467, 468, 470, 469, 329, 330, 329, 329, + 330, 330, 330, 329, 471, 471, 330, 330, + 329, 471, 329, 329, 471, 471, 329, 471, + 471, 329, 471, 471, 471, 329, 471, 329, + 471, 471, 329, 471, 471, 471, 471, 329, + 471, 471, 329, 329, 471, 471, 329, 471, + 471, 329, 472, 473, 474, 475, 476, 478, + 479, 480, 482, 483, 484, 485, 486, 487, + 488, 489, 490, 491, 492, 493, 494, 495, + 496, 497, 498, 499, 477, 481, 329, 471, + 471, 471, 471, 329, 471, 329, 471, 471, + 329, 329, 329, 471, 329, 329, 329, 471, + 471, 471, 471, 329, 329, 329, 329, 329, + 329, 329, 471, 329, 329, 329, 329, 329, + 329, 471, 329, 329, 329, 329, 329, 471, + 471, 471, 471, 329, 471, 471, 471, 471, + 471, 329, 471, 471, 329, 471, 471, 471, + 471, 329, 471, 471, 329, 329, 329, 329, + 329, 329, 471, 471, 471, 471, 471, 471, + 329, 471, 471, 471, 329, 329, 329, 329, + 329, 329, 471, 471, 329, 471, 471, 471, + 471, 471, 329, 471, 471, 329, 471, 329, + 471, 471, 329, 471, 329, 471, 471, 471, + 471, 471, 329, 471, 329, 471, 471, 471, + 471, 329, 471, 329, 500, 501, 502, 503, + 504, 505, 506, 507, 508, 509, 510, 511, + 512, 513, 514, 515, 516, 517, 518, 519, + 520, 329, 471, 471, 329, 471, 471, 471, + 329, 471, 471, 471, 471, 329, 471, 329, + 471, 471, 329, 471, 471, 329, 471, 329, + 329, 329, 471, 471, 329, 471, 471, 329, + 471, 471, 329, 471, 329, 471, 471, 471, + 471, 471, 329, 471, 329, 471, 471, 329, + 329, 329, 471, 471, 471, 329, 471, 329, + 471, 329, 471, 471, 471, 471, 471, 329, + 471, 471, 329, 521, 522, 523, 524, 525, + 329, 471, 526, 329, 471, 471, 329, 527, + 528, 522, 529, 530, 531, 532, 533, 534, + 535, 536, 537, 538, 539, 540, 541, 542, + 543, 544, 545, 546, 523, 524, 525, 329, + 471, 526, 471, 329, 471, 329, 471, 329, + 471, 471, 329, 471, 471, 329, 471, 471, + 329, 471, 329, 471, 471, 471, 329, 471, + 329, 471, 471, 329, 471, 471, 329, 471, + 471, 471, 329, 329, 471, 471, 471, 329, + 471, 329, 471, 471, 471, 471, 471, 471, + 471, 471, 329, 471, 471, 471, 471, 471, + 471, 471, 329, 471, 471, 471, 471, 329, + 471, 329, 471, 471, 329, 471, 471, 329, + 471, 329, 471, 329, 471, 329, 547, 548, + 549, 329, 471, 471, 329, 471, 329, 471, + 471, 329, 550, 551, 552, 553, 554, 555, + 556, 557, 558, 559, 560, 561, 562, 563, + 564, 329, 471, 471, 329, 471, 329, 471, + 329, 471, 471, 471, 471, 329, 471, 471, + 329, 329, 329, 329, 471, 471, 329, 471, + 329, 471, 471, 329, 329, 329, 471, 471, + 329, 471, 471, 471, 329, 471, 471, 471, + 471, 329, 471, 471, 471, 329, 471, 471, + 329, 565, 566, 551, 329, 471, 329, 471, + 471, 329, 567, 568, 569, 570, 571, 572, + 573, 329, 574, 575, 576, 577, 578, 579, + 580, 329, 471, 329, 471, 329, 471, 329, + 471, 471, 471, 471, 471, 329, 471, 329, + 471, 329, 471, 329, 581, 582, 583, 584, + 585, 586, 587, 588, 589, 590, 591, 592, + 593, 594, 595, 596, 597, 594, 598, 599, + 600, 601, 602, 603, 604, 605, 606, 607, + 608, 609, 610, 611, 329, 471, 471, 329, + 329, 471, 329, 329, 471, 471, 471, 329, + 471, 471, 329, 471, 471, 329, 329, 329, + 471, 471, 471, 329, 471, 329, 471, 471, + 471, 329, 471, 471, 471, 471, 471, 471, + 471, 329, 471, 329, 471, 471, 329, 471, + 329, 329, 471, 471, 471, 329, 329, 329, + 471, 329, 471, 471, 329, 471, 329, 471, + 329, 471, 471, 471, 329, 471, 471, 471, + 329, 471, 471, 329, 471, 329, 471, 471, + 329, 471, 471, 329, 471, 471, 471, 471, + 329, 329, 329, 471, 471, 471, 471, 329, + 471, 329, 612, 613, 614, 615, 329, 471, + 329, 471, 329, 471, 471, 329, 329, 329, + 471, 616, 329, 471, 329, 617, 618, 619, + 620, 621, 622, 329, 471, 471, 471, 329, + 329, 329, 329, 471, 471, 329, 471, 471, + 329, 329, 329, 471, 471, 471, 471, 329, + 623, 613, 624, 625, 626, 329, 471, 471, + 471, 471, 471, 329, 471, 329, 471, 329, + 471, 329, 628, 538, 540, 629, 630, 631, + 632, 633, 634, 628, 538, 538, 538, 540, + 628, 538, 635, 636, 628, 538, 637, 538, + 638, 639, 640, 641, 642, 538, 643, 644, + 538, 645, 627, 540, 627, 628, 329, 471, + 471, 471, 329, 471, 471, 329, 471, 471, + 471, 329, 329, 471, 471, 471, 471, 471, + 471, 329, 471, 329, 471, 329, 471, 329, + 329, 471, 471, 329, 471, 329, 471, 329, + 471, 471, 329, 471, 471, 329, 471, 471, + 329, 471, 471, 329, 329, 471, 646, 329, + 647, 538, 627, 648, 628, 329, 471, 329, + 649, 548, 329, 471, 329, 567, 568, 569, + 570, 571, 572, 650, 329, 651, 329, 471, + 329, 328, 330, 330, 329, 328, 330, 329, + 328, 330, 329, 653, 654, 652, 329, 328, + 330, 329, 328, 330, 329, 655, 656, 657, + 658, 659, 652, 329, 660, 329, 500, 501, + 502, 655, 656, 661, 503, 504, 505, 506, + 507, 508, 509, 510, 511, 512, 513, 514, + 515, 516, 517, 518, 519, 520, 329, 662, + 660, 500, 501, 502, 663, 657, 658, 503, + 504, 505, 506, 507, 508, 509, 510, 511, + 512, 513, 514, 515, 516, 517, 518, 519, + 520, 329, 662, 329, 664, 662, 500, 501, + 502, 665, 658, 503, 504, 505, 506, 507, + 508, 509, 510, 511, 512, 513, 514, 515, + 516, 517, 518, 519, 520, 329, 664, 329, + 329, 664, 666, 329, 664, 329, 667, 668, + 329, 662, 329, 329, 664, 329, 662, 329, + 662, 550, 551, 552, 553, 554, 555, 556, + 669, 558, 559, 560, 561, 562, 563, 564, + 671, 672, 673, 674, 675, 676, 671, 672, + 673, 674, 675, 676, 671, 670, 677, 329, + 471, 660, 329, 678, 678, 678, 664, 329, + 500, 501, 502, 663, 661, 503, 504, 505, + 506, 507, 508, 509, 510, 511, 512, 513, + 514, 515, 516, 517, 518, 519, 520, 329, + 667, 679, 329, 329, 662, 678, 678, 664, + 678, 678, 664, 678, 678, 678, 664, 678, + 678, 664, 678, 678, 664, 678, 678, 329, + 664, 664, 673, 674, 675, 676, 670, 671, + 673, 674, 675, 676, 670, 671, 673, 674, + 675, 676, 670, 671, 673, 674, 675, 676, + 670, 671, 673, 674, 675, 676, 670, 671, + 673, 674, 675, 676, 670, 671, 673, 674, + 675, 676, 670, 671, 673, 674, 675, 676, + 670, 671, 673, 674, 675, 676, 670, 671, + 672, 677, 674, 675, 676, 670, 671, 672, + 674, 675, 676, 670, 671, 672, 674, 675, + 676, 670, 671, 672, 674, 675, 676, 670, + 671, 672, 674, 675, 676, 670, 671, 672, + 674, 675, 676, 670, 671, 672, 674, 675, + 676, 670, 671, 672, 674, 675, 676, 670, + 671, 672, 674, 675, 676, 670, 671, 672, + 673, 677, 675, 676, 670, 671, 672, 673, + 675, 676, 670, 671, 672, 673, 675, 676, + 670, 671, 672, 673, 675, 676, 670, 671, + 672, 673, 675, 680, 679, 674, 329, 677, + 678, 329, 662, 664, 330, 330, 329, 681, + 682, 683, 684, 685, 686, 687, 688, 689, + 690, 691, 538, 692, 540, 693, 694, 695, + 696, 697, 698, 652, 329, 471, 330, 330, + 330, 330, 329, 471, 330, 330, 329, 471, + 471, 330, 329, 330, 471, 330, 471, 330, + 329, 471, 330, 471, 330, 329, 471, 330, + 329, 471, 330, 471, 330, 471, 330, 329, + 471, 330, 329, 471, 330, 471, 330, 329, + 471, 330, 330, 471, 329, 330, 330, 471, + 329, 471, 330, 471, 329, 330, 330, 471, + 471, 471, 471, 330, 471, 330, 471, 330, + 329, 471, 471, 471, 471, 330, 330, 471, + 330, 471, 330, 329, 471, 471, 471, 330, + 471, 330, 329, 330, 471, 330, 329, 330, + 471, 330, 471, 330, 329, 471, 471, 330, + 329, 699, 700, 652, 329, 471, 471, 330, + 329, 471, 471, 330, 329, 652, 329, 701, + 703, 704, 705, 706, 707, 708, 703, 704, + 705, 706, 707, 708, 703, 652, 702, 677, + 329, 330, 660, 330, 329, 662, 662, 662, + 664, 329, 662, 662, 664, 662, 662, 664, + 662, 662, 662, 664, 662, 662, 664, 662, + 662, 664, 662, 662, 329, 664, 705, 706, + 707, 708, 702, 703, 705, 706, 707, 708, + 702, 703, 705, 706, 707, 708, 702, 703, + 705, 706, 707, 708, 702, 703, 705, 706, + 707, 708, 702, 703, 705, 706, 707, 708, + 702, 703, 705, 706, 707, 708, 702, 703, + 705, 706, 707, 708, 702, 703, 705, 706, + 707, 708, 702, 703, 704, 677, 706, 707, + 708, 702, 703, 704, 706, 707, 708, 702, + 703, 704, 706, 707, 708, 702, 703, 704, + 706, 707, 708, 702, 703, 704, 706, 707, + 708, 702, 703, 704, 706, 707, 708, 702, + 703, 704, 706, 707, 708, 702, 703, 704, + 706, 707, 708, 702, 703, 704, 706, 707, + 708, 702, 703, 704, 705, 677, 707, 708, + 702, 703, 704, 705, 707, 708, 702, 703, + 704, 705, 707, 708, 702, 703, 704, 705, + 707, 708, 702, 703, 704, 705, 707, 709, + 710, 706, 652, 329, 677, 662, 330, 662, + 664, 330, 664, 330, 329, 662, 711, 712, + 652, 329, 330, 329, 330, 330, 330, 329, + 714, 715, 716, 717, 718, 713, 329, 719, + 720, 721, 722, 723, 724, 652, 329, 328, + 330, 329, 328, 330, 329, 330, 328, 330, + 329, 328, 330, 329, 330, 328, 330, 329, + 328, 330, 329, 725, 652, 329, 330, 330, + 329, 726, 652, 329, 330, 330, 329, 727, + 652, 329, 330, 330, 329, 628, 538, 540, + 728, 729, 730, 731, 732, 733, 628, 538, + 538, 734, 540, 628, 538, 735, 736, 628, + 538, 737, 652, 738, 652, 739, 740, 741, + 742, 743, 744, 538, 745, 627, 538, 540, + 627, 628, 329, 471, 330, 471, 330, 329, + 330, 471, 330, 471, 329, 471, 330, 471, + 330, 471, 329, 746, 329, 471, 567, 568, + 569, 570, 571, 572, 747, 329, 748, 651, + 329, 471, 329, 330, 471, 471, 330, 471, + 330, 471, 329, 330, 471, 329, 330, 329, + 471, 471, 330, 329, 330, 471, 329, 330, + 329, 471, 330, 471, 329, 330, 471, 329, + 330, 471, 330, 329, 330, 471, 330, 471, + 330, 329, 330, 471, 330, 471, 329, 330, + 330, 471, 329, 330, 471, 329, 330, 329, + 471, 713, 329, 749, 713, 329, 384, 652, + 750, 652, 329, 330, 329, 328, 3, 1, + 328, 3, 1, 752, 753, 751, 1, 328, + 3, 1, 328, 3, 1, 754, 755, 756, + 757, 758, 751, 1, 759, 146, 760, 761, + 760, 761, 761, 760, 761, 761, 760, 761, + 761, 761, 760, 761, 760, 761, 761, 760, + 761, 761, 761, 761, 760, 761, 761, 760, + 760, 761, 761, 760, 761, 761, 760, 762, + 763, 764, 765, 766, 768, 769, 770, 772, + 773, 774, 775, 776, 777, 778, 779, 780, + 781, 782, 783, 784, 785, 786, 787, 788, + 789, 767, 771, 760, 761, 761, 761, 761, + 760, 761, 760, 761, 761, 760, 760, 760, + 761, 760, 760, 760, 761, 761, 761, 761, + 760, 760, 760, 760, 760, 760, 760, 761, + 760, 760, 760, 760, 760, 760, 761, 760, + 760, 760, 760, 760, 761, 761, 761, 761, + 760, 761, 761, 761, 761, 761, 760, 761, + 761, 760, 761, 761, 761, 761, 760, 761, + 761, 760, 760, 760, 760, 760, 760, 761, + 761, 761, 761, 761, 761, 760, 761, 761, + 761, 760, 760, 760, 760, 760, 760, 761, + 761, 760, 761, 761, 761, 761, 761, 760, + 761, 761, 760, 761, 760, 761, 761, 760, + 761, 760, 761, 761, 761, 761, 761, 760, + 761, 760, 761, 761, 761, 761, 760, 761, + 760, 790, 791, 792, 793, 794, 795, 796, + 797, 798, 799, 800, 801, 802, 803, 804, + 805, 806, 807, 808, 809, 810, 760, 761, + 761, 760, 761, 761, 761, 760, 761, 761, + 761, 761, 760, 761, 760, 761, 761, 760, + 761, 761, 760, 761, 760, 760, 760, 761, + 761, 760, 761, 761, 760, 761, 761, 760, + 761, 760, 761, 761, 761, 761, 761, 760, + 761, 760, 761, 761, 760, 760, 760, 761, + 761, 761, 760, 761, 760, 761, 760, 761, + 761, 761, 761, 761, 760, 761, 761, 760, + 811, 812, 813, 814, 815, 760, 761, 816, + 760, 761, 761, 760, 817, 818, 812, 819, + 820, 821, 822, 823, 824, 825, 826, 827, + 828, 829, 830, 831, 832, 833, 834, 835, + 836, 813, 814, 815, 760, 761, 816, 761, + 760, 761, 760, 761, 760, 761, 761, 760, + 761, 761, 760, 761, 761, 760, 761, 760, + 761, 761, 761, 760, 761, 760, 761, 761, + 760, 761, 761, 760, 761, 761, 761, 760, + 760, 761, 761, 761, 760, 761, 760, 761, + 761, 761, 761, 761, 761, 761, 761, 760, + 761, 761, 761, 761, 761, 761, 761, 760, + 761, 761, 761, 761, 760, 761, 760, 761, + 761, 760, 761, 761, 760, 761, 760, 761, + 760, 761, 760, 837, 838, 839, 760, 761, + 761, 760, 761, 760, 761, 761, 760, 840, + 841, 842, 843, 844, 845, 846, 847, 848, + 849, 850, 851, 852, 853, 854, 760, 761, + 761, 760, 761, 760, 761, 760, 761, 761, + 761, 761, 760, 761, 761, 760, 760, 760, + 760, 761, 761, 760, 761, 760, 761, 761, + 760, 760, 760, 761, 761, 760, 761, 761, + 761, 760, 761, 761, 761, 761, 760, 761, + 761, 761, 760, 761, 761, 760, 855, 856, + 841, 760, 761, 760, 761, 761, 760, 857, + 858, 859, 860, 861, 862, 863, 760, 864, + 865, 866, 867, 868, 869, 870, 760, 761, + 760, 761, 760, 761, 760, 761, 761, 761, + 761, 761, 760, 761, 760, 761, 760, 761, + 760, 871, 872, 873, 874, 875, 876, 877, + 878, 879, 880, 881, 882, 883, 884, 885, + 886, 887, 884, 888, 889, 890, 891, 892, + 893, 894, 895, 896, 897, 898, 899, 900, + 901, 760, 761, 761, 760, 760, 761, 760, + 760, 761, 761, 761, 760, 761, 761, 760, + 761, 761, 760, 760, 760, 761, 761, 761, + 760, 761, 760, 761, 761, 761, 760, 761, + 761, 761, 761, 761, 761, 761, 760, 761, + 760, 761, 761, 760, 761, 760, 760, 761, + 761, 761, 760, 760, 760, 761, 760, 761, + 761, 760, 761, 760, 761, 760, 761, 761, + 761, 760, 761, 761, 761, 760, 761, 761, + 760, 761, 760, 761, 761, 760, 761, 761, + 760, 761, 761, 761, 761, 760, 760, 760, + 761, 761, 761, 761, 760, 761, 760, 902, + 903, 904, 905, 760, 761, 760, 761, 760, + 761, 761, 760, 760, 760, 761, 906, 760, + 761, 760, 907, 908, 909, 910, 911, 912, + 760, 761, 761, 761, 760, 760, 760, 760, + 761, 761, 760, 761, 761, 760, 760, 760, + 761, 761, 761, 761, 760, 913, 903, 914, + 915, 916, 760, 761, 761, 761, 761, 761, + 760, 761, 760, 761, 760, 761, 760, 918, + 828, 830, 919, 920, 921, 922, 923, 924, + 918, 828, 828, 828, 830, 918, 828, 925, + 926, 918, 828, 927, 828, 928, 929, 930, + 931, 932, 828, 933, 934, 828, 935, 917, + 830, 917, 918, 760, 761, 761, 761, 760, + 761, 761, 760, 761, 761, 761, 760, 760, + 761, 761, 761, 761, 761, 761, 760, 761, + 760, 761, 760, 761, 760, 760, 761, 761, + 760, 761, 760, 761, 760, 761, 761, 760, + 761, 761, 760, 761, 761, 760, 761, 761, + 760, 760, 761, 936, 760, 937, 828, 917, + 938, 918, 760, 761, 760, 939, 838, 760, + 761, 760, 857, 858, 859, 860, 861, 862, + 940, 760, 941, 760, 761, 760, 790, 791, + 792, 754, 755, 942, 793, 794, 795, 796, + 797, 798, 799, 800, 801, 802, 803, 804, + 805, 806, 807, 808, 809, 810, 760, 943, + 759, 790, 791, 792, 944, 756, 757, 793, + 794, 795, 796, 797, 798, 799, 800, 801, + 802, 803, 804, 805, 806, 807, 808, 809, + 810, 760, 943, 760, 945, 943, 790, 791, + 792, 946, 757, 793, 794, 795, 796, 797, + 798, 799, 800, 801, 802, 803, 804, 805, + 806, 807, 808, 809, 810, 760, 945, 760, + 146, 945, 947, 760, 945, 760, 948, 949, + 760, 943, 760, 760, 945, 760, 943, 760, + 943, 840, 841, 842, 843, 844, 845, 846, + 950, 848, 849, 850, 851, 852, 853, 854, + 952, 953, 954, 955, 956, 957, 952, 953, + 954, 955, 956, 957, 952, 951, 958, 760, + 761, 759, 760, 959, 959, 959, 945, 760, + 790, 791, 792, 944, 942, 793, 794, 795, + 796, 797, 798, 799, 800, 801, 802, 803, + 804, 805, 806, 807, 808, 809, 810, 760, + 948, 960, 760, 760, 943, 959, 959, 945, + 959, 959, 945, 959, 959, 959, 945, 959, + 959, 945, 959, 959, 945, 959, 959, 760, + 945, 945, 954, 955, 956, 957, 951, 952, + 954, 955, 956, 957, 951, 952, 954, 955, + 956, 957, 951, 952, 954, 955, 956, 957, + 951, 952, 954, 955, 956, 957, 951, 952, + 954, 955, 956, 957, 951, 952, 954, 955, + 956, 957, 951, 952, 954, 955, 956, 957, + 951, 952, 954, 955, 956, 957, 951, 952, + 953, 958, 955, 956, 957, 951, 952, 953, + 955, 956, 957, 951, 952, 953, 955, 956, + 957, 951, 952, 953, 955, 956, 957, 951, + 952, 953, 955, 956, 957, 951, 952, 953, + 955, 956, 957, 951, 952, 953, 955, 956, + 957, 951, 952, 953, 955, 956, 957, 951, + 952, 953, 955, 956, 957, 951, 952, 953, + 954, 958, 956, 957, 951, 952, 953, 954, + 956, 957, 951, 952, 953, 954, 956, 957, + 951, 952, 953, 954, 956, 957, 951, 952, + 953, 954, 956, 961, 960, 955, 760, 958, + 959, 760, 943, 945, 144, 3, 1, 962, + 963, 964, 965, 966, 967, 968, 969, 970, + 971, 972, 214, 973, 216, 974, 975, 976, + 977, 978, 979, 751, 1, 144, 980, 145, + 3, 144, 3, 144, 3, 1, 980, 981, + 981, 980, 980, 981, 980, 980, 981, 980, + 980, 980, 981, 980, 981, 980, 980, 981, + 980, 980, 980, 980, 981, 980, 980, 981, + 981, 980, 980, 981, 980, 980, 981, 982, + 983, 984, 985, 986, 988, 989, 990, 992, + 993, 994, 995, 996, 997, 998, 999, 1000, + 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, + 1009, 987, 991, 981, 980, 980, 980, 980, + 981, 980, 981, 980, 980, 981, 981, 981, + 980, 981, 981, 981, 980, 980, 980, 980, + 981, 981, 981, 981, 981, 981, 981, 980, + 981, 981, 981, 981, 981, 981, 980, 981, + 981, 981, 981, 981, 980, 980, 980, 980, + 981, 980, 980, 980, 980, 980, 981, 980, + 980, 981, 980, 980, 980, 980, 981, 980, + 980, 981, 981, 981, 981, 981, 981, 980, + 980, 980, 980, 980, 980, 981, 980, 980, + 980, 981, 981, 981, 981, 981, 981, 980, + 980, 981, 980, 980, 980, 980, 980, 981, + 980, 980, 981, 980, 981, 980, 980, 981, + 980, 981, 980, 980, 980, 980, 980, 981, + 980, 981, 980, 980, 980, 980, 981, 980, + 981, 1010, 1011, 1012, 1013, 1014, 1015, 1016, + 1017, 1018, 1019, 1020, 1021, 1022, 1023, 1024, + 1025, 1026, 1027, 1028, 1029, 1030, 981, 980, + 980, 981, 980, 980, 980, 981, 980, 980, + 980, 980, 981, 980, 981, 980, 980, 981, + 980, 980, 981, 980, 981, 981, 981, 980, + 980, 981, 980, 980, 981, 980, 980, 981, + 980, 981, 980, 980, 980, 980, 980, 981, + 980, 981, 980, 980, 981, 981, 981, 980, + 980, 980, 981, 980, 981, 980, 981, 980, + 980, 980, 980, 980, 981, 980, 980, 981, + 1031, 1032, 1033, 1034, 1035, 981, 980, 981, + 980, 981, 980, 981, 980, 981, 980, 981, + 1036, 1037, 981, 980, 981, 980, 981, 1038, + 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, + 1047, 1048, 1049, 1050, 1051, 1052, 981, 980, + 980, 981, 980, 981, 980, 981, 980, 980, + 980, 980, 981, 980, 980, 981, 981, 981, + 981, 980, 980, 981, 980, 981, 980, 980, + 981, 981, 981, 980, 980, 981, 980, 980, + 980, 981, 980, 980, 980, 980, 981, 980, + 980, 980, 981, 980, 980, 981, 1053, 1054, + 1039, 981, 980, 981, 980, 980, 981, 1055, + 1056, 1057, 1058, 1059, 1060, 1061, 981, 1062, + 1063, 1064, 1065, 1066, 1067, 1068, 981, 980, + 981, 980, 981, 980, 981, 980, 980, 980, + 980, 980, 981, 980, 981, 980, 981, 980, + 981, 1069, 1070, 1071, 1072, 1073, 1074, 1075, + 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, + 1084, 1085, 1082, 1086, 1087, 1088, 1089, 1090, + 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, + 1099, 981, 980, 980, 981, 981, 980, 981, + 981, 980, 980, 980, 981, 980, 980, 981, + 980, 980, 981, 981, 981, 980, 980, 980, + 981, 980, 981, 980, 980, 980, 981, 980, + 980, 980, 980, 980, 980, 980, 981, 980, + 981, 980, 980, 981, 980, 981, 981, 980, + 980, 980, 981, 981, 981, 980, 981, 980, + 980, 981, 980, 981, 980, 981, 980, 980, + 980, 981, 980, 980, 980, 981, 980, 980, + 981, 980, 981, 980, 980, 981, 980, 980, + 981, 980, 980, 980, 980, 981, 981, 981, + 980, 980, 980, 980, 981, 980, 981, 1100, + 1101, 1102, 1103, 981, 980, 981, 980, 981, + 980, 980, 981, 981, 981, 980, 1104, 981, + 980, 981, 1105, 1106, 1107, 1108, 1109, 1110, + 981, 980, 980, 980, 981, 981, 981, 981, + 980, 980, 981, 980, 980, 981, 981, 981, + 980, 980, 980, 980, 981, 1111, 1101, 1112, + 1113, 1114, 981, 980, 980, 980, 980, 980, + 981, 980, 981, 980, 981, 980, 981, 1115, + 981, 980, 981, 1116, 981, 1117, 1118, 1119, + 1121, 1120, 981, 980, 981, 981, 980, 980, + 145, 3, 144, 3, 1, 145, 145, 3, + 1, 3, 145, 3, 145, 3, 1, 145, + 3, 145, 3, 1, 145, 3, 1, 145, + 3, 145, 3, 145, 3, 1, 145, 3, + 1, 145, 3, 145, 3, 1, 145, 3, + 3, 145, 1, 3, 3, 145, 1, 145, + 3, 145, 1, 3, 3, 145, 145, 145, + 145, 3, 145, 3, 145, 3, 1, 145, + 145, 145, 145, 3, 3, 145, 3, 145, + 3, 1, 145, 145, 145, 3, 145, 3, + 1, 3, 145, 3, 1, 3, 145, 3, + 145, 3, 1, 145, 145, 3, 1, 1122, + 1123, 751, 1, 145, 145, 3, 1, 145, + 145, 3, 1, 751, 1, 1124, 1126, 1127, + 1128, 1129, 1130, 1131, 1126, 1127, 1128, 1129, + 1130, 1131, 1126, 751, 1125, 958, 1, 3, + 759, 3, 1, 943, 943, 943, 945, 1, + 943, 943, 945, 943, 943, 945, 943, 943, + 943, 945, 943, 943, 945, 943, 943, 945, + 943, 943, 1, 945, 1128, 1129, 1130, 1131, + 1125, 1126, 1128, 1129, 1130, 1131, 1125, 1126, + 1128, 1129, 1130, 1131, 1125, 1126, 1128, 1129, + 1130, 1131, 1125, 1126, 1128, 1129, 1130, 1131, + 1125, 1126, 1128, 1129, 1130, 1131, 1125, 1126, + 1128, 1129, 1130, 1131, 1125, 1126, 1128, 1129, + 1130, 1131, 1125, 1126, 1128, 1129, 1130, 1131, + 1125, 1126, 1127, 958, 1129, 1130, 1131, 1125, + 1126, 1127, 1129, 1130, 1131, 1125, 1126, 1127, + 1129, 1130, 1131, 1125, 1126, 1127, 1129, 1130, + 1131, 1125, 1126, 1127, 1129, 1130, 1131, 1125, + 1126, 1127, 1129, 1130, 1131, 1125, 1126, 1127, + 1129, 1130, 1131, 1125, 1126, 1127, 1129, 1130, + 1131, 1125, 1126, 1127, 1129, 1130, 1131, 1125, + 1126, 1127, 1128, 958, 1130, 1131, 1125, 1126, + 1127, 1128, 1130, 1131, 1125, 1126, 1127, 1128, + 1130, 1131, 1125, 1126, 1127, 1128, 1130, 1131, + 1125, 1126, 1127, 1128, 1130, 1132, 1133, 1129, + 751, 1, 958, 943, 3, 943, 945, 3, + 945, 3, 1, 943, 1134, 1135, 751, 1, + 144, 3, 1, 3, 3, 144, 3, 1, + 1137, 1138, 1139, 1140, 1141, 1136, 1, 1142, + 1143, 1144, 1145, 1146, 1147, 751, 1, 328, + 3, 1, 328, 3, 1, 3, 328, 3, + 1, 328, 3, 1, 3, 328, 3, 1, + 328, 3, 1, 1148, 751, 1, 3, 144, + 3, 1, 1149, 751, 1, 3, 144, 3, + 1, 1150, 751, 1, 3, 144, 3, 1, + 304, 214, 216, 1151, 1152, 1153, 1154, 1155, + 1156, 304, 214, 214, 1157, 216, 304, 214, + 1158, 1159, 304, 214, 1160, 751, 1161, 751, + 1162, 1163, 1164, 1165, 1166, 1167, 214, 1168, + 303, 214, 216, 303, 304, 1, 145, 3, + 145, 3, 1, 3, 145, 3, 145, 1, + 145, 3, 145, 3, 145, 1, 1169, 1, + 145, 1170, 1171, 1170, 1171, 1171, 1170, 1171, + 1171, 1170, 1171, 1171, 1171, 1170, 1171, 1170, + 1171, 1171, 1170, 1171, 1171, 1171, 1171, 1170, + 1171, 1171, 1170, 1170, 1171, 1171, 1170, 1171, + 1171, 1170, 1172, 1173, 1174, 1175, 1176, 1178, + 1179, 1180, 1182, 1183, 1184, 1185, 1186, 1187, + 1188, 1189, 1190, 1191, 1192, 1193, 1194, 1195, + 1196, 1197, 1198, 1199, 1177, 1181, 1170, 1171, + 1171, 1171, 1171, 1170, 1171, 1170, 1171, 1171, + 1170, 1170, 1170, 1171, 1170, 1170, 1170, 1171, + 1171, 1171, 1171, 1170, 1170, 1170, 1170, 1170, + 1170, 1170, 1171, 1170, 1170, 1170, 1170, 1170, + 1170, 1171, 1170, 1170, 1170, 1170, 1170, 1171, + 1171, 1171, 1171, 1170, 1171, 1171, 1171, 1171, + 1171, 1170, 1171, 1171, 1170, 1171, 1171, 1171, + 1171, 1170, 1171, 1171, 1170, 1170, 1170, 1170, + 1170, 1170, 1171, 1171, 1171, 1171, 1171, 1171, + 1170, 1171, 1171, 1171, 1170, 1170, 1170, 1170, + 1170, 1170, 1171, 1171, 1170, 1171, 1171, 1171, + 1171, 1171, 1170, 1171, 1171, 1170, 1171, 1170, + 1171, 1171, 1170, 1171, 1170, 1171, 1171, 1171, + 1171, 1171, 1170, 1171, 1170, 1171, 1171, 1171, + 1171, 1170, 1171, 1170, 1200, 1201, 1202, 1203, + 1204, 1205, 1206, 1207, 1208, 1209, 1210, 1211, + 1212, 1213, 1214, 1215, 1216, 1217, 1218, 1219, + 1220, 1170, 1171, 1171, 1170, 1171, 1171, 1171, + 1170, 1171, 1171, 1171, 1171, 1170, 1171, 1170, + 1171, 1171, 1170, 1171, 1171, 1170, 1171, 1170, + 1170, 1170, 1171, 1171, 1170, 1171, 1171, 1170, + 1171, 1171, 1170, 1171, 1170, 1171, 1171, 1171, + 1171, 1171, 1170, 1171, 1170, 1171, 1171, 1170, + 1170, 1170, 1171, 1171, 1171, 1170, 1171, 1170, + 1171, 1170, 1171, 1171, 1171, 1171, 1171, 1170, + 1171, 1171, 1170, 1221, 1222, 1223, 1224, 1225, + 1170, 1171, 1226, 1170, 1171, 1171, 1170, 1227, + 1228, 1222, 1229, 1230, 1231, 1232, 1233, 1234, + 1235, 1236, 1237, 1238, 1239, 1240, 1241, 1242, + 1243, 1244, 1245, 1246, 1223, 1224, 1225, 1170, + 1171, 1226, 1171, 1170, 1171, 1170, 1171, 1170, + 1171, 1171, 1170, 1171, 1171, 1170, 1171, 1171, + 1170, 1171, 1170, 1171, 1171, 1171, 1170, 1171, + 1170, 1171, 1171, 1170, 1171, 1171, 1170, 1171, + 1171, 1171, 1170, 1170, 1171, 1171, 1171, 1170, + 1171, 1170, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1170, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1170, 1171, 1171, 1171, 1171, 1170, + 1171, 1170, 1171, 1171, 1170, 1171, 1171, 1170, + 1171, 1170, 1171, 1170, 1171, 1170, 1247, 1248, + 1249, 1170, 1171, 1171, 1170, 1171, 1170, 1171, + 1171, 1170, 1250, 1251, 1252, 1253, 1254, 1255, + 1256, 1257, 1258, 1259, 1260, 1261, 1262, 1263, + 1264, 1170, 1171, 1171, 1170, 1171, 1170, 1171, + 1170, 1171, 1171, 1171, 1171, 1170, 1171, 1171, + 1170, 1170, 1170, 1170, 1171, 1171, 1170, 1171, + 1170, 1171, 1171, 1170, 1170, 1170, 1171, 1171, + 1170, 1171, 1171, 1171, 1170, 1171, 1171, 1171, + 1171, 1170, 1171, 1171, 1171, 1170, 1171, 1171, + 1170, 1265, 1266, 1251, 1170, 1171, 1170, 1171, + 1171, 1170, 1267, 1268, 1269, 1270, 1271, 1272, + 1273, 1170, 1274, 1275, 1276, 1277, 1278, 1279, + 1280, 1170, 1171, 1170, 1171, 1170, 1171, 1170, + 1171, 1171, 1171, 1171, 1171, 1170, 1171, 1170, + 1171, 1170, 1171, 1170, 1281, 1282, 1283, 1284, + 1285, 1286, 1287, 1288, 1289, 1290, 1291, 1292, + 1293, 1294, 1295, 1296, 1297, 1294, 1298, 1299, + 1300, 1301, 1302, 1303, 1304, 1305, 1306, 1307, + 1308, 1309, 1310, 1311, 1170, 1171, 1171, 1170, + 1170, 1171, 1170, 1170, 1171, 1171, 1171, 1170, + 1171, 1171, 1170, 1171, 1171, 1170, 1170, 1170, + 1171, 1171, 1171, 1170, 1171, 1170, 1171, 1171, + 1171, 1170, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1170, 1171, 1170, 1171, 1171, 1170, 1171, + 1170, 1170, 1171, 1171, 1171, 1170, 1170, 1170, + 1171, 1170, 1171, 1171, 1170, 1171, 1170, 1171, + 1170, 1171, 1171, 1171, 1170, 1171, 1171, 1171, + 1170, 1171, 1171, 1170, 1171, 1170, 1171, 1171, + 1170, 1171, 1171, 1170, 1171, 1171, 1171, 1171, + 1170, 1170, 1170, 1171, 1171, 1171, 1171, 1170, + 1171, 1170, 1312, 1313, 1314, 1315, 1170, 1171, + 1170, 1171, 1170, 1171, 1171, 1170, 1170, 1170, + 1171, 1316, 1170, 1171, 1170, 1317, 1318, 1319, + 1320, 1321, 1322, 1170, 1171, 1171, 1171, 1170, + 1170, 1170, 1170, 1171, 1171, 1170, 1171, 1171, + 1170, 1170, 1170, 1171, 1171, 1171, 1171, 1170, + 1323, 1313, 1324, 1325, 1326, 1170, 1171, 1171, + 1171, 1171, 1171, 1170, 1171, 1170, 1171, 1170, + 1171, 1170, 1328, 1238, 1240, 1329, 1330, 1331, + 1332, 1333, 1334, 1328, 1238, 1238, 1238, 1240, + 1328, 1238, 1335, 1336, 1328, 1238, 1337, 1238, + 1338, 1339, 1340, 1341, 1342, 1238, 1343, 1344, + 1238, 1345, 1327, 1240, 1327, 1328, 1170, 1171, + 1171, 1171, 1170, 1171, 1171, 1170, 1171, 1171, + 1171, 1170, 1170, 1171, 1171, 1171, 1171, 1171, + 1171, 1170, 1171, 1170, 1171, 1170, 1171, 1170, + 1170, 1171, 1171, 1170, 1171, 1170, 1171, 1170, + 1171, 1171, 1170, 1171, 1171, 1170, 1171, 1171, + 1170, 1171, 1171, 1170, 1170, 1171, 1346, 1170, + 1347, 1238, 1327, 1348, 1328, 1170, 1171, 1170, + 1349, 1248, 1170, 1171, 1170, 1267, 1268, 1269, + 1270, 1271, 1272, 1350, 1170, 1351, 1170, 1171, + 1170, 1267, 1268, 1269, 1270, 1271, 1272, 1352, + 1170, 1353, 1351, 1170, 1171, 1170, 3, 145, + 145, 3, 145, 3, 145, 1, 3, 145, + 1, 3, 1, 145, 145, 3, 1, 3, + 145, 1, 3, 1, 145, 3, 145, 1, + 3, 145, 1, 3, 145, 3, 1, 3, + 145, 3, 145, 3, 1, 3, 145, 3, + 145, 1, 3, 3, 145, 1, 3, 145, + 1, 3, 1, 145, 1136, 1, 1354, 1136, + 1, 1355, 1356, 1357, 1358, 1357, 751, 1359, + 1, 144, 3, 1, 1, 144, 1, 144, + 3, 144, 1, 144, 1, 1361, 1360, 1364, + 1365, 1366, 1367, 1368, 1369, 1370, 1371, 1373, + 1374, 1375, 1376, 1377, 1378, 1380, 1360, 1, + 1363, 1372, 1379, 1, 1362, 141, 143, 1382, + 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, + 1391, 1392, 1393, 1394, 1395, 1396, 1397, 1398, + 1399, 1381, 303, 324, 1401, 1402, 1403, 1404, + 1405, 1406, 1407, 1408, 1409, 1410, 1411, 1412, + 1413, 1414, 1415, 1416, 1417, 1418, 1400, 1419, + 303, 324, 1401, 1402, 1403, 1404, 1405, 1406, + 1407, 1408, 1409, 1410, 1411, 1412, 1420, 1421, + 1415, 1416, 1422, 1418, 1400, 1424, 1425, 1426, + 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, + 1435, 1436, 1437, 1439, 330, 652, 713, 1438, + 1423, 468, 470, 1440, 1441, 1442, 1443, 1444, + 1445, 1446, 1447, 1448, 1449, 1450, 1451, 1452, + 1453, 1454, 1455, 1456, 1457, 1423, 627, 648, + 1458, 1459, 1460, 1461, 1462, 1463, 1464, 1465, + 1466, 1467, 1468, 1469, 1470, 1471, 1472, 1473, + 1474, 1475, 1423, 1476, 627, 648, 1458, 1459, + 1460, 1461, 1462, 1463, 1464, 1465, 1466, 1467, + 1468, 1469, 1477, 1478, 1472, 1473, 1479, 1475, + 1423, 627, 648, 1458, 1459, 1460, 1461, 1462, + 1463, 1464, 1465, 1466, 1467, 1468, 1480, 1470, + 1471, 1481, 1482, 1483, 1484, 1473, 1474, 1475, + 1423, 627, 648, 1458, 1459, 1460, 1461, 1462, + 1463, 1464, 1465, 1466, 1467, 1468, 1485, 1470, + 1471, 1472, 1486, 1473, 1474, 1475, 1423, 627, + 648, 1458, 1459, 1460, 1461, 1462, 1463, 1464, + 1465, 1466, 1467, 1468, 1487, 1470, 1471, 1472, + 1488, 1473, 1474, 1475, 1423, 627, 648, 1458, + 1459, 1460, 1461, 1462, 1463, 1464, 1465, 1466, + 1467, 1468, 1489, 1470, 1471, 1472, 1490, 1473, + 1474, 1475, 1423, 627, 648, 1458, 1459, 1460, + 1461, 1462, 1463, 1464, 1465, 1466, 1467, 1468, + 1469, 1470, 1471, 1472, 1473, 1491, 1475, 1423, + 917, 938, 1493, 1494, 1495, 1496, 1497, 1498, + 1499, 1500, 1501, 1502, 1503, 1504, 1505, 1506, + 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1492, + 917, 938, 1493, 1494, 1495, 1496, 1497, 1498, + 1499, 1500, 1501, 1502, 1503, 1514, 1505, 1506, + 1515, 1511, 1512, 1513, 1492, 1516, 917, 938, + 1493, 1494, 1495, 1496, 1497, 1498, 1499, 1500, + 1501, 1502, 1503, 1514, 1517, 1518, 1515, 1511, + 1519, 1513, 1492, 917, 938, 1493, 1494, 1495, + 1496, 1497, 1498, 1499, 1500, 1501, 1502, 1503, + 1520, 1505, 1506, 1515, 1521, 1511, 1512, 1513, + 1492, 917, 938, 1493, 1494, 1495, 1496, 1497, + 1498, 1499, 1500, 1501, 1502, 1503, 1522, 1505, + 1506, 1515, 1523, 1511, 1512, 1513, 1492, 917, + 938, 1493, 1494, 1495, 1496, 1497, 1498, 1499, + 1500, 1501, 1502, 1503, 1524, 1505, 1506, 1515, + 1525, 1511, 1512, 1513, 1492, 1119, 1121, 1527, + 1528, 1529, 1530, 1531, 1532, 1533, 1534, 1535, + 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, + 1544, 1526, 1327, 1348, 1546, 1547, 1548, 1549, + 1550, 1551, 1552, 1553, 1554, 1555, 1556, 1557, + 1558, 1559, 1560, 1561, 1562, 1563, 1545, 1327, + 1348, 1546, 1547, 1548, 1549, 1550, 1551, 1552, + 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, + 1561, 1564, 1563, 1545, 1565, 1327, 1348, 1546, + 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, + 1555, 1556, 1557, 1566, 1567, 1560, 1561, 1568, + 1563, 1545, +} + +var _graphclust_trans_targs []int16 = []int16{ + 1528, 0, 1528, 1529, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, + 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 66, 67, 68, + 69, 70, 72, 73, 75, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, 86, + 87, 88, 89, 91, 92, 94, 102, 134, + 139, 141, 148, 153, 95, 96, 97, 98, + 99, 100, 101, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 135, 136, 137, 138, 140, 142, + 143, 144, 145, 146, 147, 149, 150, 151, + 152, 154, 156, 157, 158, 2, 159, 3, + 1528, 1530, 1528, 1528, 175, 176, 177, 178, + 179, 180, 181, 182, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 202, + 204, 205, 206, 207, 208, 209, 210, 211, + 212, 213, 214, 215, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 226, 231, 250, + 251, 252, 1531, 229, 230, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 254, + 255, 256, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, + 272, 274, 275, 277, 285, 317, 322, 324, + 331, 336, 278, 279, 280, 281, 282, 283, + 284, 286, 287, 288, 289, 290, 291, 292, + 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, 308, + 309, 310, 311, 312, 313, 314, 315, 316, + 318, 319, 320, 321, 323, 325, 326, 327, + 328, 329, 330, 332, 333, 334, 335, 162, + 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, + 353, 354, 356, 357, 163, 359, 361, 362, + 1532, 1528, 1533, 377, 378, 379, 380, 381, + 382, 383, 384, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, 400, 401, 402, 403, 404, 406, + 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, 418, 419, 420, 421, 422, + 423, 424, 425, 426, 428, 429, 430, 431, + 432, 434, 435, 437, 438, 439, 440, 441, + 442, 443, 444, 445, 446, 447, 448, 449, + 450, 451, 453, 454, 456, 464, 496, 501, + 503, 510, 515, 457, 458, 459, 460, 461, + 462, 463, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 476, 477, 478, + 479, 480, 481, 482, 483, 484, 485, 486, + 487, 488, 489, 490, 491, 492, 493, 494, + 495, 497, 498, 499, 500, 502, 504, 505, + 506, 507, 508, 509, 511, 512, 513, 514, + 516, 518, 519, 520, 364, 521, 365, 1534, + 537, 538, 539, 540, 541, 542, 543, 544, + 545, 546, 547, 548, 549, 550, 551, 552, + 553, 554, 555, 556, 557, 558, 559, 560, + 561, 562, 563, 564, 566, 567, 568, 569, + 570, 571, 572, 573, 574, 575, 576, 577, + 578, 579, 580, 581, 582, 583, 584, 585, + 586, 588, 593, 612, 613, 614, 1535, 591, + 592, 594, 595, 596, 597, 598, 599, 600, + 601, 602, 603, 604, 605, 606, 607, 608, + 609, 610, 611, 616, 617, 618, 620, 621, + 622, 623, 624, 625, 626, 627, 628, 629, + 630, 631, 632, 633, 634, 636, 637, 639, + 647, 679, 684, 686, 693, 698, 640, 641, + 642, 643, 644, 645, 646, 648, 649, 650, + 651, 652, 653, 654, 655, 656, 657, 658, + 659, 660, 661, 662, 663, 664, 665, 666, + 667, 668, 669, 670, 671, 672, 673, 674, + 675, 676, 677, 678, 680, 681, 682, 683, + 685, 687, 688, 689, 690, 691, 692, 694, + 695, 696, 697, 524, 699, 700, 701, 702, + 703, 704, 705, 706, 707, 708, 709, 710, + 711, 712, 713, 714, 715, 716, 718, 719, + 525, 721, 723, 724, 522, 729, 730, 732, + 734, 737, 740, 764, 1536, 746, 1537, 736, + 1538, 739, 742, 744, 745, 748, 749, 753, + 754, 755, 756, 757, 758, 759, 1539, 752, + 763, 766, 767, 768, 769, 770, 771, 772, + 773, 774, 775, 776, 777, 778, 779, 780, + 781, 782, 783, 785, 786, 789, 790, 791, + 792, 793, 794, 795, 796, 800, 801, 803, + 804, 787, 806, 813, 815, 817, 819, 807, + 808, 809, 810, 811, 812, 814, 816, 818, + 820, 821, 822, 823, 827, 828, 829, 830, + 831, 832, 833, 834, 835, 836, 837, 838, + 839, 840, 1540, 825, 826, 843, 844, 160, + 848, 849, 851, 1054, 1057, 1060, 1084, 1541, + 1528, 1542, 865, 866, 867, 868, 869, 870, + 871, 872, 873, 874, 875, 876, 877, 878, + 879, 880, 881, 882, 883, 884, 885, 886, + 887, 888, 889, 890, 891, 892, 894, 895, + 896, 897, 898, 899, 900, 901, 902, 903, + 904, 905, 906, 907, 908, 909, 910, 911, + 912, 913, 914, 916, 921, 940, 941, 942, + 1543, 919, 920, 922, 923, 924, 925, 926, + 927, 928, 929, 930, 931, 932, 933, 934, + 935, 936, 937, 938, 939, 944, 945, 946, + 948, 949, 950, 951, 952, 953, 954, 955, + 956, 957, 958, 959, 960, 961, 962, 964, + 965, 967, 975, 1007, 1012, 1014, 1021, 1026, + 968, 969, 970, 971, 972, 973, 974, 976, + 977, 978, 979, 980, 981, 982, 983, 984, + 985, 986, 987, 988, 989, 990, 991, 992, + 993, 994, 995, 996, 997, 998, 999, 1000, + 1001, 1002, 1003, 1004, 1005, 1006, 1008, 1009, + 1010, 1011, 1013, 1015, 1016, 1017, 1018, 1019, + 1020, 1022, 1023, 1024, 1025, 852, 1027, 1028, + 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, + 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, + 1046, 1047, 853, 1049, 1051, 1052, 1066, 1544, + 1056, 1545, 1059, 1062, 1064, 1065, 1068, 1069, + 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1546, + 1072, 1083, 1086, 1245, 1246, 1247, 1248, 1249, + 1250, 1251, 1252, 1253, 1254, 1255, 1256, 1257, + 1258, 1259, 1260, 1261, 1547, 1528, 1100, 1101, + 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, + 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, + 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125, + 1126, 1127, 1129, 1130, 1131, 1132, 1133, 1134, + 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, + 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1151, + 1152, 1153, 1154, 1155, 1157, 1158, 1160, 1161, + 1162, 1163, 1164, 1165, 1166, 1167, 1168, 1169, + 1170, 1171, 1172, 1173, 1174, 1176, 1177, 1179, + 1187, 1219, 1224, 1226, 1233, 1238, 1180, 1181, + 1182, 1183, 1184, 1185, 1186, 1188, 1189, 1190, + 1191, 1192, 1193, 1194, 1195, 1196, 1197, 1198, + 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, + 1207, 1208, 1209, 1210, 1211, 1212, 1213, 1214, + 1215, 1216, 1217, 1218, 1220, 1221, 1222, 1223, + 1225, 1227, 1228, 1229, 1230, 1231, 1232, 1234, + 1235, 1236, 1237, 1239, 1241, 1242, 1243, 1087, + 1244, 1088, 1263, 1264, 1267, 1268, 1269, 1270, + 1271, 1272, 1273, 1274, 1278, 1279, 1281, 1282, + 1265, 1284, 1291, 1293, 1295, 1297, 1285, 1286, + 1287, 1288, 1289, 1290, 1292, 1294, 1296, 1298, + 1299, 1300, 1301, 1506, 1507, 1508, 1509, 1510, + 1511, 1512, 1513, 1514, 1515, 1516, 1517, 1518, + 1519, 1548, 1528, 1549, 1315, 1316, 1317, 1318, + 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, + 1327, 1328, 1329, 1330, 1331, 1332, 1333, 1334, + 1335, 1336, 1337, 1338, 1339, 1340, 1341, 1342, + 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, + 1352, 1353, 1354, 1355, 1356, 1357, 1358, 1359, + 1360, 1361, 1362, 1363, 1364, 1366, 1371, 1390, + 1391, 1392, 1550, 1369, 1370, 1372, 1373, 1374, + 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1382, + 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1394, + 1395, 1396, 1398, 1399, 1400, 1401, 1402, 1403, + 1404, 1405, 1406, 1407, 1408, 1409, 1410, 1411, + 1412, 1414, 1415, 1417, 1425, 1457, 1462, 1464, + 1471, 1476, 1418, 1419, 1420, 1421, 1422, 1423, + 1424, 1426, 1427, 1428, 1429, 1430, 1431, 1432, + 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1440, + 1441, 1442, 1443, 1444, 1445, 1446, 1447, 1448, + 1449, 1450, 1451, 1452, 1453, 1454, 1455, 1456, + 1458, 1459, 1460, 1461, 1463, 1465, 1466, 1467, + 1468, 1469, 1470, 1472, 1473, 1474, 1475, 1302, + 1477, 1478, 1479, 1480, 1481, 1482, 1483, 1484, + 1485, 1486, 1487, 1488, 1489, 1490, 1491, 1492, + 1493, 1494, 1496, 1497, 1303, 1499, 1501, 1502, + 1504, 1505, 1522, 1523, 1524, 1525, 1526, 1527, + 1528, 1, 1529, 160, 161, 363, 845, 846, + 847, 850, 1085, 1262, 1265, 1266, 1275, 1276, + 1277, 1280, 1283, 1520, 1521, 1528, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, + 14, 43, 65, 71, 74, 90, 93, 155, + 1528, 164, 165, 166, 167, 168, 169, 170, + 171, 172, 173, 174, 203, 225, 358, 257, + 273, 360, 355, 227, 228, 253, 276, 1528, + 523, 725, 726, 727, 728, 731, 765, 784, + 788, 797, 798, 799, 802, 805, 841, 842, + 366, 367, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 405, 427, 433, 436, 452, + 455, 517, 526, 527, 528, 529, 530, 531, + 532, 533, 534, 535, 536, 565, 587, 720, + 619, 635, 722, 717, 589, 590, 615, 638, + 733, 747, 760, 761, 762, 735, 743, 738, + 741, 750, 751, 824, 1528, 854, 855, 856, + 857, 858, 859, 860, 861, 862, 863, 864, + 1053, 915, 1048, 1067, 1080, 1081, 1082, 963, + 1050, 1045, 893, 947, 917, 918, 943, 966, + 1055, 1063, 1058, 1061, 1070, 1071, 1528, 1089, + 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, + 1098, 1099, 1128, 1150, 1156, 1159, 1175, 1178, + 1240, 1528, 1304, 1305, 1306, 1307, 1308, 1309, + 1310, 1311, 1312, 1313, 1314, 1343, 1365, 1498, + 1397, 1413, 1503, 1495, 1500, 1367, 1368, 1393, + 1416, +} + +var _graphclust_trans_actions []byte = []byte{ + 31, 0, 27, 40, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 34, 55, 29, 19, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 55, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 40, 25, 40, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 40, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 40, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 40, 0, 40, 0, + 40, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 40, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 40, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 51, + 17, 40, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 40, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 51, + 0, 51, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 40, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 40, 21, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 40, 23, 40, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 40, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 43, 1, 47, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 15, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 7, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 13, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 5, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 9, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 11, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, +} + +var _graphclust_to_state_actions []byte = []byte{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 37, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, +} + +var _graphclust_from_state_actions []byte = []byte{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 3, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, +} + +var _graphclust_eof_trans []int16 = []int16{ + 0, 0, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, + 0, 0, 147, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 147, 148, 147, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 147, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 148, 148, 148, 148, 148, + 148, 148, 148, 0, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 330, 330, 330, + 330, 330, 330, 330, 330, 0, 0, 0, + 0, 0, 0, 147, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 147, 761, + 761, 147, 761, 761, 147, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 761, + 761, 761, 761, 761, 761, 761, 761, 147, + 761, 761, 761, 761, 0, 0, 0, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 982, 982, 982, + 982, 982, 982, 982, 982, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 1171, 1171, 1171, 1171, 1171, 1171, + 1171, 1171, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1382, 1401, 1401, 1424, 1424, 1424, 1424, + 1424, 1424, 1424, 1424, 1424, 1493, 1493, 1493, + 1493, 1493, 1493, 1527, 1546, 1546, 1546, +} + +const graphclust_start int = 1528 +const graphclust_first_final int = 1528 +const graphclust_error int = 0 + +const graphclust_en_main int = 1528 + +//line grapheme_clusters.rl:14 + +var Error = errors.New("invalid UTF8 text") + +// ScanGraphemeClusters is a split function for bufio.Scanner that splits +// on grapheme cluster boundaries. +func ScanGraphemeClusters(data []byte, atEOF bool) (int, []byte, error) { + if len(data) == 0 { + return 0, nil, nil + } + + // Ragel state + cs := 0 // Current State + p := 0 // "Pointer" into data + pe := len(data) // End-of-data "pointer" + ts := 0 + te := 0 + act := 0 + eof := pe + + // Make Go compiler happy + _ = ts + _ = te + _ = act + _ = eof + + startPos := 0 + endPos := 0 + +//line grapheme_clusters.go:3787 + { + cs = graphclust_start + ts = 0 + te = 0 + act = 0 + } + +//line grapheme_clusters.go:3795 + { + var _klen int + var _trans int + var _acts int + var _nacts uint + var _keys int + if p == pe { + goto _test_eof + } + if cs == 0 { + goto _out + } + _resume: + _acts = int(_graphclust_from_state_actions[cs]) + _nacts = uint(_graphclust_actions[_acts]) + _acts++ + for ; _nacts > 0; _nacts-- { + _acts++ + switch _graphclust_actions[_acts-1] { + case 4: +//line NONE:1 + ts = p + +//line grapheme_clusters.go:3818 + } + } + + _keys = int(_graphclust_key_offsets[cs]) + _trans = int(_graphclust_index_offsets[cs]) + + _klen = int(_graphclust_single_lengths[cs]) + if _klen > 0 { + _lower := int(_keys) + var _mid int + _upper := int(_keys + _klen - 1) + for { + if _upper < _lower { + break + } + + _mid = _lower + ((_upper - _lower) >> 1) + switch { + case data[p] < _graphclust_trans_keys[_mid]: + _upper = _mid - 1 + case data[p] > _graphclust_trans_keys[_mid]: + _lower = _mid + 1 + default: + _trans += int(_mid - int(_keys)) + goto _match + } + } + _keys += _klen + _trans += _klen + } + + _klen = int(_graphclust_range_lengths[cs]) + if _klen > 0 { + _lower := int(_keys) + var _mid int + _upper := int(_keys + (_klen << 1) - 2) + for { + if _upper < _lower { + break + } + + _mid = _lower + (((_upper - _lower) >> 1) & ^1) + switch { + case data[p] < _graphclust_trans_keys[_mid]: + _upper = _mid - 2 + case data[p] > _graphclust_trans_keys[_mid+1]: + _lower = _mid + 2 + default: + _trans += int((_mid - int(_keys)) >> 1) + goto _match + } + } + _trans += _klen + } + + _match: + _trans = int(_graphclust_indicies[_trans]) + _eof_trans: + cs = int(_graphclust_trans_targs[_trans]) + + if _graphclust_trans_actions[_trans] == 0 { + goto _again + } + + _acts = int(_graphclust_trans_actions[_trans]) + _nacts = uint(_graphclust_actions[_acts]) + _acts++ + for ; _nacts > 0; _nacts-- { + _acts++ + switch _graphclust_actions[_acts-1] { + case 0: +//line grapheme_clusters.rl:47 + + startPos = p + + case 1: +//line grapheme_clusters.rl:51 + + endPos = p + + case 5: +//line NONE:1 + te = p + 1 + + case 6: +//line grapheme_clusters.rl:55 + act = 3 + case 7: +//line grapheme_clusters.rl:55 + act = 4 + case 8: +//line grapheme_clusters.rl:55 + te = p + 1 + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 9: +//line grapheme_clusters.rl:55 + te = p + 1 + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 10: +//line grapheme_clusters.rl:55 + te = p + p-- + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 11: +//line grapheme_clusters.rl:55 + te = p + p-- + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 12: +//line grapheme_clusters.rl:55 + te = p + p-- + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 13: +//line grapheme_clusters.rl:55 + te = p + p-- + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 14: +//line grapheme_clusters.rl:55 + te = p + p-- + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 15: +//line grapheme_clusters.rl:55 + te = p + p-- + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 16: +//line grapheme_clusters.rl:55 + p = (te) - 1 + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 17: +//line grapheme_clusters.rl:55 + p = (te) - 1 + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 18: +//line grapheme_clusters.rl:55 + p = (te) - 1 + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 19: +//line grapheme_clusters.rl:55 + p = (te) - 1 + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 20: +//line grapheme_clusters.rl:55 + p = (te) - 1 + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 21: +//line grapheme_clusters.rl:55 + p = (te) - 1 + { + return endPos + 1, data[startPos : endPos+1], nil + } + case 22: +//line NONE:1 + switch act { + case 0: + { + cs = 0 + goto _again + } + case 3: + { + p = (te) - 1 + + return endPos + 1, data[startPos : endPos+1], nil + } + case 4: + { + p = (te) - 1 + + return endPos + 1, data[startPos : endPos+1], nil + } + } + +//line grapheme_clusters.go:4017 + } + } + + _again: + _acts = int(_graphclust_to_state_actions[cs]) + _nacts = uint(_graphclust_actions[_acts]) + _acts++ + for ; _nacts > 0; _nacts-- { + _acts++ + switch _graphclust_actions[_acts-1] { + case 2: +//line NONE:1 + ts = 0 + + case 3: +//line NONE:1 + act = 0 + +//line grapheme_clusters.go:4035 + } + } + + if cs == 0 { + goto _out + } + p++ + if p != pe { + goto _resume + } + _test_eof: + { + } + if p == eof { + if _graphclust_eof_trans[cs] > 0 { + _trans = int(_graphclust_eof_trans[cs] - 1) + goto _eof_trans + } + } + + _out: + { + } + } + +//line grapheme_clusters.rl:117 + + // If we fall out here then we were unable to complete a sequence. + // If we weren't able to complete a sequence then either we've + // reached the end of a partial buffer (so there's more data to come) + // or we have an isolated symbol that would normally be part of a + // grapheme cluster but has appeared in isolation here. + + if !atEOF { + // Request more + return 0, nil, nil + } + + // Just take the first UTF-8 sequence and return that. + _, seqLen := utf8.DecodeRune(data) + return seqLen, data[:seqLen], nil +} diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.rl b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/grapheme_clusters.rl similarity index 92% rename from awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.rl rename to awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/grapheme_clusters.rl index 003ffbf59480..737db18b292a 100644 --- a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.rl +++ b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/grapheme_clusters.rl @@ -42,6 +42,7 @@ func ScanGraphemeClusters(data []byte, atEOF bool) (int, []byte, error) { %%{ include GraphemeCluster "grapheme_clusters_table.rl"; + include Emoji "emoji_table.rl"; action start { startPos = p @@ -55,7 +56,7 @@ func ScanGraphemeClusters(data []byte, atEOF bool) (int, []byte, error) { return endPos+1, data[startPos:endPos+1], nil } - ZWJGlue = ZWJ (Glue_After_Zwj | E_Base_GAZ Extend* E_Modifier?)?; + ZWJGlue = ZWJ (Extended_Pictographic Extend*)?; AnyExtender = Extend | ZWJGlue | SpacingMark; Extension = AnyExtender*; ReplacementChar = (0xEF 0xBF 0xBD); @@ -69,8 +70,8 @@ func ScanGraphemeClusters(data []byte, atEOF bool) (int, []byte, error) { LVT T* | T+ ) Extension; - EmojiSeq = (E_Base | E_Base_GAZ) Extend* E_Modifier? Extension; - ZWJSeq = ZWJGlue Extension; + EmojiSeq = Extended_Pictographic Extend* Extension; + ZWJSeq = ZWJ (ZWJ | Extend | SpacingMark)*; EmojiFlagSeq = Regional_Indicator Regional_Indicator? Extension; UTF8Cont = 0x80 .. 0xBF; @@ -82,7 +83,7 @@ func ScanGraphemeClusters(data []byte, atEOF bool) (int, []byte, error) { ); # OtherSeq is any character that isn't at the start of one of the extended sequences above, followed by extension - OtherSeq = (AnyUTF8 - (CR|LF|Control|ReplacementChar|L|LV|V|LVT|T|E_Base|E_Base_GAZ|ZWJ|Regional_Indicator|Prepend)) Extension; + OtherSeq = (AnyUTF8 - (CR|LF|Control|ReplacementChar|L|LV|V|LVT|T|Extended_Pictographic|ZWJ|Regional_Indicator|Prepend)) (Extend | ZWJ | SpacingMark)*; # PrependSeq is prepend followed by any of the other patterns above, except control characters which explicitly break PrependSeq = Prepend+ (HangulSeq|EmojiSeq|ZWJSeq|EmojiFlagSeq|OtherSeq)?; @@ -129,4 +130,4 @@ func ScanGraphemeClusters(data []byte, atEOF bool) (int, []byte, error) { // Just take the first UTF-8 sequence and return that. _, seqLen := utf8.DecodeRune(data) return seqLen, data[:seqLen], nil -} +} \ No newline at end of file diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters_table.rl b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/grapheme_clusters_table.rl similarity index 95% rename from awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters_table.rl rename to awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/grapheme_clusters_table.rl index fb4511825c60..5e4b5881de28 100644 --- a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters_table.rl +++ b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/grapheme_clusters_table.rl @@ -1,7 +1,7 @@ # The following Ragel file was autogenerated with unicode2ragel.rb -# from: http://www.unicode.org/Public/9.0.0/ucd/auxiliary/GraphemeBreakProperty.txt +# from: https://www.unicode.org/Public/12.0.0/ucd/auxiliary/GraphemeBreakProperty.txt # -# It defines ["Prepend", "CR", "LF", "Control", "Extend", "Regional_Indicator", "SpacingMark", "L", "V", "T", "LV", "LVT", "E_Base", "E_Modifier", "ZWJ", "Glue_After_Zwj", "E_Base_GAZ"]. +# It defines ["Prepend", "CR", "LF", "Control", "Extend", "Regional_Indicator", "SpacingMark", "L", "V", "T", "LV", "LVT", "ZWJ"]. # # To use this, make sure that your alphtype is set to byte, # and that your input is in utf8. @@ -16,7 +16,11 @@ | 0xE0 0xA3 0xA2 #Cf ARABIC DISPUTED END OF AYAH | 0xE0 0xB5 0x8E #Lo MALAYALAM LETTER DOT REPH | 0xF0 0x91 0x82 0xBD #Cf KAITHI NUMBER SIGN + | 0xF0 0x91 0x83 0x8D #Cf KAITHI NUMBER SIGN ABOVE | 0xF0 0x91 0x87 0x82..0x83 #Lo [2] SHARADA SIGN JIHVAMULIYA..SHARA... + | 0xF0 0x91 0xA8 0xBA #Lo ZANABAZAR SQUARE CLUSTER-INITIAL L... + | 0xF0 0x91 0xAA 0x84..0x89 #Lo [6] SOYOMBO SIGN JIHVAMULIYA..SOYOM... + | 0xF0 0x91 0xB5 0x86 #Lo MASARAM GONDI REPHA ; CR = @@ -44,12 +48,10 @@ | 0xE2 0x81 0xA0..0xA4 #Cf [5] WORD JOINER..INVISIBLE PLUS | 0xE2 0x81 0xA5 #Cn | 0xE2 0x81 0xA6..0xAF #Cf [10] LEFT-TO-RIGHT ISOLATE..NOMINAL DIG... - | 0xED 0xA0 0x80..0xFF #Cs [2048] .... | 0xEF 0xBF 0xB9..0xBB #Cf [3] INTERLINEAR ANNOTATION ANCHOR..INT... + | 0xF0 0x93 0x90 0xB0..0xB8 #Cf [9] EGYPTIAN HIEROGLYPH VERTICAL JO... | 0xF0 0x9B 0xB2 0xA0..0xA3 #Cf [4] SHORTHAND FORMAT LETTER OVERLAP... | 0xF0 0x9D 0x85 0xB3..0xBA #Cf [8] MUSICAL SYMBOL BEGIN BEAM..MUSI... | 0xF3 0xA0 0x80 0x80 #Cn @@ -84,12 +86,13 @@ | 0xDD 0x00..0x8A # | 0xDE 0xA6..0xB0 #Mn [11] THAANA ABAFILI..THAANA SUKUN | 0xDF 0xAB..0xB3 #Mn [9] NKO COMBINING SHORT HIGH TONE..NKO... + | 0xDF 0xBD #Mn NKO DANTAYALAN | 0xE0 0xA0 0x96..0x99 #Mn [4] SAMARITAN MARK IN..SAMARITAN MARK ... | 0xE0 0xA0 0x9B..0xA3 #Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAM... | 0xE0 0xA0 0xA5..0xA7 #Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMA... | 0xE0 0xA0 0xA9..0xAD #Mn [5] SAMARITAN VOWEL SIGN LONG I..SAMAR... | 0xE0 0xA1 0x99..0x9B #Mn [3] MANDAIC AFFRICATION MARK..MANDAIC ... - | 0xE0 0xA3 0x94..0xA1 #Mn [14] ARABIC SMALL HIGH WORD AR-RUB..ARA... + | 0xE0 0xA3 0x93..0xA1 #Mn [15] ARABIC SMALL LOW WAW..ARABIC SMALL... | 0xE0 0xA3 0xA3..0xFF #Mn [32] ARABIC TURNED DAMMA BELOW..DEVANAG... | 0xE0 0xA4 0x00..0x82 # | 0xE0 0xA4 0xBA #Mn DEVANAGARI VOWEL SIGN OE @@ -105,6 +108,7 @@ | 0xE0 0xA7 0x8D #Mn BENGALI SIGN VIRAMA | 0xE0 0xA7 0x97 #Mc BENGALI AU LENGTH MARK | 0xE0 0xA7 0xA2..0xA3 #Mn [2] BENGALI VOWEL SIGN VOCALIC L..BENG... + | 0xE0 0xA7 0xBE #Mn BENGALI SANDHI MARK | 0xE0 0xA8 0x81..0x82 #Mn [2] GURMUKHI SIGN ADAK BINDI..GURMUKHI... | 0xE0 0xA8 0xBC #Mn GURMUKHI SIGN NUKTA | 0xE0 0xA9 0x81..0x82 #Mn [2] GURMUKHI VOWEL SIGN U..GURMUKHI VO... @@ -119,6 +123,7 @@ | 0xE0 0xAB 0x87..0x88 #Mn [2] GUJARATI VOWEL SIGN E..GUJARATI VO... | 0xE0 0xAB 0x8D #Mn GUJARATI SIGN VIRAMA | 0xE0 0xAB 0xA2..0xA3 #Mn [2] GUJARATI VOWEL SIGN VOCALIC L..GUJ... + | 0xE0 0xAB 0xBA..0xBF #Mn [6] GUJARATI SIGN SUKUN..GUJARATI SIGN... | 0xE0 0xAC 0x81 #Mn ORIYA SIGN CANDRABINDU | 0xE0 0xAC 0xBC #Mn ORIYA SIGN NUKTA | 0xE0 0xAC 0xBE #Mc ORIYA VOWEL SIGN AA @@ -134,6 +139,7 @@ | 0xE0 0xAF 0x8D #Mn TAMIL SIGN VIRAMA | 0xE0 0xAF 0x97 #Mc TAMIL AU LENGTH MARK | 0xE0 0xB0 0x80 #Mn TELUGU SIGN COMBINING CANDRABINDU ... + | 0xE0 0xB0 0x84 #Mn TELUGU SIGN COMBINING ANUSVARA ABOVE | 0xE0 0xB0 0xBE..0xFF #Mn [3] TELUGU VOWEL SIGN AA..TELUGU VOWEL... | 0xE0 0xB1 0x00..0x80 # | 0xE0 0xB1 0x86..0x88 #Mn [3] TELUGU VOWEL SIGN E..TELUGU VOWEL ... @@ -148,7 +154,8 @@ | 0xE0 0xB3 0x8C..0x8D #Mn [2] KANNADA VOWEL SIGN AU..KANNADA SIG... | 0xE0 0xB3 0x95..0x96 #Mc [2] KANNADA LENGTH MARK..KANNADA AI LE... | 0xE0 0xB3 0xA2..0xA3 #Mn [2] KANNADA VOWEL SIGN VOCALIC L..KANN... - | 0xE0 0xB4 0x81 #Mn MALAYALAM SIGN CANDRABINDU + | 0xE0 0xB4 0x80..0x81 #Mn [2] MALAYALAM SIGN COMBINING ANUSVARA ... + | 0xE0 0xB4 0xBB..0xBC #Mn [2] MALAYALAM SIGN VERTICAL BAR VIRAMA... | 0xE0 0xB4 0xBE #Mc MALAYALAM VOWEL SIGN AA | 0xE0 0xB5 0x81..0x84 #Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM ... | 0xE0 0xB5 0x8D #Mn MALAYALAM SIGN VIRAMA @@ -163,8 +170,7 @@ | 0xE0 0xB8 0xB4..0xBA #Mn [7] THAI CHARACTER SARA I..THAI CHARAC... | 0xE0 0xB9 0x87..0x8E #Mn [8] THAI CHARACTER MAITAIKHU..THAI CHA... | 0xE0 0xBA 0xB1 #Mn LAO VOWEL SIGN MAI KAN - | 0xE0 0xBA 0xB4..0xB9 #Mn [6] LAO VOWEL SIGN I..LAO VOWEL SIGN UU - | 0xE0 0xBA 0xBB..0xBC #Mn [2] LAO VOWEL SIGN MAI KON..LAO SEMIVO... + | 0xE0 0xBA 0xB4..0xBC #Mn [9] LAO VOWEL SIGN I..LAO SEMIVOWEL SI... | 0xE0 0xBB 0x88..0x8D #Mn [6] LAO TONE MAI EK..LAO NIGGAHITA | 0xE0 0xBC 0x98..0x99 #Mn [2] TIBETAN ASTROLOGICAL SIGN -KHYUD P... | 0xE0 0xBC 0xB5 #Mn TIBETAN MARK NGAS BZUNG NYI ZLA @@ -217,6 +223,7 @@ | 0xE1 0xAA 0xBE #Me COMBINING PARENTHESES OVERLAY | 0xE1 0xAC 0x80..0x83 #Mn [4] BALINESE SIGN ULU RICEM..BALINESE ... | 0xE1 0xAC 0xB4 #Mn BALINESE SIGN REREKAN + | 0xE1 0xAC 0xB5 #Mc BALINESE VOWEL SIGN TEDUNG | 0xE1 0xAC 0xB6..0xBA #Mn [5] BALINESE VOWEL SIGN ULU..BALINESE ... | 0xE1 0xAC 0xBC #Mn BALINESE VOWEL SIGN LA LENGA | 0xE1 0xAD 0x82 #Mn BALINESE VOWEL SIGN PEPET @@ -237,7 +244,7 @@ | 0xE1 0xB3 0xAD #Mn VEDIC SIGN TIRYAK | 0xE1 0xB3 0xB4 #Mn VEDIC TONE CANDRA ABOVE | 0xE1 0xB3 0xB8..0xB9 #Mn [2] VEDIC TONE RING ABOVE..VEDIC TONE ... - | 0xE1 0xB7 0x80..0xB5 #Mn [54] COMBINING DOTTED GRAVE ACCENT..COM... + | 0xE1 0xB7 0x80..0xB9 #Mn [58] COMBINING DOTTED GRAVE ACCENT..COM... | 0xE1 0xB7 0xBB..0xBF #Mn [5] COMBINING DELETION MARK..COMBINING... | 0xE2 0x80 0x8C #Cf ZERO WIDTH NON-JOINER | 0xE2 0x83 0x90..0x9C #Mn [13] COMBINING LEFT HARPOON ABOVE..COMB... @@ -262,12 +269,13 @@ | 0xEA 0xA0 0xA5..0xA6 #Mn [2] SYLOTI NAGRI VOWEL SIGN U..SYLOTI ... | 0xEA 0xA3 0x84..0x85 #Mn [2] SAURASHTRA SIGN VIRAMA..SAURASHTRA... | 0xEA 0xA3 0xA0..0xB1 #Mn [18] COMBINING DEVANAGARI DIGIT ZERO..C... + | 0xEA 0xA3 0xBF #Mn DEVANAGARI VOWEL SIGN AY | 0xEA 0xA4 0xA6..0xAD #Mn [8] KAYAH LI VOWEL UE..KAYAH LI TONE C... | 0xEA 0xA5 0x87..0x91 #Mn [11] REJANG VOWEL SIGN I..REJANG CONSON... | 0xEA 0xA6 0x80..0x82 #Mn [3] JAVANESE SIGN PANYANGGA..JAVANESE ... | 0xEA 0xA6 0xB3 #Mn JAVANESE SIGN CECAK TELU | 0xEA 0xA6 0xB6..0xB9 #Mn [4] JAVANESE VOWEL SIGN WULU..JAVANESE... - | 0xEA 0xA6 0xBC #Mn JAVANESE VOWEL SIGN PEPET + | 0xEA 0xA6 0xBC..0xBD #Mn [2] JAVANESE VOWEL SIGN PEPET..JAVANES... | 0xEA 0xA7 0xA5 #Mn MYANMAR SIGN SHAN SAW | 0xEA 0xA8 0xA9..0xAE #Mn [6] CHAM VOWEL SIGN AA..CHAM VOWEL SIG... | 0xEA 0xA8 0xB1..0xB2 #Mn [2] CHAM VOWEL SIGN AU..CHAM VOWEL SIG... @@ -298,6 +306,8 @@ | 0xF0 0x90 0xA8 0xB8..0xBA #Mn [3] KHAROSHTHI SIGN BAR ABOVE..KHAR... | 0xF0 0x90 0xA8 0xBF #Mn KHAROSHTHI VIRAMA | 0xF0 0x90 0xAB 0xA5..0xA6 #Mn [2] MANICHAEAN ABBREVIATION MARK AB... + | 0xF0 0x90 0xB4 0xA4..0xA7 #Mn [4] HANIFI ROHINGYA SIGN HARBAHAY..... + | 0xF0 0x90 0xBD 0x86..0x90 #Mn [11] SOGDIAN COMBINING DOT BELOW..SO... | 0xF0 0x91 0x80 0x81 #Mn BRAHMI SIGN ANUSVARA | 0xF0 0x91 0x80 0xB8..0xFF #Mn [15] BRAHMI VOWEL SIGN AA..BRAHMI VI... | 0xF0 0x91 0x81 0x00..0x86 # @@ -311,7 +321,7 @@ | 0xF0 0x91 0x85 0xB3 #Mn MAHAJANI SIGN NUKTA | 0xF0 0x91 0x86 0x80..0x81 #Mn [2] SHARADA SIGN CANDRABINDU..SHARA... | 0xF0 0x91 0x86 0xB6..0xBE #Mn [9] SHARADA VOWEL SIGN U..SHARADA V... - | 0xF0 0x91 0x87 0x8A..0x8C #Mn [3] SHARADA SIGN NUKTA..SHARADA EXT... + | 0xF0 0x91 0x87 0x89..0x8C #Mn [4] SHARADA SANDHI MARK..SHARADA EX... | 0xF0 0x91 0x88 0xAF..0xB1 #Mn [3] KHOJKI VOWEL SIGN U..KHOJKI VOW... | 0xF0 0x91 0x88 0xB4 #Mn KHOJKI SIGN ANUSVARA | 0xF0 0x91 0x88 0xB6..0xB7 #Mn [2] KHOJKI SIGN NUKTA..KHOJKI SIGN ... @@ -319,7 +329,7 @@ | 0xF0 0x91 0x8B 0x9F #Mn KHUDAWADI SIGN ANUSVARA | 0xF0 0x91 0x8B 0xA3..0xAA #Mn [8] KHUDAWADI VOWEL SIGN U..KHUDAWA... | 0xF0 0x91 0x8C 0x80..0x81 #Mn [2] GRANTHA SIGN COMBINING ANUSVARA... - | 0xF0 0x91 0x8C 0xBC #Mn GRANTHA SIGN NUKTA + | 0xF0 0x91 0x8C 0xBB..0xBC #Mn [2] COMBINING BINDU BELOW..GRANTHA ... | 0xF0 0x91 0x8C 0xBE #Mc GRANTHA VOWEL SIGN AA | 0xF0 0x91 0x8D 0x80 #Mn GRANTHA VOWEL SIGN II | 0xF0 0x91 0x8D 0x97 #Mc GRANTHA AU LENGTH MARK @@ -328,6 +338,7 @@ | 0xF0 0x91 0x90 0xB8..0xBF #Mn [8] NEWA VOWEL SIGN U..NEWA VOWEL S... | 0xF0 0x91 0x91 0x82..0x84 #Mn [3] NEWA SIGN VIRAMA..NEWA SIGN ANU... | 0xF0 0x91 0x91 0x86 #Mn NEWA SIGN NUKTA + | 0xF0 0x91 0x91 0x9E #Mn NEWA SANDHI MARK | 0xF0 0x91 0x92 0xB0 #Mc TIRHUTA VOWEL SIGN AA | 0xF0 0x91 0x92 0xB3..0xB8 #Mn [6] TIRHUTA VOWEL SIGN U..TIRHUTA V... | 0xF0 0x91 0x92 0xBA #Mn TIRHUTA VOWEL SIGN SHORT E @@ -352,6 +363,19 @@ | 0xF0 0x91 0x9C 0x9D..0x9F #Mn [3] AHOM CONSONANT SIGN MEDIAL LA..... | 0xF0 0x91 0x9C 0xA2..0xA5 #Mn [4] AHOM VOWEL SIGN I..AHOM VOWEL S... | 0xF0 0x91 0x9C 0xA7..0xAB #Mn [5] AHOM VOWEL SIGN AW..AHOM SIGN K... + | 0xF0 0x91 0xA0 0xAF..0xB7 #Mn [9] DOGRA VOWEL SIGN U..DOGRA SIGN ... + | 0xF0 0x91 0xA0 0xB9..0xBA #Mn [2] DOGRA SIGN VIRAMA..DOGRA SIGN N... + | 0xF0 0x91 0xA7 0x94..0x97 #Mn [4] NANDINAGARI VOWEL SIGN U..NANDI... + | 0xF0 0x91 0xA7 0x9A..0x9B #Mn [2] NANDINAGARI VOWEL SIGN E..NANDI... + | 0xF0 0x91 0xA7 0xA0 #Mn NANDINAGARI SIGN VIRAMA + | 0xF0 0x91 0xA8 0x81..0x8A #Mn [10] ZANABAZAR SQUARE VOWEL SIGN I..... + | 0xF0 0x91 0xA8 0xB3..0xB8 #Mn [6] ZANABAZAR SQUARE FINAL CONSONAN... + | 0xF0 0x91 0xA8 0xBB..0xBE #Mn [4] ZANABAZAR SQUARE CLUSTER-FINAL ... + | 0xF0 0x91 0xA9 0x87 #Mn ZANABAZAR SQUARE SUBJOINER + | 0xF0 0x91 0xA9 0x91..0x96 #Mn [6] SOYOMBO VOWEL SIGN I..SOYOMBO V... + | 0xF0 0x91 0xA9 0x99..0x9B #Mn [3] SOYOMBO VOWEL SIGN VOCALIC R..S... + | 0xF0 0x91 0xAA 0x8A..0x96 #Mn [13] SOYOMBO FINAL CONSONANT SIGN G.... + | 0xF0 0x91 0xAA 0x98..0x99 #Mn [2] SOYOMBO GEMINATION MARK..SOYOMB... | 0xF0 0x91 0xB0 0xB0..0xB6 #Mn [7] BHAIKSUKI VOWEL SIGN I..BHAIKSU... | 0xF0 0x91 0xB0 0xB8..0xBD #Mn [6] BHAIKSUKI VOWEL SIGN E..BHAIKSU... | 0xF0 0x91 0xB0 0xBF #Mn BHAIKSUKI SIGN VIRAMA @@ -359,8 +383,19 @@ | 0xF0 0x91 0xB2 0xAA..0xB0 #Mn [7] MARCHEN SUBJOINED LETTER RA..MA... | 0xF0 0x91 0xB2 0xB2..0xB3 #Mn [2] MARCHEN VOWEL SIGN U..MARCHEN V... | 0xF0 0x91 0xB2 0xB5..0xB6 #Mn [2] MARCHEN SIGN ANUSVARA..MARCHEN ... + | 0xF0 0x91 0xB4 0xB1..0xB6 #Mn [6] MASARAM GONDI VOWEL SIGN AA..MA... + | 0xF0 0x91 0xB4 0xBA #Mn MASARAM GONDI VOWEL SIGN E + | 0xF0 0x91 0xB4 0xBC..0xBD #Mn [2] MASARAM GONDI VOWEL SIGN AI..MA... + | 0xF0 0x91 0xB4 0xBF..0xFF #Mn [7] MASARAM GONDI VOWEL SIGN AU..MA... + | 0xF0 0x91 0xB5 0x00..0x85 # + | 0xF0 0x91 0xB5 0x87 #Mn MASARAM GONDI RA-KARA + | 0xF0 0x91 0xB6 0x90..0x91 #Mn [2] GUNJALA GONDI VOWEL SIGN EE..GU... + | 0xF0 0x91 0xB6 0x95 #Mn GUNJALA GONDI SIGN ANUSVARA + | 0xF0 0x91 0xB6 0x97 #Mn GUNJALA GONDI VIRAMA + | 0xF0 0x91 0xBB 0xB3..0xB4 #Mn [2] MAKASAR VOWEL SIGN I..MAKASAR V... | 0xF0 0x96 0xAB 0xB0..0xB4 #Mn [5] BASSA VAH COMBINING HIGH TONE..... | 0xF0 0x96 0xAC 0xB0..0xB6 #Mn [7] PAHAWH HMONG MARK CIM TUB..PAHA... + | 0xF0 0x96 0xBD 0x8F #Mn MIAO SIGN CONSONANT MODIFIER BAR | 0xF0 0x96 0xBE 0x8F..0x92 #Mn [4] MIAO TONE RIGHT..MIAO TONE BELOW | 0xF0 0x9B 0xB2 0x9D..0x9E #Mn [2] DUPLOYAN THICK LETTER SELECTOR.... | 0xF0 0x9D 0x85 0xA5 #Mc MUSICAL SYMBOL COMBINING STEM @@ -383,8 +418,11 @@ | 0xF0 0x9E 0x80 0x9B..0xA1 #Mn [7] COMBINING GLAGOLITIC LETTER SHT... | 0xF0 0x9E 0x80 0xA3..0xA4 #Mn [2] COMBINING GLAGOLITIC LETTER YU.... | 0xF0 0x9E 0x80 0xA6..0xAA #Mn [5] COMBINING GLAGOLITIC LETTER YO.... + | 0xF0 0x9E 0x84 0xB0..0xB6 #Mn [7] NYIAKENG PUACHUE HMONG TONE-B..... + | 0xF0 0x9E 0x8B 0xAC..0xAF #Mn [4] WANCHO TONE TUP..WANCHO TONE KOINI | 0xF0 0x9E 0xA3 0x90..0x96 #Mn [7] MENDE KIKAKUI COMBINING NUMBER ... | 0xF0 0x9E 0xA5 0x84..0x8A #Mn [7] ADLAM ALIF LENGTHENER..ADLAM NUKTA + | 0xF0 0x9F 0x8F 0xBB..0xBF #Sk [5] EMOJI MODIFIER FITZPATRICK TYPE... | 0xF3 0xA0 0x80 0xA0..0xFF #Cf [96] TAG SPACE..CANCEL TAG | 0xF3 0xA0 0x81 0x00..0xBF # | 0xF3 0xA0 0x84 0x80..0xFF #Mn [240] VARIATION SELECTOR-17..VA... @@ -462,7 +500,6 @@ | 0xE1 0xA9 0x97 #Mc TAI THAM CONSONANT SIGN LA TANG LAI | 0xE1 0xA9 0xAD..0xB2 #Mc [6] TAI THAM VOWEL SIGN OY..TAI THAM V... | 0xE1 0xAC 0x84 #Mc BALINESE SIGN BISAH - | 0xE1 0xAC 0xB5 #Mc BALINESE VOWEL SIGN TEDUNG | 0xE1 0xAC 0xBB #Mc BALINESE VOWEL SIGN RA REPA TEDUNG | 0xE1 0xAC 0xBD..0xFF #Mc [5] BALINESE VOWEL SIGN LA LENGA TEDUN... | 0xE1 0xAD 0x00..0x81 # @@ -478,7 +515,7 @@ | 0xE1 0xB0 0xA4..0xAB #Mc [8] LEPCHA SUBJOINED LETTER YA..LEPCHA... | 0xE1 0xB0 0xB4..0xB5 #Mc [2] LEPCHA CONSONANT SIGN NYIN-DO..LEP... | 0xE1 0xB3 0xA1 #Mc VEDIC TONE ATHARVAVEDIC INDEPENDEN... - | 0xE1 0xB3 0xB2..0xB3 #Mc [2] VEDIC SIGN ARDHAVISARGA..VEDIC SIG... + | 0xE1 0xB3 0xB7 #Mc VEDIC SIGN ATIKRAMA | 0xEA 0xA0 0xA3..0xA4 #Mc [2] SYLOTI NAGRI VOWEL SIGN A..SYLOTI ... | 0xEA 0xA0 0xA7 #Mc SYLOTI NAGRI VOWEL SIGN OO | 0xEA 0xA2 0x80..0x81 #Mc [2] SAURASHTRA SIGN ANUSVARA..SAURASHT... @@ -488,7 +525,7 @@ | 0xEA 0xA6 0x83 #Mc JAVANESE SIGN WIGNYAN | 0xEA 0xA6 0xB4..0xB5 #Mc [2] JAVANESE VOWEL SIGN TARUNG..JAVANE... | 0xEA 0xA6 0xBA..0xBB #Mc [2] JAVANESE VOWEL SIGN TALING..JAVANE... - | 0xEA 0xA6 0xBD..0xFF #Mc [4] JAVANESE CONSONANT SIGN KERET..JAV... + | 0xEA 0xA6 0xBE..0xFF #Mc [3] JAVANESE CONSONANT SIGN PENGKAL..J... | 0xEA 0xA7 0x00..0x80 # | 0xEA 0xA8 0xAF..0xB0 #Mc [2] CHAM VOWEL SIGN O..CHAM VOWEL SIGN AI | 0xEA 0xA8 0xB3..0xB4 #Mc [2] CHAM CONSONANT SIGN YA..CHAM CONSO... @@ -506,6 +543,7 @@ | 0xF0 0x91 0x82 0xB0..0xB2 #Mc [3] KAITHI VOWEL SIGN AA..KAITHI VO... | 0xF0 0x91 0x82 0xB7..0xB8 #Mc [2] KAITHI VOWEL SIGN O..KAITHI VOW... | 0xF0 0x91 0x84 0xAC #Mc CHAKMA VOWEL SIGN E + | 0xF0 0x91 0x85 0x85..0x86 #Mc [2] CHAKMA VOWEL SIGN AA..CHAKMA VO... | 0xF0 0x91 0x86 0x82 #Mc SHARADA SIGN VISARGA | 0xF0 0x91 0x86 0xB3..0xB5 #Mc [3] SHARADA VOWEL SIGN AA..SHARADA ... | 0xF0 0x91 0x86 0xBF..0xFF #Mc [2] SHARADA VOWEL SIGN AU..SHARADA ... @@ -539,12 +577,25 @@ | 0xF0 0x91 0x9A 0xB6 #Mc TAKRI SIGN VIRAMA | 0xF0 0x91 0x9C 0xA0..0xA1 #Mc [2] AHOM VOWEL SIGN A..AHOM VOWEL S... | 0xF0 0x91 0x9C 0xA6 #Mc AHOM VOWEL SIGN E + | 0xF0 0x91 0xA0 0xAC..0xAE #Mc [3] DOGRA VOWEL SIGN AA..DOGRA VOWE... + | 0xF0 0x91 0xA0 0xB8 #Mc DOGRA SIGN VISARGA + | 0xF0 0x91 0xA7 0x91..0x93 #Mc [3] NANDINAGARI VOWEL SIGN AA..NAND... + | 0xF0 0x91 0xA7 0x9C..0x9F #Mc [4] NANDINAGARI VOWEL SIGN O..NANDI... + | 0xF0 0x91 0xA7 0xA4 #Mc NANDINAGARI VOWEL SIGN PRISHTHAMAT... + | 0xF0 0x91 0xA8 0xB9 #Mc ZANABAZAR SQUARE SIGN VISARGA + | 0xF0 0x91 0xA9 0x97..0x98 #Mc [2] SOYOMBO VOWEL SIGN AI..SOYOMBO ... + | 0xF0 0x91 0xAA 0x97 #Mc SOYOMBO SIGN VISARGA | 0xF0 0x91 0xB0 0xAF #Mc BHAIKSUKI VOWEL SIGN AA | 0xF0 0x91 0xB0 0xBE #Mc BHAIKSUKI SIGN VISARGA | 0xF0 0x91 0xB2 0xA9 #Mc MARCHEN SUBJOINED LETTER YA | 0xF0 0x91 0xB2 0xB1 #Mc MARCHEN VOWEL SIGN I | 0xF0 0x91 0xB2 0xB4 #Mc MARCHEN VOWEL SIGN O - | 0xF0 0x96 0xBD 0x91..0xBE #Mc [46] MIAO SIGN ASPIRATION..MIAO VOWE... + | 0xF0 0x91 0xB6 0x8A..0x8E #Mc [5] GUNJALA GONDI VOWEL SIGN AA..GU... + | 0xF0 0x91 0xB6 0x93..0x94 #Mc [2] GUNJALA GONDI VOWEL SIGN OO..GU... + | 0xF0 0x91 0xB6 0x96 #Mc GUNJALA GONDI SIGN VISARGA + | 0xF0 0x91 0xBB 0xB5..0xB6 #Mc [2] MAKASAR VOWEL SIGN E..MAKASAR V... + | 0xF0 0x96 0xBD 0x91..0xFF #Mc [55] MIAO SIGN ASPIRATION..MIAO VOWE... + | 0xF0 0x96 0xBE 0x00..0x87 # | 0xF0 0x9D 0x85 0xA6 #Mc MUSICAL SYMBOL COMBINING SPRECHGES... | 0xF0 0x9D 0x85 0xAD #Mc MUSICAL SYMBOL COMBINING AUGMENTAT... ; @@ -1531,53 +1582,8 @@ | 0xED 0x9E 0x89..0xA3 #Lo [27] HANGUL SYLLABLE HIG..HANGUL SYLLAB... ; - E_Base = - 0xE2 0x98 0x9D #So WHITE UP POINTING INDEX - | 0xE2 0x9B 0xB9 #So PERSON WITH BALL - | 0xE2 0x9C 0x8A..0x8D #So [4] RAISED FIST..WRITING HAND - | 0xF0 0x9F 0x8E 0x85 #So FATHER CHRISTMAS - | 0xF0 0x9F 0x8F 0x83..0x84 #So [2] RUNNER..SURFER - | 0xF0 0x9F 0x8F 0x8A..0x8B #So [2] SWIMMER..WEIGHT LIFTER - | 0xF0 0x9F 0x91 0x82..0x83 #So [2] EAR..NOSE - | 0xF0 0x9F 0x91 0x86..0x90 #So [11] WHITE UP POINTING BACKHAND INDE... - | 0xF0 0x9F 0x91 0xAE #So POLICE OFFICER - | 0xF0 0x9F 0x91 0xB0..0xB8 #So [9] BRIDE WITH VEIL..PRINCESS - | 0xF0 0x9F 0x91 0xBC #So BABY ANGEL - | 0xF0 0x9F 0x92 0x81..0x83 #So [3] INFORMATION DESK PERSON..DANCER - | 0xF0 0x9F 0x92 0x85..0x87 #So [3] NAIL POLISH..HAIRCUT - | 0xF0 0x9F 0x92 0xAA #So FLEXED BICEPS - | 0xF0 0x9F 0x95 0xB5 #So SLEUTH OR SPY - | 0xF0 0x9F 0x95 0xBA #So MAN DANCING - | 0xF0 0x9F 0x96 0x90 #So RAISED HAND WITH FINGERS SPLAYED - | 0xF0 0x9F 0x96 0x95..0x96 #So [2] REVERSED HAND WITH MIDDLE FINGE... - | 0xF0 0x9F 0x99 0x85..0x87 #So [3] FACE WITH NO GOOD GESTURE..PERS... - | 0xF0 0x9F 0x99 0x8B..0x8F #So [5] HAPPY PERSON RAISING ONE HAND..... - | 0xF0 0x9F 0x9A 0xA3 #So ROWBOAT - | 0xF0 0x9F 0x9A 0xB4..0xB6 #So [3] BICYCLIST..PEDESTRIAN - | 0xF0 0x9F 0x9B 0x80 #So BATH - | 0xF0 0x9F 0xA4 0x98..0x9E #So [7] SIGN OF THE HORNS..HAND WITH IN... - | 0xF0 0x9F 0xA4 0xA6 #So FACE PALM - | 0xF0 0x9F 0xA4 0xB0 #So PREGNANT WOMAN - | 0xF0 0x9F 0xA4 0xB3..0xB9 #So [7] SELFIE..JUGGLING - | 0xF0 0x9F 0xA4 0xBC..0xBE #So [3] WRESTLERS..HANDBALL - ; - - E_Modifier = - 0xF0 0x9F 0x8F 0xBB..0xBF #Sk [5] EMOJI MODIFIER FITZPATRICK TYPE... - ; - ZWJ = 0xE2 0x80 0x8D #Cf ZERO WIDTH JOINER ; - Glue_After_Zwj = - 0xE2 0x9D 0xA4 #So HEAVY BLACK HEART - | 0xF0 0x9F 0x92 0x8B #So KISS MARK - | 0xF0 0x9F 0x97 0xA8 #So LEFT SPEECH BUBBLE - ; - - E_Base_GAZ = - 0xF0 0x9F 0x91 0xA6..0xA9 #So [4] BOY..WOMAN - ; - }%% diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/tables.go b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/tables.go similarity index 93% rename from awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/tables.go rename to awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/tables.go index fab7e8429550..b3f22ad432fa 100644 --- a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/tables.go +++ b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/tables.go @@ -1,5 +1,5 @@ // Generated by running -// maketables --url=http://www.unicode.org/Public/9.0.0/ucd/auxiliary/ +// maketables --url=http://www.unicode.org/Public/12.0.0/ucd/auxiliary/ // DO NOT EDIT package textseg @@ -32,12 +32,12 @@ var _GraphemeControl = &unicode.RangeTable{ unicode.Range16{Lo: 0x2060, Hi: 0x2064, Stride: 0x1}, unicode.Range16{Lo: 0x2065, Hi: 0x2065, Stride: 0x1}, unicode.Range16{Lo: 0x2066, Hi: 0x206f, Stride: 0x1}, - unicode.Range16{Lo: 0xd800, Hi: 0xdfff, Stride: 0x1}, unicode.Range16{Lo: 0xfeff, Hi: 0xfeff, Stride: 0x1}, unicode.Range16{Lo: 0xfff0, Hi: 0xfff8, Stride: 0x1}, unicode.Range16{Lo: 0xfff9, Hi: 0xfffb, Stride: 0x1}, }, R32: []unicode.Range32{ + unicode.Range32{Lo: 0x13430, Hi: 0x13438, Stride: 0x1}, unicode.Range32{Lo: 0x1bca0, Hi: 0x1bca3, Stride: 0x1}, unicode.Range32{Lo: 0x1d173, Hi: 0x1d17a, Stride: 0x1}, unicode.Range32{Lo: 0xe0000, Hi: 0xe0000, Stride: 0x1}, @@ -49,56 +49,6 @@ var _GraphemeControl = &unicode.RangeTable{ LatinOffset: 5, } -var _GraphemeE_Base = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x261d, Hi: 0x261d, Stride: 0x1}, - unicode.Range16{Lo: 0x26f9, Hi: 0x26f9, Stride: 0x1}, - unicode.Range16{Lo: 0x270a, Hi: 0x270d, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f385, Hi: 0x1f385, Stride: 0x1}, - unicode.Range32{Lo: 0x1f3c3, Hi: 0x1f3c4, Stride: 0x1}, - unicode.Range32{Lo: 0x1f3ca, Hi: 0x1f3cb, Stride: 0x1}, - unicode.Range32{Lo: 0x1f442, Hi: 0x1f443, Stride: 0x1}, - unicode.Range32{Lo: 0x1f446, Hi: 0x1f450, Stride: 0x1}, - unicode.Range32{Lo: 0x1f46e, Hi: 0x1f46e, Stride: 0x1}, - unicode.Range32{Lo: 0x1f470, Hi: 0x1f478, Stride: 0x1}, - unicode.Range32{Lo: 0x1f47c, Hi: 0x1f47c, Stride: 0x1}, - unicode.Range32{Lo: 0x1f481, Hi: 0x1f483, Stride: 0x1}, - unicode.Range32{Lo: 0x1f485, Hi: 0x1f487, Stride: 0x1}, - unicode.Range32{Lo: 0x1f4aa, Hi: 0x1f4aa, Stride: 0x1}, - unicode.Range32{Lo: 0x1f575, Hi: 0x1f575, Stride: 0x1}, - unicode.Range32{Lo: 0x1f57a, Hi: 0x1f57a, Stride: 0x1}, - unicode.Range32{Lo: 0x1f590, Hi: 0x1f590, Stride: 0x1}, - unicode.Range32{Lo: 0x1f595, Hi: 0x1f596, Stride: 0x1}, - unicode.Range32{Lo: 0x1f645, Hi: 0x1f647, Stride: 0x1}, - unicode.Range32{Lo: 0x1f64b, Hi: 0x1f64f, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6a3, Hi: 0x1f6a3, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6b4, Hi: 0x1f6b6, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6c0, Hi: 0x1f6c0, Stride: 0x1}, - unicode.Range32{Lo: 0x1f918, Hi: 0x1f91e, Stride: 0x1}, - unicode.Range32{Lo: 0x1f926, Hi: 0x1f926, Stride: 0x1}, - unicode.Range32{Lo: 0x1f930, Hi: 0x1f930, Stride: 0x1}, - unicode.Range32{Lo: 0x1f933, Hi: 0x1f939, Stride: 0x1}, - unicode.Range32{Lo: 0x1f93c, Hi: 0x1f93e, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeE_Base_GAZ = &unicode.RangeTable{ - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f466, Hi: 0x1f469, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeE_Modifier = &unicode.RangeTable{ - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f3fb, Hi: 0x1f3ff, Stride: 0x1}, - }, - LatinOffset: 0, -} - var _GraphemeExtend = &unicode.RangeTable{ R16: []unicode.Range16{ unicode.Range16{Lo: 0x300, Hi: 0x36f, Stride: 0x1}, @@ -120,12 +70,13 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0x730, Hi: 0x74a, Stride: 0x1}, unicode.Range16{Lo: 0x7a6, Hi: 0x7b0, Stride: 0x1}, unicode.Range16{Lo: 0x7eb, Hi: 0x7f3, Stride: 0x1}, + unicode.Range16{Lo: 0x7fd, Hi: 0x7fd, Stride: 0x1}, unicode.Range16{Lo: 0x816, Hi: 0x819, Stride: 0x1}, unicode.Range16{Lo: 0x81b, Hi: 0x823, Stride: 0x1}, unicode.Range16{Lo: 0x825, Hi: 0x827, Stride: 0x1}, unicode.Range16{Lo: 0x829, Hi: 0x82d, Stride: 0x1}, unicode.Range16{Lo: 0x859, Hi: 0x85b, Stride: 0x1}, - unicode.Range16{Lo: 0x8d4, Hi: 0x8e1, Stride: 0x1}, + unicode.Range16{Lo: 0x8d3, Hi: 0x8e1, Stride: 0x1}, unicode.Range16{Lo: 0x8e3, Hi: 0x902, Stride: 0x1}, unicode.Range16{Lo: 0x93a, Hi: 0x93a, Stride: 0x1}, unicode.Range16{Lo: 0x93c, Hi: 0x93c, Stride: 0x1}, @@ -140,6 +91,7 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0x9cd, Hi: 0x9cd, Stride: 0x1}, unicode.Range16{Lo: 0x9d7, Hi: 0x9d7, Stride: 0x1}, unicode.Range16{Lo: 0x9e2, Hi: 0x9e3, Stride: 0x1}, + unicode.Range16{Lo: 0x9fe, Hi: 0x9fe, Stride: 0x1}, unicode.Range16{Lo: 0xa01, Hi: 0xa02, Stride: 0x1}, unicode.Range16{Lo: 0xa3c, Hi: 0xa3c, Stride: 0x1}, unicode.Range16{Lo: 0xa41, Hi: 0xa42, Stride: 0x1}, @@ -154,6 +106,7 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xac7, Hi: 0xac8, Stride: 0x1}, unicode.Range16{Lo: 0xacd, Hi: 0xacd, Stride: 0x1}, unicode.Range16{Lo: 0xae2, Hi: 0xae3, Stride: 0x1}, + unicode.Range16{Lo: 0xafa, Hi: 0xaff, Stride: 0x1}, unicode.Range16{Lo: 0xb01, Hi: 0xb01, Stride: 0x1}, unicode.Range16{Lo: 0xb3c, Hi: 0xb3c, Stride: 0x1}, unicode.Range16{Lo: 0xb3e, Hi: 0xb3e, Stride: 0x1}, @@ -169,6 +122,7 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xbcd, Hi: 0xbcd, Stride: 0x1}, unicode.Range16{Lo: 0xbd7, Hi: 0xbd7, Stride: 0x1}, unicode.Range16{Lo: 0xc00, Hi: 0xc00, Stride: 0x1}, + unicode.Range16{Lo: 0xc04, Hi: 0xc04, Stride: 0x1}, unicode.Range16{Lo: 0xc3e, Hi: 0xc40, Stride: 0x1}, unicode.Range16{Lo: 0xc46, Hi: 0xc48, Stride: 0x1}, unicode.Range16{Lo: 0xc4a, Hi: 0xc4d, Stride: 0x1}, @@ -182,7 +136,8 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xccc, Hi: 0xccd, Stride: 0x1}, unicode.Range16{Lo: 0xcd5, Hi: 0xcd6, Stride: 0x1}, unicode.Range16{Lo: 0xce2, Hi: 0xce3, Stride: 0x1}, - unicode.Range16{Lo: 0xd01, Hi: 0xd01, Stride: 0x1}, + unicode.Range16{Lo: 0xd00, Hi: 0xd01, Stride: 0x1}, + unicode.Range16{Lo: 0xd3b, Hi: 0xd3c, Stride: 0x1}, unicode.Range16{Lo: 0xd3e, Hi: 0xd3e, Stride: 0x1}, unicode.Range16{Lo: 0xd41, Hi: 0xd44, Stride: 0x1}, unicode.Range16{Lo: 0xd4d, Hi: 0xd4d, Stride: 0x1}, @@ -197,8 +152,7 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xe34, Hi: 0xe3a, Stride: 0x1}, unicode.Range16{Lo: 0xe47, Hi: 0xe4e, Stride: 0x1}, unicode.Range16{Lo: 0xeb1, Hi: 0xeb1, Stride: 0x1}, - unicode.Range16{Lo: 0xeb4, Hi: 0xeb9, Stride: 0x1}, - unicode.Range16{Lo: 0xebb, Hi: 0xebc, Stride: 0x1}, + unicode.Range16{Lo: 0xeb4, Hi: 0xebc, Stride: 0x1}, unicode.Range16{Lo: 0xec8, Hi: 0xecd, Stride: 0x1}, unicode.Range16{Lo: 0xf18, Hi: 0xf19, Stride: 0x1}, unicode.Range16{Lo: 0xf35, Hi: 0xf35, Stride: 0x1}, @@ -251,6 +205,7 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0x1abe, Hi: 0x1abe, Stride: 0x1}, unicode.Range16{Lo: 0x1b00, Hi: 0x1b03, Stride: 0x1}, unicode.Range16{Lo: 0x1b34, Hi: 0x1b34, Stride: 0x1}, + unicode.Range16{Lo: 0x1b35, Hi: 0x1b35, Stride: 0x1}, unicode.Range16{Lo: 0x1b36, Hi: 0x1b3a, Stride: 0x1}, unicode.Range16{Lo: 0x1b3c, Hi: 0x1b3c, Stride: 0x1}, unicode.Range16{Lo: 0x1b42, Hi: 0x1b42, Stride: 0x1}, @@ -271,7 +226,7 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0x1ced, Hi: 0x1ced, Stride: 0x1}, unicode.Range16{Lo: 0x1cf4, Hi: 0x1cf4, Stride: 0x1}, unicode.Range16{Lo: 0x1cf8, Hi: 0x1cf9, Stride: 0x1}, - unicode.Range16{Lo: 0x1dc0, Hi: 0x1df5, Stride: 0x1}, + unicode.Range16{Lo: 0x1dc0, Hi: 0x1df9, Stride: 0x1}, unicode.Range16{Lo: 0x1dfb, Hi: 0x1dff, Stride: 0x1}, unicode.Range16{Lo: 0x200c, Hi: 0x200c, Stride: 0x1}, unicode.Range16{Lo: 0x20d0, Hi: 0x20dc, Stride: 0x1}, @@ -296,12 +251,13 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xa825, Hi: 0xa826, Stride: 0x1}, unicode.Range16{Lo: 0xa8c4, Hi: 0xa8c5, Stride: 0x1}, unicode.Range16{Lo: 0xa8e0, Hi: 0xa8f1, Stride: 0x1}, + unicode.Range16{Lo: 0xa8ff, Hi: 0xa8ff, Stride: 0x1}, unicode.Range16{Lo: 0xa926, Hi: 0xa92d, Stride: 0x1}, unicode.Range16{Lo: 0xa947, Hi: 0xa951, Stride: 0x1}, unicode.Range16{Lo: 0xa980, Hi: 0xa982, Stride: 0x1}, unicode.Range16{Lo: 0xa9b3, Hi: 0xa9b3, Stride: 0x1}, unicode.Range16{Lo: 0xa9b6, Hi: 0xa9b9, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bc, Hi: 0xa9bc, Stride: 0x1}, + unicode.Range16{Lo: 0xa9bc, Hi: 0xa9bd, Stride: 0x1}, unicode.Range16{Lo: 0xa9e5, Hi: 0xa9e5, Stride: 0x1}, unicode.Range16{Lo: 0xaa29, Hi: 0xaa2e, Stride: 0x1}, unicode.Range16{Lo: 0xaa31, Hi: 0xaa32, Stride: 0x1}, @@ -334,6 +290,8 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x10a38, Hi: 0x10a3a, Stride: 0x1}, unicode.Range32{Lo: 0x10a3f, Hi: 0x10a3f, Stride: 0x1}, unicode.Range32{Lo: 0x10ae5, Hi: 0x10ae6, Stride: 0x1}, + unicode.Range32{Lo: 0x10d24, Hi: 0x10d27, Stride: 0x1}, + unicode.Range32{Lo: 0x10f46, Hi: 0x10f50, Stride: 0x1}, unicode.Range32{Lo: 0x11001, Hi: 0x11001, Stride: 0x1}, unicode.Range32{Lo: 0x11038, Hi: 0x11046, Stride: 0x1}, unicode.Range32{Lo: 0x1107f, Hi: 0x11081, Stride: 0x1}, @@ -345,7 +303,7 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x11173, Hi: 0x11173, Stride: 0x1}, unicode.Range32{Lo: 0x11180, Hi: 0x11181, Stride: 0x1}, unicode.Range32{Lo: 0x111b6, Hi: 0x111be, Stride: 0x1}, - unicode.Range32{Lo: 0x111ca, Hi: 0x111cc, Stride: 0x1}, + unicode.Range32{Lo: 0x111c9, Hi: 0x111cc, Stride: 0x1}, unicode.Range32{Lo: 0x1122f, Hi: 0x11231, Stride: 0x1}, unicode.Range32{Lo: 0x11234, Hi: 0x11234, Stride: 0x1}, unicode.Range32{Lo: 0x11236, Hi: 0x11237, Stride: 0x1}, @@ -353,7 +311,7 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x112df, Hi: 0x112df, Stride: 0x1}, unicode.Range32{Lo: 0x112e3, Hi: 0x112ea, Stride: 0x1}, unicode.Range32{Lo: 0x11300, Hi: 0x11301, Stride: 0x1}, - unicode.Range32{Lo: 0x1133c, Hi: 0x1133c, Stride: 0x1}, + unicode.Range32{Lo: 0x1133b, Hi: 0x1133c, Stride: 0x1}, unicode.Range32{Lo: 0x1133e, Hi: 0x1133e, Stride: 0x1}, unicode.Range32{Lo: 0x11340, Hi: 0x11340, Stride: 0x1}, unicode.Range32{Lo: 0x11357, Hi: 0x11357, Stride: 0x1}, @@ -362,6 +320,7 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x11438, Hi: 0x1143f, Stride: 0x1}, unicode.Range32{Lo: 0x11442, Hi: 0x11444, Stride: 0x1}, unicode.Range32{Lo: 0x11446, Hi: 0x11446, Stride: 0x1}, + unicode.Range32{Lo: 0x1145e, Hi: 0x1145e, Stride: 0x1}, unicode.Range32{Lo: 0x114b0, Hi: 0x114b0, Stride: 0x1}, unicode.Range32{Lo: 0x114b3, Hi: 0x114b8, Stride: 0x1}, unicode.Range32{Lo: 0x114ba, Hi: 0x114ba, Stride: 0x1}, @@ -383,6 +342,19 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x1171d, Hi: 0x1171f, Stride: 0x1}, unicode.Range32{Lo: 0x11722, Hi: 0x11725, Stride: 0x1}, unicode.Range32{Lo: 0x11727, Hi: 0x1172b, Stride: 0x1}, + unicode.Range32{Lo: 0x1182f, Hi: 0x11837, Stride: 0x1}, + unicode.Range32{Lo: 0x11839, Hi: 0x1183a, Stride: 0x1}, + unicode.Range32{Lo: 0x119d4, Hi: 0x119d7, Stride: 0x1}, + unicode.Range32{Lo: 0x119da, Hi: 0x119db, Stride: 0x1}, + unicode.Range32{Lo: 0x119e0, Hi: 0x119e0, Stride: 0x1}, + unicode.Range32{Lo: 0x11a01, Hi: 0x11a0a, Stride: 0x1}, + unicode.Range32{Lo: 0x11a33, Hi: 0x11a38, Stride: 0x1}, + unicode.Range32{Lo: 0x11a3b, Hi: 0x11a3e, Stride: 0x1}, + unicode.Range32{Lo: 0x11a47, Hi: 0x11a47, Stride: 0x1}, + unicode.Range32{Lo: 0x11a51, Hi: 0x11a56, Stride: 0x1}, + unicode.Range32{Lo: 0x11a59, Hi: 0x11a5b, Stride: 0x1}, + unicode.Range32{Lo: 0x11a8a, Hi: 0x11a96, Stride: 0x1}, + unicode.Range32{Lo: 0x11a98, Hi: 0x11a99, Stride: 0x1}, unicode.Range32{Lo: 0x11c30, Hi: 0x11c36, Stride: 0x1}, unicode.Range32{Lo: 0x11c38, Hi: 0x11c3d, Stride: 0x1}, unicode.Range32{Lo: 0x11c3f, Hi: 0x11c3f, Stride: 0x1}, @@ -390,8 +362,18 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x11caa, Hi: 0x11cb0, Stride: 0x1}, unicode.Range32{Lo: 0x11cb2, Hi: 0x11cb3, Stride: 0x1}, unicode.Range32{Lo: 0x11cb5, Hi: 0x11cb6, Stride: 0x1}, + unicode.Range32{Lo: 0x11d31, Hi: 0x11d36, Stride: 0x1}, + unicode.Range32{Lo: 0x11d3a, Hi: 0x11d3a, Stride: 0x1}, + unicode.Range32{Lo: 0x11d3c, Hi: 0x11d3d, Stride: 0x1}, + unicode.Range32{Lo: 0x11d3f, Hi: 0x11d45, Stride: 0x1}, + unicode.Range32{Lo: 0x11d47, Hi: 0x11d47, Stride: 0x1}, + unicode.Range32{Lo: 0x11d90, Hi: 0x11d91, Stride: 0x1}, + unicode.Range32{Lo: 0x11d95, Hi: 0x11d95, Stride: 0x1}, + unicode.Range32{Lo: 0x11d97, Hi: 0x11d97, Stride: 0x1}, + unicode.Range32{Lo: 0x11ef3, Hi: 0x11ef4, Stride: 0x1}, unicode.Range32{Lo: 0x16af0, Hi: 0x16af4, Stride: 0x1}, unicode.Range32{Lo: 0x16b30, Hi: 0x16b36, Stride: 0x1}, + unicode.Range32{Lo: 0x16f4f, Hi: 0x16f4f, Stride: 0x1}, unicode.Range32{Lo: 0x16f8f, Hi: 0x16f92, Stride: 0x1}, unicode.Range32{Lo: 0x1bc9d, Hi: 0x1bc9e, Stride: 0x1}, unicode.Range32{Lo: 0x1d165, Hi: 0x1d165, Stride: 0x1}, @@ -412,25 +394,17 @@ var _GraphemeExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x1e01b, Hi: 0x1e021, Stride: 0x1}, unicode.Range32{Lo: 0x1e023, Hi: 0x1e024, Stride: 0x1}, unicode.Range32{Lo: 0x1e026, Hi: 0x1e02a, Stride: 0x1}, + unicode.Range32{Lo: 0x1e130, Hi: 0x1e136, Stride: 0x1}, + unicode.Range32{Lo: 0x1e2ec, Hi: 0x1e2ef, Stride: 0x1}, unicode.Range32{Lo: 0x1e8d0, Hi: 0x1e8d6, Stride: 0x1}, unicode.Range32{Lo: 0x1e944, Hi: 0x1e94a, Stride: 0x1}, + unicode.Range32{Lo: 0x1f3fb, Hi: 0x1f3ff, Stride: 0x1}, unicode.Range32{Lo: 0xe0020, Hi: 0xe007f, Stride: 0x1}, unicode.Range32{Lo: 0xe0100, Hi: 0xe01ef, Stride: 0x1}, }, LatinOffset: 0, } -var _GraphemeGlue_After_Zwj = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x2764, Hi: 0x2764, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f48b, Hi: 0x1f48b, Stride: 0x1}, - unicode.Range32{Lo: 0x1f5e8, Hi: 0x1f5e8, Stride: 0x1}, - }, - LatinOffset: 0, -} - var _GraphemeL = &unicode.RangeTable{ R16: []unicode.Range16{ unicode.Range16{Lo: 0x1100, Hi: 0x115f, Stride: 0x1}, @@ -1266,7 +1240,11 @@ var _GraphemePrepend = &unicode.RangeTable{ }, R32: []unicode.Range32{ unicode.Range32{Lo: 0x110bd, Hi: 0x110bd, Stride: 0x1}, + unicode.Range32{Lo: 0x110cd, Hi: 0x110cd, Stride: 0x1}, unicode.Range32{Lo: 0x111c2, Hi: 0x111c3, Stride: 0x1}, + unicode.Range32{Lo: 0x11a3a, Hi: 0x11a3a, Stride: 0x1}, + unicode.Range32{Lo: 0x11a84, Hi: 0x11a89, Stride: 0x1}, + unicode.Range32{Lo: 0x11d46, Hi: 0x11d46, Stride: 0x1}, }, LatinOffset: 0, } @@ -1339,7 +1317,6 @@ var _GraphemeSpacingMark = &unicode.RangeTable{ unicode.Range16{Lo: 0x1a57, Hi: 0x1a57, Stride: 0x1}, unicode.Range16{Lo: 0x1a6d, Hi: 0x1a72, Stride: 0x1}, unicode.Range16{Lo: 0x1b04, Hi: 0x1b04, Stride: 0x1}, - unicode.Range16{Lo: 0x1b35, Hi: 0x1b35, Stride: 0x1}, unicode.Range16{Lo: 0x1b3b, Hi: 0x1b3b, Stride: 0x1}, unicode.Range16{Lo: 0x1b3d, Hi: 0x1b41, Stride: 0x1}, unicode.Range16{Lo: 0x1b43, Hi: 0x1b44, Stride: 0x1}, @@ -1354,7 +1331,7 @@ var _GraphemeSpacingMark = &unicode.RangeTable{ unicode.Range16{Lo: 0x1c24, Hi: 0x1c2b, Stride: 0x1}, unicode.Range16{Lo: 0x1c34, Hi: 0x1c35, Stride: 0x1}, unicode.Range16{Lo: 0x1ce1, Hi: 0x1ce1, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf2, Hi: 0x1cf3, Stride: 0x1}, + unicode.Range16{Lo: 0x1cf7, Hi: 0x1cf7, Stride: 0x1}, unicode.Range16{Lo: 0xa823, Hi: 0xa824, Stride: 0x1}, unicode.Range16{Lo: 0xa827, Hi: 0xa827, Stride: 0x1}, unicode.Range16{Lo: 0xa880, Hi: 0xa881, Stride: 0x1}, @@ -1363,7 +1340,7 @@ var _GraphemeSpacingMark = &unicode.RangeTable{ unicode.Range16{Lo: 0xa983, Hi: 0xa983, Stride: 0x1}, unicode.Range16{Lo: 0xa9b4, Hi: 0xa9b5, Stride: 0x1}, unicode.Range16{Lo: 0xa9ba, Hi: 0xa9bb, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bd, Hi: 0xa9c0, Stride: 0x1}, + unicode.Range16{Lo: 0xa9be, Hi: 0xa9c0, Stride: 0x1}, unicode.Range16{Lo: 0xaa2f, Hi: 0xaa30, Stride: 0x1}, unicode.Range16{Lo: 0xaa33, Hi: 0xaa34, Stride: 0x1}, unicode.Range16{Lo: 0xaa4d, Hi: 0xaa4d, Stride: 0x1}, @@ -1382,6 +1359,7 @@ var _GraphemeSpacingMark = &unicode.RangeTable{ unicode.Range32{Lo: 0x110b0, Hi: 0x110b2, Stride: 0x1}, unicode.Range32{Lo: 0x110b7, Hi: 0x110b8, Stride: 0x1}, unicode.Range32{Lo: 0x1112c, Hi: 0x1112c, Stride: 0x1}, + unicode.Range32{Lo: 0x11145, Hi: 0x11146, Stride: 0x1}, unicode.Range32{Lo: 0x11182, Hi: 0x11182, Stride: 0x1}, unicode.Range32{Lo: 0x111b3, Hi: 0x111b5, Stride: 0x1}, unicode.Range32{Lo: 0x111bf, Hi: 0x111c0, Stride: 0x1}, @@ -1414,12 +1392,24 @@ var _GraphemeSpacingMark = &unicode.RangeTable{ unicode.Range32{Lo: 0x116b6, Hi: 0x116b6, Stride: 0x1}, unicode.Range32{Lo: 0x11720, Hi: 0x11721, Stride: 0x1}, unicode.Range32{Lo: 0x11726, Hi: 0x11726, Stride: 0x1}, + unicode.Range32{Lo: 0x1182c, Hi: 0x1182e, Stride: 0x1}, + unicode.Range32{Lo: 0x11838, Hi: 0x11838, Stride: 0x1}, + unicode.Range32{Lo: 0x119d1, Hi: 0x119d3, Stride: 0x1}, + unicode.Range32{Lo: 0x119dc, Hi: 0x119df, Stride: 0x1}, + unicode.Range32{Lo: 0x119e4, Hi: 0x119e4, Stride: 0x1}, + unicode.Range32{Lo: 0x11a39, Hi: 0x11a39, Stride: 0x1}, + unicode.Range32{Lo: 0x11a57, Hi: 0x11a58, Stride: 0x1}, + unicode.Range32{Lo: 0x11a97, Hi: 0x11a97, Stride: 0x1}, unicode.Range32{Lo: 0x11c2f, Hi: 0x11c2f, Stride: 0x1}, unicode.Range32{Lo: 0x11c3e, Hi: 0x11c3e, Stride: 0x1}, unicode.Range32{Lo: 0x11ca9, Hi: 0x11ca9, Stride: 0x1}, unicode.Range32{Lo: 0x11cb1, Hi: 0x11cb1, Stride: 0x1}, unicode.Range32{Lo: 0x11cb4, Hi: 0x11cb4, Stride: 0x1}, - unicode.Range32{Lo: 0x16f51, Hi: 0x16f7e, Stride: 0x1}, + unicode.Range32{Lo: 0x11d8a, Hi: 0x11d8e, Stride: 0x1}, + unicode.Range32{Lo: 0x11d93, Hi: 0x11d94, Stride: 0x1}, + unicode.Range32{Lo: 0x11d96, Hi: 0x11d96, Stride: 0x1}, + unicode.Range32{Lo: 0x11ef5, Hi: 0x11ef6, Stride: 0x1}, + unicode.Range32{Lo: 0x16f51, Hi: 0x16f87, Stride: 0x1}, unicode.Range32{Lo: 0x1d166, Hi: 0x1d166, Stride: 0x1}, unicode.Range32{Lo: 0x1d16d, Hi: 0x1d16d, Stride: 0x1}, }, @@ -1457,16 +1447,8 @@ func _GraphemeRuneType(r rune) *_GraphemeRuneRange { return (*_GraphemeRuneRange)(_GraphemeCR) case unicode.Is(_GraphemeControl, r): return (*_GraphemeRuneRange)(_GraphemeControl) - case unicode.Is(_GraphemeE_Base, r): - return (*_GraphemeRuneRange)(_GraphemeE_Base) - case unicode.Is(_GraphemeE_Base_GAZ, r): - return (*_GraphemeRuneRange)(_GraphemeE_Base_GAZ) - case unicode.Is(_GraphemeE_Modifier, r): - return (*_GraphemeRuneRange)(_GraphemeE_Modifier) case unicode.Is(_GraphemeExtend, r): return (*_GraphemeRuneRange)(_GraphemeExtend) - case unicode.Is(_GraphemeGlue_After_Zwj, r): - return (*_GraphemeRuneRange)(_GraphemeGlue_After_Zwj) case unicode.Is(_GraphemeL, r): return (*_GraphemeRuneRange)(_GraphemeL) case unicode.Is(_GraphemeLF, r): @@ -1497,16 +1479,8 @@ func (rng *_GraphemeRuneRange) String() string { return "CR" case _GraphemeControl: return "Control" - case _GraphemeE_Base: - return "E_Base" - case _GraphemeE_Base_GAZ: - return "E_Base_GAZ" - case _GraphemeE_Modifier: - return "E_Modifier" case _GraphemeExtend: return "Extend" - case _GraphemeGlue_After_Zwj: - return "Glue_After_Zwj" case _GraphemeL: return "L" case _GraphemeLF: @@ -1549,10 +1523,15 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x294, Hi: 0x294, Stride: 0x1}, unicode.Range16{Lo: 0x295, Hi: 0x2af, Stride: 0x1}, unicode.Range16{Lo: 0x2b0, Hi: 0x2c1, Stride: 0x1}, + unicode.Range16{Lo: 0x2c2, Hi: 0x2c5, Stride: 0x1}, unicode.Range16{Lo: 0x2c6, Hi: 0x2d1, Stride: 0x1}, + unicode.Range16{Lo: 0x2d2, Hi: 0x2d7, Stride: 0x1}, + unicode.Range16{Lo: 0x2de, Hi: 0x2df, Stride: 0x1}, unicode.Range16{Lo: 0x2e0, Hi: 0x2e4, Stride: 0x1}, unicode.Range16{Lo: 0x2ec, Hi: 0x2ec, Stride: 0x1}, + unicode.Range16{Lo: 0x2ed, Hi: 0x2ed, Stride: 0x1}, unicode.Range16{Lo: 0x2ee, Hi: 0x2ee, Stride: 0x1}, + unicode.Range16{Lo: 0x2ef, Hi: 0x2ff, Stride: 0x1}, unicode.Range16{Lo: 0x370, Hi: 0x373, Stride: 0x1}, unicode.Range16{Lo: 0x374, Hi: 0x374, Stride: 0x1}, unicode.Range16{Lo: 0x376, Hi: 0x377, Stride: 0x1}, @@ -1568,7 +1547,9 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x48a, Hi: 0x52f, Stride: 0x1}, unicode.Range16{Lo: 0x531, Hi: 0x556, Stride: 0x1}, unicode.Range16{Lo: 0x559, Hi: 0x559, Stride: 0x1}, - unicode.Range16{Lo: 0x561, Hi: 0x587, Stride: 0x1}, + unicode.Range16{Lo: 0x55b, Hi: 0x55c, Stride: 0x1}, + unicode.Range16{Lo: 0x55e, Hi: 0x55e, Stride: 0x1}, + unicode.Range16{Lo: 0x560, Hi: 0x588, Stride: 0x1}, unicode.Range16{Lo: 0x5f3, Hi: 0x5f3, Stride: 0x1}, unicode.Range16{Lo: 0x620, Hi: 0x63f, Stride: 0x1}, unicode.Range16{Lo: 0x640, Hi: 0x640, Stride: 0x1}, @@ -1592,6 +1573,7 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x824, Hi: 0x824, Stride: 0x1}, unicode.Range16{Lo: 0x828, Hi: 0x828, Stride: 0x1}, unicode.Range16{Lo: 0x840, Hi: 0x858, Stride: 0x1}, + unicode.Range16{Lo: 0x860, Hi: 0x86a, Stride: 0x1}, unicode.Range16{Lo: 0x8a0, Hi: 0x8b4, Stride: 0x1}, unicode.Range16{Lo: 0x8b6, Hi: 0x8bd, Stride: 0x1}, unicode.Range16{Lo: 0x904, Hi: 0x939, Stride: 0x1}, @@ -1611,6 +1593,7 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x9dc, Hi: 0x9dd, Stride: 0x1}, unicode.Range16{Lo: 0x9df, Hi: 0x9e1, Stride: 0x1}, unicode.Range16{Lo: 0x9f0, Hi: 0x9f1, Stride: 0x1}, + unicode.Range16{Lo: 0x9fc, Hi: 0x9fc, Stride: 0x1}, unicode.Range16{Lo: 0xa05, Hi: 0xa0a, Stride: 0x1}, unicode.Range16{Lo: 0xa0f, Hi: 0xa10, Stride: 0x1}, unicode.Range16{Lo: 0xa13, Hi: 0xa28, Stride: 0x1}, @@ -1691,7 +1674,8 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x10cd, Hi: 0x10cd, Stride: 0x1}, unicode.Range16{Lo: 0x10d0, Hi: 0x10fa, Stride: 0x1}, unicode.Range16{Lo: 0x10fc, Hi: 0x10fc, Stride: 0x1}, - unicode.Range16{Lo: 0x10fd, Hi: 0x1248, Stride: 0x1}, + unicode.Range16{Lo: 0x10fd, Hi: 0x10ff, Stride: 0x1}, + unicode.Range16{Lo: 0x1100, Hi: 0x1248, Stride: 0x1}, unicode.Range16{Lo: 0x124a, Hi: 0x124d, Stride: 0x1}, unicode.Range16{Lo: 0x1250, Hi: 0x1256, Stride: 0x1}, unicode.Range16{Lo: 0x1258, Hi: 0x1258, Stride: 0x1}, @@ -1724,7 +1708,7 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x176e, Hi: 0x1770, Stride: 0x1}, unicode.Range16{Lo: 0x1820, Hi: 0x1842, Stride: 0x1}, unicode.Range16{Lo: 0x1843, Hi: 0x1843, Stride: 0x1}, - unicode.Range16{Lo: 0x1844, Hi: 0x1877, Stride: 0x1}, + unicode.Range16{Lo: 0x1844, Hi: 0x1878, Stride: 0x1}, unicode.Range16{Lo: 0x1880, Hi: 0x1884, Stride: 0x1}, unicode.Range16{Lo: 0x1887, Hi: 0x18a8, Stride: 0x1}, unicode.Range16{Lo: 0x18aa, Hi: 0x18aa, Stride: 0x1}, @@ -1741,9 +1725,12 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x1c5a, Hi: 0x1c77, Stride: 0x1}, unicode.Range16{Lo: 0x1c78, Hi: 0x1c7d, Stride: 0x1}, unicode.Range16{Lo: 0x1c80, Hi: 0x1c88, Stride: 0x1}, + unicode.Range16{Lo: 0x1c90, Hi: 0x1cba, Stride: 0x1}, + unicode.Range16{Lo: 0x1cbd, Hi: 0x1cbf, Stride: 0x1}, unicode.Range16{Lo: 0x1ce9, Hi: 0x1cec, Stride: 0x1}, - unicode.Range16{Lo: 0x1cee, Hi: 0x1cf1, Stride: 0x1}, + unicode.Range16{Lo: 0x1cee, Hi: 0x1cf3, Stride: 0x1}, unicode.Range16{Lo: 0x1cf5, Hi: 0x1cf6, Stride: 0x1}, + unicode.Range16{Lo: 0x1cfa, Hi: 0x1cfa, Stride: 0x1}, unicode.Range16{Lo: 0x1d00, Hi: 0x1d2b, Stride: 0x1}, unicode.Range16{Lo: 0x1d2c, Hi: 0x1d6a, Stride: 0x1}, unicode.Range16{Lo: 0x1d6b, Hi: 0x1d77, Stride: 0x1}, @@ -1816,7 +1803,7 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x3005, Hi: 0x3005, Stride: 0x1}, unicode.Range16{Lo: 0x303b, Hi: 0x303b, Stride: 0x1}, unicode.Range16{Lo: 0x303c, Hi: 0x303c, Stride: 0x1}, - unicode.Range16{Lo: 0x3105, Hi: 0x312d, Stride: 0x1}, + unicode.Range16{Lo: 0x3105, Hi: 0x312f, Stride: 0x1}, unicode.Range16{Lo: 0x3131, Hi: 0x318e, Stride: 0x1}, unicode.Range16{Lo: 0x31a0, Hi: 0x31ba, Stride: 0x1}, unicode.Range16{Lo: 0xa000, Hi: 0xa014, Stride: 0x1}, @@ -1836,14 +1823,16 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range16{Lo: 0xa6a0, Hi: 0xa6e5, Stride: 0x1}, unicode.Range16{Lo: 0xa6e6, Hi: 0xa6ef, Stride: 0x1}, unicode.Range16{Lo: 0xa717, Hi: 0xa71f, Stride: 0x1}, + unicode.Range16{Lo: 0xa720, Hi: 0xa721, Stride: 0x1}, unicode.Range16{Lo: 0xa722, Hi: 0xa76f, Stride: 0x1}, unicode.Range16{Lo: 0xa770, Hi: 0xa770, Stride: 0x1}, unicode.Range16{Lo: 0xa771, Hi: 0xa787, Stride: 0x1}, unicode.Range16{Lo: 0xa788, Hi: 0xa788, Stride: 0x1}, + unicode.Range16{Lo: 0xa789, Hi: 0xa78a, Stride: 0x1}, unicode.Range16{Lo: 0xa78b, Hi: 0xa78e, Stride: 0x1}, unicode.Range16{Lo: 0xa78f, Hi: 0xa78f, Stride: 0x1}, - unicode.Range16{Lo: 0xa790, Hi: 0xa7ae, Stride: 0x1}, - unicode.Range16{Lo: 0xa7b0, Hi: 0xa7b7, Stride: 0x1}, + unicode.Range16{Lo: 0xa790, Hi: 0xa7bf, Stride: 0x1}, + unicode.Range16{Lo: 0xa7c2, Hi: 0xa7c6, Stride: 0x1}, unicode.Range16{Lo: 0xa7f7, Hi: 0xa7f7, Stride: 0x1}, unicode.Range16{Lo: 0xa7f8, Hi: 0xa7f9, Stride: 0x1}, unicode.Range16{Lo: 0xa7fa, Hi: 0xa7fa, Stride: 0x1}, @@ -1855,7 +1844,7 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range16{Lo: 0xa882, Hi: 0xa8b3, Stride: 0x1}, unicode.Range16{Lo: 0xa8f2, Hi: 0xa8f7, Stride: 0x1}, unicode.Range16{Lo: 0xa8fb, Hi: 0xa8fb, Stride: 0x1}, - unicode.Range16{Lo: 0xa8fd, Hi: 0xa8fd, Stride: 0x1}, + unicode.Range16{Lo: 0xa8fd, Hi: 0xa8fe, Stride: 0x1}, unicode.Range16{Lo: 0xa90a, Hi: 0xa925, Stride: 0x1}, unicode.Range16{Lo: 0xa930, Hi: 0xa946, Stride: 0x1}, unicode.Range16{Lo: 0xa960, Hi: 0xa97c, Stride: 0x1}, @@ -1873,8 +1862,9 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range16{Lo: 0xab20, Hi: 0xab26, Stride: 0x1}, unicode.Range16{Lo: 0xab28, Hi: 0xab2e, Stride: 0x1}, unicode.Range16{Lo: 0xab30, Hi: 0xab5a, Stride: 0x1}, + unicode.Range16{Lo: 0xab5b, Hi: 0xab5b, Stride: 0x1}, unicode.Range16{Lo: 0xab5c, Hi: 0xab5f, Stride: 0x1}, - unicode.Range16{Lo: 0xab60, Hi: 0xab65, Stride: 0x1}, + unicode.Range16{Lo: 0xab60, Hi: 0xab67, Stride: 0x1}, unicode.Range16{Lo: 0xab70, Hi: 0xabbf, Stride: 0x1}, unicode.Range16{Lo: 0xabc0, Hi: 0xabe2, Stride: 0x1}, unicode.Range16{Lo: 0xac00, Hi: 0xd7a3, Stride: 0x1}, @@ -1909,7 +1899,7 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x10280, Hi: 0x1029c, Stride: 0x1}, unicode.Range32{Lo: 0x102a0, Hi: 0x102d0, Stride: 0x1}, unicode.Range32{Lo: 0x10300, Hi: 0x1031f, Stride: 0x1}, - unicode.Range32{Lo: 0x10330, Hi: 0x10340, Stride: 0x1}, + unicode.Range32{Lo: 0x1032d, Hi: 0x10340, Stride: 0x1}, unicode.Range32{Lo: 0x10341, Hi: 0x10341, Stride: 0x1}, unicode.Range32{Lo: 0x10342, Hi: 0x10349, Stride: 0x1}, unicode.Range32{Lo: 0x1034a, Hi: 0x1034a, Stride: 0x1}, @@ -1944,7 +1934,7 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x10a00, Hi: 0x10a00, Stride: 0x1}, unicode.Range32{Lo: 0x10a10, Hi: 0x10a13, Stride: 0x1}, unicode.Range32{Lo: 0x10a15, Hi: 0x10a17, Stride: 0x1}, - unicode.Range32{Lo: 0x10a19, Hi: 0x10a33, Stride: 0x1}, + unicode.Range32{Lo: 0x10a19, Hi: 0x10a35, Stride: 0x1}, unicode.Range32{Lo: 0x10a60, Hi: 0x10a7c, Stride: 0x1}, unicode.Range32{Lo: 0x10a80, Hi: 0x10a9c, Stride: 0x1}, unicode.Range32{Lo: 0x10ac0, Hi: 0x10ac7, Stride: 0x1}, @@ -1956,10 +1946,16 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x10c00, Hi: 0x10c48, Stride: 0x1}, unicode.Range32{Lo: 0x10c80, Hi: 0x10cb2, Stride: 0x1}, unicode.Range32{Lo: 0x10cc0, Hi: 0x10cf2, Stride: 0x1}, + unicode.Range32{Lo: 0x10d00, Hi: 0x10d23, Stride: 0x1}, + unicode.Range32{Lo: 0x10f00, Hi: 0x10f1c, Stride: 0x1}, + unicode.Range32{Lo: 0x10f27, Hi: 0x10f27, Stride: 0x1}, + unicode.Range32{Lo: 0x10f30, Hi: 0x10f45, Stride: 0x1}, + unicode.Range32{Lo: 0x10fe0, Hi: 0x10ff6, Stride: 0x1}, unicode.Range32{Lo: 0x11003, Hi: 0x11037, Stride: 0x1}, unicode.Range32{Lo: 0x11083, Hi: 0x110af, Stride: 0x1}, unicode.Range32{Lo: 0x110d0, Hi: 0x110e8, Stride: 0x1}, unicode.Range32{Lo: 0x11103, Hi: 0x11126, Stride: 0x1}, + unicode.Range32{Lo: 0x11144, Hi: 0x11144, Stride: 0x1}, unicode.Range32{Lo: 0x11150, Hi: 0x11172, Stride: 0x1}, unicode.Range32{Lo: 0x11176, Hi: 0x11176, Stride: 0x1}, unicode.Range32{Lo: 0x11183, Hi: 0x111b2, Stride: 0x1}, @@ -1985,6 +1981,7 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x1135d, Hi: 0x11361, Stride: 0x1}, unicode.Range32{Lo: 0x11400, Hi: 0x11434, Stride: 0x1}, unicode.Range32{Lo: 0x11447, Hi: 0x1144a, Stride: 0x1}, + unicode.Range32{Lo: 0x1145f, Hi: 0x1145f, Stride: 0x1}, unicode.Range32{Lo: 0x11480, Hi: 0x114af, Stride: 0x1}, unicode.Range32{Lo: 0x114c4, Hi: 0x114c5, Stride: 0x1}, unicode.Range32{Lo: 0x114c7, Hi: 0x114c7, Stride: 0x1}, @@ -1993,13 +1990,34 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x11600, Hi: 0x1162f, Stride: 0x1}, unicode.Range32{Lo: 0x11644, Hi: 0x11644, Stride: 0x1}, unicode.Range32{Lo: 0x11680, Hi: 0x116aa, Stride: 0x1}, + unicode.Range32{Lo: 0x116b8, Hi: 0x116b8, Stride: 0x1}, + unicode.Range32{Lo: 0x11800, Hi: 0x1182b, Stride: 0x1}, unicode.Range32{Lo: 0x118a0, Hi: 0x118df, Stride: 0x1}, unicode.Range32{Lo: 0x118ff, Hi: 0x118ff, Stride: 0x1}, + unicode.Range32{Lo: 0x119a0, Hi: 0x119a7, Stride: 0x1}, + unicode.Range32{Lo: 0x119aa, Hi: 0x119d0, Stride: 0x1}, + unicode.Range32{Lo: 0x119e1, Hi: 0x119e1, Stride: 0x1}, + unicode.Range32{Lo: 0x119e3, Hi: 0x119e3, Stride: 0x1}, + unicode.Range32{Lo: 0x11a00, Hi: 0x11a00, Stride: 0x1}, + unicode.Range32{Lo: 0x11a0b, Hi: 0x11a32, Stride: 0x1}, + unicode.Range32{Lo: 0x11a3a, Hi: 0x11a3a, Stride: 0x1}, + unicode.Range32{Lo: 0x11a50, Hi: 0x11a50, Stride: 0x1}, + unicode.Range32{Lo: 0x11a5c, Hi: 0x11a89, Stride: 0x1}, + unicode.Range32{Lo: 0x11a9d, Hi: 0x11a9d, Stride: 0x1}, unicode.Range32{Lo: 0x11ac0, Hi: 0x11af8, Stride: 0x1}, unicode.Range32{Lo: 0x11c00, Hi: 0x11c08, Stride: 0x1}, unicode.Range32{Lo: 0x11c0a, Hi: 0x11c2e, Stride: 0x1}, unicode.Range32{Lo: 0x11c40, Hi: 0x11c40, Stride: 0x1}, unicode.Range32{Lo: 0x11c72, Hi: 0x11c8f, Stride: 0x1}, + unicode.Range32{Lo: 0x11d00, Hi: 0x11d06, Stride: 0x1}, + unicode.Range32{Lo: 0x11d08, Hi: 0x11d09, Stride: 0x1}, + unicode.Range32{Lo: 0x11d0b, Hi: 0x11d30, Stride: 0x1}, + unicode.Range32{Lo: 0x11d46, Hi: 0x11d46, Stride: 0x1}, + unicode.Range32{Lo: 0x11d60, Hi: 0x11d65, Stride: 0x1}, + unicode.Range32{Lo: 0x11d67, Hi: 0x11d68, Stride: 0x1}, + unicode.Range32{Lo: 0x11d6a, Hi: 0x11d89, Stride: 0x1}, + unicode.Range32{Lo: 0x11d98, Hi: 0x11d98, Stride: 0x1}, + unicode.Range32{Lo: 0x11ee0, Hi: 0x11ef2, Stride: 0x1}, unicode.Range32{Lo: 0x12000, Hi: 0x12399, Stride: 0x1}, unicode.Range32{Lo: 0x12400, Hi: 0x1246e, Stride: 0x1}, unicode.Range32{Lo: 0x12480, Hi: 0x12543, Stride: 0x1}, @@ -2012,10 +2030,12 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x16b40, Hi: 0x16b43, Stride: 0x1}, unicode.Range32{Lo: 0x16b63, Hi: 0x16b77, Stride: 0x1}, unicode.Range32{Lo: 0x16b7d, Hi: 0x16b8f, Stride: 0x1}, - unicode.Range32{Lo: 0x16f00, Hi: 0x16f44, Stride: 0x1}, + unicode.Range32{Lo: 0x16e40, Hi: 0x16e7f, Stride: 0x1}, + unicode.Range32{Lo: 0x16f00, Hi: 0x16f4a, Stride: 0x1}, unicode.Range32{Lo: 0x16f50, Hi: 0x16f50, Stride: 0x1}, unicode.Range32{Lo: 0x16f93, Hi: 0x16f9f, Stride: 0x1}, - unicode.Range32{Lo: 0x16fe0, Hi: 0x16fe0, Stride: 0x1}, + unicode.Range32{Lo: 0x16fe0, Hi: 0x16fe1, Stride: 0x1}, + unicode.Range32{Lo: 0x16fe3, Hi: 0x16fe3, Stride: 0x1}, unicode.Range32{Lo: 0x1bc00, Hi: 0x1bc6a, Stride: 0x1}, unicode.Range32{Lo: 0x1bc70, Hi: 0x1bc7c, Stride: 0x1}, unicode.Range32{Lo: 0x1bc80, Hi: 0x1bc88, Stride: 0x1}, @@ -2050,8 +2070,13 @@ var _WordALetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x1d78a, Hi: 0x1d7a8, Stride: 0x1}, unicode.Range32{Lo: 0x1d7aa, Hi: 0x1d7c2, Stride: 0x1}, unicode.Range32{Lo: 0x1d7c4, Hi: 0x1d7cb, Stride: 0x1}, + unicode.Range32{Lo: 0x1e100, Hi: 0x1e12c, Stride: 0x1}, + unicode.Range32{Lo: 0x1e137, Hi: 0x1e13d, Stride: 0x1}, + unicode.Range32{Lo: 0x1e14e, Hi: 0x1e14e, Stride: 0x1}, + unicode.Range32{Lo: 0x1e2c0, Hi: 0x1e2eb, Stride: 0x1}, unicode.Range32{Lo: 0x1e800, Hi: 0x1e8c4, Stride: 0x1}, unicode.Range32{Lo: 0x1e900, Hi: 0x1e943, Stride: 0x1}, + unicode.Range32{Lo: 0x1e94b, Hi: 0x1e94b, Stride: 0x1}, unicode.Range32{Lo: 0x1ee00, Hi: 0x1ee03, Stride: 0x1}, unicode.Range32{Lo: 0x1ee05, Hi: 0x1ee1f, Stride: 0x1}, unicode.Range32{Lo: 0x1ee21, Hi: 0x1ee22, Stride: 0x1}, @@ -2106,56 +2131,6 @@ var _WordDouble_Quote = &unicode.RangeTable{ LatinOffset: 1, } -var _WordE_Base = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x261d, Hi: 0x261d, Stride: 0x1}, - unicode.Range16{Lo: 0x26f9, Hi: 0x26f9, Stride: 0x1}, - unicode.Range16{Lo: 0x270a, Hi: 0x270d, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f385, Hi: 0x1f385, Stride: 0x1}, - unicode.Range32{Lo: 0x1f3c3, Hi: 0x1f3c4, Stride: 0x1}, - unicode.Range32{Lo: 0x1f3ca, Hi: 0x1f3cb, Stride: 0x1}, - unicode.Range32{Lo: 0x1f442, Hi: 0x1f443, Stride: 0x1}, - unicode.Range32{Lo: 0x1f446, Hi: 0x1f450, Stride: 0x1}, - unicode.Range32{Lo: 0x1f46e, Hi: 0x1f46e, Stride: 0x1}, - unicode.Range32{Lo: 0x1f470, Hi: 0x1f478, Stride: 0x1}, - unicode.Range32{Lo: 0x1f47c, Hi: 0x1f47c, Stride: 0x1}, - unicode.Range32{Lo: 0x1f481, Hi: 0x1f483, Stride: 0x1}, - unicode.Range32{Lo: 0x1f485, Hi: 0x1f487, Stride: 0x1}, - unicode.Range32{Lo: 0x1f4aa, Hi: 0x1f4aa, Stride: 0x1}, - unicode.Range32{Lo: 0x1f575, Hi: 0x1f575, Stride: 0x1}, - unicode.Range32{Lo: 0x1f57a, Hi: 0x1f57a, Stride: 0x1}, - unicode.Range32{Lo: 0x1f590, Hi: 0x1f590, Stride: 0x1}, - unicode.Range32{Lo: 0x1f595, Hi: 0x1f596, Stride: 0x1}, - unicode.Range32{Lo: 0x1f645, Hi: 0x1f647, Stride: 0x1}, - unicode.Range32{Lo: 0x1f64b, Hi: 0x1f64f, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6a3, Hi: 0x1f6a3, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6b4, Hi: 0x1f6b6, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6c0, Hi: 0x1f6c0, Stride: 0x1}, - unicode.Range32{Lo: 0x1f918, Hi: 0x1f91e, Stride: 0x1}, - unicode.Range32{Lo: 0x1f926, Hi: 0x1f926, Stride: 0x1}, - unicode.Range32{Lo: 0x1f930, Hi: 0x1f930, Stride: 0x1}, - unicode.Range32{Lo: 0x1f933, Hi: 0x1f939, Stride: 0x1}, - unicode.Range32{Lo: 0x1f93c, Hi: 0x1f93e, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _WordE_Base_GAZ = &unicode.RangeTable{ - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f466, Hi: 0x1f469, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _WordE_Modifier = &unicode.RangeTable{ - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f3fb, Hi: 0x1f3ff, Stride: 0x1}, - }, - LatinOffset: 0, -} - var _WordExtend = &unicode.RangeTable{ R16: []unicode.Range16{ unicode.Range16{Lo: 0x300, Hi: 0x36f, Stride: 0x1}, @@ -2177,12 +2152,13 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0x730, Hi: 0x74a, Stride: 0x1}, unicode.Range16{Lo: 0x7a6, Hi: 0x7b0, Stride: 0x1}, unicode.Range16{Lo: 0x7eb, Hi: 0x7f3, Stride: 0x1}, + unicode.Range16{Lo: 0x7fd, Hi: 0x7fd, Stride: 0x1}, unicode.Range16{Lo: 0x816, Hi: 0x819, Stride: 0x1}, unicode.Range16{Lo: 0x81b, Hi: 0x823, Stride: 0x1}, unicode.Range16{Lo: 0x825, Hi: 0x827, Stride: 0x1}, unicode.Range16{Lo: 0x829, Hi: 0x82d, Stride: 0x1}, unicode.Range16{Lo: 0x859, Hi: 0x85b, Stride: 0x1}, - unicode.Range16{Lo: 0x8d4, Hi: 0x8e1, Stride: 0x1}, + unicode.Range16{Lo: 0x8d3, Hi: 0x8e1, Stride: 0x1}, unicode.Range16{Lo: 0x8e3, Hi: 0x902, Stride: 0x1}, unicode.Range16{Lo: 0x903, Hi: 0x903, Stride: 0x1}, unicode.Range16{Lo: 0x93a, Hi: 0x93a, Stride: 0x1}, @@ -2205,6 +2181,7 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0x9cd, Hi: 0x9cd, Stride: 0x1}, unicode.Range16{Lo: 0x9d7, Hi: 0x9d7, Stride: 0x1}, unicode.Range16{Lo: 0x9e2, Hi: 0x9e3, Stride: 0x1}, + unicode.Range16{Lo: 0x9fe, Hi: 0x9fe, Stride: 0x1}, unicode.Range16{Lo: 0xa01, Hi: 0xa02, Stride: 0x1}, unicode.Range16{Lo: 0xa03, Hi: 0xa03, Stride: 0x1}, unicode.Range16{Lo: 0xa3c, Hi: 0xa3c, Stride: 0x1}, @@ -2225,6 +2202,7 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xacb, Hi: 0xacc, Stride: 0x1}, unicode.Range16{Lo: 0xacd, Hi: 0xacd, Stride: 0x1}, unicode.Range16{Lo: 0xae2, Hi: 0xae3, Stride: 0x1}, + unicode.Range16{Lo: 0xafa, Hi: 0xaff, Stride: 0x1}, unicode.Range16{Lo: 0xb01, Hi: 0xb01, Stride: 0x1}, unicode.Range16{Lo: 0xb02, Hi: 0xb03, Stride: 0x1}, unicode.Range16{Lo: 0xb3c, Hi: 0xb3c, Stride: 0x1}, @@ -2248,6 +2226,7 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xbd7, Hi: 0xbd7, Stride: 0x1}, unicode.Range16{Lo: 0xc00, Hi: 0xc00, Stride: 0x1}, unicode.Range16{Lo: 0xc01, Hi: 0xc03, Stride: 0x1}, + unicode.Range16{Lo: 0xc04, Hi: 0xc04, Stride: 0x1}, unicode.Range16{Lo: 0xc3e, Hi: 0xc40, Stride: 0x1}, unicode.Range16{Lo: 0xc41, Hi: 0xc44, Stride: 0x1}, unicode.Range16{Lo: 0xc46, Hi: 0xc48, Stride: 0x1}, @@ -2266,8 +2245,9 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xccc, Hi: 0xccd, Stride: 0x1}, unicode.Range16{Lo: 0xcd5, Hi: 0xcd6, Stride: 0x1}, unicode.Range16{Lo: 0xce2, Hi: 0xce3, Stride: 0x1}, - unicode.Range16{Lo: 0xd01, Hi: 0xd01, Stride: 0x1}, + unicode.Range16{Lo: 0xd00, Hi: 0xd01, Stride: 0x1}, unicode.Range16{Lo: 0xd02, Hi: 0xd03, Stride: 0x1}, + unicode.Range16{Lo: 0xd3b, Hi: 0xd3c, Stride: 0x1}, unicode.Range16{Lo: 0xd3e, Hi: 0xd40, Stride: 0x1}, unicode.Range16{Lo: 0xd41, Hi: 0xd44, Stride: 0x1}, unicode.Range16{Lo: 0xd46, Hi: 0xd48, Stride: 0x1}, @@ -2286,8 +2266,7 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xe34, Hi: 0xe3a, Stride: 0x1}, unicode.Range16{Lo: 0xe47, Hi: 0xe4e, Stride: 0x1}, unicode.Range16{Lo: 0xeb1, Hi: 0xeb1, Stride: 0x1}, - unicode.Range16{Lo: 0xeb4, Hi: 0xeb9, Stride: 0x1}, - unicode.Range16{Lo: 0xebb, Hi: 0xebc, Stride: 0x1}, + unicode.Range16{Lo: 0xeb4, Hi: 0xebc, Stride: 0x1}, unicode.Range16{Lo: 0xec8, Hi: 0xecd, Stride: 0x1}, unicode.Range16{Lo: 0xf18, Hi: 0xf19, Stride: 0x1}, unicode.Range16{Lo: 0xf35, Hi: 0xf35, Stride: 0x1}, @@ -2400,10 +2379,10 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0x1ce1, Hi: 0x1ce1, Stride: 0x1}, unicode.Range16{Lo: 0x1ce2, Hi: 0x1ce8, Stride: 0x1}, unicode.Range16{Lo: 0x1ced, Hi: 0x1ced, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf2, Hi: 0x1cf3, Stride: 0x1}, unicode.Range16{Lo: 0x1cf4, Hi: 0x1cf4, Stride: 0x1}, + unicode.Range16{Lo: 0x1cf7, Hi: 0x1cf7, Stride: 0x1}, unicode.Range16{Lo: 0x1cf8, Hi: 0x1cf9, Stride: 0x1}, - unicode.Range16{Lo: 0x1dc0, Hi: 0x1df5, Stride: 0x1}, + unicode.Range16{Lo: 0x1dc0, Hi: 0x1df9, Stride: 0x1}, unicode.Range16{Lo: 0x1dfb, Hi: 0x1dff, Stride: 0x1}, unicode.Range16{Lo: 0x200c, Hi: 0x200c, Stride: 0x1}, unicode.Range16{Lo: 0x20d0, Hi: 0x20dc, Stride: 0x1}, @@ -2432,6 +2411,7 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xa8b4, Hi: 0xa8c3, Stride: 0x1}, unicode.Range16{Lo: 0xa8c4, Hi: 0xa8c5, Stride: 0x1}, unicode.Range16{Lo: 0xa8e0, Hi: 0xa8f1, Stride: 0x1}, + unicode.Range16{Lo: 0xa8ff, Hi: 0xa8ff, Stride: 0x1}, unicode.Range16{Lo: 0xa926, Hi: 0xa92d, Stride: 0x1}, unicode.Range16{Lo: 0xa947, Hi: 0xa951, Stride: 0x1}, unicode.Range16{Lo: 0xa952, Hi: 0xa953, Stride: 0x1}, @@ -2441,8 +2421,8 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xa9b4, Hi: 0xa9b5, Stride: 0x1}, unicode.Range16{Lo: 0xa9b6, Hi: 0xa9b9, Stride: 0x1}, unicode.Range16{Lo: 0xa9ba, Hi: 0xa9bb, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bc, Hi: 0xa9bc, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bd, Hi: 0xa9c0, Stride: 0x1}, + unicode.Range16{Lo: 0xa9bc, Hi: 0xa9bd, Stride: 0x1}, + unicode.Range16{Lo: 0xa9be, Hi: 0xa9c0, Stride: 0x1}, unicode.Range16{Lo: 0xa9e5, Hi: 0xa9e5, Stride: 0x1}, unicode.Range16{Lo: 0xaa29, Hi: 0xaa2e, Stride: 0x1}, unicode.Range16{Lo: 0xaa2f, Hi: 0xaa30, Stride: 0x1}, @@ -2487,6 +2467,8 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x10a38, Hi: 0x10a3a, Stride: 0x1}, unicode.Range32{Lo: 0x10a3f, Hi: 0x10a3f, Stride: 0x1}, unicode.Range32{Lo: 0x10ae5, Hi: 0x10ae6, Stride: 0x1}, + unicode.Range32{Lo: 0x10d24, Hi: 0x10d27, Stride: 0x1}, + unicode.Range32{Lo: 0x10f46, Hi: 0x10f50, Stride: 0x1}, unicode.Range32{Lo: 0x11000, Hi: 0x11000, Stride: 0x1}, unicode.Range32{Lo: 0x11001, Hi: 0x11001, Stride: 0x1}, unicode.Range32{Lo: 0x11002, Hi: 0x11002, Stride: 0x1}, @@ -2501,13 +2483,14 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x11127, Hi: 0x1112b, Stride: 0x1}, unicode.Range32{Lo: 0x1112c, Hi: 0x1112c, Stride: 0x1}, unicode.Range32{Lo: 0x1112d, Hi: 0x11134, Stride: 0x1}, + unicode.Range32{Lo: 0x11145, Hi: 0x11146, Stride: 0x1}, unicode.Range32{Lo: 0x11173, Hi: 0x11173, Stride: 0x1}, unicode.Range32{Lo: 0x11180, Hi: 0x11181, Stride: 0x1}, unicode.Range32{Lo: 0x11182, Hi: 0x11182, Stride: 0x1}, unicode.Range32{Lo: 0x111b3, Hi: 0x111b5, Stride: 0x1}, unicode.Range32{Lo: 0x111b6, Hi: 0x111be, Stride: 0x1}, unicode.Range32{Lo: 0x111bf, Hi: 0x111c0, Stride: 0x1}, - unicode.Range32{Lo: 0x111ca, Hi: 0x111cc, Stride: 0x1}, + unicode.Range32{Lo: 0x111c9, Hi: 0x111cc, Stride: 0x1}, unicode.Range32{Lo: 0x1122c, Hi: 0x1122e, Stride: 0x1}, unicode.Range32{Lo: 0x1122f, Hi: 0x11231, Stride: 0x1}, unicode.Range32{Lo: 0x11232, Hi: 0x11233, Stride: 0x1}, @@ -2520,7 +2503,7 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x112e3, Hi: 0x112ea, Stride: 0x1}, unicode.Range32{Lo: 0x11300, Hi: 0x11301, Stride: 0x1}, unicode.Range32{Lo: 0x11302, Hi: 0x11303, Stride: 0x1}, - unicode.Range32{Lo: 0x1133c, Hi: 0x1133c, Stride: 0x1}, + unicode.Range32{Lo: 0x1133b, Hi: 0x1133c, Stride: 0x1}, unicode.Range32{Lo: 0x1133e, Hi: 0x1133f, Stride: 0x1}, unicode.Range32{Lo: 0x11340, Hi: 0x11340, Stride: 0x1}, unicode.Range32{Lo: 0x11341, Hi: 0x11344, Stride: 0x1}, @@ -2536,6 +2519,7 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x11442, Hi: 0x11444, Stride: 0x1}, unicode.Range32{Lo: 0x11445, Hi: 0x11445, Stride: 0x1}, unicode.Range32{Lo: 0x11446, Hi: 0x11446, Stride: 0x1}, + unicode.Range32{Lo: 0x1145e, Hi: 0x1145e, Stride: 0x1}, unicode.Range32{Lo: 0x114b0, Hi: 0x114b2, Stride: 0x1}, unicode.Range32{Lo: 0x114b3, Hi: 0x114b8, Stride: 0x1}, unicode.Range32{Lo: 0x114b9, Hi: 0x114b9, Stride: 0x1}, @@ -2569,6 +2553,27 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x11722, Hi: 0x11725, Stride: 0x1}, unicode.Range32{Lo: 0x11726, Hi: 0x11726, Stride: 0x1}, unicode.Range32{Lo: 0x11727, Hi: 0x1172b, Stride: 0x1}, + unicode.Range32{Lo: 0x1182c, Hi: 0x1182e, Stride: 0x1}, + unicode.Range32{Lo: 0x1182f, Hi: 0x11837, Stride: 0x1}, + unicode.Range32{Lo: 0x11838, Hi: 0x11838, Stride: 0x1}, + unicode.Range32{Lo: 0x11839, Hi: 0x1183a, Stride: 0x1}, + unicode.Range32{Lo: 0x119d1, Hi: 0x119d3, Stride: 0x1}, + unicode.Range32{Lo: 0x119d4, Hi: 0x119d7, Stride: 0x1}, + unicode.Range32{Lo: 0x119da, Hi: 0x119db, Stride: 0x1}, + unicode.Range32{Lo: 0x119dc, Hi: 0x119df, Stride: 0x1}, + unicode.Range32{Lo: 0x119e0, Hi: 0x119e0, Stride: 0x1}, + unicode.Range32{Lo: 0x119e4, Hi: 0x119e4, Stride: 0x1}, + unicode.Range32{Lo: 0x11a01, Hi: 0x11a0a, Stride: 0x1}, + unicode.Range32{Lo: 0x11a33, Hi: 0x11a38, Stride: 0x1}, + unicode.Range32{Lo: 0x11a39, Hi: 0x11a39, Stride: 0x1}, + unicode.Range32{Lo: 0x11a3b, Hi: 0x11a3e, Stride: 0x1}, + unicode.Range32{Lo: 0x11a47, Hi: 0x11a47, Stride: 0x1}, + unicode.Range32{Lo: 0x11a51, Hi: 0x11a56, Stride: 0x1}, + unicode.Range32{Lo: 0x11a57, Hi: 0x11a58, Stride: 0x1}, + unicode.Range32{Lo: 0x11a59, Hi: 0x11a5b, Stride: 0x1}, + unicode.Range32{Lo: 0x11a8a, Hi: 0x11a96, Stride: 0x1}, + unicode.Range32{Lo: 0x11a97, Hi: 0x11a97, Stride: 0x1}, + unicode.Range32{Lo: 0x11a98, Hi: 0x11a99, Stride: 0x1}, unicode.Range32{Lo: 0x11c2f, Hi: 0x11c2f, Stride: 0x1}, unicode.Range32{Lo: 0x11c30, Hi: 0x11c36, Stride: 0x1}, unicode.Range32{Lo: 0x11c38, Hi: 0x11c3d, Stride: 0x1}, @@ -2581,9 +2586,23 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x11cb2, Hi: 0x11cb3, Stride: 0x1}, unicode.Range32{Lo: 0x11cb4, Hi: 0x11cb4, Stride: 0x1}, unicode.Range32{Lo: 0x11cb5, Hi: 0x11cb6, Stride: 0x1}, + unicode.Range32{Lo: 0x11d31, Hi: 0x11d36, Stride: 0x1}, + unicode.Range32{Lo: 0x11d3a, Hi: 0x11d3a, Stride: 0x1}, + unicode.Range32{Lo: 0x11d3c, Hi: 0x11d3d, Stride: 0x1}, + unicode.Range32{Lo: 0x11d3f, Hi: 0x11d45, Stride: 0x1}, + unicode.Range32{Lo: 0x11d47, Hi: 0x11d47, Stride: 0x1}, + unicode.Range32{Lo: 0x11d8a, Hi: 0x11d8e, Stride: 0x1}, + unicode.Range32{Lo: 0x11d90, Hi: 0x11d91, Stride: 0x1}, + unicode.Range32{Lo: 0x11d93, Hi: 0x11d94, Stride: 0x1}, + unicode.Range32{Lo: 0x11d95, Hi: 0x11d95, Stride: 0x1}, + unicode.Range32{Lo: 0x11d96, Hi: 0x11d96, Stride: 0x1}, + unicode.Range32{Lo: 0x11d97, Hi: 0x11d97, Stride: 0x1}, + unicode.Range32{Lo: 0x11ef3, Hi: 0x11ef4, Stride: 0x1}, + unicode.Range32{Lo: 0x11ef5, Hi: 0x11ef6, Stride: 0x1}, unicode.Range32{Lo: 0x16af0, Hi: 0x16af4, Stride: 0x1}, unicode.Range32{Lo: 0x16b30, Hi: 0x16b36, Stride: 0x1}, - unicode.Range32{Lo: 0x16f51, Hi: 0x16f7e, Stride: 0x1}, + unicode.Range32{Lo: 0x16f4f, Hi: 0x16f4f, Stride: 0x1}, + unicode.Range32{Lo: 0x16f51, Hi: 0x16f87, Stride: 0x1}, unicode.Range32{Lo: 0x16f8f, Hi: 0x16f92, Stride: 0x1}, unicode.Range32{Lo: 0x1bc9d, Hi: 0x1bc9e, Stride: 0x1}, unicode.Range32{Lo: 0x1d165, Hi: 0x1d166, Stride: 0x1}, @@ -2604,8 +2623,11 @@ var _WordExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x1e01b, Hi: 0x1e021, Stride: 0x1}, unicode.Range32{Lo: 0x1e023, Hi: 0x1e024, Stride: 0x1}, unicode.Range32{Lo: 0x1e026, Hi: 0x1e02a, Stride: 0x1}, + unicode.Range32{Lo: 0x1e130, Hi: 0x1e136, Stride: 0x1}, + unicode.Range32{Lo: 0x1e2ec, Hi: 0x1e2ef, Stride: 0x1}, unicode.Range32{Lo: 0x1e8d0, Hi: 0x1e8d6, Stride: 0x1}, unicode.Range32{Lo: 0x1e944, Hi: 0x1e94a, Stride: 0x1}, + unicode.Range32{Lo: 0x1f3fb, Hi: 0x1f3ff, Stride: 0x1}, unicode.Range32{Lo: 0xe0020, Hi: 0xe007f, Stride: 0x1}, unicode.Range32{Lo: 0xe0100, Hi: 0xe01ef, Stride: 0x1}, }, @@ -2643,6 +2665,8 @@ var _WordFormat = &unicode.RangeTable{ }, R32: []unicode.Range32{ unicode.Range32{Lo: 0x110bd, Hi: 0x110bd, Stride: 0x1}, + unicode.Range32{Lo: 0x110cd, Hi: 0x110cd, Stride: 0x1}, + unicode.Range32{Lo: 0x13430, Hi: 0x13438, Stride: 0x1}, unicode.Range32{Lo: 0x1bca0, Hi: 0x1bca3, Stride: 0x1}, unicode.Range32{Lo: 0x1d173, Hi: 0x1d17a, Stride: 0x1}, unicode.Range32{Lo: 0xe0001, Hi: 0xe0001, Stride: 0x1}, @@ -2650,21 +2674,10 @@ var _WordFormat = &unicode.RangeTable{ LatinOffset: 1, } -var _WordGlue_After_Zwj = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x2764, Hi: 0x2764, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f48b, Hi: 0x1f48b, Stride: 0x1}, - unicode.Range32{Lo: 0x1f5e8, Hi: 0x1f5e8, Stride: 0x1}, - }, - LatinOffset: 0, -} - var _WordHebrew_Letter = &unicode.RangeTable{ R16: []unicode.Range16{ unicode.Range16{Lo: 0x5d0, Hi: 0x5ea, Stride: 0x1}, - unicode.Range16{Lo: 0x5f0, Hi: 0x5f2, Stride: 0x1}, + unicode.Range16{Lo: 0x5ef, Hi: 0x5f2, Stride: 0x1}, unicode.Range16{Lo: 0xfb1d, Hi: 0xfb1d, Stride: 0x1}, unicode.Range16{Lo: 0xfb1f, Hi: 0xfb28, Stride: 0x1}, unicode.Range16{Lo: 0xfb2a, Hi: 0xfb36, Stride: 0x1}, @@ -2694,6 +2707,7 @@ var _WordKatakana = &unicode.RangeTable{ }, R32: []unicode.Range32{ unicode.Range32{Lo: 0x1b000, Hi: 0x1b000, Stride: 0x1}, + unicode.Range32{Lo: 0x1b164, Hi: 0x1b167, Stride: 0x1}, }, LatinOffset: 0, } @@ -2709,7 +2723,6 @@ var _WordMidLetter = &unicode.RangeTable{ R16: []unicode.Range16{ unicode.Range16{Lo: 0x3a, Hi: 0x3a, Stride: 0x1}, unicode.Range16{Lo: 0xb7, Hi: 0xb7, Stride: 0x1}, - unicode.Range16{Lo: 0x2d7, Hi: 0x2d7, Stride: 0x1}, unicode.Range16{Lo: 0x387, Hi: 0x387, Stride: 0x1}, unicode.Range16{Lo: 0x5f4, Hi: 0x5f4, Stride: 0x1}, unicode.Range16{Lo: 0x2027, Hi: 0x2027, Stride: 0x1}, @@ -2802,9 +2815,11 @@ var _WordNumeric = &unicode.RangeTable{ unicode.Range16{Lo: 0xa9f0, Hi: 0xa9f9, Stride: 0x1}, unicode.Range16{Lo: 0xaa50, Hi: 0xaa59, Stride: 0x1}, unicode.Range16{Lo: 0xabf0, Hi: 0xabf9, Stride: 0x1}, + unicode.Range16{Lo: 0xff10, Hi: 0xff19, Stride: 0x1}, }, R32: []unicode.Range32{ unicode.Range32{Lo: 0x104a0, Hi: 0x104a9, Stride: 0x1}, + unicode.Range32{Lo: 0x10d30, Hi: 0x10d39, Stride: 0x1}, unicode.Range32{Lo: 0x11066, Hi: 0x1106f, Stride: 0x1}, unicode.Range32{Lo: 0x110f0, Hi: 0x110f9, Stride: 0x1}, unicode.Range32{Lo: 0x11136, Hi: 0x1113f, Stride: 0x1}, @@ -2817,9 +2832,13 @@ var _WordNumeric = &unicode.RangeTable{ unicode.Range32{Lo: 0x11730, Hi: 0x11739, Stride: 0x1}, unicode.Range32{Lo: 0x118e0, Hi: 0x118e9, Stride: 0x1}, unicode.Range32{Lo: 0x11c50, Hi: 0x11c59, Stride: 0x1}, + unicode.Range32{Lo: 0x11d50, Hi: 0x11d59, Stride: 0x1}, + unicode.Range32{Lo: 0x11da0, Hi: 0x11da9, Stride: 0x1}, unicode.Range32{Lo: 0x16a60, Hi: 0x16a69, Stride: 0x1}, unicode.Range32{Lo: 0x16b50, Hi: 0x16b59, Stride: 0x1}, unicode.Range32{Lo: 0x1d7ce, Hi: 0x1d7ff, Stride: 0x1}, + unicode.Range32{Lo: 0x1e140, Hi: 0x1e149, Stride: 0x1}, + unicode.Range32{Lo: 0x1e2f0, Hi: 0x1e2f9, Stride: 0x1}, unicode.Range32{Lo: 0x1e950, Hi: 0x1e959, Stride: 0x1}, }, LatinOffset: 1, @@ -2839,6 +2858,18 @@ var _WordSingle_Quote = &unicode.RangeTable{ LatinOffset: 1, } +var _WordWSegSpace = &unicode.RangeTable{ + R16: []unicode.Range16{ + unicode.Range16{Lo: 0x20, Hi: 0x20, Stride: 0x1}, + unicode.Range16{Lo: 0x1680, Hi: 0x1680, Stride: 0x1}, + unicode.Range16{Lo: 0x2000, Hi: 0x2006, Stride: 0x1}, + unicode.Range16{Lo: 0x2008, Hi: 0x200a, Stride: 0x1}, + unicode.Range16{Lo: 0x205f, Hi: 0x205f, Stride: 0x1}, + unicode.Range16{Lo: 0x3000, Hi: 0x3000, Stride: 0x1}, + }, + LatinOffset: 1, +} + var _WordZWJ = &unicode.RangeTable{ R16: []unicode.Range16{ unicode.Range16{Lo: 0x200d, Hi: 0x200d, Stride: 0x1}, @@ -2856,20 +2887,12 @@ func _WordRuneType(r rune) *_WordRuneRange { return (*_WordRuneRange)(_WordCR) case unicode.Is(_WordDouble_Quote, r): return (*_WordRuneRange)(_WordDouble_Quote) - case unicode.Is(_WordE_Base, r): - return (*_WordRuneRange)(_WordE_Base) - case unicode.Is(_WordE_Base_GAZ, r): - return (*_WordRuneRange)(_WordE_Base_GAZ) - case unicode.Is(_WordE_Modifier, r): - return (*_WordRuneRange)(_WordE_Modifier) case unicode.Is(_WordExtend, r): return (*_WordRuneRange)(_WordExtend) case unicode.Is(_WordExtendNumLet, r): return (*_WordRuneRange)(_WordExtendNumLet) case unicode.Is(_WordFormat, r): return (*_WordRuneRange)(_WordFormat) - case unicode.Is(_WordGlue_After_Zwj, r): - return (*_WordRuneRange)(_WordGlue_After_Zwj) case unicode.Is(_WordHebrew_Letter, r): return (*_WordRuneRange)(_WordHebrew_Letter) case unicode.Is(_WordKatakana, r): @@ -2890,6 +2913,8 @@ func _WordRuneType(r rune) *_WordRuneRange { return (*_WordRuneRange)(_WordRegional_Indicator) case unicode.Is(_WordSingle_Quote, r): return (*_WordRuneRange)(_WordSingle_Quote) + case unicode.Is(_WordWSegSpace, r): + return (*_WordRuneRange)(_WordWSegSpace) case unicode.Is(_WordZWJ, r): return (*_WordRuneRange)(_WordZWJ) default: @@ -2904,20 +2929,12 @@ func (rng *_WordRuneRange) String() string { return "CR" case _WordDouble_Quote: return "Double_Quote" - case _WordE_Base: - return "E_Base" - case _WordE_Base_GAZ: - return "E_Base_GAZ" - case _WordE_Modifier: - return "E_Modifier" case _WordExtend: return "Extend" case _WordExtendNumLet: return "ExtendNumLet" case _WordFormat: return "Format" - case _WordGlue_After_Zwj: - return "Glue_After_Zwj" case _WordHebrew_Letter: return "Hebrew_Letter" case _WordKatakana: @@ -2938,6 +2955,8 @@ func (rng *_WordRuneRange) String() string { return "Regional_Indicator" case _WordSingle_Quote: return "Single_Quote" + case _WordWSegSpace: + return "WSegSpace" case _WordZWJ: return "ZWJ" default: @@ -3166,12 +3185,13 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0x730, Hi: 0x74a, Stride: 0x1}, unicode.Range16{Lo: 0x7a6, Hi: 0x7b0, Stride: 0x1}, unicode.Range16{Lo: 0x7eb, Hi: 0x7f3, Stride: 0x1}, + unicode.Range16{Lo: 0x7fd, Hi: 0x7fd, Stride: 0x1}, unicode.Range16{Lo: 0x816, Hi: 0x819, Stride: 0x1}, unicode.Range16{Lo: 0x81b, Hi: 0x823, Stride: 0x1}, unicode.Range16{Lo: 0x825, Hi: 0x827, Stride: 0x1}, unicode.Range16{Lo: 0x829, Hi: 0x82d, Stride: 0x1}, unicode.Range16{Lo: 0x859, Hi: 0x85b, Stride: 0x1}, - unicode.Range16{Lo: 0x8d4, Hi: 0x8e1, Stride: 0x1}, + unicode.Range16{Lo: 0x8d3, Hi: 0x8e1, Stride: 0x1}, unicode.Range16{Lo: 0x8e3, Hi: 0x902, Stride: 0x1}, unicode.Range16{Lo: 0x903, Hi: 0x903, Stride: 0x1}, unicode.Range16{Lo: 0x93a, Hi: 0x93a, Stride: 0x1}, @@ -3194,6 +3214,7 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0x9cd, Hi: 0x9cd, Stride: 0x1}, unicode.Range16{Lo: 0x9d7, Hi: 0x9d7, Stride: 0x1}, unicode.Range16{Lo: 0x9e2, Hi: 0x9e3, Stride: 0x1}, + unicode.Range16{Lo: 0x9fe, Hi: 0x9fe, Stride: 0x1}, unicode.Range16{Lo: 0xa01, Hi: 0xa02, Stride: 0x1}, unicode.Range16{Lo: 0xa03, Hi: 0xa03, Stride: 0x1}, unicode.Range16{Lo: 0xa3c, Hi: 0xa3c, Stride: 0x1}, @@ -3214,6 +3235,7 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xacb, Hi: 0xacc, Stride: 0x1}, unicode.Range16{Lo: 0xacd, Hi: 0xacd, Stride: 0x1}, unicode.Range16{Lo: 0xae2, Hi: 0xae3, Stride: 0x1}, + unicode.Range16{Lo: 0xafa, Hi: 0xaff, Stride: 0x1}, unicode.Range16{Lo: 0xb01, Hi: 0xb01, Stride: 0x1}, unicode.Range16{Lo: 0xb02, Hi: 0xb03, Stride: 0x1}, unicode.Range16{Lo: 0xb3c, Hi: 0xb3c, Stride: 0x1}, @@ -3237,6 +3259,7 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xbd7, Hi: 0xbd7, Stride: 0x1}, unicode.Range16{Lo: 0xc00, Hi: 0xc00, Stride: 0x1}, unicode.Range16{Lo: 0xc01, Hi: 0xc03, Stride: 0x1}, + unicode.Range16{Lo: 0xc04, Hi: 0xc04, Stride: 0x1}, unicode.Range16{Lo: 0xc3e, Hi: 0xc40, Stride: 0x1}, unicode.Range16{Lo: 0xc41, Hi: 0xc44, Stride: 0x1}, unicode.Range16{Lo: 0xc46, Hi: 0xc48, Stride: 0x1}, @@ -3255,8 +3278,9 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xccc, Hi: 0xccd, Stride: 0x1}, unicode.Range16{Lo: 0xcd5, Hi: 0xcd6, Stride: 0x1}, unicode.Range16{Lo: 0xce2, Hi: 0xce3, Stride: 0x1}, - unicode.Range16{Lo: 0xd01, Hi: 0xd01, Stride: 0x1}, + unicode.Range16{Lo: 0xd00, Hi: 0xd01, Stride: 0x1}, unicode.Range16{Lo: 0xd02, Hi: 0xd03, Stride: 0x1}, + unicode.Range16{Lo: 0xd3b, Hi: 0xd3c, Stride: 0x1}, unicode.Range16{Lo: 0xd3e, Hi: 0xd40, Stride: 0x1}, unicode.Range16{Lo: 0xd41, Hi: 0xd44, Stride: 0x1}, unicode.Range16{Lo: 0xd46, Hi: 0xd48, Stride: 0x1}, @@ -3275,8 +3299,7 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xe34, Hi: 0xe3a, Stride: 0x1}, unicode.Range16{Lo: 0xe47, Hi: 0xe4e, Stride: 0x1}, unicode.Range16{Lo: 0xeb1, Hi: 0xeb1, Stride: 0x1}, - unicode.Range16{Lo: 0xeb4, Hi: 0xeb9, Stride: 0x1}, - unicode.Range16{Lo: 0xebb, Hi: 0xebc, Stride: 0x1}, + unicode.Range16{Lo: 0xeb4, Hi: 0xebc, Stride: 0x1}, unicode.Range16{Lo: 0xec8, Hi: 0xecd, Stride: 0x1}, unicode.Range16{Lo: 0xf18, Hi: 0xf19, Stride: 0x1}, unicode.Range16{Lo: 0xf35, Hi: 0xf35, Stride: 0x1}, @@ -3389,10 +3412,10 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0x1ce1, Hi: 0x1ce1, Stride: 0x1}, unicode.Range16{Lo: 0x1ce2, Hi: 0x1ce8, Stride: 0x1}, unicode.Range16{Lo: 0x1ced, Hi: 0x1ced, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf2, Hi: 0x1cf3, Stride: 0x1}, unicode.Range16{Lo: 0x1cf4, Hi: 0x1cf4, Stride: 0x1}, + unicode.Range16{Lo: 0x1cf7, Hi: 0x1cf7, Stride: 0x1}, unicode.Range16{Lo: 0x1cf8, Hi: 0x1cf9, Stride: 0x1}, - unicode.Range16{Lo: 0x1dc0, Hi: 0x1df5, Stride: 0x1}, + unicode.Range16{Lo: 0x1dc0, Hi: 0x1df9, Stride: 0x1}, unicode.Range16{Lo: 0x1dfb, Hi: 0x1dff, Stride: 0x1}, unicode.Range16{Lo: 0x200c, Hi: 0x200d, Stride: 0x1}, unicode.Range16{Lo: 0x20d0, Hi: 0x20dc, Stride: 0x1}, @@ -3421,6 +3444,7 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xa8b4, Hi: 0xa8c3, Stride: 0x1}, unicode.Range16{Lo: 0xa8c4, Hi: 0xa8c5, Stride: 0x1}, unicode.Range16{Lo: 0xa8e0, Hi: 0xa8f1, Stride: 0x1}, + unicode.Range16{Lo: 0xa8ff, Hi: 0xa8ff, Stride: 0x1}, unicode.Range16{Lo: 0xa926, Hi: 0xa92d, Stride: 0x1}, unicode.Range16{Lo: 0xa947, Hi: 0xa951, Stride: 0x1}, unicode.Range16{Lo: 0xa952, Hi: 0xa953, Stride: 0x1}, @@ -3430,8 +3454,8 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range16{Lo: 0xa9b4, Hi: 0xa9b5, Stride: 0x1}, unicode.Range16{Lo: 0xa9b6, Hi: 0xa9b9, Stride: 0x1}, unicode.Range16{Lo: 0xa9ba, Hi: 0xa9bb, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bc, Hi: 0xa9bc, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bd, Hi: 0xa9c0, Stride: 0x1}, + unicode.Range16{Lo: 0xa9bc, Hi: 0xa9bd, Stride: 0x1}, + unicode.Range16{Lo: 0xa9be, Hi: 0xa9c0, Stride: 0x1}, unicode.Range16{Lo: 0xa9e5, Hi: 0xa9e5, Stride: 0x1}, unicode.Range16{Lo: 0xaa29, Hi: 0xaa2e, Stride: 0x1}, unicode.Range16{Lo: 0xaa2f, Hi: 0xaa30, Stride: 0x1}, @@ -3476,6 +3500,8 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x10a38, Hi: 0x10a3a, Stride: 0x1}, unicode.Range32{Lo: 0x10a3f, Hi: 0x10a3f, Stride: 0x1}, unicode.Range32{Lo: 0x10ae5, Hi: 0x10ae6, Stride: 0x1}, + unicode.Range32{Lo: 0x10d24, Hi: 0x10d27, Stride: 0x1}, + unicode.Range32{Lo: 0x10f46, Hi: 0x10f50, Stride: 0x1}, unicode.Range32{Lo: 0x11000, Hi: 0x11000, Stride: 0x1}, unicode.Range32{Lo: 0x11001, Hi: 0x11001, Stride: 0x1}, unicode.Range32{Lo: 0x11002, Hi: 0x11002, Stride: 0x1}, @@ -3490,13 +3516,14 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x11127, Hi: 0x1112b, Stride: 0x1}, unicode.Range32{Lo: 0x1112c, Hi: 0x1112c, Stride: 0x1}, unicode.Range32{Lo: 0x1112d, Hi: 0x11134, Stride: 0x1}, + unicode.Range32{Lo: 0x11145, Hi: 0x11146, Stride: 0x1}, unicode.Range32{Lo: 0x11173, Hi: 0x11173, Stride: 0x1}, unicode.Range32{Lo: 0x11180, Hi: 0x11181, Stride: 0x1}, unicode.Range32{Lo: 0x11182, Hi: 0x11182, Stride: 0x1}, unicode.Range32{Lo: 0x111b3, Hi: 0x111b5, Stride: 0x1}, unicode.Range32{Lo: 0x111b6, Hi: 0x111be, Stride: 0x1}, unicode.Range32{Lo: 0x111bf, Hi: 0x111c0, Stride: 0x1}, - unicode.Range32{Lo: 0x111ca, Hi: 0x111cc, Stride: 0x1}, + unicode.Range32{Lo: 0x111c9, Hi: 0x111cc, Stride: 0x1}, unicode.Range32{Lo: 0x1122c, Hi: 0x1122e, Stride: 0x1}, unicode.Range32{Lo: 0x1122f, Hi: 0x11231, Stride: 0x1}, unicode.Range32{Lo: 0x11232, Hi: 0x11233, Stride: 0x1}, @@ -3509,7 +3536,7 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x112e3, Hi: 0x112ea, Stride: 0x1}, unicode.Range32{Lo: 0x11300, Hi: 0x11301, Stride: 0x1}, unicode.Range32{Lo: 0x11302, Hi: 0x11303, Stride: 0x1}, - unicode.Range32{Lo: 0x1133c, Hi: 0x1133c, Stride: 0x1}, + unicode.Range32{Lo: 0x1133b, Hi: 0x1133c, Stride: 0x1}, unicode.Range32{Lo: 0x1133e, Hi: 0x1133f, Stride: 0x1}, unicode.Range32{Lo: 0x11340, Hi: 0x11340, Stride: 0x1}, unicode.Range32{Lo: 0x11341, Hi: 0x11344, Stride: 0x1}, @@ -3525,6 +3552,7 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x11442, Hi: 0x11444, Stride: 0x1}, unicode.Range32{Lo: 0x11445, Hi: 0x11445, Stride: 0x1}, unicode.Range32{Lo: 0x11446, Hi: 0x11446, Stride: 0x1}, + unicode.Range32{Lo: 0x1145e, Hi: 0x1145e, Stride: 0x1}, unicode.Range32{Lo: 0x114b0, Hi: 0x114b2, Stride: 0x1}, unicode.Range32{Lo: 0x114b3, Hi: 0x114b8, Stride: 0x1}, unicode.Range32{Lo: 0x114b9, Hi: 0x114b9, Stride: 0x1}, @@ -3558,6 +3586,27 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x11722, Hi: 0x11725, Stride: 0x1}, unicode.Range32{Lo: 0x11726, Hi: 0x11726, Stride: 0x1}, unicode.Range32{Lo: 0x11727, Hi: 0x1172b, Stride: 0x1}, + unicode.Range32{Lo: 0x1182c, Hi: 0x1182e, Stride: 0x1}, + unicode.Range32{Lo: 0x1182f, Hi: 0x11837, Stride: 0x1}, + unicode.Range32{Lo: 0x11838, Hi: 0x11838, Stride: 0x1}, + unicode.Range32{Lo: 0x11839, Hi: 0x1183a, Stride: 0x1}, + unicode.Range32{Lo: 0x119d1, Hi: 0x119d3, Stride: 0x1}, + unicode.Range32{Lo: 0x119d4, Hi: 0x119d7, Stride: 0x1}, + unicode.Range32{Lo: 0x119da, Hi: 0x119db, Stride: 0x1}, + unicode.Range32{Lo: 0x119dc, Hi: 0x119df, Stride: 0x1}, + unicode.Range32{Lo: 0x119e0, Hi: 0x119e0, Stride: 0x1}, + unicode.Range32{Lo: 0x119e4, Hi: 0x119e4, Stride: 0x1}, + unicode.Range32{Lo: 0x11a01, Hi: 0x11a0a, Stride: 0x1}, + unicode.Range32{Lo: 0x11a33, Hi: 0x11a38, Stride: 0x1}, + unicode.Range32{Lo: 0x11a39, Hi: 0x11a39, Stride: 0x1}, + unicode.Range32{Lo: 0x11a3b, Hi: 0x11a3e, Stride: 0x1}, + unicode.Range32{Lo: 0x11a47, Hi: 0x11a47, Stride: 0x1}, + unicode.Range32{Lo: 0x11a51, Hi: 0x11a56, Stride: 0x1}, + unicode.Range32{Lo: 0x11a57, Hi: 0x11a58, Stride: 0x1}, + unicode.Range32{Lo: 0x11a59, Hi: 0x11a5b, Stride: 0x1}, + unicode.Range32{Lo: 0x11a8a, Hi: 0x11a96, Stride: 0x1}, + unicode.Range32{Lo: 0x11a97, Hi: 0x11a97, Stride: 0x1}, + unicode.Range32{Lo: 0x11a98, Hi: 0x11a99, Stride: 0x1}, unicode.Range32{Lo: 0x11c2f, Hi: 0x11c2f, Stride: 0x1}, unicode.Range32{Lo: 0x11c30, Hi: 0x11c36, Stride: 0x1}, unicode.Range32{Lo: 0x11c38, Hi: 0x11c3d, Stride: 0x1}, @@ -3570,9 +3619,23 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x11cb2, Hi: 0x11cb3, Stride: 0x1}, unicode.Range32{Lo: 0x11cb4, Hi: 0x11cb4, Stride: 0x1}, unicode.Range32{Lo: 0x11cb5, Hi: 0x11cb6, Stride: 0x1}, + unicode.Range32{Lo: 0x11d31, Hi: 0x11d36, Stride: 0x1}, + unicode.Range32{Lo: 0x11d3a, Hi: 0x11d3a, Stride: 0x1}, + unicode.Range32{Lo: 0x11d3c, Hi: 0x11d3d, Stride: 0x1}, + unicode.Range32{Lo: 0x11d3f, Hi: 0x11d45, Stride: 0x1}, + unicode.Range32{Lo: 0x11d47, Hi: 0x11d47, Stride: 0x1}, + unicode.Range32{Lo: 0x11d8a, Hi: 0x11d8e, Stride: 0x1}, + unicode.Range32{Lo: 0x11d90, Hi: 0x11d91, Stride: 0x1}, + unicode.Range32{Lo: 0x11d93, Hi: 0x11d94, Stride: 0x1}, + unicode.Range32{Lo: 0x11d95, Hi: 0x11d95, Stride: 0x1}, + unicode.Range32{Lo: 0x11d96, Hi: 0x11d96, Stride: 0x1}, + unicode.Range32{Lo: 0x11d97, Hi: 0x11d97, Stride: 0x1}, + unicode.Range32{Lo: 0x11ef3, Hi: 0x11ef4, Stride: 0x1}, + unicode.Range32{Lo: 0x11ef5, Hi: 0x11ef6, Stride: 0x1}, unicode.Range32{Lo: 0x16af0, Hi: 0x16af4, Stride: 0x1}, unicode.Range32{Lo: 0x16b30, Hi: 0x16b36, Stride: 0x1}, - unicode.Range32{Lo: 0x16f51, Hi: 0x16f7e, Stride: 0x1}, + unicode.Range32{Lo: 0x16f4f, Hi: 0x16f4f, Stride: 0x1}, + unicode.Range32{Lo: 0x16f51, Hi: 0x16f87, Stride: 0x1}, unicode.Range32{Lo: 0x16f8f, Hi: 0x16f92, Stride: 0x1}, unicode.Range32{Lo: 0x1bc9d, Hi: 0x1bc9e, Stride: 0x1}, unicode.Range32{Lo: 0x1d165, Hi: 0x1d166, Stride: 0x1}, @@ -3593,6 +3656,8 @@ var _SentenceExtend = &unicode.RangeTable{ unicode.Range32{Lo: 0x1e01b, Hi: 0x1e021, Stride: 0x1}, unicode.Range32{Lo: 0x1e023, Hi: 0x1e024, Stride: 0x1}, unicode.Range32{Lo: 0x1e026, Hi: 0x1e02a, Stride: 0x1}, + unicode.Range32{Lo: 0x1e130, Hi: 0x1e136, Stride: 0x1}, + unicode.Range32{Lo: 0x1e2ec, Hi: 0x1e2ef, Stride: 0x1}, unicode.Range32{Lo: 0x1e8d0, Hi: 0x1e8d6, Stride: 0x1}, unicode.Range32{Lo: 0x1e944, Hi: 0x1e94a, Stride: 0x1}, unicode.Range32{Lo: 0xe0020, Hi: 0xe007f, Stride: 0x1}, @@ -3620,6 +3685,8 @@ var _SentenceFormat = &unicode.RangeTable{ }, R32: []unicode.Range32{ unicode.Range32{Lo: 0x110bd, Hi: 0x110bd, Stride: 0x1}, + unicode.Range32{Lo: 0x110cd, Hi: 0x110cd, Stride: 0x1}, + unicode.Range32{Lo: 0x13430, Hi: 0x13438, Stride: 0x1}, unicode.Range32{Lo: 0x1bca0, Hi: 0x1bca3, Stride: 0x1}, unicode.Range32{Lo: 0x1d173, Hi: 0x1d17a, Stride: 0x1}, unicode.Range32{Lo: 0xe0001, Hi: 0xe0001, Stride: 0x1}, @@ -3911,7 +3978,7 @@ var _SentenceLower = &unicode.RangeTable{ unicode.Range16{Lo: 0x52b, Hi: 0x52b, Stride: 0x1}, unicode.Range16{Lo: 0x52d, Hi: 0x52d, Stride: 0x1}, unicode.Range16{Lo: 0x52f, Hi: 0x52f, Stride: 0x1}, - unicode.Range16{Lo: 0x561, Hi: 0x587, Stride: 0x1}, + unicode.Range16{Lo: 0x560, Hi: 0x588, Stride: 0x1}, unicode.Range16{Lo: 0x13f8, Hi: 0x13fd, Stride: 0x1}, unicode.Range16{Lo: 0x1c80, Hi: 0x1c88, Stride: 0x1}, unicode.Range16{Lo: 0x1d00, Hi: 0x1d2b, Stride: 0x1}, @@ -4244,13 +4311,19 @@ var _SentenceLower = &unicode.RangeTable{ unicode.Range16{Lo: 0xa7a5, Hi: 0xa7a5, Stride: 0x1}, unicode.Range16{Lo: 0xa7a7, Hi: 0xa7a7, Stride: 0x1}, unicode.Range16{Lo: 0xa7a9, Hi: 0xa7a9, Stride: 0x1}, + unicode.Range16{Lo: 0xa7af, Hi: 0xa7af, Stride: 0x1}, unicode.Range16{Lo: 0xa7b5, Hi: 0xa7b5, Stride: 0x1}, unicode.Range16{Lo: 0xa7b7, Hi: 0xa7b7, Stride: 0x1}, + unicode.Range16{Lo: 0xa7b9, Hi: 0xa7b9, Stride: 0x1}, + unicode.Range16{Lo: 0xa7bb, Hi: 0xa7bb, Stride: 0x1}, + unicode.Range16{Lo: 0xa7bd, Hi: 0xa7bd, Stride: 0x1}, + unicode.Range16{Lo: 0xa7bf, Hi: 0xa7bf, Stride: 0x1}, + unicode.Range16{Lo: 0xa7c3, Hi: 0xa7c3, Stride: 0x1}, unicode.Range16{Lo: 0xa7f8, Hi: 0xa7f9, Stride: 0x1}, unicode.Range16{Lo: 0xa7fa, Hi: 0xa7fa, Stride: 0x1}, unicode.Range16{Lo: 0xab30, Hi: 0xab5a, Stride: 0x1}, unicode.Range16{Lo: 0xab5c, Hi: 0xab5f, Stride: 0x1}, - unicode.Range16{Lo: 0xab60, Hi: 0xab65, Stride: 0x1}, + unicode.Range16{Lo: 0xab60, Hi: 0xab67, Stride: 0x1}, unicode.Range16{Lo: 0xab70, Hi: 0xabbf, Stride: 0x1}, unicode.Range16{Lo: 0xfb00, Hi: 0xfb06, Stride: 0x1}, unicode.Range16{Lo: 0xfb13, Hi: 0xfb17, Stride: 0x1}, @@ -4261,6 +4334,7 @@ var _SentenceLower = &unicode.RangeTable{ unicode.Range32{Lo: 0x104d8, Hi: 0x104fb, Stride: 0x1}, unicode.Range32{Lo: 0x10cc0, Hi: 0x10cf2, Stride: 0x1}, unicode.Range32{Lo: 0x118c0, Hi: 0x118df, Stride: 0x1}, + unicode.Range32{Lo: 0x16e60, Hi: 0x16e7f, Stride: 0x1}, unicode.Range32{Lo: 0x1d41a, Hi: 0x1d433, Stride: 0x1}, unicode.Range32{Lo: 0x1d44e, Hi: 0x1d454, Stride: 0x1}, unicode.Range32{Lo: 0x1d456, Hi: 0x1d467, Stride: 0x1}, @@ -4333,9 +4407,11 @@ var _SentenceNumeric = &unicode.RangeTable{ unicode.Range16{Lo: 0xa9f0, Hi: 0xa9f9, Stride: 0x1}, unicode.Range16{Lo: 0xaa50, Hi: 0xaa59, Stride: 0x1}, unicode.Range16{Lo: 0xabf0, Hi: 0xabf9, Stride: 0x1}, + unicode.Range16{Lo: 0xff10, Hi: 0xff19, Stride: 0x1}, }, R32: []unicode.Range32{ unicode.Range32{Lo: 0x104a0, Hi: 0x104a9, Stride: 0x1}, + unicode.Range32{Lo: 0x10d30, Hi: 0x10d39, Stride: 0x1}, unicode.Range32{Lo: 0x11066, Hi: 0x1106f, Stride: 0x1}, unicode.Range32{Lo: 0x110f0, Hi: 0x110f9, Stride: 0x1}, unicode.Range32{Lo: 0x11136, Hi: 0x1113f, Stride: 0x1}, @@ -4348,9 +4424,13 @@ var _SentenceNumeric = &unicode.RangeTable{ unicode.Range32{Lo: 0x11730, Hi: 0x11739, Stride: 0x1}, unicode.Range32{Lo: 0x118e0, Hi: 0x118e9, Stride: 0x1}, unicode.Range32{Lo: 0x11c50, Hi: 0x11c59, Stride: 0x1}, + unicode.Range32{Lo: 0x11d50, Hi: 0x11d59, Stride: 0x1}, + unicode.Range32{Lo: 0x11da0, Hi: 0x11da9, Stride: 0x1}, unicode.Range32{Lo: 0x16a60, Hi: 0x16a69, Stride: 0x1}, unicode.Range32{Lo: 0x16b50, Hi: 0x16b59, Stride: 0x1}, unicode.Range32{Lo: 0x1d7ce, Hi: 0x1d7ff, Stride: 0x1}, + unicode.Range32{Lo: 0x1e140, Hi: 0x1e149, Stride: 0x1}, + unicode.Range32{Lo: 0x1e2f0, Hi: 0x1e2f9, Stride: 0x1}, unicode.Range32{Lo: 0x1e950, Hi: 0x1e959, Stride: 0x1}, }, LatinOffset: 1, @@ -4368,7 +4448,7 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x374, Hi: 0x374, Stride: 0x1}, unicode.Range16{Lo: 0x559, Hi: 0x559, Stride: 0x1}, unicode.Range16{Lo: 0x5d0, Hi: 0x5ea, Stride: 0x1}, - unicode.Range16{Lo: 0x5f0, Hi: 0x5f2, Stride: 0x1}, + unicode.Range16{Lo: 0x5ef, Hi: 0x5f2, Stride: 0x1}, unicode.Range16{Lo: 0x5f3, Hi: 0x5f3, Stride: 0x1}, unicode.Range16{Lo: 0x620, Hi: 0x63f, Stride: 0x1}, unicode.Range16{Lo: 0x640, Hi: 0x640, Stride: 0x1}, @@ -4392,6 +4472,7 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x824, Hi: 0x824, Stride: 0x1}, unicode.Range16{Lo: 0x828, Hi: 0x828, Stride: 0x1}, unicode.Range16{Lo: 0x840, Hi: 0x858, Stride: 0x1}, + unicode.Range16{Lo: 0x860, Hi: 0x86a, Stride: 0x1}, unicode.Range16{Lo: 0x8a0, Hi: 0x8b4, Stride: 0x1}, unicode.Range16{Lo: 0x8b6, Hi: 0x8bd, Stride: 0x1}, unicode.Range16{Lo: 0x904, Hi: 0x939, Stride: 0x1}, @@ -4411,6 +4492,7 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x9dc, Hi: 0x9dd, Stride: 0x1}, unicode.Range16{Lo: 0x9df, Hi: 0x9e1, Stride: 0x1}, unicode.Range16{Lo: 0x9f0, Hi: 0x9f1, Stride: 0x1}, + unicode.Range16{Lo: 0x9fc, Hi: 0x9fc, Stride: 0x1}, unicode.Range16{Lo: 0xa05, Hi: 0xa0a, Stride: 0x1}, unicode.Range16{Lo: 0xa0f, Hi: 0xa10, Stride: 0x1}, unicode.Range16{Lo: 0xa13, Hi: 0xa28, Stride: 0x1}, @@ -4488,16 +4570,10 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range16{Lo: 0xe46, Hi: 0xe46, Stride: 0x1}, unicode.Range16{Lo: 0xe81, Hi: 0xe82, Stride: 0x1}, unicode.Range16{Lo: 0xe84, Hi: 0xe84, Stride: 0x1}, - unicode.Range16{Lo: 0xe87, Hi: 0xe88, Stride: 0x1}, - unicode.Range16{Lo: 0xe8a, Hi: 0xe8a, Stride: 0x1}, - unicode.Range16{Lo: 0xe8d, Hi: 0xe8d, Stride: 0x1}, - unicode.Range16{Lo: 0xe94, Hi: 0xe97, Stride: 0x1}, - unicode.Range16{Lo: 0xe99, Hi: 0xe9f, Stride: 0x1}, - unicode.Range16{Lo: 0xea1, Hi: 0xea3, Stride: 0x1}, + unicode.Range16{Lo: 0xe86, Hi: 0xe8a, Stride: 0x1}, + unicode.Range16{Lo: 0xe8c, Hi: 0xea3, Stride: 0x1}, unicode.Range16{Lo: 0xea5, Hi: 0xea5, Stride: 0x1}, - unicode.Range16{Lo: 0xea7, Hi: 0xea7, Stride: 0x1}, - unicode.Range16{Lo: 0xeaa, Hi: 0xeab, Stride: 0x1}, - unicode.Range16{Lo: 0xead, Hi: 0xeb0, Stride: 0x1}, + unicode.Range16{Lo: 0xea7, Hi: 0xeb0, Stride: 0x1}, unicode.Range16{Lo: 0xeb2, Hi: 0xeb3, Stride: 0x1}, unicode.Range16{Lo: 0xebd, Hi: 0xebd, Stride: 0x1}, unicode.Range16{Lo: 0xec0, Hi: 0xec4, Stride: 0x1}, @@ -4518,7 +4594,8 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x108e, Hi: 0x108e, Stride: 0x1}, unicode.Range16{Lo: 0x10d0, Hi: 0x10fa, Stride: 0x1}, unicode.Range16{Lo: 0x10fc, Hi: 0x10fc, Stride: 0x1}, - unicode.Range16{Lo: 0x10fd, Hi: 0x1248, Stride: 0x1}, + unicode.Range16{Lo: 0x10fd, Hi: 0x10ff, Stride: 0x1}, + unicode.Range16{Lo: 0x1100, Hi: 0x1248, Stride: 0x1}, unicode.Range16{Lo: 0x124a, Hi: 0x124d, Stride: 0x1}, unicode.Range16{Lo: 0x1250, Hi: 0x1256, Stride: 0x1}, unicode.Range16{Lo: 0x1258, Hi: 0x1258, Stride: 0x1}, @@ -4552,7 +4629,7 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x17dc, Hi: 0x17dc, Stride: 0x1}, unicode.Range16{Lo: 0x1820, Hi: 0x1842, Stride: 0x1}, unicode.Range16{Lo: 0x1843, Hi: 0x1843, Stride: 0x1}, - unicode.Range16{Lo: 0x1844, Hi: 0x1877, Stride: 0x1}, + unicode.Range16{Lo: 0x1844, Hi: 0x1878, Stride: 0x1}, unicode.Range16{Lo: 0x1880, Hi: 0x1884, Stride: 0x1}, unicode.Range16{Lo: 0x1887, Hi: 0x18a8, Stride: 0x1}, unicode.Range16{Lo: 0x18aa, Hi: 0x18aa, Stride: 0x1}, @@ -4574,9 +4651,12 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x1c4d, Hi: 0x1c4f, Stride: 0x1}, unicode.Range16{Lo: 0x1c5a, Hi: 0x1c77, Stride: 0x1}, unicode.Range16{Lo: 0x1c78, Hi: 0x1c7d, Stride: 0x1}, + unicode.Range16{Lo: 0x1c90, Hi: 0x1cba, Stride: 0x1}, + unicode.Range16{Lo: 0x1cbd, Hi: 0x1cbf, Stride: 0x1}, unicode.Range16{Lo: 0x1ce9, Hi: 0x1cec, Stride: 0x1}, - unicode.Range16{Lo: 0x1cee, Hi: 0x1cf1, Stride: 0x1}, + unicode.Range16{Lo: 0x1cee, Hi: 0x1cf3, Stride: 0x1}, unicode.Range16{Lo: 0x1cf5, Hi: 0x1cf6, Stride: 0x1}, + unicode.Range16{Lo: 0x1cfa, Hi: 0x1cfa, Stride: 0x1}, unicode.Range16{Lo: 0x2135, Hi: 0x2138, Stride: 0x1}, unicode.Range16{Lo: 0x2180, Hi: 0x2182, Stride: 0x1}, unicode.Range16{Lo: 0x2185, Hi: 0x2188, Stride: 0x1}, @@ -4606,12 +4686,12 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range16{Lo: 0x30a1, Hi: 0x30fa, Stride: 0x1}, unicode.Range16{Lo: 0x30fc, Hi: 0x30fe, Stride: 0x1}, unicode.Range16{Lo: 0x30ff, Hi: 0x30ff, Stride: 0x1}, - unicode.Range16{Lo: 0x3105, Hi: 0x312d, Stride: 0x1}, + unicode.Range16{Lo: 0x3105, Hi: 0x312f, Stride: 0x1}, unicode.Range16{Lo: 0x3131, Hi: 0x318e, Stride: 0x1}, unicode.Range16{Lo: 0x31a0, Hi: 0x31ba, Stride: 0x1}, unicode.Range16{Lo: 0x31f0, Hi: 0x31ff, Stride: 0x1}, unicode.Range16{Lo: 0x3400, Hi: 0x4db5, Stride: 0x1}, - unicode.Range16{Lo: 0x4e00, Hi: 0x9fd5, Stride: 0x1}, + unicode.Range16{Lo: 0x4e00, Hi: 0x9fef, Stride: 0x1}, unicode.Range16{Lo: 0xa000, Hi: 0xa014, Stride: 0x1}, unicode.Range16{Lo: 0xa015, Hi: 0xa015, Stride: 0x1}, unicode.Range16{Lo: 0xa016, Hi: 0xa48c, Stride: 0x1}, @@ -4637,7 +4717,7 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range16{Lo: 0xa882, Hi: 0xa8b3, Stride: 0x1}, unicode.Range16{Lo: 0xa8f2, Hi: 0xa8f7, Stride: 0x1}, unicode.Range16{Lo: 0xa8fb, Hi: 0xa8fb, Stride: 0x1}, - unicode.Range16{Lo: 0xa8fd, Hi: 0xa8fd, Stride: 0x1}, + unicode.Range16{Lo: 0xa8fd, Hi: 0xa8fe, Stride: 0x1}, unicode.Range16{Lo: 0xa90a, Hi: 0xa925, Stride: 0x1}, unicode.Range16{Lo: 0xa930, Hi: 0xa946, Stride: 0x1}, unicode.Range16{Lo: 0xa960, Hi: 0xa97c, Stride: 0x1}, @@ -4711,7 +4791,7 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x10280, Hi: 0x1029c, Stride: 0x1}, unicode.Range32{Lo: 0x102a0, Hi: 0x102d0, Stride: 0x1}, unicode.Range32{Lo: 0x10300, Hi: 0x1031f, Stride: 0x1}, - unicode.Range32{Lo: 0x10330, Hi: 0x10340, Stride: 0x1}, + unicode.Range32{Lo: 0x1032d, Hi: 0x10340, Stride: 0x1}, unicode.Range32{Lo: 0x10341, Hi: 0x10341, Stride: 0x1}, unicode.Range32{Lo: 0x10342, Hi: 0x10349, Stride: 0x1}, unicode.Range32{Lo: 0x1034a, Hi: 0x1034a, Stride: 0x1}, @@ -4743,7 +4823,7 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x10a00, Hi: 0x10a00, Stride: 0x1}, unicode.Range32{Lo: 0x10a10, Hi: 0x10a13, Stride: 0x1}, unicode.Range32{Lo: 0x10a15, Hi: 0x10a17, Stride: 0x1}, - unicode.Range32{Lo: 0x10a19, Hi: 0x10a33, Stride: 0x1}, + unicode.Range32{Lo: 0x10a19, Hi: 0x10a35, Stride: 0x1}, unicode.Range32{Lo: 0x10a60, Hi: 0x10a7c, Stride: 0x1}, unicode.Range32{Lo: 0x10a80, Hi: 0x10a9c, Stride: 0x1}, unicode.Range32{Lo: 0x10ac0, Hi: 0x10ac7, Stride: 0x1}, @@ -4753,10 +4833,16 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x10b60, Hi: 0x10b72, Stride: 0x1}, unicode.Range32{Lo: 0x10b80, Hi: 0x10b91, Stride: 0x1}, unicode.Range32{Lo: 0x10c00, Hi: 0x10c48, Stride: 0x1}, + unicode.Range32{Lo: 0x10d00, Hi: 0x10d23, Stride: 0x1}, + unicode.Range32{Lo: 0x10f00, Hi: 0x10f1c, Stride: 0x1}, + unicode.Range32{Lo: 0x10f27, Hi: 0x10f27, Stride: 0x1}, + unicode.Range32{Lo: 0x10f30, Hi: 0x10f45, Stride: 0x1}, + unicode.Range32{Lo: 0x10fe0, Hi: 0x10ff6, Stride: 0x1}, unicode.Range32{Lo: 0x11003, Hi: 0x11037, Stride: 0x1}, unicode.Range32{Lo: 0x11083, Hi: 0x110af, Stride: 0x1}, unicode.Range32{Lo: 0x110d0, Hi: 0x110e8, Stride: 0x1}, unicode.Range32{Lo: 0x11103, Hi: 0x11126, Stride: 0x1}, + unicode.Range32{Lo: 0x11144, Hi: 0x11144, Stride: 0x1}, unicode.Range32{Lo: 0x11150, Hi: 0x11172, Stride: 0x1}, unicode.Range32{Lo: 0x11176, Hi: 0x11176, Stride: 0x1}, unicode.Range32{Lo: 0x11183, Hi: 0x111b2, Stride: 0x1}, @@ -4782,6 +4868,7 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x1135d, Hi: 0x11361, Stride: 0x1}, unicode.Range32{Lo: 0x11400, Hi: 0x11434, Stride: 0x1}, unicode.Range32{Lo: 0x11447, Hi: 0x1144a, Stride: 0x1}, + unicode.Range32{Lo: 0x1145f, Hi: 0x1145f, Stride: 0x1}, unicode.Range32{Lo: 0x11480, Hi: 0x114af, Stride: 0x1}, unicode.Range32{Lo: 0x114c4, Hi: 0x114c5, Stride: 0x1}, unicode.Range32{Lo: 0x114c7, Hi: 0x114c7, Stride: 0x1}, @@ -4790,13 +4877,34 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x11600, Hi: 0x1162f, Stride: 0x1}, unicode.Range32{Lo: 0x11644, Hi: 0x11644, Stride: 0x1}, unicode.Range32{Lo: 0x11680, Hi: 0x116aa, Stride: 0x1}, - unicode.Range32{Lo: 0x11700, Hi: 0x11719, Stride: 0x1}, + unicode.Range32{Lo: 0x116b8, Hi: 0x116b8, Stride: 0x1}, + unicode.Range32{Lo: 0x11700, Hi: 0x1171a, Stride: 0x1}, + unicode.Range32{Lo: 0x11800, Hi: 0x1182b, Stride: 0x1}, unicode.Range32{Lo: 0x118ff, Hi: 0x118ff, Stride: 0x1}, + unicode.Range32{Lo: 0x119a0, Hi: 0x119a7, Stride: 0x1}, + unicode.Range32{Lo: 0x119aa, Hi: 0x119d0, Stride: 0x1}, + unicode.Range32{Lo: 0x119e1, Hi: 0x119e1, Stride: 0x1}, + unicode.Range32{Lo: 0x119e3, Hi: 0x119e3, Stride: 0x1}, + unicode.Range32{Lo: 0x11a00, Hi: 0x11a00, Stride: 0x1}, + unicode.Range32{Lo: 0x11a0b, Hi: 0x11a32, Stride: 0x1}, + unicode.Range32{Lo: 0x11a3a, Hi: 0x11a3a, Stride: 0x1}, + unicode.Range32{Lo: 0x11a50, Hi: 0x11a50, Stride: 0x1}, + unicode.Range32{Lo: 0x11a5c, Hi: 0x11a89, Stride: 0x1}, + unicode.Range32{Lo: 0x11a9d, Hi: 0x11a9d, Stride: 0x1}, unicode.Range32{Lo: 0x11ac0, Hi: 0x11af8, Stride: 0x1}, unicode.Range32{Lo: 0x11c00, Hi: 0x11c08, Stride: 0x1}, unicode.Range32{Lo: 0x11c0a, Hi: 0x11c2e, Stride: 0x1}, unicode.Range32{Lo: 0x11c40, Hi: 0x11c40, Stride: 0x1}, unicode.Range32{Lo: 0x11c72, Hi: 0x11c8f, Stride: 0x1}, + unicode.Range32{Lo: 0x11d00, Hi: 0x11d06, Stride: 0x1}, + unicode.Range32{Lo: 0x11d08, Hi: 0x11d09, Stride: 0x1}, + unicode.Range32{Lo: 0x11d0b, Hi: 0x11d30, Stride: 0x1}, + unicode.Range32{Lo: 0x11d46, Hi: 0x11d46, Stride: 0x1}, + unicode.Range32{Lo: 0x11d60, Hi: 0x11d65, Stride: 0x1}, + unicode.Range32{Lo: 0x11d67, Hi: 0x11d68, Stride: 0x1}, + unicode.Range32{Lo: 0x11d6a, Hi: 0x11d89, Stride: 0x1}, + unicode.Range32{Lo: 0x11d98, Hi: 0x11d98, Stride: 0x1}, + unicode.Range32{Lo: 0x11ee0, Hi: 0x11ef2, Stride: 0x1}, unicode.Range32{Lo: 0x12000, Hi: 0x12399, Stride: 0x1}, unicode.Range32{Lo: 0x12400, Hi: 0x1246e, Stride: 0x1}, unicode.Range32{Lo: 0x12480, Hi: 0x12543, Stride: 0x1}, @@ -4809,18 +4917,27 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x16b40, Hi: 0x16b43, Stride: 0x1}, unicode.Range32{Lo: 0x16b63, Hi: 0x16b77, Stride: 0x1}, unicode.Range32{Lo: 0x16b7d, Hi: 0x16b8f, Stride: 0x1}, - unicode.Range32{Lo: 0x16f00, Hi: 0x16f44, Stride: 0x1}, + unicode.Range32{Lo: 0x16f00, Hi: 0x16f4a, Stride: 0x1}, unicode.Range32{Lo: 0x16f50, Hi: 0x16f50, Stride: 0x1}, unicode.Range32{Lo: 0x16f93, Hi: 0x16f9f, Stride: 0x1}, - unicode.Range32{Lo: 0x16fe0, Hi: 0x16fe0, Stride: 0x1}, - unicode.Range32{Lo: 0x17000, Hi: 0x187ec, Stride: 0x1}, + unicode.Range32{Lo: 0x16fe0, Hi: 0x16fe1, Stride: 0x1}, + unicode.Range32{Lo: 0x16fe3, Hi: 0x16fe3, Stride: 0x1}, + unicode.Range32{Lo: 0x17000, Hi: 0x187f7, Stride: 0x1}, unicode.Range32{Lo: 0x18800, Hi: 0x18af2, Stride: 0x1}, - unicode.Range32{Lo: 0x1b000, Hi: 0x1b001, Stride: 0x1}, + unicode.Range32{Lo: 0x1b000, Hi: 0x1b11e, Stride: 0x1}, + unicode.Range32{Lo: 0x1b150, Hi: 0x1b152, Stride: 0x1}, + unicode.Range32{Lo: 0x1b164, Hi: 0x1b167, Stride: 0x1}, + unicode.Range32{Lo: 0x1b170, Hi: 0x1b2fb, Stride: 0x1}, unicode.Range32{Lo: 0x1bc00, Hi: 0x1bc6a, Stride: 0x1}, unicode.Range32{Lo: 0x1bc70, Hi: 0x1bc7c, Stride: 0x1}, unicode.Range32{Lo: 0x1bc80, Hi: 0x1bc88, Stride: 0x1}, unicode.Range32{Lo: 0x1bc90, Hi: 0x1bc99, Stride: 0x1}, + unicode.Range32{Lo: 0x1e100, Hi: 0x1e12c, Stride: 0x1}, + unicode.Range32{Lo: 0x1e137, Hi: 0x1e13d, Stride: 0x1}, + unicode.Range32{Lo: 0x1e14e, Hi: 0x1e14e, Stride: 0x1}, + unicode.Range32{Lo: 0x1e2c0, Hi: 0x1e2eb, Stride: 0x1}, unicode.Range32{Lo: 0x1e800, Hi: 0x1e8c4, Stride: 0x1}, + unicode.Range32{Lo: 0x1e94b, Hi: 0x1e94b, Stride: 0x1}, unicode.Range32{Lo: 0x1ee00, Hi: 0x1ee03, Stride: 0x1}, unicode.Range32{Lo: 0x1ee05, Hi: 0x1ee1f, Stride: 0x1}, unicode.Range32{Lo: 0x1ee21, Hi: 0x1ee22, Stride: 0x1}, @@ -4858,6 +4975,7 @@ var _SentenceOLetter = &unicode.RangeTable{ unicode.Range32{Lo: 0x2a700, Hi: 0x2b734, Stride: 0x1}, unicode.Range32{Lo: 0x2b740, Hi: 0x2b81d, Stride: 0x1}, unicode.Range32{Lo: 0x2b820, Hi: 0x2cea1, Stride: 0x1}, + unicode.Range32{Lo: 0x2ceb0, Hi: 0x2ebe0, Stride: 0x1}, unicode.Range32{Lo: 0x2f800, Hi: 0x2fa1d, Stride: 0x1}, }, LatinOffset: 0, @@ -4895,10 +5013,13 @@ var _SentenceSTerm = &unicode.RangeTable{ unicode.Range16{Lo: 0x21, Hi: 0x21, Stride: 0x1}, unicode.Range16{Lo: 0x3f, Hi: 0x3f, Stride: 0x1}, unicode.Range16{Lo: 0x589, Hi: 0x589, Stride: 0x1}, - unicode.Range16{Lo: 0x61f, Hi: 0x61f, Stride: 0x1}, + unicode.Range16{Lo: 0x61e, Hi: 0x61f, Stride: 0x1}, unicode.Range16{Lo: 0x6d4, Hi: 0x6d4, Stride: 0x1}, unicode.Range16{Lo: 0x700, Hi: 0x702, Stride: 0x1}, unicode.Range16{Lo: 0x7f9, Hi: 0x7f9, Stride: 0x1}, + unicode.Range16{Lo: 0x837, Hi: 0x837, Stride: 0x1}, + unicode.Range16{Lo: 0x839, Hi: 0x839, Stride: 0x1}, + unicode.Range16{Lo: 0x83d, Hi: 0x83e, Stride: 0x1}, unicode.Range16{Lo: 0x964, Hi: 0x965, Stride: 0x1}, unicode.Range16{Lo: 0x104a, Hi: 0x104b, Stride: 0x1}, unicode.Range16{Lo: 0x1362, Hi: 0x1362, Stride: 0x1}, @@ -4936,6 +5057,7 @@ var _SentenceSTerm = &unicode.RangeTable{ }, R32: []unicode.Range32{ unicode.Range32{Lo: 0x10a56, Hi: 0x10a57, Stride: 0x1}, + unicode.Range32{Lo: 0x10f55, Hi: 0x10f59, Stride: 0x1}, unicode.Range32{Lo: 0x11047, Hi: 0x11048, Stride: 0x1}, unicode.Range32{Lo: 0x110be, Hi: 0x110c1, Stride: 0x1}, unicode.Range32{Lo: 0x11141, Hi: 0x11143, Stride: 0x1}, @@ -4950,11 +5072,15 @@ var _SentenceSTerm = &unicode.RangeTable{ unicode.Range32{Lo: 0x115c9, Hi: 0x115d7, Stride: 0x1}, unicode.Range32{Lo: 0x11641, Hi: 0x11642, Stride: 0x1}, unicode.Range32{Lo: 0x1173c, Hi: 0x1173e, Stride: 0x1}, + unicode.Range32{Lo: 0x11a42, Hi: 0x11a43, Stride: 0x1}, + unicode.Range32{Lo: 0x11a9b, Hi: 0x11a9c, Stride: 0x1}, unicode.Range32{Lo: 0x11c41, Hi: 0x11c42, Stride: 0x1}, + unicode.Range32{Lo: 0x11ef7, Hi: 0x11ef8, Stride: 0x1}, unicode.Range32{Lo: 0x16a6e, Hi: 0x16a6f, Stride: 0x1}, unicode.Range32{Lo: 0x16af5, Hi: 0x16af5, Stride: 0x1}, unicode.Range32{Lo: 0x16b37, Hi: 0x16b38, Stride: 0x1}, unicode.Range32{Lo: 0x16b44, Hi: 0x16b44, Stride: 0x1}, + unicode.Range32{Lo: 0x16e98, Hi: 0x16e98, Stride: 0x1}, unicode.Range32{Lo: 0x1bc9f, Hi: 0x1bc9f, Stride: 0x1}, unicode.Range32{Lo: 0x1da88, Hi: 0x1da88, Stride: 0x1}, }, @@ -5582,6 +5708,12 @@ var _SentenceUpper = &unicode.RangeTable{ unicode.Range16{Lo: 0xa7aa, Hi: 0xa7ae, Stride: 0x1}, unicode.Range16{Lo: 0xa7b0, Hi: 0xa7b4, Stride: 0x1}, unicode.Range16{Lo: 0xa7b6, Hi: 0xa7b6, Stride: 0x1}, + unicode.Range16{Lo: 0xa7b8, Hi: 0xa7b8, Stride: 0x1}, + unicode.Range16{Lo: 0xa7ba, Hi: 0xa7ba, Stride: 0x1}, + unicode.Range16{Lo: 0xa7bc, Hi: 0xa7bc, Stride: 0x1}, + unicode.Range16{Lo: 0xa7be, Hi: 0xa7be, Stride: 0x1}, + unicode.Range16{Lo: 0xa7c2, Hi: 0xa7c2, Stride: 0x1}, + unicode.Range16{Lo: 0xa7c4, Hi: 0xa7c6, Stride: 0x1}, unicode.Range16{Lo: 0xff21, Hi: 0xff3a, Stride: 0x1}, }, R32: []unicode.Range32{ @@ -5589,6 +5721,7 @@ var _SentenceUpper = &unicode.RangeTable{ unicode.Range32{Lo: 0x104b0, Hi: 0x104d3, Stride: 0x1}, unicode.Range32{Lo: 0x10c80, Hi: 0x10cb2, Stride: 0x1}, unicode.Range32{Lo: 0x118a0, Hi: 0x118bf, Stride: 0x1}, + unicode.Range32{Lo: 0x16e40, Hi: 0x16e5f, Stride: 0x1}, unicode.Range32{Lo: 0x1d400, Hi: 0x1d419, Stride: 0x1}, unicode.Range32{Lo: 0x1d434, Hi: 0x1d44d, Stride: 0x1}, unicode.Range32{Lo: 0x1d468, Hi: 0x1d481, Stride: 0x1}, diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/unicode2ragel.rb b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/unicode2ragel.rb similarity index 99% rename from awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/unicode2ragel.rb rename to awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/unicode2ragel.rb index 422e4e5ccd03..bfb7b7268a1a 100644 --- a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/unicode2ragel.rb +++ b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/unicode2ragel.rb @@ -82,7 +82,7 @@ def each_alpha( url, property ) open( url ) do |file| file.each_line do |line| next if line =~ /^#/; - next if line !~ /; #{property} #/; + next if line !~ /; #{property} *#/; range, description = line.split(/;/) range.strip! diff --git a/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/utf8_seqs.go b/awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/utf8_seqs.go similarity index 100% rename from awsproviderlint/vendor/github.com/apparentlymart/go-textseg/textseg/utf8_seqs.go rename to awsproviderlint/vendor/github.com/apparentlymart/go-textseg/v12/textseg/utf8_seqs.go diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/client/client.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/client/client.go index 03334d69207b..74f35ccf0cdc 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/client/client.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/client/client.go @@ -88,10 +88,6 @@ func (c *Client) NewRequest(operation *request.Operation, params interface{}, da // AddDebugHandlers injects debug logging handlers into the service to log request // debug information. func (c *Client) AddDebugHandlers() { - if !c.Config.LogLevel.AtLeast(aws.LogDebug) { - return - } - c.Handlers.Send.PushFrontNamed(LogHTTPRequestHandler) c.Handlers.Send.PushBackNamed(LogHTTPResponseHandler) } diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go index 8958c32d4e9f..1d774cfa251f 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go @@ -53,6 +53,10 @@ var LogHTTPRequestHandler = request.NamedHandler{ } func logRequest(r *request.Request) { + if !r.Config.LogLevel.AtLeast(aws.LogDebug) { + return + } + logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) bodySeekable := aws.IsReaderSeekable(r.Body) @@ -120,6 +124,10 @@ var LogHTTPResponseHandler = request.NamedHandler{ } func logResponse(r *request.Request) { + if !r.Config.LogLevel.AtLeast(aws.LogDebug) { + return + } + lw := &logWriter{r.Config.Logger, bytes.NewBuffer(nil)} if r.HTTPResponse == nil { diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go index e42c5cdbb2e2..260a37cbbabe 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds/assume_role_provider.go @@ -95,7 +95,7 @@ import ( // StdinTokenProvider will prompt on stderr and read from stdin for a string value. // An error is returned if reading from stdin fails. // -// Use this function go read MFA tokens from stdin. The function makes no attempt +// Use this function to read MFA tokens from stdin. The function makes no attempt // to make atomic prompts from stdin across multiple gorouties. // // Using StdinTokenProvider with multiple AssumeRoleProviders, or Credentials will diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index 6ee1adc08aee..ee958ece47c3 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -21,6 +21,7 @@ const ( ApEast1RegionID = "ap-east-1" // Asia Pacific (Hong Kong). ApNortheast1RegionID = "ap-northeast-1" // Asia Pacific (Tokyo). ApNortheast2RegionID = "ap-northeast-2" // Asia Pacific (Seoul). + ApNortheast3RegionID = "ap-northeast-3" // Asia Pacific (Osaka). ApSouth1RegionID = "ap-south-1" // Asia Pacific (Mumbai). ApSoutheast1RegionID = "ap-southeast-1" // Asia Pacific (Singapore). ApSoutheast2RegionID = "ap-southeast-2" // Asia Pacific (Sydney). @@ -121,6 +122,9 @@ var awsPartition = partition{ "ap-northeast-2": region{ Description: "Asia Pacific (Seoul)", }, + "ap-northeast-3": region{ + Description: "Asia Pacific (Osaka)", + }, "ap-south-1": region{ Description: "Asia Pacific (Mumbai)", }, @@ -184,6 +188,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -239,6 +244,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -358,6 +364,23 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "amplifybackend": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "api.detective": service{ Defaults: endpoint{ Protocols: []string{"https"}, @@ -436,6 +459,12 @@ var awsPartition = partition{ Region: "ap-northeast-2", }, }, + "ap-northeast-3": endpoint{ + Hostname: "api.ecr.ap-northeast-3.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-3", + }, + }, "ap-south-1": endpoint{ Hostname: "api.ecr.ap-south-1.amazonaws.com", CredentialScope: credentialScope{ @@ -690,6 +719,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -749,6 +779,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -899,6 +930,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -972,9 +1004,11 @@ var awsPartition = partition{ "batch": service{ Endpoints: endpoints{ + "af-south-1": endpoint{}, "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -1104,6 +1138,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -1369,6 +1404,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -1583,6 +1619,12 @@ var awsPartition = partition{ Region: "us-east-2", }, }, + "fips-us-west-1": endpoint{ + Hostname: "cognito-idp-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, "fips-us-west-2": endpoint{ Hostname: "cognito-idp-fips.us-west-2.amazonaws.com", CredentialScope: credentialScope{ @@ -1686,6 +1728,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -1743,7 +1786,10 @@ var awsPartition = partition{ "contact-lens": service{ Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-west-2": endpoint{}, }, @@ -1880,6 +1926,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -1941,6 +1988,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2118,6 +2166,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2180,6 +2229,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2237,6 +2287,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2303,6 +2354,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2354,6 +2406,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2403,6 +2456,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2434,6 +2488,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2483,6 +2538,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2517,6 +2573,12 @@ var awsPartition = partition{ Region: "ap-northeast-2", }, }, + "fips-ap-northeast-3": endpoint{ + Hostname: "elasticfilesystem-fips.ap-northeast-3.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-3", + }, + }, "fips-ap-south-1": endpoint{ Hostname: "elasticfilesystem-fips.ap-south-1.amazonaws.com", CredentialScope: credentialScope{ @@ -2630,6 +2692,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2682,6 +2745,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2761,9 +2825,19 @@ var awsPartition = partition{ "emr-containers": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "entitlement.marketplace": service{ @@ -2783,6 +2857,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2814,6 +2889,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -2863,6 +2939,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -3159,6 +3236,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -3214,6 +3292,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -3674,6 +3753,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -3767,6 +3847,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -3825,11 +3906,12 @@ var awsPartition = partition{ Region: "us-west-2", }, }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "me-south-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "lambda": service{ @@ -3839,6 +3921,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -3955,6 +4038,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -4254,6 +4338,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -4328,6 +4413,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -4935,12 +5021,42 @@ var awsPartition = partition{ "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, - "me-south-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "fips-ca-central-1": endpoint{ + Hostname: "ram-fips.ca-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + }, + "fips-us-east-1": endpoint{ + Hostname: "ram-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "fips-us-east-2": endpoint{ + Hostname: "ram-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "fips-us-west-1": endpoint{ + Hostname: "ram-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "fips-us-west-2": endpoint{ + Hostname: "ram-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + "me-south-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "rds": service{ @@ -4950,6 +5066,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -5007,6 +5124,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -5110,6 +5228,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -5312,6 +5431,7 @@ var awsPartition = partition{ SignatureVersions: []string{"s3", "s3v4"}, }, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{ Hostname: "s3.ap-southeast-1.amazonaws.com", @@ -5388,6 +5508,13 @@ var awsPartition = partition{ Region: "ap-northeast-2", }, }, + "ap-northeast-3": endpoint{ + Hostname: "s3-control.ap-northeast-3.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "ap-northeast-3", + }, + }, "ap-south-1": endpoint{ Hostname: "s3-control.ap-south-1.amazonaws.com", SignatureVersions: []string{"s3v4"}, @@ -5583,6 +5710,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -5824,6 +5952,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -5934,6 +6063,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -6056,6 +6186,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -6108,6 +6239,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -6159,6 +6291,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -6214,6 +6347,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -6359,6 +6493,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -6426,6 +6561,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -6475,6 +6611,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -6560,6 +6697,8 @@ var awsPartition = partition{ "transfer": service{ Endpoints: endpoints{ + "af-south-1": endpoint{}, + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -6601,11 +6740,12 @@ var awsPartition = partition{ Region: "us-west-2", }, }, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "me-south-1": endpoint{}, + "sa-east-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "translate": service{ @@ -6951,6 +7091,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, @@ -6981,6 +7122,7 @@ var awsPartition = partition{ "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-northeast-3": endpoint{}, "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, @@ -7449,6 +7591,16 @@ var awscnPartition = partition{ "cn-north-1": endpoint{}, }, }, + "guardduty": service{ + IsRegionalized: boxedTrue, + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, "health": service{ Endpoints: endpoints{ @@ -8118,18 +8270,6 @@ var awsusgovPartition = partition{ "batch": service{ Endpoints: endpoints{ - "fips-us-gov-east-1": endpoint{ - Hostname: "batch.us-gov-east-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-east-1", - }, - }, - "fips-us-gov-west-1": endpoint{ - Hostname: "batch.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, @@ -8323,6 +8463,12 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "connect": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "datasync": service{ Endpoints: endpoints{ @@ -8964,6 +9110,22 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "models.lex": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "lex", + }, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + "us-gov-west-1-fips": endpoint{ + Hostname: "models-fips.lex.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, "monitoring": service{ Endpoints: endpoints{ @@ -9072,8 +9234,18 @@ var awsusgovPartition = partition{ "ram": service{ Endpoints: endpoints{ - "us-gov-east-1": endpoint{}, - "us-gov-west-1": endpoint{}, + "us-gov-east-1": endpoint{ + Hostname: "ram.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, + "us-gov-west-1": endpoint{ + Hostname: "ram.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, }, }, "rds": service{ @@ -9169,6 +9341,22 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "runtime.lex": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "lex", + }, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + "us-gov-west-1-fips": endpoint{ + Hostname: "runtime-fips.lex.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, "runtime.sagemaker": service{ Endpoints: endpoints{ @@ -10311,6 +10499,19 @@ var awsisobPartition = partition{ "us-isob-east-1": endpoint{}, }, }, + "route53": service{ + PartitionEndpoint: "aws-iso-b-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-iso-b-global": endpoint{ + Hostname: "route53.sc2s.sgov.gov", + CredentialScope: credentialScope{ + Region: "us-isob-east-1", + }, + }, + }, + }, "s3": service{ Defaults: endpoint{ Protocols: []string{"http", "https"}, diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go index d71f7b3f4fa0..1737c2686de4 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go @@ -689,9 +689,12 @@ func (ctx *signingCtx) buildBodyDigest() error { if hash == "" { includeSHA256Header := ctx.unsignedPayload || ctx.ServiceName == "s3" || + ctx.ServiceName == "s3-object-lambda" || ctx.ServiceName == "glacier" - s3Presign := ctx.isPresign && ctx.ServiceName == "s3" + s3Presign := ctx.isPresign && + (ctx.ServiceName == "s3" || + ctx.ServiceName == "s3-object-lambda") if ctx.unsignedPayload || s3Presign { hash = "UNSIGNED-PAYLOAD" diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/version.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/version.go index 781c2ca10861..7092e4a51929 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.37.4" +const SDKVersion = "1.38.6" diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/internal/s3shared/arn/arn.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/internal/s3shared/arn/arn.go index 7a8e46fbdaed..3079e4ab0e24 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/internal/s3shared/arn/arn.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/internal/s3shared/arn/arn.go @@ -7,6 +7,21 @@ import ( "github.com/aws/aws-sdk-go/aws/arn" ) +var supportedServiceARN = []string{ + "s3", + "s3-outposts", + "s3-object-lambda", +} + +func isSupportedServiceARN(service string) bool { + for _, name := range supportedServiceARN { + if name == service { + return true + } + } + return false +} + // Resource provides the interfaces abstracting ARNs of specific resource // types. type Resource interface { @@ -29,9 +44,10 @@ func ParseResource(s string, resParser ResourceParser) (resARN Resource, err err return nil, InvalidARNError{ARN: a, Reason: "partition not set"} } - if a.Service != "s3" && a.Service != "s3-outposts" { + if !isSupportedServiceARN(a.Service) { return nil, InvalidARNError{ARN: a, Reason: "service is not supported"} } + if len(a.Resource) == 0 { return nil, InvalidARNError{ARN: a, Reason: "resource not set"} } diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/internal/s3shared/arn/s3_object_lambda_arn.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/internal/s3shared/arn/s3_object_lambda_arn.go new file mode 100644 index 000000000000..513154cc0e31 --- /dev/null +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/internal/s3shared/arn/s3_object_lambda_arn.go @@ -0,0 +1,15 @@ +package arn + +// S3ObjectLambdaARN represents an ARN for the s3-object-lambda service +type S3ObjectLambdaARN interface { + Resource + + isS3ObjectLambdasARN() +} + +// S3ObjectLambdaAccessPointARN is an S3ObjectLambdaARN for the Access Point resource type +type S3ObjectLambdaAccessPointARN struct { + AccessPointARN +} + +func (s S3ObjectLambdaAccessPointARN) isS3ObjectLambdasARN() {} diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/api.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/api.go index 89a0a29afffe..6d15bad28f7e 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/api.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/api.go @@ -14,6 +14,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awsutil" "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/internal/s3shared/arn" "github.com/aws/aws-sdk-go/private/checksum" "github.com/aws/aws-sdk-go/private/protocol" @@ -67,7 +68,7 @@ func (c *S3) AbortMultipartUploadRequest(input *AbortMultipartUploadInput) (req // AbortMultipartUpload API operation for Amazon Simple Storage Service. // -// This operation aborts a multipart upload. After a multipart upload is aborted, +// This action aborts a multipart upload. After a multipart upload is aborted, // no additional parts can be uploaded using that upload ID. The storage consumed // by any previously uploaded parts will be freed. However, if any part uploads // are currently in progress, those part uploads might or might not succeed. @@ -76,10 +77,10 @@ func (c *S3) AbortMultipartUploadRequest(input *AbortMultipartUploadInput) (req // // To verify that all parts have been removed, so you don't get charged for // the part storage, you should call the ListParts (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListParts.html) -// operation and ensure that the parts list is empty. +// action and ensure that the parts list is empty. // -// For information about permissions required to use the multipart upload API, -// see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). +// For information about permissions required to use the multipart upload, see +// Multipart Upload and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). // // The following operations are related to AbortMultipartUpload: // @@ -175,10 +176,10 @@ func (c *S3) CompleteMultipartUploadRequest(input *CompleteMultipartUploadInput) // You first initiate the multipart upload and then upload all parts using the // UploadPart (https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html) // operation. After successfully uploading all relevant parts of an upload, -// you call this operation to complete the upload. Upon receiving this request, +// you call this action to complete the upload. Upon receiving this request, // Amazon S3 concatenates all the parts in ascending order by part number to // create a new object. In the Complete Multipart Upload request, you must provide -// the parts list. You must ensure that the parts list is complete. This operation +// the parts list. You must ensure that the parts list is complete. This action // concatenates the parts that you provide in the list. For each part in the // list, you must provide the part number and the ETag value, returned after // that part was uploaded. @@ -199,7 +200,7 @@ func (c *S3) CompleteMultipartUploadRequest(input *CompleteMultipartUploadInput) // Multipart Upload (https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html). // // For information about permissions required to use the multipart upload API, -// see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). +// see Multipart Upload and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). // // CompleteMultipartUpload has the following special errors: // @@ -306,10 +307,10 @@ func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *request.Request, ou // Creates a copy of an object that is already stored in Amazon S3. // // You can store individual objects of up to 5 TB in Amazon S3. You create a -// copy of your object up to 5 GB in size in a single atomic operation using -// this API. However, to copy an object greater than 5 GB, you must use the -// multipart upload Upload Part - Copy API. For more information, see Copy Object -// Using the REST Multipart Upload API (https://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjctsUsingRESTMPUapi.html). +// copy of your object up to 5 GB in size in a single atomic action using this +// API. However, to copy an object greater than 5 GB, you must use the multipart +// upload Upload Part - Copy API. For more information, see Copy Object Using +// the REST Multipart Upload API (https://docs.aws.amazon.com/AmazonS3/latest/dev/CopyingObjctsUsingRESTMPUapi.html). // // All copy requests must be authenticated. Additionally, you must have read // access to the source object and write access to the destination bucket. For @@ -319,7 +320,7 @@ func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *request.Request, ou // // A copy request might return an error when Amazon S3 receives the copy request // or while Amazon S3 is copying the files. If the error occurs before the copy -// operation starts, you receive a standard Amazon S3 error. If the error occurs +// action starts, you receive a standard Amazon S3 error. If the error occurs // during the copy operation, the error response is embedded in the 200 OK response. // This means that a 200 OK response can contain either a success or an error. // Design your application to parse the contents of the response and handle @@ -334,7 +335,7 @@ func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *request.Request, ou // // The copy request charge is based on the storage class and Region that you // specify for the destination object. For pricing information, see Amazon S3 -// pricing (https://aws.amazon.com/s3/pricing/). +// pricing (http://aws.amazon.com/s3/pricing/). // // Amazon S3 transfer acceleration does not support cross-Region copies. If // you request a cross-Region copy using a transfer acceleration endpoint, you @@ -404,7 +405,7 @@ func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *request.Request, ou // // If a target object uses SSE-KMS, you can enable an S3 Bucket Key for the // object. For more information, see Amazon S3 Bucket Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Access Control List (ACL)-Specific Request Headers // @@ -418,7 +419,7 @@ func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *request.Request, ou // // Storage Class Options // -// You can use the CopyObject operation to change the storage class of an object +// You can use the CopyObject action to change the storage class of an object // that is already stored in Amazon S3 using the StorageClass parameter. For // more information, see Storage Classes (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-class-intro.html) // in the Amazon S3 Service Developer Guide. @@ -459,8 +460,8 @@ func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *request.Request, ou // // Returned Error Codes: // * ErrCodeObjectNotInActiveTierError "ObjectNotInActiveTierError" -// The source object of the COPY operation is not in the active tier and is -// only stored in Amazon S3 Glacier. +// The source object of the COPY action is not in the active tier and is only +// stored in Amazon S3 Glacier. // // See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObject func (c *S3) CopyObject(input *CopyObjectInput) (*CopyObjectOutput, error) { @@ -678,10 +679,10 @@ func (c *S3) CreateMultipartUploadRequest(input *CreateMultipartUploadInput) (re // CreateMultipartUpload API operation for Amazon Simple Storage Service. // -// This operation initiates a multipart upload and returns an upload ID. This -// upload ID is used to associate all of the parts in the specific multipart -// upload. You specify this upload ID in each of your subsequent upload part -// requests (see UploadPart (https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html)). +// This action initiates a multipart upload and returns an upload ID. This upload +// ID is used to associate all of the parts in the specific multipart upload. +// You specify this upload ID in each of your subsequent upload part requests +// (see UploadPart (https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html)). // You also include this upload ID in the final request to either complete or // abort the multipart upload request. // @@ -691,12 +692,12 @@ func (c *S3) CreateMultipartUploadRequest(input *CreateMultipartUploadInput) (re // If you have configured a lifecycle rule to abort incomplete multipart uploads, // the upload must complete within the number of days specified in the bucket // lifecycle configuration. Otherwise, the incomplete multipart upload becomes -// eligible for an abort operation and Amazon S3 aborts the multipart upload. -// For more information, see Aborting Incomplete Multipart Uploads Using a Bucket +// eligible for an abort action and Amazon S3 aborts the multipart upload. For +// more information, see Aborting Incomplete Multipart Uploads Using a Bucket // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config). // // For information about the permissions required to use the multipart upload -// API, see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). +// API, see Multipart Upload and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). // // For request signing, multipart upload is just a series of regular requests. // You initiate a multipart upload, send one or more requests to upload parts, @@ -716,7 +717,7 @@ func (c *S3) CreateMultipartUploadRequest(input *CreateMultipartUploadInput) (re // and decrypts it when you access it. You can provide your own encryption key, // or use AWS Key Management Service (AWS KMS) customer master keys (CMKs) or // Amazon S3-managed encryption keys. If you choose to provide your own encryption -// key, the request headers you provide in UploadPart (AmazonS3/latest/API/API_UploadPart.html) +// key, the request headers you provide in UploadPart (https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html) // and UploadPartCopy (https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPartCopy.html) // requests must match the headers you used in the request to initiate the upload // by using CreateMultipartUpload. @@ -989,8 +990,8 @@ func (c *S3) DeleteBucketAnalyticsConfigurationRequest(input *DeleteBucketAnalyt // To use this operation, you must have permissions to perform the s3:PutAnalyticsConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // For information about the Amazon S3 analytics feature, see Amazon S3 Analytics // – Storage Class Analysis (https://docs.aws.amazon.com/AmazonS3/latest/dev/analytics-storage-class.html). @@ -1083,7 +1084,7 @@ func (c *S3) DeleteBucketCorsRequest(input *DeleteBucketCorsInput) (req *request // permission to others. // // For information about cors, see Enabling Cross-Origin Resource Sharing (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Related Resources: // @@ -1164,17 +1165,17 @@ func (c *S3) DeleteBucketEncryptionRequest(input *DeleteBucketEncryptionInput) ( // DeleteBucketEncryption API operation for Amazon Simple Storage Service. // -// This implementation of the DELETE operation removes default encryption from +// This implementation of the DELETE action removes default encryption from // the bucket. For information about the Amazon S3 default encryption feature, // see Amazon S3 Default Bucket Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // To use this operation, you must have permissions to perform the s3:PutEncryptionConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) +// in the Amazon S3 User Guide. // // Related Resources // @@ -1361,8 +1362,8 @@ func (c *S3) DeleteBucketInventoryConfigurationRequest(input *DeleteBucketInvent // To use this operation, you must have permissions to perform the s3:PutInventoryConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // For information about the Amazon S3 inventory feature, see Amazon S3 Inventory // (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html). @@ -1550,8 +1551,8 @@ func (c *S3) DeleteBucketMetricsConfigurationRequest(input *DeleteBucketMetricsC // To use this operation, you must have permissions to perform the s3:PutMetricsConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // For information about CloudWatch request metrics for Amazon S3, see Monitoring // Metrics with Amazon CloudWatch (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html). @@ -1725,9 +1726,9 @@ func (c *S3) DeleteBucketPolicyRequest(input *DeleteBucketPolicyInput) (req *req // DeleteBucketPolicy API operation for Amazon Simple Storage Service. // -// This implementation of the DELETE operation uses the policy subresource to -// delete the policy of a specified bucket. If you are using an identity other -// than the root user of the AWS account that owns the bucket, the calling identity +// This implementation of the DELETE action uses the policy subresource to delete +// the policy of a specified bucket. If you are using an identity other than +// the root user of the AWS account that owns the bucket, the calling identity // must have the DeleteBucketPolicy permissions on the specified bucket and // belong to the bucket owner's account to use this operation. // @@ -1827,8 +1828,8 @@ func (c *S3) DeleteBucketReplicationRequest(input *DeleteBucketReplicationInput) // To use this operation, you must have permissions to perform the s3:PutReplicationConfiguration // action. The bucket owner has these permissions by default and can grant it // to others. For more information about permissions, see Permissions Related -// to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // It can take a while for the deletion of a replication configuration to fully // propagate. @@ -2000,15 +2001,15 @@ func (c *S3) DeleteBucketWebsiteRequest(input *DeleteBucketWebsiteInput) (req *r // DeleteBucketWebsite API operation for Amazon Simple Storage Service. // -// This operation removes the website configuration for a bucket. Amazon S3 -// returns a 200 OK response upon successfully deleting a website configuration -// on the specified bucket. You will get a 200 OK response if the website configuration +// This action removes the website configuration for a bucket. Amazon S3 returns +// a 200 OK response upon successfully deleting a website configuration on the +// specified bucket. You will get a 200 OK response if the website configuration // you are trying to delete does not exist on the bucket. Amazon S3 returns // a 404 response if the bucket specified in the request does not exist. // -// This DELETE operation requires the S3:DeleteBucketWebsite permission. By -// default, only the bucket owner can delete the website configuration attached -// to a bucket. However, bucket owners can grant other users permission to delete +// This DELETE action requires the S3:DeleteBucketWebsite permission. By default, +// only the bucket owner can delete the website configuration attached to a +// bucket. However, bucket owners can grant other users permission to delete // the website configuration by writing a bucket policy granting them the S3:DeleteBucketWebsite // permission. // @@ -2095,7 +2096,8 @@ func (c *S3) DeleteObjectRequest(input *DeleteObjectInput) (req *request.Request // // Removes the null version (if there is one) of an object and inserts a delete // marker, which becomes the latest version of the object. If there isn't a -// null version, Amazon S3 does not remove any objects. +// null version, Amazon S3 does not remove any objects but will still respond +// that the command was successful. // // To remove a specific version, you must be the bucket owner and you must use // the version Id subresource. Using this subresource permanently deletes the @@ -2110,14 +2112,14 @@ func (c *S3) DeleteObjectRequest(input *DeleteObjectInput) (req *request.Request // For more information about MFA Delete, see Using MFA Delete (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMFADelete.html). // To see sample requests that use versioning, see Sample Request (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html#ExampleVersionObjectDelete). // -// You can delete objects by explicitly calling the DELETE Object API or configure -// its lifecycle (PutBucketLifecycle (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycle.html)) +// You can delete objects by explicitly calling DELETE Object or configure its +// lifecycle (PutBucketLifecycle (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycle.html)) // to enable Amazon S3 to remove them for you. If you want to block users or // accounts from removing or deleting objects from your bucket, you must deny // them the s3:DeleteObject, s3:DeleteObjectVersion, and s3:PutLifeCycleConfiguration // actions. // -// The following operation is related to DeleteObject: +// The following action is related to DeleteObject: // // * PutObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) // @@ -2285,27 +2287,27 @@ func (c *S3) DeleteObjectsRequest(input *DeleteObjectsInput) (req *request.Reque // DeleteObjects API operation for Amazon Simple Storage Service. // -// This operation enables you to delete multiple objects from a bucket using -// a single HTTP request. If you know the object keys that you want to delete, -// then this operation provides a suitable alternative to sending individual -// delete requests, reducing per-request overhead. +// This action enables you to delete multiple objects from a bucket using a +// single HTTP request. If you know the object keys that you want to delete, +// then this action provides a suitable alternative to sending individual delete +// requests, reducing per-request overhead. // // The request contains a list of up to 1000 keys that you want to delete. In // the XML, you provide the object key names, and optionally, version IDs if // you want to delete a specific version of the object from a versioning-enabled -// bucket. For each key, Amazon S3 performs a delete operation and returns the +// bucket. For each key, Amazon S3 performs a delete action and returns the // result of that delete, success, or failure, in the response. Note that if // the object specified in the request is not found, Amazon S3 returns the result // as deleted. // -// The operation supports two modes for the response: verbose and quiet. By -// default, the operation uses verbose mode in which the response includes the -// result of deletion of each key in your request. In quiet mode the response -// includes only keys where the delete operation encountered an error. For a -// successful deletion, the operation does not return any information about -// the delete in the response body. +// The action supports two modes for the response: verbose and quiet. By default, +// the action uses verbose mode in which the response includes the result of +// deletion of each key in your request. In quiet mode the response includes +// only keys where the delete action encountered an error. For a successful +// deletion, the action does not return any information about the delete in +// the response body. // -// When performing this operation on an MFA Delete enabled bucket, that attempts +// When performing this action on an MFA Delete enabled bucket, that attempts // to delete any versioned objects, you must include an MFA token. If you do // not provide one, the entire request will fail, even if there are non-versioned // objects you are trying to delete. If you provide an invalid token, whether @@ -2404,8 +2406,8 @@ func (c *S3) DeletePublicAccessBlockRequest(input *DeletePublicAccessBlockInput) // Removes the PublicAccessBlock configuration for an Amazon S3 bucket. To use // this operation, you must have the s3:PutBucketPublicAccessBlock permission. // For more information about permissions, see Permissions Related to Bucket -// Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // The following operations are related to DeletePublicAccessBlock: // @@ -2489,17 +2491,17 @@ func (c *S3) GetBucketAccelerateConfigurationRequest(input *GetBucketAccelerateC // GetBucketAccelerateConfiguration API operation for Amazon Simple Storage Service. // -// This implementation of the GET operation uses the accelerate subresource -// to return the Transfer Acceleration state of a bucket, which is either Enabled +// This implementation of the GET action uses the accelerate subresource to +// return the Transfer Acceleration state of a bucket, which is either Enabled // or Suspended. Amazon S3 Transfer Acceleration is a bucket-level feature that // enables you to perform faster data transfers to and from Amazon S3. // // To use this operation, you must have permission to perform the s3:GetAccelerateConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) +// in the Amazon S3 User Guide. // // You set the Transfer Acceleration state of an existing bucket to Enabled // or Suspended by using the PutBucketAccelerateConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketAccelerateConfiguration.html) @@ -2511,7 +2513,7 @@ func (c *S3) GetBucketAccelerateConfigurationRequest(input *GetBucketAccelerateC // // For more information about transfer acceleration, see Transfer Acceleration // (https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Related Resources // @@ -2589,7 +2591,7 @@ func (c *S3) GetBucketAclRequest(input *GetBucketAclInput) (req *request.Request // GetBucketAcl API operation for Amazon Simple Storage Service. // -// This implementation of the GET operation uses the acl subresource to return +// This implementation of the GET action uses the acl subresource to return // the access control list (ACL) of a bucket. To use GET to return the ACL of // the bucket, you must have READ_ACP access to the bucket. If READ_ACP permission // is granted to the anonymous user, you can return the ACL of the bucket without @@ -2671,19 +2673,19 @@ func (c *S3) GetBucketAnalyticsConfigurationRequest(input *GetBucketAnalyticsCon // GetBucketAnalyticsConfiguration API operation for Amazon Simple Storage Service. // -// This implementation of the GET operation returns an analytics configuration +// This implementation of the GET action returns an analytics configuration // (identified by the analytics configuration ID) from the bucket. // // To use this operation, you must have permissions to perform the s3:GetAnalyticsConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) +// in the Amazon S3 User Guide. // // For information about Amazon S3 analytics feature, see Amazon S3 Analytics // – Storage Class Analysis (https://docs.aws.amazon.com/AmazonS3/latest/dev/analytics-storage-class.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Related Resources // @@ -2852,15 +2854,18 @@ func (c *S3) GetBucketEncryptionRequest(input *GetBucketEncryptionInput) (req *r // GetBucketEncryption API operation for Amazon Simple Storage Service. // -// Returns the default encryption configuration for an Amazon S3 bucket. For -// information about the Amazon S3 default encryption feature, see Amazon S3 -// Default Bucket Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html). +// Returns the default encryption configuration for an Amazon S3 bucket. If +// the bucket does not have a default encryption configuration, GetBucketEncryption +// returns ServerSideEncryptionConfigurationNotFoundError. +// +// For information about the Amazon S3 default encryption feature, see Amazon +// S3 Default Bucket Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html). // // To use this operation, you must have permission to perform the s3:GetEncryptionConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // The following operations are related to GetBucketEncryption: // @@ -3045,8 +3050,8 @@ func (c *S3) GetBucketInventoryConfigurationRequest(input *GetBucketInventoryCon // To use this operation, you must have permissions to perform the s3:GetInventoryConfiguration // action. The bucket owner has this permission by default and can grant this // permission to others. For more information about permissions, see Permissions -// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // For information about the Amazon S3 inventory feature, see Amazon S3 Inventory // (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html). @@ -3148,8 +3153,8 @@ func (c *S3) GetBucketLifecycleRequest(input *GetBucketLifecycleInput) (req *req // To use this operation, you must have permission to perform the s3:GetLifecycleConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // GetBucketLifecycle has the following special error: // @@ -3247,8 +3252,8 @@ func (c *S3) GetBucketLifecycleConfigurationRequest(input *GetBucketLifecycleCon // Accordingly, this section describes the latest API. The response describes // the new filter element that you can use to specify a filter to select a subset // of objects to which the rule applies. If you are using a previous version -// of the lifecycle configuration, it still works. For the earlier API description, -// see GetBucketLifecycle (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLifecycle.html). +// of the lifecycle configuration, it still works. For the earlier action, see +// GetBucketLifecycle (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketLifecycle.html). // // Returns the lifecycle configuration information set on the bucket. For information // about lifecycle configuration, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html). @@ -3256,8 +3261,8 @@ func (c *S3) GetBucketLifecycleConfigurationRequest(input *GetBucketLifecycleCon // To use this operation, you must have permission to perform the s3:GetLifecycleConfiguration // action. The bucket owner has this permission, by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // GetBucketLifecycleConfiguration has the following special error: // @@ -3516,8 +3521,8 @@ func (c *S3) GetBucketMetricsConfigurationRequest(input *GetBucketMetricsConfigu // To use this operation, you must have permissions to perform the s3:GetMetricsConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // For information about CloudWatch request metrics for Amazon S3, see Monitoring // Metrics with Amazon CloudWatch (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html). @@ -3689,8 +3694,8 @@ func (c *S3) GetBucketNotificationConfigurationRequest(input *GetBucketNotificat // // Returns the notification configuration of a bucket. // -// If notifications are not enabled on the bucket, the operation returns an -// empty NotificationConfiguration element. +// If notifications are not enabled on the bucket, the action returns an empty +// NotificationConfiguration element. // // By default, you must be the bucket owner to read the notification configuration // of a bucket. However, the bucket owner can use a bucket policy to grant permission @@ -3701,7 +3706,7 @@ func (c *S3) GetBucketNotificationConfigurationRequest(input *GetBucketNotificat // on a bucket, see Setting Up Notification of Bucket Events (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html). // For more information about bucket policies, see Using Bucket Policies (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html). // -// The following operation is related to GetBucketNotification: +// The following action is related to GetBucketNotification: // // * PutBucketNotification (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketNotification.html) // @@ -3879,7 +3884,7 @@ func (c *S3) GetBucketPolicyRequest(input *GetBucketPolicyInput) (req *request.R // For more information about bucket policies, see Using Bucket Policies and // User Policies (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html). // -// The following operation is related to GetBucketPolicy: +// The following action is related to GetBucketPolicy: // // * GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html) // @@ -4052,11 +4057,11 @@ func (c *S3) GetBucketReplicationRequest(input *GetBucketReplicationInput) (req // can return a wrong result. // // For information about replication configuration, see Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // -// This operation requires permissions for the s3:GetReplicationConfiguration -// action. For more information about permissions, see Using Bucket Policies -// and User Policies (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html). +// This action requires permissions for the s3:GetReplicationConfiguration action. +// For more information about permissions, see Using Bucket Policies and User +// Policies (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-iam-policies.html). // // If you include the Filter element in a replication configuration, you must // also include the DeleteMarkerReplication and Priority elements. The response @@ -4405,7 +4410,7 @@ func (c *S3) GetBucketWebsiteRequest(input *GetBucketWebsiteInput) (req *request // For more information about hosting websites, see Hosting Websites on Amazon // S3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html). // -// This GET operation requires the S3:GetBucketWebsite permission. By default, +// This GET action requires the S3:GetBucketWebsite permission. By default, // only the bucket owner can read the bucket website configuration. However, // bucket owners can allow other users to read the website configuration by // writing a bucket policy granting them the S3:GetBucketWebsite permission. @@ -4515,7 +4520,7 @@ func (c *S3) GetObjectRequest(input *GetObjectInput) (req *request.Request, outp // Deep Archive storage class, or S3 Intelligent-Tiering Archive or S3 Intelligent-Tiering // Deep Archive tiers, before you can retrieve the object you must first restore // a copy using RestoreObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_RestoreObject.html). -// Otherwise, this operation returns an InvalidObjectStateError error. For information +// Otherwise, this action returns an InvalidObjectStateError error. For information // about restoring archived objects, see Restoring Archived Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/restoring-objects.html). // // Encryption request headers, like x-amz-server-side-encryption, should not @@ -4558,8 +4563,8 @@ func (c *S3) GetObjectRequest(input *GetObjectInput) (req *request.Request, outp // // Versioning // -// By default, the GET operation returns the current version of an object. To -// return a different version, use the versionId subresource. +// By default, the GET action returns the current version of an object. To return +// a different version, use the versionId subresource. // // If the current version of the object is a delete marker, Amazon S3 behaves // as if the object was deleted and includes x-amz-delete-marker: true in the @@ -5026,7 +5031,7 @@ func (c *S3) GetObjectTaggingRequest(input *GetObjectTaggingInput) (req *request // subresource associated with the object. // // To use this operation, you must have permission to perform the s3:GetObjectTagging -// action. By default, the GET operation returns information about current version +// action. By default, the GET action returns information about current version // of an object. For a versioned bucket, you can have multiple versions of an // object in your bucket. To retrieve tags of any other version, use the versionId // query parameter. You also need permission for the s3:GetObjectVersionTagging @@ -5038,10 +5043,12 @@ func (c *S3) GetObjectTaggingRequest(input *GetObjectTaggingInput) (req *request // For information about the Amazon S3 object tagging feature, see Object Tagging // (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-tagging.html). // -// The following operation is related to GetObjectTagging: +// The following action is related to GetObjectTagging: // // * PutObjectTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObjectTagging.html) // +// * DeleteObjectTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjectTagging.html) +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -5126,7 +5133,7 @@ func (c *S3) GetObjectTorrentRequest(input *GetObjectTorrentInput) (req *request // // This action is not supported by Amazon S3 on Outposts. // -// The following operation is related to GetObjectTorrent: +// The following action is related to GetObjectTorrent: // // * GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html) // @@ -5300,16 +5307,20 @@ func (c *S3) HeadBucketRequest(input *HeadBucketInput) (req *request.Request, ou // HeadBucket API operation for Amazon Simple Storage Service. // -// This operation is useful to determine if a bucket exists and you have permission -// to access it. The operation returns a 200 OK if the bucket exists and you -// have permission to access it. Otherwise, the operation might return responses -// such as 404 Not Found and 403 Forbidden. +// This action is useful to determine if a bucket exists and you have permission +// to access it. The action returns a 200 OK if the bucket exists and you have +// permission to access it. +// +// If the bucket does not exist or you do not have permission to access it, +// the HEAD request returns a generic 404 Not Found or 403 Forbidden code. A +// message body is not included, so you cannot determine the exception beyond +// these error codes. // // To use this operation, you must have permissions to perform the s3:ListBucket // action. The bucket owner has this permission by default and can grant this // permission to others. For more information about permissions, see Permissions -// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -5388,13 +5399,15 @@ func (c *S3) HeadObjectRequest(input *HeadObjectInput) (req *request.Request, ou // HeadObject API operation for Amazon Simple Storage Service. // -// The HEAD operation retrieves metadata from an object without returning the -// object itself. This operation is useful if you're only interested in an object's -// metadata. To use HEAD, you must have READ access to the object. +// The HEAD action retrieves metadata from an object without returning the object +// itself. This action is useful if you're only interested in an object's metadata. +// To use HEAD, you must have READ access to the object. // -// A HEAD request has the same options as a GET operation on an object. The -// response is identical to the GET response except that there is no response -// body. +// A HEAD request has the same options as a GET action on an object. The response +// is identical to the GET response except that there is no response body. Because +// of this, if the HEAD request generates an error, it returns a generic 404 +// Not Found or 403 Forbidden code. It is not possible to retrieve the exact +// exception beyond these error codes. // // If you encrypt an object by using server-side encryption with customer-provided // encryption keys (SSE-C) when you store the object in Amazon S3, then when @@ -5409,11 +5422,14 @@ func (c *S3) HeadObjectRequest(input *HeadObjectInput) (req *request.Request, ou // For more information about SSE-C, see Server-Side Encryption (Using Customer-Provided // Encryption Keys) (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html). // -// Encryption request headers, like x-amz-server-side-encryption, should not -// be sent for GET requests if your object uses server-side encryption with -// CMKs stored in AWS KMS (SSE-KMS) or server-side encryption with Amazon S3–managed -// encryption keys (SSE-S3). If your object does use these types of keys, you’ll -// get an HTTP 400 BadRequest error. +// * Encryption request headers, like x-amz-server-side-encryption, should +// not be sent for GET requests if your object uses server-side encryption +// with CMKs stored in AWS KMS (SSE-KMS) or server-side encryption with Amazon +// S3–managed encryption keys (SSE-S3). If your object does use these types +// of keys, you’ll get an HTTP 400 BadRequest error. +// +// * The last modified property in this case is the creation date of the +// object. // // Request headers are limited to 8 KB in size. For more information, see Common // Request Headers (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonRequestHeaders.html). @@ -5445,7 +5461,7 @@ func (c *S3) HeadObjectRequest(input *HeadObjectInput) (req *request.Request, ou // * If you don’t have the s3:ListBucket permission, Amazon S3 returns // an HTTP status code 403 ("access denied") error. // -// The following operation is related to HeadObject: +// The following action is related to HeadObject: // // * GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html) // @@ -5527,19 +5543,19 @@ func (c *S3) ListBucketAnalyticsConfigurationsRequest(input *ListBucketAnalytics // Lists the analytics configurations for the bucket. You can have up to 1,000 // analytics configurations per bucket. // -// This operation supports list pagination and does not return more than 100 -// configurations at a time. You should always check the IsTruncated element -// in the response. If there are no more configurations to list, IsTruncated -// is set to false. If there are more configurations to list, IsTruncated is -// set to true, and there will be a value in NextContinuationToken. You use -// the NextContinuationToken value to continue the pagination of the list by -// passing the value in continuation-token in the request to GET the next page. +// This action supports list pagination and does not return more than 100 configurations +// at a time. You should always check the IsTruncated element in the response. +// If there are no more configurations to list, IsTruncated is set to false. +// If there are more configurations to list, IsTruncated is set to true, and +// there will be a value in NextContinuationToken. You use the NextContinuationToken +// value to continue the pagination of the list by passing the value in continuation-token +// in the request to GET the next page. // // To use this operation, you must have permissions to perform the s3:GetAnalyticsConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // For information about Amazon S3 analytics feature, see Amazon S3 Analytics // – Storage Class Analysis (https://docs.aws.amazon.com/AmazonS3/latest/dev/analytics-storage-class.html). @@ -5726,19 +5742,19 @@ func (c *S3) ListBucketInventoryConfigurationsRequest(input *ListBucketInventory // Returns a list of inventory configurations for the bucket. You can have up // to 1,000 analytics configurations per bucket. // -// This operation supports list pagination and does not return more than 100 -// configurations at a time. Always check the IsTruncated element in the response. -// If there are no more configurations to list, IsTruncated is set to false. -// If there are more configurations to list, IsTruncated is set to true, and -// there is a value in NextContinuationToken. You use the NextContinuationToken -// value to continue the pagination of the list by passing the value in continuation-token +// This action supports list pagination and does not return more than 100 configurations +// at a time. Always check the IsTruncated element in the response. If there +// are no more configurations to list, IsTruncated is set to false. If there +// are more configurations to list, IsTruncated is set to true, and there is +// a value in NextContinuationToken. You use the NextContinuationToken value +// to continue the pagination of the list by passing the value in continuation-token // in the request to GET the next page. // // To use this operation, you must have permissions to perform the s3:GetInventoryConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // For information about the Amazon S3 inventory feature, see Amazon S3 Inventory // (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html) @@ -5827,19 +5843,19 @@ func (c *S3) ListBucketMetricsConfigurationsRequest(input *ListBucketMetricsConf // are only for the request metrics of the bucket and do not provide information // on daily storage metrics. You can have up to 1,000 configurations per bucket. // -// This operation supports list pagination and does not return more than 100 -// configurations at a time. Always check the IsTruncated element in the response. -// If there are no more configurations to list, IsTruncated is set to false. -// If there are more configurations to list, IsTruncated is set to true, and -// there is a value in NextContinuationToken. You use the NextContinuationToken -// value to continue the pagination of the list by passing the value in continuation-token +// This action supports list pagination and does not return more than 100 configurations +// at a time. Always check the IsTruncated element in the response. If there +// are no more configurations to list, IsTruncated is set to false. If there +// are more configurations to list, IsTruncated is set to true, and there is +// a value in NextContinuationToken. You use the NextContinuationToken value +// to continue the pagination of the list by passing the value in continuation-token // in the request to GET the next page. // // To use this operation, you must have permissions to perform the s3:GetMetricsConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // For more information about metrics configurations and CloudWatch request // metrics, see Monitoring Metrics with Amazon CloudWatch (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html). @@ -6004,11 +6020,11 @@ func (c *S3) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) (req // ListMultipartUploads API operation for Amazon Simple Storage Service. // -// This operation lists in-progress multipart uploads. An in-progress multipart +// This action lists in-progress multipart uploads. An in-progress multipart // upload is a multipart upload that has been initiated using the Initiate Multipart // Upload request, but has not yet been completed or aborted. // -// This operation returns at most 1,000 multipart uploads in the response. 1,000 +// This action returns at most 1,000 multipart uploads in the response. 1,000 // multipart uploads is the maximum number of uploads a response can include, // which is also the default value. You can further limit the number of uploads // in a response by specifying the max-uploads parameter in the response. If @@ -6025,7 +6041,7 @@ func (c *S3) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) (req // Upload (https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html). // // For information on permissions required to use the multipart upload API, -// see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). +// see Multipart Upload and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). // // The following operations are related to ListMultipartUploads: // @@ -6173,6 +6189,9 @@ func (c *S3) ListObjectVersionsRequest(input *ListObjectVersionsInput) (req *req // use request parameters as selection criteria to return metadata about a subset // of all the object versions. // +// To use this operation, you must have permissions to perform the s3:ListBucketVersions +// action. Be aware of the name difference. +// // A 200 OK response can contain valid or invalid XML. Make sure to design your // application to parse the contents of the response and handle it appropriately. // @@ -6326,8 +6345,8 @@ func (c *S3) ListObjectsRequest(input *ListObjectsInput) (req *request.Request, // to design your application to parse the contents of the response and handle // it appropriately. // -// This API has been revised. We recommend that you use the newer version, ListObjectsV2 -// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html), +// This action has been revised. We recommend that you use the newer version, +// ListObjectsV2 (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html), // when developing applications. For backward compatibility, Amazon S3 continues // to support ListObjects. // @@ -6482,18 +6501,19 @@ func (c *S3) ListObjectsV2Request(input *ListObjectsV2Input) (req *request.Reque // the request parameters as selection criteria to return a subset of the objects // in a bucket. A 200 OK response can contain valid or invalid XML. Make sure // to design your application to parse the contents of the response and handle -// it appropriately. +// it appropriately. Objects are returned sorted in an ascending order of the +// respective key names in the list. // // To use this operation, you must have READ access to the bucket. // -// To use this operation in an AWS Identity and Access Management (IAM) policy, +// To use this action in an AWS Identity and Access Management (IAM) policy, // you must have permissions to perform the s3:ListBucket action. The bucket // owner has this permission by default and can grant this permission to others. // For more information about permissions, see Permissions Related to Bucket -// Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // -// This section describes the latest revision of the API. We recommend that +// This section describes the latest revision of this action. We recommend that // you use this revised API for application development. For backward compatibility, // Amazon S3 continues to support the prior version of this API, ListObjects // (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjects.html). @@ -6658,7 +6678,7 @@ func (c *S3) ListPartsRequest(input *ListPartsInput) (req *request.Request, outp // Upload (https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html). // // For information on permissions required to use the multipart upload API, -// see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). +// see Multipart Upload and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html). // // The following operations are related to ListParts: // @@ -6804,8 +6824,8 @@ func (c *S3) PutBucketAccelerateConfigurationRequest(input *PutBucketAccelerateC // To use this operation, you must have permission to perform the s3:PutAccelerateConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // The Transfer Acceleration state of a bucket can be set to one of the following // two values: @@ -6815,7 +6835,7 @@ func (c *S3) PutBucketAccelerateConfigurationRequest(input *PutBucketAccelerateC // * Suspended – Disables accelerated data transfers to the bucket. // // The GetBucketAccelerateConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketAccelerateConfiguration.html) -// operation returns the transfer acceleration state of a bucket. +// action returns the transfer acceleration state of a bucket. // // After setting the Transfer Acceleration state of a bucket to Enabled, it // might take up to thirty minutes before the data transfer rates to the bucket @@ -7092,8 +7112,8 @@ func (c *S3) PutBucketAnalyticsConfigurationRequest(input *PutBucketAnalyticsCon // To use this operation, you must have permissions to perform the s3:PutAnalyticsConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // Special Errors // @@ -7227,7 +7247,7 @@ func (c *S3) PutBucketCorsRequest(input *PutBucketCorsInput) (req *request.Reque // // For more information about CORS, go to Enabling Cross-Origin Resource Sharing // (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) in the Amazon -// Simple Storage Service Developer Guide. +// S3 User Guide. // // Related Resources // @@ -7314,7 +7334,7 @@ func (c *S3) PutBucketEncryptionRequest(input *PutBucketEncryptionInput) (req *r // PutBucketEncryption API operation for Amazon Simple Storage Service. // -// This operation uses the encryption subresource to configure default encryption +// This action uses the encryption subresource to configure default encryption // and Amazon S3 Bucket Key for an existing bucket. // // Default encryption for a bucket can use server-side encryption with Amazon @@ -7322,19 +7342,19 @@ func (c *S3) PutBucketEncryptionRequest(input *PutBucketEncryptionInput) (req *r // specify default encryption using SSE-KMS, you can also configure Amazon S3 // Bucket Key. For information about default encryption, see Amazon S3 default // bucket encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html) -// in the Amazon Simple Storage Service Developer Guide. For more information -// about S3 Bucket Keys, see Amazon S3 Bucket Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. For more information about S3 Bucket Keys, see +// Amazon S3 Bucket Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html) +// in the Amazon S3 User Guide. // -// This operation requires AWS Signature Version 4. For more information, see -// Authenticating Requests (AWS Signature Version 4) (sig-v4-authenticating-requests.html). +// This action requires AWS Signature Version 4. For more information, see Authenticating +// Requests (AWS Signature Version 4) (https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html). // // To use this operation, you must have permissions to perform the s3:PutEncryptionConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) +// in the Amazon S3 User Guide. // // Related Resources // @@ -7415,7 +7435,8 @@ func (c *S3) PutBucketIntelligentTieringConfigurationRequest(input *PutBucketInt // PutBucketIntelligentTieringConfiguration API operation for Amazon Simple Storage Service. // -// Puts a S3 Intelligent-Tiering configuration to the specified bucket. +// Puts a S3 Intelligent-Tiering configuration to the specified bucket. You +// can have up to 1,000 S3 Intelligent-Tiering configurations per bucket. // // The S3 Intelligent-Tiering storage class is designed to optimize storage // costs by automatically moving data to the most cost-effective storage access @@ -7442,6 +7463,22 @@ func (c *S3) PutBucketIntelligentTieringConfigurationRequest(input *PutBucketInt // // * ListBucketIntelligentTieringConfigurations (https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListBucketIntelligentTieringConfigurations.html) // +// You only need S3 Intelligent-Tiering enabled on a bucket if you want to automatically +// move objects stored in the S3 Intelligent-Tiering storage class to the Archive +// Access or Deep Archive Access tier. +// +// Special Errors +// +// * HTTP 400 Bad Request Error Code: InvalidArgument Cause: Invalid Argument +// +// * HTTP 400 Bad Request Error Code: TooManyConfigurations Cause: You are +// attempting to create a new configuration but have already reached the +// 1,000-configuration limit. +// +// * HTTP 403 Forbidden Error Code: AccessDenied Cause: You are not the owner +// of the specified bucket, or you do not have the s3:PutIntelligentTieringConfiguration +// bucket permission to set the configuration on the bucket. +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -7515,9 +7552,9 @@ func (c *S3) PutBucketInventoryConfigurationRequest(input *PutBucketInventoryCon // PutBucketInventoryConfiguration API operation for Amazon Simple Storage Service. // -// This implementation of the PUT operation adds an inventory configuration -// (identified by the inventory ID) to the bucket. You can have up to 1,000 -// inventory configurations per bucket. +// This implementation of the PUT action adds an inventory configuration (identified +// by the inventory ID) to the bucket. You can have up to 1,000 inventory configurations +// per bucket. // // Amazon S3 inventory generates inventories of the objects in the bucket on // a daily or weekly basis, and the results are published to a flat file. The @@ -7530,7 +7567,7 @@ func (c *S3) PutBucketInventoryConfigurationRequest(input *PutBucketInventoryCon // the inventory daily or weekly. You can also configure what object metadata // to include and whether to inventory all object versions or only current versions. // For more information, see Amazon S3 Inventory (https://docs.aws.amazon.com/AmazonS3/latest/dev/storage-inventory.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // You must create a bucket policy on the destination bucket to grant permissions // to Amazon S3 to write objects to the bucket in the defined location. For @@ -7540,9 +7577,9 @@ func (c *S3) PutBucketInventoryConfigurationRequest(input *PutBucketInventoryCon // To use this operation, you must have permissions to perform the s3:PutInventoryConfiguration // action. The bucket owner has this permission by default and can grant this // permission to others. For more information about permissions, see Permissions -// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. +// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) +// in the Amazon S3 User Guide. // // Special Errors // @@ -7654,7 +7691,7 @@ func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) (req *req // Creates a new lifecycle configuration for the bucket or replaces an existing // lifecycle configuration. For information about lifecycle configuration, see // Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // By default, all Amazon S3 resources, including buckets, objects, and related // subresources (for example, lifecycle configuration and website configuration) @@ -7675,8 +7712,8 @@ func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) (req *req // * s3:PutLifecycleConfiguration // // For more information about permissions, see Managing Access Permissions to -// your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. +// your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) +// in the Amazon S3 User Guide. // // For more examples of transitioning objects to storage classes such as STANDARD_IA // or ONEZONE_IA, see Examples of Lifecycle Configuration (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#lifecycle-configuration-examples). @@ -7692,9 +7729,9 @@ func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) (req *req // * By default, a resource owner—in this case, a bucket owner, which is // the AWS account that created the bucket—can perform any of the operations. // A resource owner can also grant others permission to perform the operation. -// For more information, see the following topics in the Amazon Simple Storage -// Service Developer Guide: Specifying Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html) -// Managing Access Permissions to your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) +// For more information, see the following topics in the Amazon S3 User Guide: +// Specifying Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html) +// Managing Access Permissions to your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -7779,7 +7816,7 @@ func (c *S3) PutBucketLifecycleConfigurationRequest(input *PutBucketLifecycleCon // // Creates a new lifecycle configuration for the bucket or replaces an existing // lifecycle configuration. For information about lifecycle configuration, see -// Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // Bucket lifecycle configuration now supports specifying a lifecycle rule using // an object key name prefix, one or more object tags, or a combination of both. @@ -7831,7 +7868,7 @@ func (c *S3) PutBucketLifecycleConfigurationRequest(input *PutBucketLifecycleCon // * s3:PutLifecycleConfiguration // // For more information about permissions, see Managing Access Permissions to -// Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // The following are related to PutBucketLifecycleConfiguration: // @@ -8048,8 +8085,8 @@ func (c *S3) PutBucketMetricsConfigurationRequest(input *PutBucketMetricsConfigu // To use this operation, you must have permissions to perform the s3:PutMetricsConfiguration // action. The bucket owner has this permission by default. The bucket owner // can grant this permission to others. For more information about permissions, -// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// see Permissions Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // For information about CloudWatch request metrics for Amazon S3, see Monitoring // Metrics with Amazon CloudWatch (https://docs.aws.amazon.com/AmazonS3/latest/dev/cloudwatch-monitoring.html). @@ -8245,8 +8282,8 @@ func (c *S3) PutBucketNotificationConfigurationRequest(input *PutBucketNotificat // // // -// This operation replaces the existing notification configuration with the -// configuration you include in the request body. +// This action replaces the existing notification configuration with the configuration +// you include in the request body. // // After Amazon S3 receives this request, it first verifies that any Amazon // Simple Notification Service (Amazon SNS) or Amazon Simple Queue Service (Amazon @@ -8266,8 +8303,8 @@ func (c *S3) PutBucketNotificationConfigurationRequest(input *PutBucketNotificat // The PUT notification is an atomic operation. For example, suppose your notification // configuration includes SNS topic, SQS queue, and Lambda function configurations. // When you send a PUT request with this configuration, Amazon S3 sends test -// messages to your SNS topic. If the message fails, the entire PUT operation -// will fail, and Amazon S3 will not add the configuration to your bucket. +// messages to your SNS topic. If the message fails, the entire PUT action will +// fail, and Amazon S3 will not add the configuration to your bucket. // // Responses // @@ -8276,7 +8313,7 @@ func (c *S3) PutBucketNotificationConfigurationRequest(input *PutBucketNotificat // will also include the x-amz-sns-test-message-id header containing the message // ID of the test notification sent to the topic. // -// The following operation is related to PutBucketNotificationConfiguration: +// The following action is related to PutBucketNotificationConfiguration: // // * GetBucketNotificationConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketNotificationConfiguration.html) // @@ -8552,8 +8589,8 @@ func (c *S3) PutBucketReplicationRequest(input *PutBucketReplicationInput) (req // information, see Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html) // in the Amazon S3 Developer Guide. // -// To perform this operation, the user or role performing the operation must -// have the iam:PassRole (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_passrole.html) +// To perform this operation, the user or role performing the action must have +// the iam:PassRole (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use_passrole.html) // permission. // // Specify the replication configuration in the request body. In the replication @@ -8583,7 +8620,7 @@ func (c *S3) PutBucketReplicationRequest(input *PutBucketReplicationInput) (req // bucket, can perform this operation. The resource owner can also grant others // permissions to perform the operation. For more information about permissions, // see Specifying Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // Handling Replication of Encrypted Objects // @@ -8786,8 +8823,8 @@ func (c *S3) PutBucketTaggingRequest(input *PutBucketTaggingInput) (req *request // To use this operation, you must have permissions to perform the s3:PutBucketTagging // action. The bucket owner has this permission by default and can grant this // permission to others. For more information about permissions, see Permissions -// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html). +// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html). // // PutBucketTagging has the following special errors: // @@ -8801,7 +8838,7 @@ func (c *S3) PutBucketTaggingRequest(input *PutBucketTaggingInput) (req *request // match the schema. // // * Error code: OperationAbortedError Description: A conflicting conditional -// operation is currently in progress against this resource. Please try again. +// action is currently in progress against this resource. Please try again. // // * Error code: InternalError Description: The service was unable to apply // the provided tag to the bucket. @@ -9008,7 +9045,7 @@ func (c *S3) PutBucketWebsiteRequest(input *PutBucketWebsiteInput) (req *request // document and any redirect rules. For more information, see Hosting Websites // on Amazon S3 (https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html). // -// This PUT operation requires the S3:PutBucketWebsite permission. By default, +// This PUT action requires the S3:PutBucketWebsite permission. By default, // only the bucket owner can configure the website attached to a bucket; however, // bucket owners can allow other users to set the website configuration by writing // a bucket policy that grants them the S3:PutBucketWebsite permission. @@ -9067,7 +9104,7 @@ func (c *S3) PutBucketWebsiteRequest(input *PutBucketWebsiteInput) (req *request // Amazon S3 has a limitation of 50 routing rules per website configuration. // If you require more than 50 routing rules, you can use object redirect. For // more information, see Configuring an Object Redirect (https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -9161,7 +9198,7 @@ func (c *S3) PutObjectRequest(input *PutObjectInput) (req *request.Request, outp // The Content-MD5 header is required for any request to upload an object with // a retention period configured using Amazon S3 Object Lock. For more information // about Amazon S3 Object Lock, see Amazon S3 Object Lock Overview (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock-overview.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Server-side Encryption // @@ -9174,7 +9211,7 @@ func (c *S3) PutObjectRequest(input *PutObjectInput) (req *request.Request, outp // If you request server-side encryption using AWS Key Management Service (SSE-KMS), // you can enable an S3 Bucket Key at the object-level. For more information, // see Amazon S3 Bucket Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Access Control List (ACL)-Specific Request Headers // @@ -9293,7 +9330,7 @@ func (c *S3) PutObjectAclRequest(input *PutObjectAclInput) (req *request.Request // for a new or existing object in an S3 bucket. You must have WRITE_ACP permission // to set the ACL of an object. For more information, see What permissions can // I grant? (https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#permissions) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // This action is not supported by Amazon S3 on Outposts. // @@ -9457,14 +9494,11 @@ func (c *S3) PutObjectLegalHoldRequest(input *PutObjectLegalHoldInput) (req *req // PutObjectLegalHold API operation for Amazon Simple Storage Service. // -// Applies a Legal Hold configuration to the specified object. +// Applies a Legal Hold configuration to the specified object. For more information, +// see Locking Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html). // // This action is not supported by Amazon S3 on Outposts. // -// Related Resources -// -// * Locking Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html) -// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -9543,14 +9577,16 @@ func (c *S3) PutObjectLockConfigurationRequest(input *PutObjectLockConfiguration // // Places an Object Lock configuration on the specified bucket. The rule specified // in the Object Lock configuration will be applied by default to every new -// object placed in the specified bucket. +// object placed in the specified bucket. For more information, see Locking +// Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html). // -// DefaultRetention requires either Days or Years. You can't specify both at -// the same time. +// * The DefaultRetention settings require both a mode and a period. // -// Related Resources +// * The DefaultRetention period can be either Days or Years but you must +// select one. You cannot specify Days and Years at the same time. // -// * Locking Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html) +// * You can only enable Object Lock for new buckets. If you want to turn +// on Object Lock for an existing bucket, contact AWS Support. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -9628,14 +9664,11 @@ func (c *S3) PutObjectRetentionRequest(input *PutObjectRetentionInput) (req *req // PutObjectRetention API operation for Amazon Simple Storage Service. // -// Places an Object Retention configuration on an object. +// Places an Object Retention configuration on an object. For more information, +// see Locking Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html). // // This action is not supported by Amazon S3 on Outposts. // -// Related Resources -// -// * Locking Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lock.html) -// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -9741,7 +9774,7 @@ func (c *S3) PutObjectTaggingRequest(input *PutObjectTaggingInput) (req *request // // * Code: MalformedXMLError Cause: The XML provided does not match the schema. // -// * Code: OperationAbortedError Cause: A conflicting conditional operation +// * Code: OperationAbortedError Cause: A conflicting conditional action // is currently in progress against this resource. Please try again. // // * Code: InternalError Cause: The service was unable to apply the provided @@ -9751,6 +9784,8 @@ func (c *S3) PutObjectTaggingRequest(input *PutObjectTaggingInput) (req *request // // * GetObjectTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectTagging.html) // +// * DeleteObjectTagging (https://docs.aws.amazon.com/AmazonS3/latest/API/API_DeleteObjectTagging.html) +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -9938,9 +9973,9 @@ func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Reque // To use this operation, you must have permissions to perform the s3:RestoreObject // action. The bucket owner has this permission by default and can grant this // permission to others. For more information about permissions, see Permissions -// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) -// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) -// in the Amazon Simple Storage Service Developer Guide. +// Related to Bucket Subresource Operations (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-with-s3-actions.html#using-with-s3-actions-related-to-bucket-subresources) +// and Managing Access Permissions to Your Amazon S3 Resources (https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-access-control.html) +// in the Amazon S3 User Guide. // // Querying Archives with Select Requests // @@ -9950,7 +9985,7 @@ func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Reque // queries and custom analytics on your archived data without having to restore // your data to a hotter Amazon S3 tier. For an overview about select requests, // see Querying Archived Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/querying-glacier-archives.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // When making a select request, do the following: // @@ -9961,13 +9996,12 @@ func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Reque // the storage class and encryption for the output objects stored in the // bucket. For more information about output, see Querying Archived Objects // (https://docs.aws.amazon.com/AmazonS3/latest/dev/querying-glacier-archives.html) -// in the Amazon Simple Storage Service Developer Guide. For more information -// about the S3 structure in the request body, see the following: PutObject -// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) Managing -// Access with ACLs (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3_ACLs_UsingACLs.html) -// in the Amazon Simple Storage Service Developer Guide Protecting Data Using -// Server-Side Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html) -// in the Amazon Simple Storage Service Developer Guide +// in the Amazon S3 User Guide. For more information about the S3 structure +// in the request body, see the following: PutObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html) +// Managing Access with ACLs (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3_ACLs_UsingACLs.html) +// in the Amazon S3 User Guide Protecting Data Using Server-Side Encryption +// (https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html) +// in the Amazon S3 User Guide // // * Define the SQL expression for the SELECT type of restoration for your // query in the request body's SelectParameters structure. You can use expressions @@ -9983,7 +10017,7 @@ func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Reque // // For more information about using SQL with S3 Glacier Select restore, see // SQL Reference for Amazon S3 Select and S3 Glacier Select (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-glacier-select-sql-reference.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // When making a select request, you can also do the following: // @@ -10054,19 +10088,19 @@ func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Reque // // For more information about archive retrieval options and provisioned capacity // for Expedited data access, see Restoring Archived Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/restoring-objects.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // You can use Amazon S3 restore speed upgrade to change the restore speed to // a faster speed while it is in progress. For more information, see Upgrading // the speed of an in-progress restore (https://docs.aws.amazon.com/AmazonS3/latest/dev/restoring-objects.html#restoring-objects-upgrade-tier.title.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // To get the status of object restoration, you can send a HEAD request. Operations // return the x-amz-restore header, which provides information about the restoration // status, in the response. You can use Amazon S3 event notifications to notify // you when a restore is initiated or completed. For more information, see Configuring // Amazon S3 Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // After restoring an archived object, you can update the restoration period // by reissuing the request with a new period. Amazon S3 updates the restoration @@ -10081,11 +10115,11 @@ func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Reque // the object in 3 days. For more information about lifecycle configuration, // see PutBucketLifecycleConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html) // and Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) -// in Amazon Simple Storage Service Developer Guide. +// in Amazon S3 User Guide. // // Responses // -// A successful operation returns either the 200 OK or 202 Accepted status code. +// A successful action returns either the 200 OK or 202 Accepted status code. // // * If the object is not previously restored, then Amazon S3 returns 202 // Accepted in the response. @@ -10112,7 +10146,7 @@ func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Reque // * GetBucketNotificationConfiguration (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetBucketNotificationConfiguration.html) // // * SQL Reference for Amazon S3 Select and S3 Glacier Select (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-glacier-select-sql-reference.html) -// in the Amazon Simple Storage Service Developer Guide +// in the Amazon S3 User Guide // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -10123,7 +10157,7 @@ func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Reque // // Returned Error Codes: // * ErrCodeObjectAlreadyInActiveTierError "ObjectAlreadyInActiveTierError" -// This operation is not allowed against this storage tier. +// This action is not allowed against this storage tier. // // See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreObject func (c *S3) RestoreObject(input *RestoreObjectInput) (*RestoreObjectOutput, error) { @@ -10200,7 +10234,7 @@ func (c *S3) SelectObjectContentRequest(input *SelectObjectContentInput) (req *r // SelectObjectContent API operation for Amazon Simple Storage Service. // -// This operation filters the contents of an Amazon S3 object based on a simple +// This action filters the contents of an Amazon S3 object based on a simple // structured query language (SQL) statement. In the request, along with the // SQL expression, you must also specify a data serialization format (JSON, // CSV, or Apache Parquet) of the object. Amazon S3 uses this format to parse @@ -10212,18 +10246,18 @@ func (c *S3) SelectObjectContentRequest(input *SelectObjectContentInput) (req *r // // For more information about Amazon S3 Select, see Selecting Content from Objects // (https://docs.aws.amazon.com/AmazonS3/latest/dev/selecting-content-from-objects.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // For more information about using SQL with Amazon S3 Select, see SQL Reference // for Amazon S3 Select and S3 Glacier Select (https://docs.aws.amazon.com/AmazonS3/latest/dev/s3-glacier-select-sql-reference.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Permissions // // You must have s3:GetObject permission for this operation. Amazon S3 Select // does not support anonymous access. For more information about permissions, // see Specifying Permissions in a Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-with-s3-actions.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Object Data Formats // @@ -10246,13 +10280,13 @@ func (c *S3) SelectObjectContentRequest(input *SelectObjectContentInput) (req *r // you must use the headers that are documented in the GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html). // For more information about SSE-C, see Server-Side Encryption (Using Customer-Provided // Encryption Keys) (https://docs.aws.amazon.com/AmazonS3/latest/dev/ServerSideEncryptionCustomerKeys.html) -// in the Amazon Simple Storage Service Developer Guide. For objects that -// are encrypted with Amazon S3 managed encryption keys (SSE-S3) and customer -// master keys (CMKs) stored in AWS Key Management Service (SSE-KMS), server-side -// encryption is handled transparently, so you don't need to specify anything. -// For more information about server-side encryption, including SSE-S3 and -// SSE-KMS, see Protecting Data Using Server-Side Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. For objects that are encrypted with Amazon +// S3 managed encryption keys (SSE-S3) and customer master keys (CMKs) stored +// in AWS Key Management Service (SSE-KMS), server-side encryption is handled +// transparently, so you don't need to specify anything. For more information +// about server-side encryption, including SSE-S3 and SSE-KMS, see Protecting +// Data Using Server-Side Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/serv-side-encryption.html) +// in the Amazon S3 User Guide. // // Working with the Response Body // @@ -10263,8 +10297,8 @@ func (c *S3) SelectObjectContentRequest(input *SelectObjectContentInput) (req *r // // GetObject Support // -// The SelectObjectContent operation does not support the following GetObject -// functionality. For more information, see GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html). +// The SelectObjectContent action does not support the following GetObject functionality. +// For more information, see GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html). // // * Range: Although you can specify a scan range for an Amazon S3 Select // request (see SelectObjectContentRequest - ScanRange (https://docs.aws.amazon.com/AmazonS3/latest/API/API_SelectObjectContent.html#AmazonS3-SelectObjectContent-request-ScanRange) @@ -10274,7 +10308,7 @@ func (c *S3) SelectObjectContentRequest(input *SelectObjectContentInput) (req *r // * GLACIER, DEEP_ARCHIVE and REDUCED_REDUNDANCY storage classes: You cannot // specify the GLACIER, DEEP_ARCHIVE, or REDUCED_REDUNDANCY storage classes. // For more information, about storage classes see Storage Classes (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#storage-class-intro) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Special Errors // @@ -10567,11 +10601,11 @@ func (c *S3) UploadPartRequest(input *UploadPartInput) (req *request.Request, ou // // For more information on multipart uploads, go to Multipart Upload Overview // (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html) in the -// Amazon Simple Storage Service Developer Guide . +// Amazon S3 User Guide . // // For information on the permissions required to use the multipart upload API, -// go to Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html) -// in the Amazon Simple Storage Service Developer Guide. +// go to Multipart Upload and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html) +// in the Amazon S3 User Guide. // // You can optionally request server-side encryption where Amazon S3 encrypts // your data as it writes it to disks in its data centers and decrypts it for @@ -10581,7 +10615,7 @@ func (c *S3) UploadPartRequest(input *UploadPartInput) (req *request.Request, ou // match the headers you used in the request to initiate the upload by using // CreateMultipartUpload (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CreateMultipartUpload.html). // For more information, go to Using Server-Side Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingServerSideEncryption.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Server-side encryption is supported by the S3 Multipart Upload actions. Unless // you are using a customer-provided encryption key, you don't need to specify @@ -10697,10 +10731,10 @@ func (c *S3) UploadPartCopyRequest(input *UploadPartCopyInput) (req *request.Req // // The minimum allowable part size for a multipart upload is 5 MB. For more // information about multipart upload limits, go to Quick Facts (https://docs.aws.amazon.com/AmazonS3/latest/dev/qfacts.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // Instead of using an existing object as part data, you might use the UploadPart -// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html) operation +// (https://docs.aws.amazon.com/AmazonS3/latest/API/API_UploadPart.html) action // and provide data in your request. // // You must initiate a multipart upload before you can upload any part. In response @@ -10711,15 +10745,15 @@ func (c *S3) UploadPartCopyRequest(input *UploadPartCopyInput) (req *request.Req // // * For conceptual information about multipart uploads, see Uploading Objects // Using Multipart Upload (https://docs.aws.amazon.com/AmazonS3/latest/dev/uploadobjusingmpu.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. // // * For information about permissions required to use the multipart upload -// API, see Multipart Upload API and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html) -// in the Amazon Simple Storage Service Developer Guide. +// API, see Multipart Upload and Permissions (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuAndPermissions.html) +// in the Amazon S3 User Guide. // -// * For information about copying objects using a single atomic operation -// vs. the multipart upload, see Operations on Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectOperations.html) -// in the Amazon Simple Storage Service Developer Guide. +// * For information about copying objects using a single atomic action vs. +// the multipart upload, see Operations on Objects (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectOperations.html) +// in the Amazon S3 User Guide. // // * For information about using server-side encryption with customer-provided // encryption keys with the UploadPartCopy operation, see CopyObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html) @@ -10808,11 +10842,128 @@ func (c *S3) UploadPartCopyWithContext(ctx aws.Context, input *UploadPartCopyInp return out, req.Send() } +const opWriteGetObjectResponse = "WriteGetObjectResponse" + +// WriteGetObjectResponseRequest generates a "aws/request.Request" representing the +// client's request for the WriteGetObjectResponse operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See WriteGetObjectResponse for more information on using the WriteGetObjectResponse +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the WriteGetObjectResponseRequest method. +// req, resp := client.WriteGetObjectResponseRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/WriteGetObjectResponse +func (c *S3) WriteGetObjectResponseRequest(input *WriteGetObjectResponseInput) (req *request.Request, output *WriteGetObjectResponseOutput) { + op := &request.Operation{ + Name: opWriteGetObjectResponse, + HTTPMethod: "POST", + HTTPPath: "/WriteGetObjectResponse", + } + + if input == nil { + input = &WriteGetObjectResponseInput{} + } + + output = &WriteGetObjectResponseOutput{} + req = c.newRequest(op, input, output) + req.Handlers.Sign.Remove(v4.SignRequestHandler) + handler := v4.BuildNamedHandler("v4.CustomSignerHandler", v4.WithUnsignedPayload) + req.Handlers.Sign.PushFrontNamed(handler) + req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) + req.Handlers.Build.PushBackNamed(protocol.NewHostPrefixHandler("{RequestRoute}.", input.hostLabels)) + req.Handlers.Build.PushBackNamed(protocol.ValidateEndpointHostHandler) + return +} + +// WriteGetObjectResponse API operation for Amazon Simple Storage Service. +// +// Passes transformed objects to a GetObject operation when using Object Lambda +// Access Points. For information about Object Lambda Access Points, see Transforming +// objects with Object Lambda Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/transforming-objects.html) +// in the Amazon S3 User Guide. +// +// This operation supports metadata that can be returned by GetObject (https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html), +// in addition to RequestRoute, RequestToken, StatusCode, ErrorCode, and ErrorMessage. +// The GetObject response metadata is supported so that the WriteGetObjectResponse +// caller, typically an AWS Lambda function, can provide the same metadata when +// it internally invokes GetObject. When WriteGetObjectResponse is called by +// a customer-owned Lambda function, the metadata returned to the end user GetObject +// call might differ from what Amazon S3 would normally return. +// +// AWS provides some prebuilt Lambda functions that you can use with S3 Object +// Lambda to detect and redact personally identifiable information (PII) and +// decompress S3 objects. These Lambda functions are available in the AWS Serverless +// Application Repository, and can be selected through the AWS Management Console +// when you create your Object Lambda Access Point. +// +// Example 1: PII Access Control - This Lambda function uses Amazon Comprehend, +// a natural language processing (NLP) service using machine learning to find +// insights and relationships in text. It automatically detects personally identifiable +// information (PII) such as names, addresses, dates, credit card numbers, and +// social security numbers from documents in your Amazon S3 bucket. +// +// Example 2: PII Redaction - This Lambda function uses Amazon Comprehend, a +// natural language processing (NLP) service using machine learning to find +// insights and relationships in text. It automatically redacts personally identifiable +// information (PII) such as names, addresses, dates, credit card numbers, and +// social security numbers from documents in your Amazon S3 bucket. +// +// Example 3: Decompression - The Lambda function S3ObjectLambdaDecompression, +// is equipped to decompress objects stored in S3 in one of six compressed file +// formats including bzip2, gzip, snappy, zlib, zstandard and ZIP. +// +// For information on how to view and use these functions, see Using AWS built +// Lambda functions (https://docs.aws.amazon.com/AmazonS3/latest/userguide/olap-examples.html) +// in the Amazon S3 User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Simple Storage Service's +// API operation WriteGetObjectResponse for usage and error information. +// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/WriteGetObjectResponse +func (c *S3) WriteGetObjectResponse(input *WriteGetObjectResponseInput) (*WriteGetObjectResponseOutput, error) { + req, out := c.WriteGetObjectResponseRequest(input) + return out, req.Send() +} + +// WriteGetObjectResponseWithContext is the same as WriteGetObjectResponse with the addition of +// the ability to pass a context and additional request options. +// +// See WriteGetObjectResponse for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *S3) WriteGetObjectResponseWithContext(ctx aws.Context, input *WriteGetObjectResponseInput, opts ...request.Option) (*WriteGetObjectResponseOutput, error) { + req, out := c.WriteGetObjectResponseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + // Specifies the days since the initiation of an incomplete multipart upload // that Amazon S3 will wait before permanently removing all parts of the upload. // For more information, see Aborting Incomplete Multipart Uploads Using a Bucket // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. type AbortIncompleteMultipartUpload struct { _ struct{} `type:"structure"` @@ -10842,25 +10993,25 @@ type AbortMultipartUploadInput struct { // The bucket name to which the upload was taking place. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -11008,7 +11159,7 @@ func (s *AbortMultipartUploadOutput) SetRequestCharged(v string) *AbortMultipart // Configures the transfer acceleration state for an Amazon S3 bucket. For more // information, see Amazon S3 Transfer Acceleration (https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-acceleration.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. type AccelerateConfiguration struct { _ struct{} `type:"structure"` @@ -11486,7 +11637,7 @@ func (s *Bucket) SetName(v string) *Bucket { // Specifies the lifecycle configuration for objects in an Amazon S3 bucket. // For more information, see Object Lifecycle Management (https://docs.aws.amazon.com/AmazonS3/latest/dev/object-lifecycle-mgmt.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. type BucketLifecycleConfiguration struct { _ struct{} `type:"structure"` @@ -11580,7 +11731,7 @@ func (s *BucketLoggingStatus) SetLoggingEnabled(v *LoggingEnabled) *BucketLoggin // Describes the cross-origin access configuration for objects in an Amazon // S3 bucket. For more information, see Enabling Cross-Origin Resource Sharing // (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) in the Amazon -// Simple Storage Service Developer Guide. +// S3 User Guide. type CORSConfiguration struct { _ struct{} `type:"structure"` @@ -11656,6 +11807,9 @@ type CORSRule struct { // object). ExposeHeaders []*string `locationName:"ExposeHeader" type:"list" flattened:"true"` + // Unique identifier for the rule. The value cannot be longer than 255 characters. + ID *string `type:"string"` + // The time in seconds that your browser is to cache the preflight response // for the specified resource. MaxAgeSeconds *int64 `type:"integer"` @@ -11711,6 +11865,12 @@ func (s *CORSRule) SetExposeHeaders(v []*string) *CORSRule { return s } +// SetID sets the ID field's value. +func (s *CORSRule) SetID(v string) *CORSRule { + s.ID = &v + return s +} + // SetMaxAgeSeconds sets the MaxAgeSeconds field's value. func (s *CORSRule) SetMaxAgeSeconds(v int64) *CORSRule { s.MaxAgeSeconds = &v @@ -11991,7 +12151,7 @@ type CompleteMultipartUploadInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -12127,20 +12287,20 @@ type CompleteMultipartUploadOutput struct { // The name of the bucket that contains the newly created object. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. Bucket *string `type:"string"` // Indicates whether the multipart upload uses an S3 Bucket Key for server-side @@ -12341,6 +12501,10 @@ type Condition struct { // the parent element Condition is specified and sibling HttpErrorCodeReturnedEquals // is not specified. If both conditions are specified, both must be true for // the redirect to be applied. + // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). KeyPrefixEquals *string `type:"string"` } @@ -12409,20 +12573,20 @@ type CopyObjectInput struct { // The name of the destination bucket. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -12432,8 +12596,8 @@ type CopyObjectInput struct { // to true causes Amazon S3 to use an S3 Bucket Key for object encryption with // SSE-KMS. // - // Specifying this header with a COPY operation doesn’t affect bucket-level - // settings for S3 Bucket Key. + // Specifying this header with a COPY action doesn’t affect bucket-level settings + // for S3 Bucket Key. BucketKeyEnabled *bool `location:"header" locationName:"x-amz-server-side-encryption-bucket-key-enabled" type:"boolean"` // Specifies caching behavior along the request/reply chain. @@ -12455,7 +12619,7 @@ type CopyObjectInput struct { // Specifies the source object for the copy operation. You specify the value // in one of two formats, depending on whether you want to access the source - // object through an access point (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-points.html): + // object through an access point (https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html): // // * For objects not accessed through an access point, specify the name of // the source bucket and the key of the source object, separated by a slash @@ -12513,12 +12677,12 @@ type CopyObjectInput struct { // encryption key was transmitted without error. CopySourceSSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key-MD5" type:"string"` - // The account id of the expected destination bucket owner. If the destination + // The account ID of the expected destination bucket owner. If the destination // bucket is owned by a different account, the request will fail with an HTTP // 403 (Access Denied) error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` - // The account id of the expected source bucket owner. If the source bucket + // The account ID of the expected source bucket owner. If the source bucket // is owned by a different account, the request will fail with an HTTP 403 (Access // Denied) error. ExpectedSourceBucketOwner *string `location:"header" locationName:"x-amz-source-expected-bucket-owner" type:"string"` @@ -13083,10 +13247,10 @@ type CopyObjectResult struct { // Returns the ETag of the new object. The ETag reflects only changes to the // contents of an object, not its metadata. The source and destination ETag - // is identical for a successfully copied object. + // is identical for a successfully copied non-multipart object. ETag *string `type:"string"` - // Returns the date that the object was last modified. + // Creation date of the object. LastModified *time.Time `type:"timestamp"` } @@ -13326,20 +13490,20 @@ type CreateMultipartUploadInput struct { // The name of the bucket to which to initiate the upload // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -13349,7 +13513,7 @@ type CreateMultipartUploadInput struct { // to true causes Amazon S3 to use an S3 Bucket Key for object encryption with // SSE-KMS. // - // Specifying this header with an object operation doesn’t affect bucket-level + // Specifying this header with an object action doesn’t affect bucket-level // settings for S3 Bucket Key. BucketKeyEnabled *bool `location:"header" locationName:"x-amz-server-side-encryption-bucket-key-enabled" type:"boolean"` @@ -13370,7 +13534,7 @@ type CreateMultipartUploadInput struct { // A standard MIME type describing the format of the object data. ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -13447,7 +13611,7 @@ type CreateMultipartUploadInput struct { // object encryption. All GET and PUT requests for an object protected by AWS // KMS will fail if not made via SSL or using SigV4. For information about configuring // using any of the officially supported AWS SDKs and AWS CLI, see Specifying - // the Signature Version in Request Authentication (https://docs.aws.amazon.com/http:/docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version) + // the Signature Version in Request Authentication (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version) // in the Amazon S3 Developer Guide. SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` @@ -13740,20 +13904,20 @@ type CreateMultipartUploadOutput struct { // The name of the bucket to which the multipart upload was initiated. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. Bucket *string `locationName:"Bucket" type:"string"` // Indicates whether the multipart upload uses an S3 Bucket Key for server-side @@ -13886,17 +14050,24 @@ func (s *CreateMultipartUploadOutput) SetUploadId(v string) *CreateMultipartUplo // The container element for specifying the default Object Lock retention settings // for new objects placed in the specified bucket. +// +// * The DefaultRetention settings require both a mode and a period. +// +// * The DefaultRetention period can be either Days or Years but you must +// select one. You cannot specify Days and Years at the same time. type DefaultRetention struct { _ struct{} `type:"structure"` // The number of days that you want to specify for the default retention period. + // Must be used with Mode. Days *int64 `type:"integer"` // The default Object Lock retention mode you want to apply to new objects placed - // in the specified bucket. + // in the specified bucket. Must be used with either Days or Years. Mode *string `type:"string" enum:"ObjectLockRetentionMode"` // The number of years that you want to specify for the default retention period. + // Must be used with Mode. Years *int64 `type:"integer"` } @@ -13995,7 +14166,7 @@ type DeleteBucketAnalyticsConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -14109,7 +14280,7 @@ type DeleteBucketCorsInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -14210,7 +14381,7 @@ type DeleteBucketEncryptionInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -14310,7 +14481,7 @@ type DeleteBucketInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -14500,7 +14671,7 @@ type DeleteBucketInventoryConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -14614,7 +14785,7 @@ type DeleteBucketLifecycleInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -14714,7 +14885,7 @@ type DeleteBucketMetricsConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -14842,7 +15013,7 @@ type DeleteBucketOwnershipControlsInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -14942,7 +15113,7 @@ type DeleteBucketPolicyInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -15042,7 +15213,7 @@ type DeleteBucketReplicationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -15142,7 +15313,7 @@ type DeleteBucketTaggingInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -15242,7 +15413,7 @@ type DeleteBucketWebsiteInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -15438,20 +15609,20 @@ type DeleteObjectInput struct { // The bucket name of the bucket containing the object. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -15460,7 +15631,7 @@ type DeleteObjectInput struct { // to process this operation. BypassGovernanceRetention *bool `location:"header" locationName:"x-amz-bypass-governance-retention" type:"boolean"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -15644,30 +15815,31 @@ type DeleteObjectTaggingInput struct { // The bucket name containing the objects from which to remove the tags. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` - // Name of the object key. + // The key that identifies the object in the bucket from which to remove all + // tags. // // Key is a required field Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` @@ -15794,20 +15966,20 @@ type DeleteObjectsInput struct { // The bucket name containing the objects to delete. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -15822,7 +15994,7 @@ type DeleteObjectsInput struct { // Delete is a required field Delete *Delete `locationName:"Delete" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -15952,7 +16124,7 @@ type DeleteObjectsOutput struct { // was successfully deleted. Deleted []*DeletedObject `type:"list" flattened:"true"` - // Container for a failed delete operation that describes the object that Amazon + // Container for a failed delete action that describes the object that Amazon // S3 attempted to delete and the error it encountered. Errors []*Error `locationName:"Error" type:"list" flattened:"true"` @@ -15997,7 +16169,7 @@ type DeletePublicAccessBlockInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -16423,9 +16595,9 @@ type Error struct { // Forbidden SOAP Fault Code Prefix: Client // // * Code: AccountProblem Description: There is a problem with your AWS account - // that prevents the operation from completing successfully. Contact AWS - // Support for further assistance. HTTP Status Code: 403 Forbidden SOAP Fault - // Code Prefix: Client + // that prevents the action from completing successfully. Contact AWS Support + // for further assistance. HTTP Status Code: 403 Forbidden SOAP Fault Code + // Prefix: Client // // * Code: AllAccessDisabled Description: All access to this Amazon S3 resource // has been disabled. Contact AWS Support for further assistance. HTTP Status @@ -16528,9 +16700,9 @@ type Error struct { // Select a Region for Your Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro). // HTTP Status Code: 400 Bad Request SOAP Fault Code Prefix: Client // - // * Code: InvalidObjectState Description: The operation is not valid for - // the current state of the object. HTTP Status Code: 403 Forbidden SOAP - // Fault Code Prefix: Client + // * Code: InvalidObjectState Description: The action is not valid for the + // current state of the object. HTTP Status Code: 403 Forbidden SOAP Fault + // Code Prefix: Client // // * Code: InvalidPart Description: One or more of the specified parts could // not be found. The part might not have been uploaded, or the specified @@ -16695,7 +16867,7 @@ type Error struct { // can sign up at the following URL: https://aws.amazon.com/s3 HTTP Status // Code: 403 Forbidden SOAP Fault Code Prefix: Client // - // * Code: OperationAborted Description: A conflicting conditional operation + // * Code: OperationAborted Description: A conflicting conditional action // is currently in progress against this resource. Try again. HTTP Status // Code: 409 Conflict SOAP Fault Code Prefix: Client // @@ -16821,6 +16993,10 @@ type ErrorDocument struct { // The object key name to use when a 4XX class error occurs. // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). + // // Key is a required field Key *string `min:"1" type:"string" required:"true"` } @@ -16905,7 +17081,7 @@ type FilterRule struct { // the filtering rule applies. The maximum length is 1,024 characters. Overlapping // prefixes and suffixes are not supported. For more information, see Configuring // Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. Name *string `type:"string" enum:"FilterRuleName"` // The value that the filter searches for in object key names. @@ -16942,7 +17118,7 @@ type GetBucketAccelerateConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -17051,7 +17227,7 @@ type GetBucketAclInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -17169,7 +17345,7 @@ type GetBucketAnalyticsConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -17292,7 +17468,7 @@ type GetBucketCorsInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -17403,7 +17579,7 @@ type GetBucketEncryptionInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -17625,7 +17801,7 @@ type GetBucketInventoryConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -17748,7 +17924,7 @@ type GetBucketLifecycleConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -17857,7 +18033,7 @@ type GetBucketLifecycleInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -17966,7 +18142,7 @@ type GetBucketLocationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -18077,7 +18253,7 @@ type GetBucketLoggingInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -18189,7 +18365,7 @@ type GetBucketMetricsConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -18312,7 +18488,7 @@ type GetBucketNotificationConfigurationRequest struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -18398,7 +18574,7 @@ type GetBucketOwnershipControlsInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -18508,7 +18684,7 @@ type GetBucketPolicyInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -18617,7 +18793,7 @@ type GetBucketPolicyStatusInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -18726,7 +18902,7 @@ type GetBucketReplicationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -18836,7 +19012,7 @@ type GetBucketRequestPaymentInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -18945,7 +19121,7 @@ type GetBucketTaggingInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -19056,7 +19232,7 @@ type GetBucketVersioningInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -19176,7 +19352,7 @@ type GetBucketWebsiteInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -19310,17 +19486,17 @@ type GetObjectAclInput struct { // The bucket name that contains the object for which to get the ACL information. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -19484,25 +19660,25 @@ type GetObjectInput struct { // The bucket name containing the object. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -19565,14 +19741,14 @@ type GetObjectInput struct { // Sets the Expires header of the response. ResponseExpires *time.Time `location:"querystring" locationName:"response-expires" type:"timestamp" timestampFormat:"rfc822"` - // Specifies the algorithm to use to when encrypting the object (for example, + // Specifies the algorithm to use to when decrypting the object (for example, // AES256). SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // S3 does not store the encryption key. The key must be appropriate for use - // with the algorithm specified in the x-amz-server-side-encryption-customer-algorithm + // Specifies the customer-provided encryption key for Amazon S3 used to encrypt + // the data. This value is used to decrypt the object when recovering it and + // must match the one used when storing the data. The key must be appropriate + // for use with the algorithm specified in the x-amz-server-side-encryption-customer-algorithm // header. SSECustomerKey *string `marshal-as:"blob" location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string" sensitive:"true"` @@ -19784,17 +19960,17 @@ type GetObjectLegalHoldInput struct { // The bucket name containing the object whose Legal Hold status you want to // retrieve. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -19939,17 +20115,17 @@ type GetObjectLockConfigurationInput struct { // The bucket whose Object Lock configuration you want to retrieve. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -20103,7 +20279,7 @@ type GetObjectOutput struct { // The date and time at which the object is no longer cacheable. Expires *string `location:"header" locationName:"Expires" type:"string"` - // Last modified date of the object + // Creation date of the object. LastModified *time.Time `location:"header" locationName:"Last-Modified" type:"timestamp"` // A map of metadata to store with the object in S3. @@ -20140,7 +20316,7 @@ type GetObjectOutput struct { // request. RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - // Provides information about object restoration operation and expiration time + // Provides information about object restoration action and expiration time // of the restored object copy. Restore *string `location:"header" locationName:"x-amz-restore" type:"string"` @@ -20387,17 +20563,17 @@ type GetObjectRetentionInput struct { // The bucket name containing the object whose retention settings you want to // retrieve. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -20542,25 +20718,25 @@ type GetObjectTaggingInput struct { // The bucket name containing the object for which to get the tagging information. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -20570,6 +20746,13 @@ type GetObjectTaggingInput struct { // Key is a required field Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + // Confirms that the requester knows that they will be charged for the request. + // Bucket owners need not specify this parameter in their requests. For information + // about downloading objects from requester pays buckets, see Downloading Objects + // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) + // in the Amazon S3 Developer Guide. + RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` + // The versionId of the object for which to get the tagging information. VersionId *string `location:"querystring" locationName:"versionId" type:"string"` } @@ -20631,6 +20814,12 @@ func (s *GetObjectTaggingInput) SetKey(v string) *GetObjectTaggingInput { return s } +// SetRequestPayer sets the RequestPayer field's value. +func (s *GetObjectTaggingInput) SetRequestPayer(v string) *GetObjectTaggingInput { + s.RequestPayer = &v + return s +} + // SetVersionId sets the VersionId field's value. func (s *GetObjectTaggingInput) SetVersionId(v string) *GetObjectTaggingInput { s.VersionId = &v @@ -20707,7 +20896,7 @@ type GetObjectTorrentInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -20857,7 +21046,7 @@ type GetPublicAccessBlockInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -21149,25 +21338,25 @@ type HeadBucketInput struct { // The bucket name. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -21264,25 +21453,25 @@ type HeadObjectInput struct { // The name of the bucket containing the object. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -21555,7 +21744,7 @@ type HeadObjectOutput struct { // The date and time at which the object is no longer cacheable. Expires *string `location:"header" locationName:"Expires" type:"string"` - // Last modified date of the object + // Creation date of the object. LastModified *time.Time `location:"header" locationName:"Last-Modified" type:"timestamp"` // A map of metadata to store with the object in S3. @@ -21636,7 +21825,7 @@ type HeadObjectOutput struct { // If an archive copy is already restored, the header value indicates when Amazon // S3 is scheduled to delete the object copy. For example: // - // x-amz-restore: ongoing-request="false", expiry-date="Fri, 23 Dec 2012 00:00:00 + // x-amz-restore: ongoing-request="false", expiry-date="Fri, 21 Dec 2012 00:00:00 // GMT" // // If the object restoration is in progress, the header returns the value ongoing-request="true". @@ -21881,6 +22070,10 @@ type IndexDocument struct { // with the key name images/index.html) The suffix must not be empty and must // not include a slash character. // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). + // // Suffix is a required field Suffix *string `type:"string" required:"true"` } @@ -22164,6 +22357,10 @@ type IntelligentTieringFilter struct { // An object key name prefix that identifies the subset of objects to which // the rule applies. + // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). Prefix *string `type:"string"` // A container of a key value name pair. @@ -22705,14 +22902,14 @@ type LambdaFunctionConfiguration struct { // The Amazon S3 bucket event for which to invoke the AWS Lambda function. For // more information, see Supported Event Types (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. // // Events is a required field Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` // Specifies object key name filtering rules. For information about key name // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. Filter *NotificationConfigurationFilter `type:"structure"` // An optional unique identifier for configurations in a notification configuration. @@ -22880,7 +23077,7 @@ type LifecycleRule struct { // that Amazon S3 will wait before permanently removing all parts of the upload. // For more information, see Aborting Incomplete Multipart Uploads Using a Bucket // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` // Specifies the expiration for the lifecycle of the object in the form of date, @@ -22888,7 +23085,8 @@ type LifecycleRule struct { Expiration *LifecycleExpiration `type:"structure"` // The Filter is used to identify objects that a Lifecycle Rule applies to. - // A Filter must have exactly one of Prefix, Tag, or And specified. + // A Filter must have exactly one of Prefix, Tag, or And specified. Filter is + // required if the LifecycleRule does not containt a Prefix element. Filter *LifecycleRuleFilter `type:"structure"` // Unique identifier for the rule. The value cannot be longer than 255 characters. @@ -22909,7 +23107,11 @@ type LifecycleRule struct { NoncurrentVersionTransitions []*NoncurrentVersionTransition `locationName:"NoncurrentVersionTransition" type:"list" flattened:"true"` // Prefix identifying one or more objects to which the rule applies. This is - // No longer used; use Filter instead. + // no longer used; use Filter instead. + // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). // // Deprecated: Prefix has been deprecated Prefix *string `deprecated:"true" type:"string"` @@ -23073,6 +23275,10 @@ type LifecycleRuleFilter struct { And *LifecycleRuleAndOperator `type:"structure"` // Prefix identifying one or more objects to which the rule applies. + // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). Prefix *string `type:"string"` // This tag must exist in the object's tag set in order for the rule to apply. @@ -23139,7 +23345,7 @@ type ListBucketAnalyticsConfigurationsInput struct { // should begin. ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -23433,7 +23639,7 @@ type ListBucketInventoryConfigurationsInput struct { // that Amazon S3 understands. ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -23586,7 +23792,7 @@ type ListBucketMetricsConfigurationsInput struct { // value that Amazon S3 understands. ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -23777,20 +23983,20 @@ type ListMultipartUploadsInput struct { // The name of the bucket to which the multipart upload was initiated. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -23813,7 +24019,7 @@ type ListMultipartUploadsInput struct { // keys in the response. EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -24125,7 +24331,7 @@ type ListObjectVersionsInput struct { // keys in the response. EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -24134,7 +24340,7 @@ type ListObjectVersionsInput struct { KeyMarker *string `location:"querystring" locationName:"key-marker" type:"string"` // Sets the maximum number of keys returned in the response. By default the - // API returns up to 1,000 key names. The response might contain fewer keys + // action returns up to 1,000 key names. The response might contain fewer keys // but will never contain more. If additional keys satisfy the search criteria, // but were not returned because max-keys was exceeded, the response contains // true. To return the additional keys, see key-marker @@ -24417,20 +24623,20 @@ type ListObjectsInput struct { // The name of the bucket containing the objects. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -24446,7 +24652,7 @@ type ListObjectsInput struct { // keys in the response. EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -24455,7 +24661,7 @@ type ListObjectsInput struct { Marker *string `location:"querystring" locationName:"marker" type:"string"` // Sets the maximum number of keys returned in the response. By default the - // API returns up to 1,000 key names. The response might contain fewer keys + // action returns up to 1,000 key names. The response might contain fewer keys // but will never contain more. MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` @@ -24579,8 +24785,8 @@ func (s ListObjectsInput) updateArnableField(v string) (interface{}, error) { type ListObjectsOutput struct { _ struct{} `type:"structure"` - // All of the keys rolled up in a common prefix count as a single return when - // calculating the number of returns. + // All of the keys (up to 1,000) rolled up in a common prefix count as a single + // return when calculating the number of returns. // // A response can contain CommonPrefixes only if you specify a delimiter. // @@ -24711,20 +24917,20 @@ type ListObjectsV2Input struct { // Bucket name to list. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -24740,7 +24946,7 @@ type ListObjectsV2Input struct { // Encoding type used by Amazon S3 to encode object keys in the response. EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -24751,7 +24957,7 @@ type ListObjectsV2Input struct { FetchOwner *bool `location:"querystring" locationName:"fetch-owner" type:"boolean"` // Sets the maximum number of keys returned in the response. By default the - // API returns up to 1,000 key names. The response might contain fewer keys + // action returns up to 1,000 key names. The response might contain fewer keys // but will never contain more. MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` @@ -24891,8 +25097,8 @@ func (s ListObjectsV2Input) updateArnableField(v string) (interface{}, error) { type ListObjectsV2Output struct { _ struct{} `type:"structure"` - // All of the keys rolled up into a common prefix count as a single return when - // calculating the number of returns. + // All of the keys (up to 1,000) rolled up into a common prefix count as a single + // return when calculating the number of returns. // // A response can contain CommonPrefixes only if you specify a delimiter. // @@ -24936,31 +25142,31 @@ type ListObjectsV2Output struct { IsTruncated *bool `type:"boolean"` // KeyCount is the number of keys returned with this request. KeyCount will - // always be less than equals to MaxKeys field. Say you ask for 50 keys, your - // result will include less than equals 50 keys + // always be less than or equals to MaxKeys field. Say you ask for 50 keys, + // your result will include less than equals 50 keys KeyCount *int64 `type:"integer"` // Sets the maximum number of keys returned in the response. By default the - // API returns up to 1,000 key names. The response might contain fewer keys + // action returns up to 1,000 key names. The response might contain fewer keys // but will never contain more. MaxKeys *int64 `type:"integer"` // The bucket name. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. Name *string `type:"string"` // NextContinuationToken is sent when isTruncated is true, which means there @@ -25063,25 +25269,25 @@ type ListPartsInput struct { // The name of the bucket to which the parts are being uploaded. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -25983,7 +26189,7 @@ type NoncurrentVersionTransition struct { // perform the associated action. For information about the noncurrent days // calculations, see How Amazon S3 Calculates How Long an Object Has Been Noncurrent // (https://docs.aws.amazon.com/AmazonS3/latest/dev/intro-lifecycle-rules.html#non-current-days-calculations) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. NoncurrentDays *int64 `type:"integer"` // The class of storage used to store the object. @@ -26145,7 +26351,7 @@ func (s *NotificationConfigurationDeprecated) SetTopicConfiguration(v *TopicConf // Specifies object key name filtering rules. For information about key name // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. type NotificationConfigurationFilter struct { _ struct{} `type:"structure"` @@ -26195,7 +26401,7 @@ type Object struct { // the object. Key *string `min:"1" type:"string"` - // The date the Object was Last Modified + // Creation date of the object. LastModified *time.Time `type:"timestamp"` // The owner of the object @@ -26258,7 +26464,11 @@ func (s *Object) SetStorageClass(v string) *Object { type ObjectIdentifier struct { _ struct{} `type:"structure"` - // Key name of the object to delete. + // Key name of the object. + // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). // // Key is a required field Key *string `min:"1" type:"string" required:"true"` @@ -26309,10 +26519,14 @@ func (s *ObjectIdentifier) SetVersionId(v string) *ObjectIdentifier { type ObjectLockConfiguration struct { _ struct{} `type:"structure"` - // Indicates whether this bucket has an Object Lock configuration enabled. + // Indicates whether this bucket has an Object Lock configuration enabled. Enable + // ObjectLockEnabled when you apply ObjectLockConfiguration to a bucket. ObjectLockEnabled *string `type:"string" enum:"ObjectLockEnabled"` - // The Object Lock rule in place for the specified object. + // Specifies the Object Lock rule for the specified object. Enable the this + // rule when you apply ObjectLockConfiguration to a bucket. Bucket settings + // require both a mode and a period. The period can be either Days or Years + // but you must select one. You cannot specify Days and Years at the same time. Rule *ObjectLockRule `type:"structure"` } @@ -26399,8 +26613,10 @@ func (s *ObjectLockRetention) SetRetainUntilDate(v time.Time) *ObjectLockRetenti type ObjectLockRule struct { _ struct{} `type:"structure"` - // The default retention period that you want to apply to new objects placed - // in the specified bucket. + // The default Object Lock retention mode and period that you want to apply + // to new objects placed in the specified bucket. Bucket settings require both + // a mode and a period. The period can be either Days or Years but you must + // select one. You cannot specify Days and Years at the same time. DefaultRetention *DefaultRetention `type:"structure"` } @@ -26899,7 +27115,7 @@ func (s *ProgressEvent) MarshalEvent(pm protocol.PayloadMarshaler) (msg eventstr // S3 bucket. You can enable the configuration options in any combination. For // more information about when Amazon S3 considers a bucket or object public, // see The Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. type PublicAccessBlockConfiguration struct { _ struct{} `type:"structure"` @@ -26990,7 +27206,7 @@ type PutBucketAccelerateConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -27105,7 +27321,7 @@ type PutBucketAclInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -27273,7 +27489,7 @@ type PutBucketAnalyticsConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -27404,12 +27620,12 @@ type PutBucketCorsInput struct { // Describes the cross-origin access configuration for objects in an Amazon // S3 bucket. For more information, see Enabling Cross-Origin Resource Sharing // (https://docs.aws.amazon.com/AmazonS3/latest/dev/cors.html) in the Amazon - // Simple Storage Service Developer Guide. + // S3 User Guide. // // CORSConfiguration is a required field CORSConfiguration *CORSConfiguration `locationName:"CORSConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -27522,12 +27738,12 @@ type PutBucketEncryptionInput struct { // Amazon S3-managed keys (SSE-S3) or customer master keys stored in AWS KMS // (SSE-KMS). For information about the Amazon S3 default encryption feature, // see Amazon S3 Default Bucket Encryption (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-encryption.html) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -27769,7 +27985,7 @@ type PutBucketInventoryConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -27902,7 +28118,7 @@ type PutBucketLifecycleConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -28014,7 +28230,7 @@ type PutBucketLifecycleInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -28133,7 +28349,7 @@ type PutBucketLoggingInput struct { // BucketLoggingStatus is a required field BucketLoggingStatus *BucketLoggingStatus `locationName:"BucketLoggingStatus" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -28247,7 +28463,7 @@ type PutBucketMetricsConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -28380,7 +28596,7 @@ type PutBucketNotificationConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -28500,7 +28716,7 @@ type PutBucketNotificationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -28614,7 +28830,7 @@ type PutBucketOwnershipControlsInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -28738,7 +28954,7 @@ type PutBucketPolicyInput struct { // to change this bucket policy in the future. ConfirmRemoveSelfBucketAccess *bool `location:"header" locationName:"x-amz-confirm-remove-self-bucket-access" type:"boolean"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -28858,7 +29074,7 @@ type PutBucketReplicationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -28987,7 +29203,7 @@ type PutBucketRequestPaymentInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -29106,7 +29322,7 @@ type PutBucketTaggingInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -29225,7 +29441,7 @@ type PutBucketVersioningInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -29349,7 +29565,7 @@ type PutBucketWebsiteInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -29473,17 +29689,17 @@ type PutObjectAclInput struct { // The bucket name that contains the object to which you want to attach the // ACL. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -29512,22 +29728,22 @@ type PutObjectAclInput struct { // This action is not supported by Amazon S3 on Outposts. GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - // Key for which the PUT operation was initiated. + // Key for which the PUT action was initiated. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Key is a required field Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` @@ -29722,22 +29938,22 @@ type PutObjectInput struct { // Object data. Body io.ReadSeeker `type:"blob"` - // The bucket name to which the PUT operation was initiated. + // The bucket name to which the PUT action was initiated. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -29747,8 +29963,8 @@ type PutObjectInput struct { // to true causes Amazon S3 to use an S3 Bucket Key for object encryption with // SSE-KMS. // - // Specifying this header with a PUT operation doesn’t affect bucket-level - // settings for S3 Bucket Key. + // Specifying this header with a PUT action doesn’t affect bucket-level settings + // for S3 Bucket Key. BucketKeyEnabled *bool `location:"header" locationName:"x-amz-server-side-encryption-bucket-key-enabled" type:"boolean"` // Can be used to specify caching behavior along the request/reply chain. For @@ -29786,7 +30002,7 @@ type PutObjectInput struct { // see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17 (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17). ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -29815,7 +30031,7 @@ type PutObjectInput struct { // This action is not supported by Amazon S3 on Outposts. GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - // Object key for which the PUT operation was initiated. + // Object key for which the PUT action was initiated. // // Key is a required field Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` @@ -30181,17 +30397,17 @@ type PutObjectLegalHoldInput struct { // The bucket name containing the object that you want to place a Legal Hold // on. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -30350,7 +30566,7 @@ type PutObjectLockConfigurationInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -30611,20 +30827,20 @@ type PutObjectRetentionInput struct { // The bucket name that contains the object you want to apply this Object Retention // configuration to. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // Indicates whether this operation should bypass Governance-mode restrictions. + // Indicates whether this action should bypass Governance-mode restrictions. BypassGovernanceRetention *bool `location:"header" locationName:"x-amz-bypass-governance-retention" type:"boolean"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -30787,25 +31003,25 @@ type PutObjectTaggingInput struct { // The bucket name containing the object. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -30815,6 +31031,13 @@ type PutObjectTaggingInput struct { // Key is a required field Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` + // Confirms that the requester knows that they will be charged for the request. + // Bucket owners need not specify this parameter in their requests. For information + // about downloading objects from requester pays buckets, see Downloading Objects + // in Requestor Pays Buckets (https://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html) + // in the Amazon S3 Developer Guide. + RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` + // Container for the TagSet and Tag elements // // Tagging is a required field @@ -30889,6 +31112,12 @@ func (s *PutObjectTaggingInput) SetKey(v string) *PutObjectTaggingInput { return s } +// SetRequestPayer sets the RequestPayer field's value. +func (s *PutObjectTaggingInput) SetRequestPayer(v string) *PutObjectTaggingInput { + s.RequestPayer = &v + return s +} + // SetTagging sets the Tagging field's value. func (s *PutObjectTaggingInput) SetTagging(v *Tagging) *PutObjectTaggingInput { s.Tagging = v @@ -30960,7 +31189,7 @@ type PutPublicAccessBlockInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -30969,7 +31198,7 @@ type PutPublicAccessBlockInput struct { // S3 bucket. You can enable the configuration options in any combination. For // more information about when Amazon S3 considers a bucket or object public, // see The Meaning of "Public" (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-control-block-public-access.html#access-control-block-public-access-policy-status) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. // // PublicAccessBlockConfiguration is a required field PublicAccessBlockConfiguration *PublicAccessBlockConfiguration `locationName:"PublicAccessBlockConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` @@ -31082,7 +31311,7 @@ type QueueConfiguration struct { // Specifies object key name filtering rules. For information about key name // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. Filter *NotificationConfigurationFilter `type:"structure"` // An optional unique identifier for configurations in a notification configuration. @@ -31158,7 +31387,7 @@ type QueueConfigurationDeprecated struct { // Deprecated: Event has been deprecated Event *string `deprecated:"true" type:"string" enum:"Event"` - // A collection of bucket events for which to send notifications + // A collection of bucket events for which to send notifications. Events []*string `locationName:"Event" type:"list" flattened:"true"` // An optional unique identifier for configurations in a notification configuration. @@ -31275,11 +31504,19 @@ type Redirect struct { // and in the Redirect set ReplaceKeyPrefixWith to /documents. Not required // if one of the siblings is present. Can be present only if ReplaceKeyWith // is not provided. + // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). ReplaceKeyPrefixWith *string `type:"string"` // The specific object key to use in the redirect request. For example, redirect // request to error.html. Not required if one of the siblings is present. Can // be present only if ReplaceKeyPrefixWith is not provided. + // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). ReplaceKeyWith *string `type:"string"` } @@ -31428,7 +31665,7 @@ type ReplicationConfiguration struct { // The Amazon Resource Name (ARN) of the AWS Identity and Access Management // (IAM) role that Amazon S3 assumes when replicating objects. For more information, // see How to Set Up Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication-how-setup.html) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. // // Role is a required field Role *string `type:"string" required:"true"` @@ -31529,6 +31766,10 @@ type ReplicationRule struct { // the rule applies. The maximum prefix length is 1,024 characters. To include // all objects in a bucket, specify an empty string. // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). + // // Deprecated: Prefix has been deprecated Prefix *string `deprecated:"true" type:"string"` @@ -31539,7 +31780,7 @@ type ReplicationRule struct { // with the highest priority. The higher the number, the higher the priority. // // For more information, see Replication (https://docs.aws.amazon.com/AmazonS3/latest/dev/replication.html) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. Priority *int64 `type:"integer"` // A container that describes additional filters for identifying the source @@ -31665,7 +31906,7 @@ func (s *ReplicationRule) SetStatus(v string) *ReplicationRule { // an And tag. // // * If you specify a filter based on multiple tags, wrap the Tag elements -// in an And tag +// in an And tag. type ReplicationRuleAndOperator struct { _ struct{} `type:"structure"` @@ -31737,6 +31978,10 @@ type ReplicationRuleFilter struct { // An object key name prefix that identifies the subset of objects to which // the rule applies. + // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). Prefix *string `type:"string"` // A container for specifying a tag key and value. @@ -31946,30 +32191,30 @@ type RestoreObjectInput struct { // The bucket name containing the object to restore. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` - // Object key for which the operation was initiated. + // Object key for which the action was initiated. // // Key is a required field Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` @@ -32240,7 +32485,7 @@ func (s *RestoreRequest) SetType(v string) *RestoreRequest { // Specifies the redirect behavior and when a redirect is applied. For more // information about routing rules, see Configuring advanced conditional redirects // (https://docs.aws.amazon.com/AmazonS3/latest/dev/how-to-page-redirect.html#advanced-conditional-redirects) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. type RoutingRule struct { _ struct{} `type:"structure"` @@ -32296,7 +32541,7 @@ func (s *RoutingRule) SetRedirect(v *Redirect) *RoutingRule { // Specifies lifecycle rules for an Amazon S3 bucket. For more information, // see Put Bucket Lifecycle Configuration (https://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html) // in the Amazon Simple Storage Service API Reference. For examples, see Put -// Bucket Lifecycle Configuration Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html#API_PutBucketLifecycleConfiguration_Examples) +// Bucket Lifecycle Configuration Examples (https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutBucketLifecycleConfiguration.html#API_PutBucketLifecycleConfiguration_Examples). type Rule struct { _ struct{} `type:"structure"` @@ -32304,7 +32549,7 @@ type Rule struct { // that Amazon S3 will wait before permanently removing all parts of the upload. // For more information, see Aborting Incomplete Multipart Uploads Using a Bucket // Lifecycle Policy (https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html#mpu-abort-incomplete-mpu-lifecycle-config) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` // Specifies the expiration for the lifecycle of the object. @@ -32332,6 +32577,10 @@ type Rule struct { // Object key prefix that identifies one or more objects to which this rule // applies. // + // Replacement must be made for object keys containing special characters (such + // as carriage returns) when using XML requests. For more information, see XML + // related object key constraints (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-keys.html#object-key-xml-related-constraints). + // // Prefix is a required field Prefix *string `type:"string" required:"true"` @@ -32344,7 +32593,7 @@ type Rule struct { // Specifies when an object transitions to a specified storage class. For more // information about Amazon S3 lifecycle configuration rules, see Transitioning // Objects Using Amazon S3 Lifecycle (https://docs.aws.amazon.com/AmazonS3/latest/dev/lifecycle-transition-general-considerations.html) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. Transition *Transition `type:"structure"` } @@ -32703,7 +32952,7 @@ type SelectObjectContentInput struct { // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -33168,7 +33417,7 @@ type ServerSideEncryptionRule struct { // S3 to use an S3 Bucket Key. By default, S3 Bucket Key is not enabled. // // For more information, see Amazon S3 Bucket Keys (https://docs.aws.amazon.com/AmazonS3/latest/dev/bucket-key.html) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. BucketKeyEnabled *bool `type:"boolean"` } @@ -33735,14 +33984,14 @@ type TopicConfiguration struct { // The Amazon S3 bucket event about which to send notifications. For more information, // see Supported Event Types (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. // // Events is a required field Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` // Specifies object key name filtering rules. For information about key name // filtering, see Configuring Event Notifications (https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - // in the Amazon Simple Storage Service Developer Guide. + // in the Amazon S3 User Guide. Filter *NotificationConfigurationFilter `type:"structure"` // An optional unique identifier for configurations in a notification configuration. @@ -33868,7 +34117,7 @@ func (s *TopicConfigurationDeprecated) SetTopic(v string) *TopicConfigurationDep // Specifies when an object transitions to a specified storage class. For more // information about Amazon S3 lifecycle configuration rules, see Transitioning // Objects Using Amazon S3 Lifecycle (https://docs.aws.amazon.com/AmazonS3/latest/dev/lifecycle-transition-general-considerations.html) -// in the Amazon Simple Storage Service Developer Guide. +// in the Amazon S3 User Guide. type Transition struct { _ struct{} `type:"structure"` @@ -33917,27 +34166,27 @@ type UploadPartCopyInput struct { // The bucket name. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` // Specifies the source object for the copy operation. You specify the value // in one of two formats, depending on whether you want to access the source - // object through an access point (https://docs.aws.amazon.com/AmazonS3/latest/dev/access-points.html): + // object through an access point (https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html): // // * For objects not accessed through an access point, specify the name of // the source bucket and key of the source object, separated by a slash (/). @@ -34001,12 +34250,12 @@ type UploadPartCopyInput struct { // encryption key was transmitted without error. CopySourceSSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key-MD5" type:"string"` - // The account id of the expected destination bucket owner. If the destination + // The account ID of the expected destination bucket owner. If the destination // bucket is owned by a different account, the request will fail with an HTTP // 403 (Access Denied) error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` - // The account id of the expected source bucket owner. If the source bucket + // The account ID of the expected source bucket owner. If the source bucket // is owned by a different account, the request will fail with an HTTP 403 (Access // Denied) error. ExpectedSourceBucketOwner *string `location:"header" locationName:"x-amz-source-expected-bucket-owner" type:"string"` @@ -34359,20 +34608,20 @@ type UploadPartInput struct { // The name of the bucket to which the multipart upload was initiated. // - // When using this API with an access point, you must direct requests to the - // access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. - // When using this operation with an access point through the AWS SDKs, you - // provide the access point ARN in place of the bucket name. For more information - // about access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/dev/using-access-points.html) - // in the Amazon Simple Storage Service Developer Guide. + // When using this action with an access point, you must direct requests to + // the access point hostname. The access point hostname takes the form AccessPointName-AccountId.s3-accesspoint.Region.amazonaws.com. + // When using this action with an access point through the AWS SDKs, you provide + // the access point ARN in place of the bucket name. For more information about + // access point ARNs, see Using Access Points (https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html) + // in the Amazon S3 User Guide. // - // When using this API with Amazon S3 on Outposts, you must direct requests + // When using this action with Amazon S3 on Outposts, you must direct requests // to the S3 on Outposts hostname. The S3 on Outposts hostname takes the form // AccessPointName-AccountId.outpostID.s3-outposts.Region.amazonaws.com. When - // using this operation using S3 on Outposts through the AWS SDKs, you provide + // using this action using S3 on Outposts through the AWS SDKs, you provide // the Outposts bucket ARN in place of the bucket name. For more information - // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/dev/S3onOutposts.html) - // in the Amazon Simple Storage Service Developer Guide. + // about S3 on Outposts ARNs, see Using S3 on Outposts (https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html) + // in the Amazon S3 User Guide. // // Bucket is a required field Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` @@ -34386,7 +34635,7 @@ type UploadPartInput struct { // if object lock parameters are specified. ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` - // The account id of the expected bucket owner. If the bucket is owned by a + // The account ID of the expected bucket owner. If the bucket is owned by a // different account, the request will fail with an HTTP 403 (Access Denied) // error. ExpectedBucketOwner *string `location:"header" locationName:"x-amz-expected-bucket-owner" type:"string"` @@ -34793,6 +35042,452 @@ func (s *WebsiteConfiguration) SetRoutingRules(v []*RoutingRule) *WebsiteConfigu return s } +type WriteGetObjectResponseInput struct { + _ struct{} `locationName:"WriteGetObjectResponseRequest" type:"structure" payload:"Body"` + + // Indicates that a range of bytes was specified. + AcceptRanges *string `location:"header" locationName:"x-amz-fwd-header-accept-ranges" type:"string"` + + // The object data. + // + // To use an non-seekable io.Reader for this request wrap the io.Reader with + // "aws.ReadSeekCloser". The SDK will not retry request errors for non-seekable + // readers. This will allow the SDK to send the reader's payload as chunked + // transfer encoding. + Body io.ReadSeeker `type:"blob"` + + // Indicates whether the object stored in Amazon S3 uses an S3 bucket key for + // server-side encryption with AWS KMS (SSE-KMS). + BucketKeyEnabled *bool `location:"header" locationName:"x-amz-fwd-header-x-amz-server-side-encryption-bucket-key-enabled" type:"boolean"` + + // Specifies caching behavior along the request/reply chain. + CacheControl *string `location:"header" locationName:"x-amz-fwd-header-Cache-Control" type:"string"` + + // Specifies presentational information for the object. + ContentDisposition *string `location:"header" locationName:"x-amz-fwd-header-Content-Disposition" type:"string"` + + // Specifies what content encodings have been applied to the object and thus + // what decoding mechanisms must be applied to obtain the media-type referenced + // by the Content-Type header field. + ContentEncoding *string `location:"header" locationName:"x-amz-fwd-header-Content-Encoding" type:"string"` + + // The language the content is in. + ContentLanguage *string `location:"header" locationName:"x-amz-fwd-header-Content-Language" type:"string"` + + // The size of the content body in bytes. + ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` + + // The portion of the object returned in the response. + ContentRange *string `location:"header" locationName:"x-amz-fwd-header-Content-Range" type:"string"` + + // A standard MIME type describing the format of the object data. + ContentType *string `location:"header" locationName:"x-amz-fwd-header-Content-Type" type:"string"` + + // Specifies whether an object stored in Amazon S3 is (true) or is not (false) + // a delete marker. + DeleteMarker *bool `location:"header" locationName:"x-amz-fwd-header-x-amz-delete-marker" type:"boolean"` + + // An opaque identifier assigned by a web server to a specific version of a + // resource found at a URL. + ETag *string `location:"header" locationName:"x-amz-fwd-header-ETag" type:"string"` + + // A string that uniquely identifies an error condition. Returned in the + // tag of the error XML response for a corresponding GetObject call. Cannot + // be used with a successful StatusCode header or when the transformed object + // is provided in the body. All error codes from S3 are sentence-cased. Regex + // value is "^[A-Z][a-zA-Z]+$". + ErrorCode *string `location:"header" locationName:"x-amz-fwd-error-code" type:"string"` + + // Contains a generic description of the error condition. Returned in the + // tag of the error XML response for a corresponding GetObject call. Cannot + // be used with a successful StatusCode header or when the transformed object + // is provided in body. + ErrorMessage *string `location:"header" locationName:"x-amz-fwd-error-message" type:"string"` + + // If object stored in Amazon S3 expiration is configured (see PUT Bucket lifecycle) + // it includes expiry-date and rule-id key-value pairs providing object expiration + // information. The value of the rule-id is URL encoded. + Expiration *string `location:"header" locationName:"x-amz-fwd-header-x-amz-expiration" type:"string"` + + // The date and time at which the object is no longer cacheable. + Expires *time.Time `location:"header" locationName:"x-amz-fwd-header-Expires" type:"timestamp"` + + // The date and time that the object was last modified. + LastModified *time.Time `location:"header" locationName:"x-amz-fwd-header-Last-Modified" type:"timestamp"` + + // A map of metadata to store with the object in S3. + Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` + + // Set to the number of metadata entries not returned in x-amz-meta headers. + // This can happen if you create metadata using an API like SOAP that supports + // more flexible metadata than the REST API. For example, using SOAP, you can + // create metadata whose values are not legal HTTP headers. + MissingMeta *int64 `location:"header" locationName:"x-amz-fwd-header-x-amz-missing-meta" type:"integer"` + + // Indicates whether an object stored in Amazon S3 has an active legal hold. + ObjectLockLegalHoldStatus *string `location:"header" locationName:"x-amz-fwd-header-x-amz-object-lock-legal-hold" type:"string" enum:"ObjectLockLegalHoldStatus"` + + // Indicates whether an object stored in Amazon S3 has Object Lock enabled. + // For more information about S3 Object Lock, see Object Lock (https://docs.aws.amazon.com/AmazonS3/latest/userguide/object-lock.html). + ObjectLockMode *string `location:"header" locationName:"x-amz-fwd-header-x-amz-object-lock-mode" type:"string" enum:"ObjectLockMode"` + + // The date and time when Object Lock is configured to expire. + ObjectLockRetainUntilDate *time.Time `location:"header" locationName:"x-amz-fwd-header-x-amz-object-lock-retain-until-date" type:"timestamp" timestampFormat:"iso8601"` + + // The count of parts this object has. + PartsCount *int64 `location:"header" locationName:"x-amz-fwd-header-x-amz-mp-parts-count" type:"integer"` + + // Indicates if request involves bucket that is either a source or destination + // in a Replication rule. For more information about S3 Replication, see Replication + // (https://docs.aws.amazon.com/AmazonS3/latest/userguide/replication.html). + ReplicationStatus *string `location:"header" locationName:"x-amz-fwd-header-x-amz-replication-status" type:"string" enum:"ReplicationStatus"` + + // If present, indicates that the requester was successfully charged for the + // request. + RequestCharged *string `location:"header" locationName:"x-amz-fwd-header-x-amz-request-charged" type:"string" enum:"RequestCharged"` + + // Route prefix to the HTTP URL generated. + // + // RequestRoute is a required field + RequestRoute *string `location:"header" locationName:"x-amz-request-route" type:"string" required:"true"` + + // A single use encrypted token that maps WriteGetObjectResponse to the end + // user GetObject request. + // + // RequestToken is a required field + RequestToken *string `location:"header" locationName:"x-amz-request-token" type:"string" required:"true"` + + // Provides information about object restoration operation and expiration time + // of the restored object copy. + Restore *string `location:"header" locationName:"x-amz-fwd-header-x-amz-restore" type:"string"` + + // Encryption algorithm used if server-side encryption with a customer-provided + // encryption key was specified for object stored in Amazon S3. + SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-fwd-header-x-amz-server-side-encryption-customer-algorithm" type:"string"` + + // 128-bit MD5 digest of customer-provided encryption key used in Amazon S3 + // to encrypt data stored in S3. For more information, see Protecting data using + // server-side encryption with customer-provided encryption keys (SSE-C) (https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html). + SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-fwd-header-x-amz-server-side-encryption-customer-key-MD5" type:"string"` + + // If present, specifies the ID of the AWS Key Management Service (AWS KMS) + // symmetric customer managed customer master key (CMK) that was used for stored + // in Amazon S3 object. + SSEKMSKeyId *string `location:"header" locationName:"x-amz-fwd-header-x-amz-server-side-encryption-aws-kms-key-id" type:"string" sensitive:"true"` + + // The server-side encryption algorithm used when storing requested object in + // Amazon S3 (for example, AES256, aws:kms). + ServerSideEncryption *string `location:"header" locationName:"x-amz-fwd-header-x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` + + // The integer status code for an HTTP response of a corresponding GetObject + // request. + // + // Status Codes + // + // * 200 - OK + // + // * 206 - Partial Content + // + // * 304 - Not Modified + // + // * 400 - Bad Request + // + // * 401 - Unauthorized + // + // * 403 - Forbidden + // + // * 404 - Not Found + // + // * 405 - Method Not Allowed + // + // * 409 - Conflict + // + // * 411 - Length Required + // + // * 412 - Precondition Failed + // + // * 416 - Range Not Satisfiable + // + // * 500 - Internal Server Error + // + // * 503 - Service Unavailable + StatusCode *int64 `location:"header" locationName:"x-amz-fwd-status" type:"integer"` + + // The class of storage used to store object in Amazon S3. + StorageClass *string `location:"header" locationName:"x-amz-fwd-header-x-amz-storage-class" type:"string" enum:"StorageClass"` + + // The number of tags, if any, on the object. + TagCount *int64 `location:"header" locationName:"x-amz-fwd-header-x-amz-tagging-count" type:"integer"` + + // An ID used to reference a specific version of the object. + VersionId *string `location:"header" locationName:"x-amz-fwd-header-x-amz-version-id" type:"string"` +} + +// String returns the string representation +func (s WriteGetObjectResponseInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s WriteGetObjectResponseInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *WriteGetObjectResponseInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "WriteGetObjectResponseInput"} + if s.RequestRoute == nil { + invalidParams.Add(request.NewErrParamRequired("RequestRoute")) + } + if s.RequestRoute != nil && len(*s.RequestRoute) < 1 { + invalidParams.Add(request.NewErrParamMinLen("RequestRoute", 1)) + } + if s.RequestToken == nil { + invalidParams.Add(request.NewErrParamRequired("RequestToken")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAcceptRanges sets the AcceptRanges field's value. +func (s *WriteGetObjectResponseInput) SetAcceptRanges(v string) *WriteGetObjectResponseInput { + s.AcceptRanges = &v + return s +} + +// SetBody sets the Body field's value. +func (s *WriteGetObjectResponseInput) SetBody(v io.ReadSeeker) *WriteGetObjectResponseInput { + s.Body = v + return s +} + +// SetBucketKeyEnabled sets the BucketKeyEnabled field's value. +func (s *WriteGetObjectResponseInput) SetBucketKeyEnabled(v bool) *WriteGetObjectResponseInput { + s.BucketKeyEnabled = &v + return s +} + +// SetCacheControl sets the CacheControl field's value. +func (s *WriteGetObjectResponseInput) SetCacheControl(v string) *WriteGetObjectResponseInput { + s.CacheControl = &v + return s +} + +// SetContentDisposition sets the ContentDisposition field's value. +func (s *WriteGetObjectResponseInput) SetContentDisposition(v string) *WriteGetObjectResponseInput { + s.ContentDisposition = &v + return s +} + +// SetContentEncoding sets the ContentEncoding field's value. +func (s *WriteGetObjectResponseInput) SetContentEncoding(v string) *WriteGetObjectResponseInput { + s.ContentEncoding = &v + return s +} + +// SetContentLanguage sets the ContentLanguage field's value. +func (s *WriteGetObjectResponseInput) SetContentLanguage(v string) *WriteGetObjectResponseInput { + s.ContentLanguage = &v + return s +} + +// SetContentLength sets the ContentLength field's value. +func (s *WriteGetObjectResponseInput) SetContentLength(v int64) *WriteGetObjectResponseInput { + s.ContentLength = &v + return s +} + +// SetContentRange sets the ContentRange field's value. +func (s *WriteGetObjectResponseInput) SetContentRange(v string) *WriteGetObjectResponseInput { + s.ContentRange = &v + return s +} + +// SetContentType sets the ContentType field's value. +func (s *WriteGetObjectResponseInput) SetContentType(v string) *WriteGetObjectResponseInput { + s.ContentType = &v + return s +} + +// SetDeleteMarker sets the DeleteMarker field's value. +func (s *WriteGetObjectResponseInput) SetDeleteMarker(v bool) *WriteGetObjectResponseInput { + s.DeleteMarker = &v + return s +} + +// SetETag sets the ETag field's value. +func (s *WriteGetObjectResponseInput) SetETag(v string) *WriteGetObjectResponseInput { + s.ETag = &v + return s +} + +// SetErrorCode sets the ErrorCode field's value. +func (s *WriteGetObjectResponseInput) SetErrorCode(v string) *WriteGetObjectResponseInput { + s.ErrorCode = &v + return s +} + +// SetErrorMessage sets the ErrorMessage field's value. +func (s *WriteGetObjectResponseInput) SetErrorMessage(v string) *WriteGetObjectResponseInput { + s.ErrorMessage = &v + return s +} + +// SetExpiration sets the Expiration field's value. +func (s *WriteGetObjectResponseInput) SetExpiration(v string) *WriteGetObjectResponseInput { + s.Expiration = &v + return s +} + +// SetExpires sets the Expires field's value. +func (s *WriteGetObjectResponseInput) SetExpires(v time.Time) *WriteGetObjectResponseInput { + s.Expires = &v + return s +} + +// SetLastModified sets the LastModified field's value. +func (s *WriteGetObjectResponseInput) SetLastModified(v time.Time) *WriteGetObjectResponseInput { + s.LastModified = &v + return s +} + +// SetMetadata sets the Metadata field's value. +func (s *WriteGetObjectResponseInput) SetMetadata(v map[string]*string) *WriteGetObjectResponseInput { + s.Metadata = v + return s +} + +// SetMissingMeta sets the MissingMeta field's value. +func (s *WriteGetObjectResponseInput) SetMissingMeta(v int64) *WriteGetObjectResponseInput { + s.MissingMeta = &v + return s +} + +// SetObjectLockLegalHoldStatus sets the ObjectLockLegalHoldStatus field's value. +func (s *WriteGetObjectResponseInput) SetObjectLockLegalHoldStatus(v string) *WriteGetObjectResponseInput { + s.ObjectLockLegalHoldStatus = &v + return s +} + +// SetObjectLockMode sets the ObjectLockMode field's value. +func (s *WriteGetObjectResponseInput) SetObjectLockMode(v string) *WriteGetObjectResponseInput { + s.ObjectLockMode = &v + return s +} + +// SetObjectLockRetainUntilDate sets the ObjectLockRetainUntilDate field's value. +func (s *WriteGetObjectResponseInput) SetObjectLockRetainUntilDate(v time.Time) *WriteGetObjectResponseInput { + s.ObjectLockRetainUntilDate = &v + return s +} + +// SetPartsCount sets the PartsCount field's value. +func (s *WriteGetObjectResponseInput) SetPartsCount(v int64) *WriteGetObjectResponseInput { + s.PartsCount = &v + return s +} + +// SetReplicationStatus sets the ReplicationStatus field's value. +func (s *WriteGetObjectResponseInput) SetReplicationStatus(v string) *WriteGetObjectResponseInput { + s.ReplicationStatus = &v + return s +} + +// SetRequestCharged sets the RequestCharged field's value. +func (s *WriteGetObjectResponseInput) SetRequestCharged(v string) *WriteGetObjectResponseInput { + s.RequestCharged = &v + return s +} + +// SetRequestRoute sets the RequestRoute field's value. +func (s *WriteGetObjectResponseInput) SetRequestRoute(v string) *WriteGetObjectResponseInput { + s.RequestRoute = &v + return s +} + +// SetRequestToken sets the RequestToken field's value. +func (s *WriteGetObjectResponseInput) SetRequestToken(v string) *WriteGetObjectResponseInput { + s.RequestToken = &v + return s +} + +// SetRestore sets the Restore field's value. +func (s *WriteGetObjectResponseInput) SetRestore(v string) *WriteGetObjectResponseInput { + s.Restore = &v + return s +} + +// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. +func (s *WriteGetObjectResponseInput) SetSSECustomerAlgorithm(v string) *WriteGetObjectResponseInput { + s.SSECustomerAlgorithm = &v + return s +} + +// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. +func (s *WriteGetObjectResponseInput) SetSSECustomerKeyMD5(v string) *WriteGetObjectResponseInput { + s.SSECustomerKeyMD5 = &v + return s +} + +// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. +func (s *WriteGetObjectResponseInput) SetSSEKMSKeyId(v string) *WriteGetObjectResponseInput { + s.SSEKMSKeyId = &v + return s +} + +// SetServerSideEncryption sets the ServerSideEncryption field's value. +func (s *WriteGetObjectResponseInput) SetServerSideEncryption(v string) *WriteGetObjectResponseInput { + s.ServerSideEncryption = &v + return s +} + +// SetStatusCode sets the StatusCode field's value. +func (s *WriteGetObjectResponseInput) SetStatusCode(v int64) *WriteGetObjectResponseInput { + s.StatusCode = &v + return s +} + +// SetStorageClass sets the StorageClass field's value. +func (s *WriteGetObjectResponseInput) SetStorageClass(v string) *WriteGetObjectResponseInput { + s.StorageClass = &v + return s +} + +// SetTagCount sets the TagCount field's value. +func (s *WriteGetObjectResponseInput) SetTagCount(v int64) *WriteGetObjectResponseInput { + s.TagCount = &v + return s +} + +// SetVersionId sets the VersionId field's value. +func (s *WriteGetObjectResponseInput) SetVersionId(v string) *WriteGetObjectResponseInput { + s.VersionId = &v + return s +} + +func (s *WriteGetObjectResponseInput) hostLabels() map[string]string { + return map[string]string{ + "RequestRoute": aws.StringValue(s.RequestRoute), + } +} + +type WriteGetObjectResponseOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s WriteGetObjectResponseOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s WriteGetObjectResponseOutput) GoString() string { + return s.String() +} + const ( // AnalyticsS3ExportFileFormatCsv is a AnalyticsS3ExportFileFormat enum value AnalyticsS3ExportFileFormatCsv = "CSV" diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go index f1959b03a953..ce87ab32017e 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go @@ -48,6 +48,8 @@ func defaultInitRequestFn(r *request.Request) { // case opGetObject: // r.Handlers.Build.PushBack(askForTxEncodingAppendMD5) // r.Handlers.Unmarshal.PushBack(useMD5ValidationReader) + case opWriteGetObjectResponse: + r.Handlers.Build.PushFront(buildWriteGetObjectResponseEndpoint) } } diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint.go index 6346b9279608..9fc2105fd2f3 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint.go @@ -1,6 +1,8 @@ package s3 import ( + "fmt" + "github.com/aws/aws-sdk-go/aws/awserr" "net/url" "strings" @@ -11,6 +13,13 @@ import ( "github.com/aws/aws-sdk-go/internal/s3shared/arn" ) +const ( + s3Namespace = "s3" + s3AccessPointNamespace = "s3-accesspoint" + s3ObjectsLambdaNamespace = "s3-object-lambda" + s3OutpostsNamespace = "s3-outposts" +) + // Used by shapes with members decorated as endpoint ARN. func parseEndpointARN(v string) (arn.Resource, error) { return arn.ParseResource(v, accessPointResourceParser) @@ -20,10 +29,14 @@ func accessPointResourceParser(a awsarn.ARN) (arn.Resource, error) { resParts := arn.SplitResource(a.Resource) switch resParts[0] { case "accesspoint": - if a.Service != "s3" { - return arn.AccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: "service is not s3"} + switch a.Service { + case s3Namespace: + return arn.ParseAccessPointResource(a, resParts[1:]) + case s3ObjectsLambdaNamespace: + return parseS3ObjectLambdaAccessPointResource(a, resParts) + default: + return arn.AccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: fmt.Sprintf("service is not %s or %s", s3Namespace, s3ObjectsLambdaNamespace)} } - return arn.ParseAccessPointResource(a, resParts[1:]) case "outpost": if a.Service != "s3-outposts" { return arn.OutpostAccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: "service is not s3-outposts"} @@ -80,6 +93,25 @@ func parseOutpostAccessPointResource(a awsarn.ARN, resParts []string) (arn.Outpo return outpostAccessPointARN, nil } +func parseS3ObjectLambdaAccessPointResource(a awsarn.ARN, resParts []string) (arn.S3ObjectLambdaAccessPointARN, error) { + if a.Service != s3ObjectsLambdaNamespace { + return arn.S3ObjectLambdaAccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: fmt.Sprintf("service is not %s", s3ObjectsLambdaNamespace)} + } + + accessPointARN, err := arn.ParseAccessPointResource(a, resParts[1:]) + if err != nil { + return arn.S3ObjectLambdaAccessPointARN{}, err + } + + if len(accessPointARN.Region) == 0 { + return arn.S3ObjectLambdaAccessPointARN{}, arn.InvalidARNError{ARN: a, Reason: fmt.Sprintf("%s region not set", s3ObjectsLambdaNamespace)} + } + + return arn.S3ObjectLambdaAccessPointARN{ + AccessPointARN: accessPointARN, + }, nil +} + func endpointHandler(req *request.Request) { endpoint, ok := req.Params.(endpointARNGetter) if !ok || !endpoint.hasEndpointARN() { @@ -116,6 +148,11 @@ func endpointHandler(req *request.Request) { if err != nil { req.Error = err } + case arn.S3ObjectLambdaAccessPointARN: + err = updateRequestS3ObjectLambdaAccessPointEndpoint(req, tv) + if err != nil { + req.Error = err + } case arn.OutpostAccessPointARN: // outposts does not support FIPS regions if resReq.ResourceConfiguredForFIPS() { @@ -162,6 +199,31 @@ func updateRequestAccessPointEndpoint(req *request.Request, accessPoint arn.Acce return nil } +func updateRequestS3ObjectLambdaAccessPointEndpoint(req *request.Request, accessPoint arn.S3ObjectLambdaAccessPointARN) error { + // DualStack not supported + if aws.BoolValue(req.Config.UseDualStack) { + return s3shared.NewClientConfiguredForDualStackError(accessPoint, + req.ClientInfo.PartitionID, aws.StringValue(req.Config.Region), nil) + } + + // Accelerate not supported + if aws.BoolValue(req.Config.S3UseAccelerate) { + return s3shared.NewClientConfiguredForAccelerateError(accessPoint, + req.ClientInfo.PartitionID, aws.StringValue(req.Config.Region), nil) + } + + // Ignore the disable host prefix for access points + req.Config.DisableEndpointHostPrefix = aws.Bool(false) + + if err := s3ObjectLambdaAccessPointEndpointBuilder(accessPoint).build(req); err != nil { + return err + } + + removeBucketFromPath(req.HTTPRequest.URL) + + return nil +} + func updateRequestOutpostAccessPointEndpoint(req *request.Request, accessPoint arn.OutpostAccessPointARN) error { // Accelerate not supported if aws.BoolValue(req.Config.S3UseAccelerate) { @@ -192,3 +254,37 @@ func removeBucketFromPath(u *url.URL) { u.Path = "/" } } + +func buildWriteGetObjectResponseEndpoint(req *request.Request) { + // DualStack not supported + if aws.BoolValue(req.Config.UseDualStack) { + req.Error = awserr.New("ConfigurationError", "client configured for dualstack but not supported for operation", nil) + return + } + + // Accelerate not supported + if aws.BoolValue(req.Config.S3UseAccelerate) { + req.Error = awserr.New("ConfigurationError", "client configured for accelerate but not supported for operation", nil) + return + } + + signingName := s3ObjectsLambdaNamespace + signingRegion := req.ClientInfo.SigningRegion + + if !hasCustomEndpoint(req) { + endpoint, err := resolveRegionalEndpoint(req, aws.StringValue(req.Config.Region), EndpointsID) + if err != nil { + req.Error = awserr.New(request.ErrCodeSerialization, "failed to resolve endpoint", err) + return + } + signingRegion = endpoint.SigningRegion + + if err = updateRequestEndpoint(req, endpoint.URL); err != nil { + req.Error = err + return + } + updateS3HostPrefixForS3ObjectLambda(req) + } + + redirectSigner(req, signingName, signingRegion) +} diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint_builder.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint_builder.go index eb77d981ef69..71e9c9eff062 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint_builder.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/endpoint_builder.go @@ -66,13 +66,9 @@ func (a accessPointEndpointBuilder) build(req *request.Request) error { if err = updateRequestEndpoint(req, endpoint.URL); err != nil { return err } - const serviceEndpointLabel = "s3-accesspoint" // dual stack provided by endpoint resolver - cfgHost := req.HTTPRequest.URL.Host - if strings.HasPrefix(cfgHost, "s3") { - req.HTTPRequest.URL.Host = serviceEndpointLabel + cfgHost[2:] - } + updateS3HostForS3AccessPoint(req) } protocol.HostPrefixBuilder{ @@ -98,6 +94,73 @@ func (a accessPointEndpointBuilder) hostPrefixLabelValues() map[string]string { } } +// s3ObjectLambdaAccessPointEndpointBuilder represents the endpoint builder for an s3 object lambda access point arn +type s3ObjectLambdaAccessPointEndpointBuilder arn.S3ObjectLambdaAccessPointARN + +// build builds the endpoint for corresponding access point arn +// +// For building an endpoint from access point arn, format used is: +// - Access point endpoint format : {accesspointName}-{accountId}.s3-object-lambda.{region}.{dnsSuffix} +// - example : myaccesspoint-012345678901.s3-object-lambda.us-west-2.amazonaws.com +// +// Access Point Endpoint requests are signed using "s3-object-lambda" as signing name. +// +func (a s3ObjectLambdaAccessPointEndpointBuilder) build(req *request.Request) error { + resolveRegion := arn.S3ObjectLambdaAccessPointARN(a).Region + cfgRegion := aws.StringValue(req.Config.Region) + + if s3shared.IsFIPS(cfgRegion) { + if aws.BoolValue(req.Config.S3UseARNRegion) && s3shared.IsCrossRegion(req, resolveRegion) { + // FIPS with cross region is not supported, the SDK must fail + // because there is no well defined method for SDK to construct a + // correct FIPS endpoint. + return s3shared.NewClientConfiguredForCrossRegionFIPSError(arn.S3ObjectLambdaAccessPointARN(a), + req.ClientInfo.PartitionID, cfgRegion, nil) + } + resolveRegion = cfgRegion + } + + endpoint, err := resolveRegionalEndpoint(req, resolveRegion, EndpointsID) + if err != nil { + return s3shared.NewFailedToResolveEndpointError(arn.S3ObjectLambdaAccessPointARN(a), + req.ClientInfo.PartitionID, cfgRegion, err) + } + + endpoint.URL = endpoints.AddScheme(endpoint.URL, aws.BoolValue(req.Config.DisableSSL)) + + endpoint.SigningName = s3ObjectsLambdaNamespace + + if !hasCustomEndpoint(req) { + if err = updateRequestEndpoint(req, endpoint.URL); err != nil { + return err + } + + updateS3HostPrefixForS3ObjectLambda(req) + } + + protocol.HostPrefixBuilder{ + Prefix: accessPointPrefixTemplate, + LabelsFn: a.hostPrefixLabelValues, + }.Build(req) + + // signer redirection + redirectSigner(req, endpoint.SigningName, endpoint.SigningRegion) + + err = protocol.ValidateEndpointHost(req.Operation.Name, req.HTTPRequest.URL.Host) + if err != nil { + return s3shared.NewInvalidARNError(arn.S3ObjectLambdaAccessPointARN(a), err) + } + + return nil +} + +func (a s3ObjectLambdaAccessPointEndpointBuilder) hostPrefixLabelValues() map[string]string { + return map[string]string{ + accessPointPrefixLabel: arn.S3ObjectLambdaAccessPointARN(a).AccessPointName, + accountIDPrefixLabel: arn.S3ObjectLambdaAccessPointARN(a).AccountID, + } +} + // outpostAccessPointEndpointBuilder represents the Endpoint builder for outpost access point arn. type outpostAccessPointEndpointBuilder arn.OutpostAccessPointARN @@ -114,7 +177,7 @@ func (o outpostAccessPointEndpointBuilder) build(req *request.Request) error { resolveService := o.Service endpointsID := resolveService - if resolveService == "s3-outposts" { + if resolveService == s3OutpostsNamespace { endpointsID = "s3" } @@ -130,11 +193,7 @@ func (o outpostAccessPointEndpointBuilder) build(req *request.Request) error { if err = updateRequestEndpoint(req, endpoint.URL); err != nil { return err } - // add url host as s3-outposts - cfgHost := req.HTTPRequest.URL.Host - if strings.HasPrefix(cfgHost, endpointsID) { - req.HTTPRequest.URL.Host = resolveService + cfgHost[len(endpointsID):] - } + updateHostPrefix(req, endpointsID, resolveService) } protocol.HostPrefixBuilder{ @@ -170,7 +229,6 @@ func resolveRegionalEndpoint(r *request.Request, region string, endpointsID stri } func updateRequestEndpoint(r *request.Request, endpoint string) (err error) { - r.HTTPRequest.URL, err = url.Parse(endpoint + r.Operation.HTTPPath) if err != nil { return awserr.New(request.ErrCodeSerialization, @@ -185,3 +243,19 @@ func redirectSigner(req *request.Request, signingName string, signingRegion stri req.ClientInfo.SigningName = signingName req.ClientInfo.SigningRegion = signingRegion } + +func updateS3HostForS3AccessPoint(req *request.Request) { + updateHostPrefix(req, "s3", s3AccessPointNamespace) +} + +func updateS3HostPrefixForS3ObjectLambda(req *request.Request) { + updateHostPrefix(req, "s3", s3ObjectsLambdaNamespace) +} + +func updateHostPrefix(req *request.Request, oldEndpointPrefix, newEndpointPrefix string) { + host := req.HTTPRequest.URL.Host + if strings.HasPrefix(host, oldEndpointPrefix) { + // replace service hostlabel oldEndpointPrefix to newEndpointPrefix + req.HTTPRequest.URL.Host = newEndpointPrefix + host[len(oldEndpointPrefix):] + } +} diff --git a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go index f64b55135eee..6d3e726cf516 100644 --- a/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go +++ b/awsproviderlint/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go @@ -48,13 +48,13 @@ const ( // ErrCodeObjectAlreadyInActiveTierError for service response error code // "ObjectAlreadyInActiveTierError". // - // This operation is not allowed against this storage tier. + // This action is not allowed against this storage tier. ErrCodeObjectAlreadyInActiveTierError = "ObjectAlreadyInActiveTierError" // ErrCodeObjectNotInActiveTierError for service response error code // "ObjectNotInActiveTierError". // - // The source object of the COPY operation is not in the active tier and is - // only stored in Amazon S3 Glacier. + // The source object of the COPY action is not in the active tier and is only + // stored in Amazon S3 Glacier. ErrCodeObjectNotInActiveTierError = "ObjectNotInActiveTierError" ) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/analyzers.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/analyzers.go index b5fcb049387c..9fc2a16b8746 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/analyzers.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/analyzers.go @@ -11,6 +11,27 @@ import ( "golang.org/x/tools/go/analysis/passes/inspect" ) +// AvoidSelectorExprAnalyzer returns an Analyzer for *ast.SelectorExpr to avoid +func AvoidSelectorExprAnalyzer(analyzerName string, callExprAnalyzer, selectorExprAnalyzer *analysis.Analyzer, packagePath, typeName string) *analysis.Analyzer { + doc := fmt.Sprintf(`check for %[2]s.%[3]s usage to avoid + +The %[1]s analyzer reports usage: + +%[2]s.%[3]s +`, analyzerName, packagePath, typeName) + + return &analysis.Analyzer{ + Name: analyzerName, + Doc: doc, + Requires: []*analysis.Analyzer{ + callExprAnalyzer, + commentignore.Analyzer, + selectorExprAnalyzer, + }, + Run: AvoidSelectorExprRunner(analyzerName, callExprAnalyzer, selectorExprAnalyzer, packagePath, typeName), + } +} + // DeprecatedReceiverMethodSelectorExprAnalyzer returns an Analyzer for deprecated *ast.SelectorExpr func DeprecatedReceiverMethodSelectorExprAnalyzer(analyzerName string, callExprAnalyzer, selectorExprAnalyzer *analysis.Analyzer, packagePath, typeName, methodName string) *analysis.Analyzer { doc := fmt.Sprintf(`check for deprecated %[2]s.%[3]s usage diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/runners.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/runners.go index 50b44083efea..2c7cc9ccfca1 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/runners.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/runners.go @@ -15,6 +15,74 @@ import ( "golang.org/x/tools/go/ast/inspector" ) +// AvoidSelectorExprRunner returns an Analyzer runner for *ast.SelectorExpr to avoid +func AvoidSelectorExprRunner(analyzerName string, callExprAnalyzer, selectorExprAnalyzer *analysis.Analyzer, packagePath, typeName string) func(*analysis.Pass) (interface{}, error) { + return func(pass *analysis.Pass) (interface{}, error) { + callExprs := pass.ResultOf[callExprAnalyzer].([]*ast.CallExpr) + selectorExprs := pass.ResultOf[selectorExprAnalyzer].([]*ast.SelectorExpr) + ignorer := pass.ResultOf[commentignore.Analyzer].(*commentignore.Ignorer) + + // CallExpr and SelectorExpr will overlap, so only perform one report/fix + reported := make(map[token.Pos]struct{}) + + for _, callExpr := range callExprs { + if ignorer.ShouldIgnore(analyzerName, callExpr) { + continue + } + + pass.Report(analysis.Diagnostic{ + Pos: callExpr.Pos(), + End: callExpr.End(), + Message: fmt.Sprintf("%s: avoid %s.%s", analyzerName, packagePath, typeName), + SuggestedFixes: []analysis.SuggestedFix{ + { + Message: "Remove", + TextEdits: []analysis.TextEdit{ + { + Pos: callExpr.Pos(), + End: callExpr.End(), + NewText: []byte{}, + }, + }, + }, + }, + }) + + reported[callExpr.Pos()] = struct{}{} + } + + for _, selectorExpr := range selectorExprs { + if ignorer.ShouldIgnore(analyzerName, selectorExpr) { + continue + } + + if _, ok := reported[selectorExpr.Pos()]; ok { + continue + } + + pass.Report(analysis.Diagnostic{ + Pos: selectorExpr.Pos(), + End: selectorExpr.End(), + Message: fmt.Sprintf("%s: avoid %s.%s", analyzerName, packagePath, typeName), + SuggestedFixes: []analysis.SuggestedFix{ + { + Message: "Remove", + TextEdits: []analysis.TextEdit{ + { + Pos: selectorExpr.Pos(), + End: selectorExpr.End(), + NewText: []byte{}, + }, + }, + }, + }, + }) + } + + return nil, nil + } +} + // DeprecatedReceiverMethodSelectorExprRunner returns an Analyzer runner for deprecated *ast.SelectorExpr func DeprecatedReceiverMethodSelectorExprRunner(analyzerName string, callExprAnalyzer, selectorExprAnalyzer *analysis.Analyzer, packagePath, typeName, methodName string) func(*analysis.Pass) (interface{}, error) { return func(pass *analysis.Pass) (interface{}, error) { diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_analyzers.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_analyzers.go index df0a1dbd2387..e21f27ae6fee 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_analyzers.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_analyzers.go @@ -21,3 +21,16 @@ func StdlibFunctionCallExprAnalyzer(analyzerName string, packagePath string, fun ResultType: reflect.TypeOf([]*ast.CallExpr{}), } } + +// StdlibFunctionSelectorExprAnalyzer returns an Analyzer for standard library function *ast.SelectorExpr +func StdlibFunctionSelectorExprAnalyzer(analyzerName string, packagePath string, functionName string) *analysis.Analyzer { + return &analysis.Analyzer{ + Name: analyzerName, + Doc: fmt.Sprintf("find %s.%s() selectors for later passes", packagePath, functionName), + Requires: []*analysis.Analyzer{ + inspect.Analyzer, + }, + Run: StdlibFunctionSelectorExprRunner(packagePath, functionName), + ResultType: reflect.TypeOf([]*ast.SelectorExpr{}), + } +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_runners.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_runners.go index 36ad4bf86870..a5dee95c21c9 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_runners.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/analysisutils/stdlib_runners.go @@ -31,3 +31,26 @@ func StdlibFunctionCallExprRunner(packagePath string, functionName string) func( return result, nil } } + +// StdlibFunctionSelectorExprRunner returns an Analyzer runner for function *ast.SelectorExpr +func StdlibFunctionSelectorExprRunner(packagePath string, functionName string) func(*analysis.Pass) (interface{}, error) { + return func(pass *analysis.Pass) (interface{}, error) { + inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector) + nodeFilter := []ast.Node{ + (*ast.SelectorExpr)(nil), + } + var result []*ast.SelectorExpr + + inspect.Preorder(nodeFilter, func(n ast.Node) { + selectorExpr := n.(*ast.SelectorExpr) + + if !astutils.IsStdlibPackageFunc(selectorExpr, pass.TypesInfo, packagePath, functionName) { + return + } + + result = append(result, selectorExpr) + }) + + return result, nil + } +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/resource/type_testcase.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/resource/type_testcase.go index bbad5f997252..f55ae3c78c77 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/resource/type_testcase.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/resource/type_testcase.go @@ -9,6 +9,7 @@ import ( const ( TestCaseFieldCheckDestroy = `CheckDestroy` + TestCaseFieldErrorCheck = `ErrorCheck` TestCaseFieldIDRefreshName = `IDRefreshName` TestCaseFieldIDRefreshIgnore = `IDRefreshIgnore` TestCaseFieldIsUnitTest = `IsUnitTest` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema/type_resource.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema/type_resource.go index 2bac427df55a..1d8f75b22ca6 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema/type_resource.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema/type_resource.go @@ -9,24 +9,28 @@ import ( ) const ( - ResourceFieldCreate = `Create` - ResourceFieldCreateContext = `CreateContext` - ResourceFieldCustomizeDiff = `CustomizeDiff` - ResourceFieldDelete = `Delete` - ResourceFieldDeleteContext = `DeleteContext` - ResourceFieldDeprecationMessage = `DeprecationMessage` - ResourceFieldDescription = `Description` - ResourceFieldExists = `Exists` - ResourceFieldImporter = `Importer` - ResourceFieldMigrateState = `MigrateState` - ResourceFieldRead = `Read` - ResourceFieldReadContext = `ReadContext` - ResourceFieldSchema = `Schema` - ResourceFieldSchemaVersion = `SchemaVersion` - ResourceFieldStateUpgraders = `StateUpgraders` - ResourceFieldTimeouts = `Timeouts` - ResourceFieldUpdate = `Update` - ResourceFieldUpdateContext = `UpdateContext` + ResourceFieldCreate = `Create` + ResourceFieldCreateContext = `CreateContext` + ResourceFieldCreateWithoutTimeout = `CreateWithoutTimeout` + ResourceFieldCustomizeDiff = `CustomizeDiff` + ResourceFieldDelete = `Delete` + ResourceFieldDeleteContext = `DeleteContext` + ResourceFieldDeleteWithoutTimeout = `DeleteWithoutTimeout` + ResourceFieldDeprecationMessage = `DeprecationMessage` + ResourceFieldDescription = `Description` + ResourceFieldExists = `Exists` + ResourceFieldImporter = `Importer` + ResourceFieldMigrateState = `MigrateState` + ResourceFieldRead = `Read` + ResourceFieldReadContext = `ReadContext` + ResourceFieldReadWithoutTimeout = `ReadWithoutTimeout` + ResourceFieldSchema = `Schema` + ResourceFieldSchemaVersion = `SchemaVersion` + ResourceFieldStateUpgraders = `StateUpgraders` + ResourceFieldTimeouts = `Timeouts` + ResourceFieldUpdate = `Update` + ResourceFieldUpdateContext = `UpdateContext` + ResourceFieldUpdateWithoutTimeout = `UpdateWithoutTimeout` TypeNameResource = `Resource` ) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT010/AT010.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT010/AT010.go new file mode 100644 index 000000000000..efe21e2f3023 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT010/AT010.go @@ -0,0 +1,48 @@ +package AT010 + +import ( + "github.com/bflad/tfproviderlint/helper/terraformtype/helper/resource" + "github.com/bflad/tfproviderlint/passes/commentignore" + "github.com/bflad/tfproviderlint/passes/helper/resource/testcaseinfo" + "golang.org/x/tools/go/analysis" +) + +const Doc = `check for TestCase including IDRefreshName implementation + +The AT010 analyzer reports likely extraneous use of ID-only refresh testing. +Most resources should prefer to include a TestStep with ImportState instead +since it will cover the same testing functionality along with verifying +resource import support.` + +const analyzerName = "AT010" + +var Analyzer = &analysis.Analyzer{ + Name: analyzerName, + Doc: Doc, + Requires: []*analysis.Analyzer{ + commentignore.Analyzer, + testcaseinfo.Analyzer, + }, + Run: run, +} + +func run(pass *analysis.Pass) (interface{}, error) { + ignorer := pass.ResultOf[commentignore.Analyzer].(*commentignore.Ignorer) + testCases := pass.ResultOf[testcaseinfo.Analyzer].([]*resource.TestCaseInfo) + + for _, testCase := range testCases { + field, ok := testCase.Fields[resource.TestCaseFieldIDRefreshName] + + if !ok || field == nil { + continue + } + + if ignorer.ShouldIgnore(analyzerName, field) { + continue + } + + pass.Reportf(field.Pos(), "%s: prefer TestStep ImportState testing over TestCase IDRefreshName", analyzerName) + } + + return nil, nil +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT010/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT010/README.md new file mode 100644 index 000000000000..8d1c912e38b7 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT010/README.md @@ -0,0 +1,70 @@ +# AT010 + +The AT010 analyzer reports likely extraneous use of ID-only refresh testing. Most resources should prefer to include a `TestStep` with `ImportState` instead since it will cover the same testing functionality along with verifying resource import support. + +## Flagged Code + +```go +func TestAccExampleThing_Attr1(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + IDRefreshName: "example_thing.test", + Steps: []resource.TestStep{ + { + Config: testAccExampleThingConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("example_thing.test", "attr1"), + ), + }, + }, + }) +} +``` + +## Passing Code + +```go +func TestAccExampleThing_Attr1(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccExampleThingConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("example_thing.test", "attr1"), + ), + }, + { + Config: testAccExampleThingConfig(), + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} +``` + +## Ignoring Reports + +Singular reports can be ignored by adding the a `//lintignore:AT010` Go code comment on the line immediately proceding, e.g. + +```go +func TestAccExampleThing_Attr1(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + //lintignore:AT010 + IDRefreshName: "example_thing.test", + Steps: []resource.TestStep{ + { + Config: testAccExampleThingConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("example_thing.test", "attr1"), + ), + }, + }, + }) +} +``` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT011/AT011.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT011/AT011.go new file mode 100644 index 000000000000..da834d66710f --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT011/AT011.go @@ -0,0 +1,53 @@ +package AT011 + +import ( + "github.com/bflad/tfproviderlint/helper/terraformtype/helper/resource" + "github.com/bflad/tfproviderlint/passes/commentignore" + "github.com/bflad/tfproviderlint/passes/helper/resource/testcaseinfo" + "golang.org/x/tools/go/analysis" +) + +const Doc = `check for TestCase including IDRefreshIgnore implementation without IDRefreshName + +The AT011 analyzer reports likely extraneous use of ID-only refresh testing. +Most resources should prefer to include a TestStep with ImportState instead +since it will cover the same testing functionality along with verifying +resource import support. + +However for cases where IDRefreshName is being already being used, the +IDRefreshIgnore field is considered valid. If IDRefreshName is not being used, +then this analyzer will return a report. +` + +const analyzerName = "AT011" + +var Analyzer = &analysis.Analyzer{ + Name: analyzerName, + Doc: Doc, + Requires: []*analysis.Analyzer{ + commentignore.Analyzer, + testcaseinfo.Analyzer, + }, + Run: run, +} + +func run(pass *analysis.Pass) (interface{}, error) { + ignorer := pass.ResultOf[commentignore.Analyzer].(*commentignore.Ignorer) + testCases := pass.ResultOf[testcaseinfo.Analyzer].([]*resource.TestCaseInfo) + + for _, testCase := range testCases { + field, ok := testCase.Fields[resource.TestCaseFieldIDRefreshIgnore] + + if !ok || field == nil || testCase.DeclaresField(resource.TestCaseFieldIDRefreshName) { + continue + } + + if ignorer.ShouldIgnore(analyzerName, field) { + continue + } + + pass.Reportf(field.Pos(), "%s: extraneous TestCase IDRefreshIgnore without IDRefreshName", analyzerName) + } + + return nil, nil +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT011/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT011/README.md new file mode 100644 index 000000000000..49865aa4e500 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT011/README.md @@ -0,0 +1,91 @@ +# AT011 + +The AT011 analyzer reports likely extraneous use of ID-only refresh testing. Most resources should prefer to include a `TestStep` with `ImportState` instead since it will cover the same testing functionality along with verifying resource import support. + +However for cases where `IDRefreshName` is being already being used, the `IDRefreshIgnore` field is considered valid. If `IDRefreshName` is not being used, then this analyzer will return a report. + +## Flagged Code + +```go +func TestAccExampleThing_Attr1(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + IDRefreshIgnore: []string{"attr1"}, + Steps: []resource.TestStep{ + { + Config: testAccExampleThingConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("example_thing.test", "attr1"), + ), + }, + }, + }) +} +``` + +## Passing Code + +```go +func TestAccExampleThing_Attr1(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccExampleThingConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("example_thing.test", "attr1"), + ), + }, + { + Config: testAccExampleThingConfig(), + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} + +// ... or ... + +func TestAccExampleThing_Attr1(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + IDRefreshName: "example_thing.test", + IDRefreshIgnore: []string{"attr1"}, + Steps: []resource.TestStep{ + { + Config: testAccExampleThingConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("example_thing.test", "attr1"), + ), + }, + }, + }) +} +``` + +## Ignoring Reports + +Singular reports can be ignored by adding the a `//lintignore:AT011` Go code comment on the line immediately proceding, e.g. + +```go +func TestAccExampleThing_Attr1(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + //lintignore:AT011 + IDRefreshIgnore: []string{"attr1"}, + Steps: []resource.TestStep{ + { + Config: testAccExampleThingConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("example_thing.test", "attr1"), + ), + }, + }, + }) +} +``` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT012/AT012.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT012/AT012.go new file mode 100644 index 000000000000..ae696f554abe --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT012/AT012.go @@ -0,0 +1,118 @@ +package AT012 + +import ( + "flag" + "go/ast" + "go/token" + "path/filepath" + "strings" + + "github.com/bflad/tfproviderlint/passes/commentignore" + "github.com/bflad/tfproviderlint/passes/testaccfuncdecl" + "golang.org/x/tools/go/analysis" +) + +const Doc = `check for test files containing multiple acceptance test function name prefixes + +The AT012 analyzer reports likely incorrect uses of multiple TestAcc function +name prefixes up to the conventional underscore (_) prefix separator within +the same file. Typically, Terraform acceptance tests should use the same naming +prefix within one test file so testers can easily run all acceptance tests for +the file and not miss associated tests. + +Optional parameters: + - ignored-filenames Comma-separated list of file names to ignore, defaults to none.` + +const ( + acceptanceTestNameSeparator = "_" + + analyzerName = "AT012" +) + +var ( + ignoredFilenames string +) + +var Analyzer = &analysis.Analyzer{ + Name: analyzerName, + Doc: Doc, + Flags: parseFlags(), + Requires: []*analysis.Analyzer{ + commentignore.Analyzer, + testaccfuncdecl.Analyzer, + }, + Run: run, +} + +func isFilenameIgnored(fileName string, fileNameList string) bool { + prefixes := strings.Split(fileNameList, ",") + + for _, prefix := range prefixes { + if strings.HasPrefix(fileName, prefix) { + return true + } + } + return false +} + +func parseFlags() flag.FlagSet { + var flags = flag.NewFlagSet(analyzerName, flag.ExitOnError) + flags.StringVar(&ignoredFilenames, "ignored-filenames", "", "Comma-separated list of file names to ignore") + return *flags +} + +func run(pass *analysis.Pass) (interface{}, error) { + ignorer := pass.ResultOf[commentignore.Analyzer].(*commentignore.Ignorer) + funcDecls := pass.ResultOf[testaccfuncdecl.Analyzer].([]*ast.FuncDecl) + + fileFuncDecls := make(map[*token.File][]*ast.FuncDecl) + + for _, funcDecl := range funcDecls { + file := pass.Fset.File(funcDecl.Pos()) + fileName := filepath.Base(file.Name()) + + if ignoredFilenames != "" && isFilenameIgnored(fileName, ignoredFilenames) { + continue + } + + if ignorer.ShouldIgnore(analyzerName, funcDecl) { + continue + } + + fileFuncDecls[file] = append(fileFuncDecls[file], funcDecl) + } + + for file, funcDecls := range fileFuncDecls { + // Map to simplify checking + funcNamePrefixes := make(map[string]struct{}) + + for _, funcDecl := range funcDecls { + funcName := funcDecl.Name.Name + + funcNamePrefixParts := strings.SplitN(funcName, acceptanceTestNameSeparator, 2) + + // Ensure function name includes separator + if len(funcNamePrefixParts) != 2 || funcNamePrefixParts[0] == "" || funcNamePrefixParts[1] == "" { + continue + } + + funcNamePrefix := funcNamePrefixParts[0] + + funcNamePrefixes[funcNamePrefix] = struct{}{} + } + + if len(funcNamePrefixes) <= 1 { + continue + } + + // Easier to print map keys as slice + namePrefixes := make([]string, 0, len(funcNamePrefixes)) + for k := range funcNamePrefixes { + namePrefixes = append(namePrefixes, k) + } + + pass.Reportf(file.Pos(0), "%s: file contains multiple acceptance test name prefixes: %v", analyzerName, namePrefixes) + } + + return nil, nil +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT012/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT012/README.md new file mode 100644 index 000000000000..8b00c2864ae9 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/AT012/README.md @@ -0,0 +1,37 @@ +# AT012 + +The AT012 analyzer reports likely incorrect uses of multiple `TestAcc` function name prefixes up to the conventional underscore (`_`) prefix separator within the same file. Typically, Terraform acceptance tests should use the same naming prefix within one test file so testers can easily run all acceptance tests for the file and not miss associated tests. + +Optional parameters: + +- `ignored-filenames` Comma-separated list of file names to ignore, defaults to none. + +## Flagged Code + +```go +func TestAccExampleThing1_Test(t *testing.T) { /* ... */ } + +func TestAccExampleThing2_Test(t *testing.T) { /* ... */ } +``` + +## Passing Code + +```go +func TestAccExampleThing_Test1(t *testing.T) { /* ... */ } + +func TestAccExampleThing_Test2(t *testing.T) { /* ... */ } +``` + +## Ignoring Reports + +In addition to the optional parameters, reports can be ignored by adding a `//lintignore:AT012` Go code comment before any test declaration to ignore, e.g. + +```go +//lintignore:AT012 +func TestAccExampleThing1_Test(t *testing.T) { /* ... */ } + +//lintignore:AT012 +func TestAccExampleThing2_Test(t *testing.T) { /* ... */ } +``` + +If a file mainly uses one prefix, the code ignores can be simplified to only the non-conforming test declarations. diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V011/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V011/README.md new file mode 100644 index 000000000000..37e59e30558e --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V011/README.md @@ -0,0 +1,50 @@ +# V011 + +The V011 analyzer reports when custom SchemaValidateFunc declarations can be +replaced with [validation.StringLenBetween()](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation#StringLenBetween). + +## Flagged Code + +```go +func validateExampleThing(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + + if len(value) < 1 || len(value) > 255 { + errors = append(errors, fmt.Errorf("%q must be between 1 and 255 characters: %q", k, value)) + } + + return +} +``` + +## Passing Code + +```go +// directly in Schema +ValidateFunc: validation.StringLenBetween(1, 255), + +// or saving as a variable +var validateExampleThing = validation.StringLenBetween(1, 255) + +// or replacing the function +func validateExampleThing() schema.SchemaValidateFunc { + return validation.StringLenBetween(1, 255) +} +``` + +## Ignoring Reports + +Singular reports can be ignored by adding the a `//lintignore:V011` Go code comment at the end of the offending line or on the line immediately proceding, e.g. + +```go +//lintignore:V011 +func validateExampleThing(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + + if len(value) < 1 || len(value) > 255 { + errors = append(errors, fmt.Errorf("%q must be between 1 and 255 characters: %q", k, value)) + } + + return +} +``` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V011/V011.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V011/V011.go new file mode 100644 index 000000000000..857986b51237 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V011/V011.go @@ -0,0 +1,139 @@ +package V011 + +import ( + "go/ast" + "go/token" + "go/types" + + "github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema" + "github.com/bflad/tfproviderlint/passes/commentignore" + "github.com/bflad/tfproviderlint/passes/helper/schema/schemavalidatefuncinfo" + "golang.org/x/tools/go/analysis" +) + +const Doc = `check for custom SchemaValidateFunc that implement validation.StringLenBetween() + +The V011 analyzer reports when custom SchemaValidateFunc declarations can be +replaced with validation.StringLenBetween().` + +const analyzerName = "V011" + +var Analyzer = &analysis.Analyzer{ + Name: analyzerName, + Doc: Doc, + Requires: []*analysis.Analyzer{ + commentignore.Analyzer, + schemavalidatefuncinfo.Analyzer, + }, + Run: run, +} + +func run(pass *analysis.Pass) (interface{}, error) { + ignorer := pass.ResultOf[commentignore.Analyzer].(*commentignore.Ignorer) + schemaValidateFuncs := pass.ResultOf[schemavalidatefuncinfo.Analyzer].([]*schema.SchemaValidateFuncInfo) + + for _, schemaValidateFunc := range schemaValidateFuncs { + if ignorer.ShouldIgnore(analyzerName, schemaValidateFunc.Node) { + continue + } + + if !hasIfStringLenCheck(schemaValidateFunc.Body, pass.TypesInfo) { + continue + } + + pass.Reportf(schemaValidateFunc.Pos, "%s: custom SchemaValidateFunc should be replaced with validation.StringLenBetween()", analyzerName) + } + + return nil, nil +} + +func hasIfStringLenCheck(node ast.Node, info *types.Info) bool { + result := false + + ast.Inspect(node, func(n ast.Node) bool { + switch n := n.(type) { + default: + return true + case *ast.IfStmt: + if !hasStringLenCheck(n, info) { + return true + } + + result = true + + return false + } + }) + + return result +} + +func hasStringLenCheck(node ast.Node, info *types.Info) bool { + result := false + + ast.Inspect(node, func(n ast.Node) bool { + binaryExpr, ok := n.(*ast.BinaryExpr) + + if !ok { + return true + } + + if !exprIsStringLenCallExpr(binaryExpr.X, info) && !exprIsStringLenCallExpr(binaryExpr.Y, info) { + return true + } + + if !tokenIsLenCheck(binaryExpr.Op) { + return true + } + + result = true + + return false + }) + + return result +} + +func exprIsStringLenCallExpr(e ast.Expr, info *types.Info) bool { + switch e := e.(type) { + default: + return false + case *ast.CallExpr: + switch fun := e.Fun.(type) { + default: + return false + case *ast.Ident: + if fun.Name != "len" { + return false + } + } + + if len(e.Args) != 1 { + return false + } + + switch arg := info.TypeOf(e.Args[0]).Underlying().(type) { + default: + return false + case *types.Basic: + return arg.Kind() == types.String + } + } +} + +func tokenIsLenCheck(t token.Token) bool { + validTokens := []token.Token{ + token.GEQ, // >= + token.GTR, // > + token.LEQ, // <= + token.LSS, // < + } + + for _, validToken := range validTokens { + if t == validToken { + return true + } + } + + return false +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V012/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V012/README.md new file mode 100644 index 000000000000..1719e5eb023a --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V012/README.md @@ -0,0 +1,50 @@ +# V012 + +The V012 analyzer reports when custom SchemaValidateFunc declarations can be +replaced with [validation.IntAtLeast()](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation#IntAtLeast), [validation.IntAtMost()](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation#IntAtMost), or [validation.IntBetween()](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation#IntBetween). + +## Flagged Code + +```go +func validateExampleThing(v interface{}, k string) (ws []string, errors []error) { + value := v.(int) + + if value < 1 || value > 255 { + errors = append(errors, fmt.Errorf("%q must be between 1 and 255: %d", k, value)) + } + + return +} +``` + +## Passing Code + +```go +// directly in Schema +ValidateFunc: validation.IntBetween(1, 255), + +// or saving as a variable +var validateExampleThing = validation.IntBetween(1, 255) + +// or replacing the function +func validateExampleThing() schema.SchemaValidateFunc { + return validation.IntBetween(1, 255) +} +``` + +## Ignoring Reports + +Singular reports can be ignored by adding the a `//lintignore:V012` Go code comment at the end of the offending line or on the line immediately proceding, e.g. + +```go +//lintignore:V012 +func validateExampleThing(v interface{}, k string) (ws []string, errors []error) { + value := v.(int) + + if value < 1 || value > 255 { + errors = append(errors, fmt.Errorf("%q must be between 1 and 255: %d", k, value)) + } + + return +} +``` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V012/V012.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V012/V012.go new file mode 100644 index 000000000000..af1feb632b9d --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V012/V012.go @@ -0,0 +1,153 @@ +package V012 + +import ( + "go/ast" + "go/token" + "go/types" + + "github.com/bflad/tfproviderlint/helper/astutils" + "github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema" + "github.com/bflad/tfproviderlint/passes/commentignore" + "github.com/bflad/tfproviderlint/passes/helper/schema/schemavalidatefuncinfo" + "golang.org/x/tools/go/analysis" +) + +const Doc = `check for custom SchemaValidateFunc that implement validation.IntAtLeast(), validation.IntAtMost(), or validation.IntBetween() + +The V012 analyzer reports when custom SchemaValidateFunc declarations can be +replaced with validation.IntAtLeast(), validation.IntAtMost(), or +validation.IntBetween().` + +const analyzerName = "V012" + +var Analyzer = &analysis.Analyzer{ + Name: analyzerName, + Doc: Doc, + Requires: []*analysis.Analyzer{ + commentignore.Analyzer, + schemavalidatefuncinfo.Analyzer, + }, + Run: run, +} + +func run(pass *analysis.Pass) (interface{}, error) { + ignorer := pass.ResultOf[commentignore.Analyzer].(*commentignore.Ignorer) + schemaValidateFuncs := pass.ResultOf[schemavalidatefuncinfo.Analyzer].([]*schema.SchemaValidateFuncInfo) + + for _, schemaValidateFunc := range schemaValidateFuncs { + if ignorer.ShouldIgnore(analyzerName, schemaValidateFunc.Node) { + continue + } + + if hasStrconvAtoiCallExpr(schemaValidateFunc.Body, pass.TypesInfo) { + continue + } + + if !hasIfIntCheck(schemaValidateFunc.Body, pass.TypesInfo) { + continue + } + + pass.Reportf(schemaValidateFunc.Pos, "%s: custom SchemaValidateFunc should be replaced with validation.IntAtLeast(), validation.IntAtMost(), or validation.IntBetween()", analyzerName) + } + + return nil, nil +} + +func hasIfIntCheck(node ast.Node, info *types.Info) bool { + result := false + + ast.Inspect(node, func(n ast.Node) bool { + switch n := n.(type) { + default: + return true + case *ast.IfStmt: + if !hasIntCheck(n, info) { + return true + } + + result = true + + return false + } + }) + + return result +} + +func hasIntCheck(node ast.Node, info *types.Info) bool { + result := false + + ast.Inspect(node, func(n ast.Node) bool { + binaryExpr, ok := n.(*ast.BinaryExpr) + + if !ok { + return true + } + + if !exprIsIntIdent(binaryExpr.X, info) && !exprIsIntIdent(binaryExpr.Y, info) { + return true + } + + if !tokenIsIntCheck(binaryExpr.Op) { + return true + } + + result = true + + return false + }) + + return result +} + +func hasStrconvAtoiCallExpr(node ast.Node, info *types.Info) bool { + result := false + + ast.Inspect(node, func(n ast.Node) bool { + switch n := n.(type) { + default: + return true + case *ast.CallExpr: + if !astutils.IsStdlibPackageFunc(n.Fun, info, "strconv", "Atoi") { + return true + } + + result = true + + return false + } + }) + + return result +} + +func exprIsIntIdent(e ast.Expr, info *types.Info) bool { + switch e := e.(type) { + default: + return false + case *ast.Ident: + switch t := info.TypeOf(e).Underlying().(type) { + default: + return false + case *types.Basic: + return t.Kind() == types.Int + } + } +} + +func tokenIsIntCheck(t token.Token) bool { + validTokens := []token.Token{ + token.GEQ, // >= + token.GTR, // > + token.LEQ, // <= + token.LSS, // < + } + + for _, validToken := range validTokens { + if t == validToken { + return true + } + } + + return false +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V013/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V013/README.md new file mode 100644 index 000000000000..b926c66d9470 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V013/README.md @@ -0,0 +1,50 @@ +# V013 + +The V013 analyzer reports when custom SchemaValidateFunc declarations can be +replaced with [validation.StringInSlice()](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation#StringInSlice) or [validation.StringNotInSlice()](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation#StringNotInSlice). + +## Flagged Code + +```go +func validateExampleThing(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + + if value != "value1" && value != "value2" { + errors = append(errors, fmt.Errorf("%q must be value1 or value2: %s", k, value)) + } + + return +} +``` + +## Passing Code + +```go +// directly in Schema +ValidateFunc: validation.StringInSlice([]string{"value1", "value2"}, false), + +// or saving as a variable +var validateExampleThing = validation.StringInSlice([]string{"value1", "value2"}, false) + +// or replacing the function +func validateExampleThing() schema.SchemaValidateFunc { + return validation.StringInSlice([]string{"value1", "value2"}, false) +} +``` + +## Ignoring Reports + +Singular reports can be ignored by adding the a `//lintignore:V013` Go code comment at the end of the offending line or on the line immediately proceding, e.g. + +```go +//lintignore:V013 +func validateExampleThing(v interface{}, k string) (ws []string, errors []error) { + value := v.(string) + + if value != "value1" && value != "value2" { + errors = append(errors, fmt.Errorf("%q must be value1 or value2: %s", k, value)) + } + + return +} +``` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V013/V013.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V013/V013.go new file mode 100644 index 000000000000..dea5eec80254 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V013/V013.go @@ -0,0 +1,126 @@ +package V013 + +import ( + "go/ast" + "go/token" + "go/types" + + "github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema" + "github.com/bflad/tfproviderlint/passes/commentignore" + "github.com/bflad/tfproviderlint/passes/helper/schema/schemavalidatefuncinfo" + "golang.org/x/tools/go/analysis" +) + +const Doc = `check for custom SchemaValidateFunc that implement validation.StringInSlice() or validation.StringNotInSlice() + +The V013 analyzer reports when custom SchemaValidateFunc declarations can be +replaced with validation.StringInSlice() or validation.StringNotInSlice().` + +const analyzerName = "V013" + +var Analyzer = &analysis.Analyzer{ + Name: analyzerName, + Doc: Doc, + Requires: []*analysis.Analyzer{ + commentignore.Analyzer, + schemavalidatefuncinfo.Analyzer, + }, + Run: run, +} + +func run(pass *analysis.Pass) (interface{}, error) { + ignorer := pass.ResultOf[commentignore.Analyzer].(*commentignore.Ignorer) + schemaValidateFuncs := pass.ResultOf[schemavalidatefuncinfo.Analyzer].([]*schema.SchemaValidateFuncInfo) + + for _, schemaValidateFunc := range schemaValidateFuncs { + if ignorer.ShouldIgnore(analyzerName, schemaValidateFunc.Node) { + continue + } + + if !hasIfStringEquality(schemaValidateFunc.Body, pass.TypesInfo) { + continue + } + + pass.Reportf(schemaValidateFunc.Pos, "%s: custom SchemaValidateFunc should be replaced with validation.StringInSlice() or validation.StringNotInSlice()", analyzerName) + } + + return nil, nil +} + +func hasIfStringEquality(node ast.Node, info *types.Info) bool { + result := false + + ast.Inspect(node, func(n ast.Node) bool { + switch n := n.(type) { + default: + return true + case *ast.IfStmt: + if !hasStringEquality(n, info) { + return true + } + + result = true + + return false + } + }) + + return result +} + +func hasStringEquality(node ast.Node, info *types.Info) bool { + result := false + + ast.Inspect(node, func(n ast.Node) bool { + binaryExpr, ok := n.(*ast.BinaryExpr) + + if !ok { + return true + } + + if !exprIsString(binaryExpr.X, info) || !exprIsString(binaryExpr.Y, info) { + return true + } + + if !tokenIsEquality(binaryExpr.Op) { + return true + } + + result = true + + return false + }) + + return result +} + +func exprIsString(e ast.Expr, info *types.Info) bool { + switch e := e.(type) { + default: + return false + case *ast.BasicLit: + return e.Kind == token.STRING + case *ast.Ident: + switch t := info.TypeOf(e).Underlying().(type) { + default: + return false + case *types.Basic: + return t.Kind() == types.String + } + } +} + +func tokenIsEquality(t token.Token) bool { + validTokens := []token.Token{ + token.EQL, // == + token.NEQ, // != + } + + for _, validToken := range validTokens { + if t == validToken { + return true + } + } + + return false +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V014/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V014/README.md new file mode 100644 index 000000000000..159bce38231f --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V014/README.md @@ -0,0 +1,50 @@ +# V014 + +The V014 analyzer reports when custom SchemaValidateFunc declarations can be +replaced with [validation.IntInSlice()](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation#IntInSlice) or [validation.IntNotInSlice()](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation#IntNotInSlice). + +## Flagged Code + +```go +func validateExampleThing(v interface{}, k string) (ws []string, errors []error) { + value := v.(int) + + if value != 1 && value != 2 { + errors = append(errors, fmt.Errorf("%q must be 1 or 2: %d", k, value)) + } + + return +} +``` + +## Passing Code + +```go +// directly in Schema +ValidateFunc: validation.IntInSlice([]int{1, 2}, false), + +// or saving as a variable +var validateExampleThing = validation.IntInSlice([]int{1, 2}, false) + +// or replacing the function +func validateExampleThing() schema.SchemaValidateFunc { + return validation.IntInSlice([]int{1, 2}, false) +} +``` + +## Ignoring Reports + +Singular reports can be ignored by adding the a `//lintignore:V014` Go code comment at the end of the offending line or on the line immediately proceding, e.g. + +```go +//lintignore:V014 +func validateExampleThing(v interface{}, k string) (ws []string, errors []error) { + value := v.(int) + + if value != 1 && value != 2 { + errors = append(errors, fmt.Errorf("%q must be 1 or 2: %d", k, value)) + } + + return +} +``` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V014/V014.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V014/V014.go new file mode 100644 index 000000000000..5f8ef1b141c9 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/V014/V014.go @@ -0,0 +1,152 @@ +package V014 + +import ( + "go/ast" + "go/token" + "go/types" + + "github.com/bflad/tfproviderlint/helper/astutils" + "github.com/bflad/tfproviderlint/helper/terraformtype/helper/schema" + "github.com/bflad/tfproviderlint/passes/commentignore" + "github.com/bflad/tfproviderlint/passes/helper/schema/schemavalidatefuncinfo" + "golang.org/x/tools/go/analysis" +) + +const Doc = `check for custom SchemaValidateFunc that implement validation.IntInSlice() or validation.IntNotInSlice() + +The V014 analyzer reports when custom SchemaValidateFunc declarations can be +replaced with validation.IntInSlice() or validation.IntNotInSlice().` + +const analyzerName = "V014" + +var Analyzer = &analysis.Analyzer{ + Name: analyzerName, + Doc: Doc, + Requires: []*analysis.Analyzer{ + commentignore.Analyzer, + schemavalidatefuncinfo.Analyzer, + }, + Run: run, +} + +func run(pass *analysis.Pass) (interface{}, error) { + ignorer := pass.ResultOf[commentignore.Analyzer].(*commentignore.Ignorer) + schemaValidateFuncs := pass.ResultOf[schemavalidatefuncinfo.Analyzer].([]*schema.SchemaValidateFuncInfo) + + for _, schemaValidateFunc := range schemaValidateFuncs { + if ignorer.ShouldIgnore(analyzerName, schemaValidateFunc.Node) { + continue + } + + if hasStrconvAtoiCallExpr(schemaValidateFunc.Body, pass.TypesInfo) { + continue + } + + if !hasIfIntEquality(schemaValidateFunc.Body, pass.TypesInfo) { + continue + } + + pass.Reportf(schemaValidateFunc.Pos, "%s: custom SchemaValidateFunc should be replaced with validation.IntInSlice() or validation.IntNotInSlice()", analyzerName) + } + + return nil, nil +} + +func hasIfIntEquality(node ast.Node, info *types.Info) bool { + result := false + + ast.Inspect(node, func(n ast.Node) bool { + switch n := n.(type) { + default: + return true + case *ast.IfStmt: + if !hasIntEquality(n, info) { + return true + } + + result = true + + return false + } + }) + + return result +} + +func hasIntEquality(node ast.Node, info *types.Info) bool { + result := false + + ast.Inspect(node, func(n ast.Node) bool { + binaryExpr, ok := n.(*ast.BinaryExpr) + + if !ok { + return true + } + + if !exprIsInt(binaryExpr.X, info) || !exprIsInt(binaryExpr.Y, info) { + return true + } + + if !tokenIsEquality(binaryExpr.Op) { + return true + } + + result = true + + return false + }) + + return result +} + +func hasStrconvAtoiCallExpr(node ast.Node, info *types.Info) bool { + result := false + + ast.Inspect(node, func(n ast.Node) bool { + switch n := n.(type) { + default: + return true + case *ast.CallExpr: + if !astutils.IsStdlibPackageFunc(n.Fun, info, "strconv", "Atoi") { + return true + } + + result = true + + return false + } + }) + + return result +} + +func exprIsInt(e ast.Expr, info *types.Info) bool { + switch e := e.(type) { + default: + return false + case *ast.BasicLit: + return e.Kind == token.INT + case *ast.Ident: + switch t := info.TypeOf(e).Underlying().(type) { + default: + return false + case *types.Basic: + return t.Kind() == types.Int + } + } +} + +func tokenIsEquality(t token.Token) bool { + validTokens := []token.Token{ + token.EQL, // == + token.NEQ, // != + } + + for _, validToken := range validTokens { + if t == validToken { + return true + } + } + + return false +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/checks.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/checks.go index 92cd064a782b..374c47618b7a 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/checks.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/checks.go @@ -10,6 +10,9 @@ import ( "github.com/bflad/tfproviderlint/passes/AT007" "github.com/bflad/tfproviderlint/passes/AT008" "github.com/bflad/tfproviderlint/passes/AT009" + "github.com/bflad/tfproviderlint/passes/AT010" + "github.com/bflad/tfproviderlint/passes/AT011" + "github.com/bflad/tfproviderlint/passes/AT012" "github.com/bflad/tfproviderlint/passes/R001" "github.com/bflad/tfproviderlint/passes/R002" "github.com/bflad/tfproviderlint/passes/R003" @@ -76,6 +79,10 @@ import ( "github.com/bflad/tfproviderlint/passes/V008" "github.com/bflad/tfproviderlint/passes/V009" "github.com/bflad/tfproviderlint/passes/V010" + "github.com/bflad/tfproviderlint/passes/V011" + "github.com/bflad/tfproviderlint/passes/V012" + "github.com/bflad/tfproviderlint/passes/V013" + "github.com/bflad/tfproviderlint/passes/V014" "golang.org/x/tools/go/analysis" ) @@ -92,6 +99,9 @@ var AllChecks = []*analysis.Analyzer{ AT007.Analyzer, AT008.Analyzer, AT009.Analyzer, + AT010.Analyzer, + AT011.Analyzer, + AT012.Analyzer, R001.Analyzer, R002.Analyzer, R003.Analyzer, @@ -158,4 +168,8 @@ var AllChecks = []*analysis.Analyzer{ V008.Analyzer, V009.Analyzer, V010.Analyzer, + V011.Analyzer, + V012.Analyzer, + V013.Analyzer, + V014.Analyzer, } diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr/osexeccommandcallexpr.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr/osexeccommandcallexpr.go new file mode 100644 index 000000000000..c39ce0e3f188 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr/osexeccommandcallexpr.go @@ -0,0 +1,11 @@ +package osexeccommandcallexpr + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" +) + +var Analyzer = analysisutils.StdlibFunctionCallExprAnalyzer( + "osexeccommandcallexpr", + "os/exec", + "Command", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr/osexeccommandcontextcallexpr.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr/osexeccommandcontextcallexpr.go new file mode 100644 index 000000000000..50a38373591f --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr/osexeccommandcontextcallexpr.go @@ -0,0 +1,11 @@ +package osexeccommandcontextcallexpr + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" +) + +var Analyzer = analysisutils.StdlibFunctionCallExprAnalyzer( + "osexeccommandcontextcallexpr", + "os/exec", + "CommandContext", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr/osexeccommandcontextselectorexpr.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr/osexeccommandcontextselectorexpr.go new file mode 100644 index 000000000000..18b7e3706c2c --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr/osexeccommandcontextselectorexpr.go @@ -0,0 +1,11 @@ +package osexeccommandcontextselectorexpr + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" +) + +var Analyzer = analysisutils.StdlibFunctionSelectorExprAnalyzer( + "osexeccommandselectorexpr", + "os/exec", + "CommandContext", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr/osexeccommandselectorexpr.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr/osexeccommandselectorexpr.go new file mode 100644 index 000000000000..a90a13d720cf --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr/osexeccommandselectorexpr.go @@ -0,0 +1,11 @@ +package osexeccommandselectorexpr + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" +) + +var Analyzer = analysisutils.StdlibFunctionSelectorExprAnalyzer( + "osexeccommandselectorexpr", + "os/exec", + "Command", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XAT001/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XAT001/README.md new file mode 100644 index 000000000000..5f65fb6c05b4 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XAT001/README.md @@ -0,0 +1,69 @@ +# XAT001 + +The XAT001 analyzer reports uses of `TestCase` which do not define an `ErrorCheck` function. `ErrorCheck` can be used to skip tests for known environmental issues. + +## Flagged Code + +NOTE: This analyzer does not differentiate between resource acceptance tests and data source acceptance tests. This is by design to ensure authors add the equivalent resource `CheckDestroy` function to data source testing, if available. + +```go +func TestAccExampleThing_Attr1(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckExampleThingDestroy, + Steps: []resource.TestStep{ + { + Config: testAccExampleThingConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("example_thing.test", "attr1"), + ), + }, + }, + }) +} +``` + +## Passing Code + +```go +func TestAccExampleThing_Attr1(t *testing.T) { + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + ErrorCheck: testAccErrorCheck, + CheckDestroy: testAccCheckExampleThingDestroy, + Steps: []resource.TestStep{ + { + Config: testAccExampleThingConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("example_thing.test", "attr1"), + ), + }, + }, + }) +} +``` + +## Ignoring Reports + +Singular reports can be ignored by adding the a `//lintignore:XAT001` Go code comment at the end of the offending line or on the line immediately proceding, e.g. + +```go +func TestAccExampleThing_Attr1(t *testing.T) { + //lintignore:XAT001 + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckExampleThingDestroy, + Steps: []resource.TestStep{ + { + Config: testAccExampleThingConfig(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("example_thing.test", "attr1"), + ), + }, + }, + }) +} +``` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XAT001/XAT001.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XAT001/XAT001.go new file mode 100644 index 000000000000..a675c94e101d --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XAT001/XAT001.go @@ -0,0 +1,46 @@ +package XAT001 + +import ( + "go/ast" + + "github.com/bflad/tfproviderlint/helper/terraformtype/helper/resource" + "github.com/bflad/tfproviderlint/passes/commentignore" + "github.com/bflad/tfproviderlint/passes/helper/resource/testcaseinfo" + "golang.org/x/tools/go/analysis" +) + +const Doc = `check for TestCase missing ErrorCheck + +The XAT001 analyzer reports uses of TestCase which do not define an ErrorCheck +function. ErrorCheck can be used to skip tests for known environmental issues.` + +const analyzerName = "XAT001" + +var Analyzer = &analysis.Analyzer{ + Name: analyzerName, + Doc: Doc, + Requires: []*analysis.Analyzer{ + commentignore.Analyzer, + testcaseinfo.Analyzer, + }, + Run: run, +} + +func run(pass *analysis.Pass) (interface{}, error) { + ignorer := pass.ResultOf[commentignore.Analyzer].(*commentignore.Ignorer) + testCases := pass.ResultOf[testcaseinfo.Analyzer].([]*resource.TestCaseInfo) + + for _, testCase := range testCases { + if ignorer.ShouldIgnore(analyzerName, testCase.AstCompositeLit) { + continue + } + + if testCase.DeclaresField(resource.TestCaseFieldErrorCheck) { + continue + } + + pass.Reportf(testCase.AstCompositeLit.Type.(*ast.SelectorExpr).Sel.Pos(), "%s: missing ErrorCheck", analyzerName) + } + + return nil, nil +} diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR006/XR006.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR006/XR006.go index d9c8d405fce2..6d89ae4b74f4 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR006/XR006.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR006/XR006.go @@ -32,19 +32,19 @@ func run(pass *analysis.Pass) (interface{}, error) { continue } - if !resource.DeclaresField(schema.ResourceFieldCreate) && !resource.DeclaresField(schema.ResourceFieldCreateContext) && resource.Resource.Timeouts.Create != nil { + if !resource.DeclaresField(schema.ResourceFieldCreate) && !resource.DeclaresField(schema.ResourceFieldCreateContext) && !resource.DeclaresField(schema.ResourceFieldCreateWithoutTimeout) && resource.Resource.Timeouts.Create != nil { pass.Reportf(resource.AstCompositeLit.Pos(), "%s: resource should not configure Timeouts.Create without Create implementation", analyzerName) } - if !resource.DeclaresField(schema.ResourceFieldDelete) && !resource.DeclaresField(schema.ResourceFieldDeleteContext) && resource.Resource.Timeouts.Delete != nil { + if !resource.DeclaresField(schema.ResourceFieldDelete) && !resource.DeclaresField(schema.ResourceFieldDeleteContext) && !resource.DeclaresField(schema.ResourceFieldDeleteWithoutTimeout) && resource.Resource.Timeouts.Delete != nil { pass.Reportf(resource.AstCompositeLit.Pos(), "%s: resource should not configure Timeouts.Delete without Delete implementation", analyzerName) } - if !resource.DeclaresField(schema.ResourceFieldRead) && !resource.DeclaresField(schema.ResourceFieldReadContext) && resource.Resource.Timeouts.Read != nil { + if !resource.DeclaresField(schema.ResourceFieldRead) && !resource.DeclaresField(schema.ResourceFieldReadContext) && !resource.DeclaresField(schema.ResourceFieldReadWithoutTimeout) && resource.Resource.Timeouts.Read != nil { pass.Reportf(resource.AstCompositeLit.Pos(), "%s: resource should not configure Timeouts.Read without Read implementation", analyzerName) } - if !resource.DeclaresField(schema.ResourceFieldUpdate) && !resource.DeclaresField(schema.ResourceFieldUpdateContext) && resource.Resource.Timeouts.Update != nil { + if !resource.DeclaresField(schema.ResourceFieldUpdate) && !resource.DeclaresField(schema.ResourceFieldUpdateContext) && !resource.DeclaresField(schema.ResourceFieldUpdateWithoutTimeout) && resource.Resource.Timeouts.Update != nil { pass.Reportf(resource.AstCompositeLit.Pos(), "%s: resource should not configure Timeouts.Update without Update implementation", analyzerName) } } diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/README.md new file mode 100644 index 000000000000..bd8272908643 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/README.md @@ -0,0 +1,28 @@ +# XR007 + +The XR007 analyzer reports usage of the [`os/exec.Command()`](https://pkg.go.dev/os/exec#Command) function. Providers that are using Go language based SDKs likely want to prevent any execution of other binaries for various reasons such as security and unexpected requirements (e.g. tool installation outside Terraform). + +## Flagged Code + +```go +var sneaky = exec.Command + +sneaky("evilprogram") + +exec.Command("evilprogram") +``` + +## Passing Code + +```go +// Not present :) +``` + +## Ignoring Reports + +Singular reports can be ignored by adding the a `//lintignore:XR007` Go code comment at the end of the offending line or on the line immediately proceding, e.g. + +```go +//lintignore:XR007 +exec.Command("evilprogram") +``` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/XR007.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/XR007.go new file mode 100644 index 000000000000..5db4c3ab93d6 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR007/XR007.go @@ -0,0 +1,15 @@ +package XR007 + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" + "github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr" + "github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr" +) + +var Analyzer = analysisutils.AvoidSelectorExprAnalyzer( + "XR007", + osexeccommandcallexpr.Analyzer, + osexeccommandselectorexpr.Analyzer, + "os/exec", + "Command", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/README.md b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/README.md new file mode 100644 index 000000000000..69edac4a6ee3 --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/README.md @@ -0,0 +1,28 @@ +# XR008 + +The XR008 analyzer reports usage of the [`os/exec.CommandContext()`](https://pkg.go.dev/os/exec#CommandContext) function. Providers that are using Go language based SDKs likely want to prevent any execution of other binaries for various reasons such as security and unexpected requirements (e.g. tool installation outside Terraform). + +## Flagged Code + +```go +var sneaky = exec.CommandContext + +sneaky("evilprogram") + +exec.CommandContext("evilprogram") +``` + +## Passing Code + +```go +// Not present :) +``` + +## Ignoring Reports + +Singular reports can be ignored by adding the a `//lintignore:XR008` Go code comment at the end of the offending line or on the line immediately proceding, e.g. + +```go +//lintignore:XR008 +exec.CommandContext("evilprogram") +``` diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/XR008.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/XR008.go new file mode 100644 index 000000000000..8e970478f47b --- /dev/null +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/XR008/XR008.go @@ -0,0 +1,15 @@ +package XR008 + +import ( + "github.com/bflad/tfproviderlint/helper/analysisutils" + "github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr" + "github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr" +) + +var Analyzer = analysisutils.AvoidSelectorExprAnalyzer( + "XR008", + osexeccommandcontextcallexpr.Analyzer, + osexeccommandcontextselectorexpr.Analyzer, + "os/exec", + "CommandContext", +) diff --git a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/checks.go b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/checks.go index f08386bd61ab..289fa1cbfa26 100644 --- a/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/checks.go +++ b/awsproviderlint/vendor/github.com/bflad/tfproviderlint/xpasses/checks.go @@ -1,12 +1,15 @@ package xpasses import ( + "github.com/bflad/tfproviderlint/xpasses/XAT001" "github.com/bflad/tfproviderlint/xpasses/XR001" "github.com/bflad/tfproviderlint/xpasses/XR002" "github.com/bflad/tfproviderlint/xpasses/XR003" "github.com/bflad/tfproviderlint/xpasses/XR004" "github.com/bflad/tfproviderlint/xpasses/XR005" "github.com/bflad/tfproviderlint/xpasses/XR006" + "github.com/bflad/tfproviderlint/xpasses/XR007" + "github.com/bflad/tfproviderlint/xpasses/XR008" "github.com/bflad/tfproviderlint/xpasses/XS001" "github.com/bflad/tfproviderlint/xpasses/XS002" "golang.org/x/tools/go/analysis" @@ -16,12 +19,15 @@ import ( // This can be consumed via multichecker.Main(xpasses.AllChecks...) or by // combining these Analyzers with additional custom Analyzers var AllChecks = []*analysis.Analyzer{ + XAT001.Analyzer, XR001.Analyzer, XR002.Analyzer, XR003.Analyzer, XR004.Analyzer, XR005.Analyzer, XR006.Analyzer, + XR007.Analyzer, + XR008.Analyzer, XS001.Analyzer, XS002.Analyzer, } diff --git a/awsproviderlint/vendor/github.com/hashicorp/go-getter/.goreleaser.yml b/awsproviderlint/vendor/github.com/hashicorp/go-getter/.goreleaser.yml new file mode 100644 index 000000000000..e23ee051fb67 --- /dev/null +++ b/awsproviderlint/vendor/github.com/hashicorp/go-getter/.goreleaser.yml @@ -0,0 +1,50 @@ +env: + - GOPRIVATE=github.com/hashicorp + +builds: + - id: signable + mod_timestamp: '{{ .CommitTimestamp }}' + targets: + - darwin_amd64 + - windows_386 + - windows_amd64 + hooks: + post: | + docker run + -e ARTIFACTORY_TOKEN={{ .Env.ARTIFACTORY_TOKEN }} + -e ARTIFACTORY_USER={{ .Env.ARTIFACTORY_USER }} + -e CIRCLE_TOKEN={{ .Env.CIRCLE_TOKEN }} + -v {{ dir .Path }}:/workdir + {{ .Env.CODESIGN_IMAGE }} + sign -product-name={{ .ProjectName }} {{ .Name }} + dir: ./cmd/go-getter/ + flags: + - -trimpath + ldflags: + - -X main.GitCommit={{ .Commit }} + - mod_timestamp: '{{ .CommitTimestamp }}' + targets: + - linux_386 + - linux_amd64 + dir: ./cmd/go-getter/ + flags: + - -trimpath + ldflags: + - -X main.GitCommit={{ .Commit }} + +archives: + - format: zip + name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + files: + - none* + +checksum: + name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS' + algorithm: sha256 + +signs: + - args: ["-u", "{{ .Env.PGP_KEY_ID }}", "--output", "${signature}", "--detach-sign", "${artifact}"] + artifacts: checksum + +changelog: + skip: true diff --git a/awsproviderlint/vendor/github.com/hashicorp/go-getter/README.md b/awsproviderlint/vendor/github.com/hashicorp/go-getter/README.md index e5395894d8cd..a27e0f2623db 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/go-getter/README.md +++ b/awsproviderlint/vendor/github.com/hashicorp/go-getter/README.md @@ -1,9 +1,9 @@ # go-getter -[![CircleCI](https://circleci.com/gh/hashicorp/go-getter/tree/master.svg?style=svg)][circleci] +[![CircleCI](https://circleci.com/gh/hashicorp/go-getter/tree/main.svg?style=svg)][circleci] [![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs] -[circleci]: https://circleci.com/gh/hashicorp/go-getter/tree/master +[circleci]: https://circleci.com/gh/hashicorp/go-getter/tree/main [godocs]: http://godoc.org/github.com/hashicorp/go-getter go-getter is a library for Go (golang) for downloading files or directories diff --git a/awsproviderlint/vendor/github.com/hashicorp/go-getter/checksum.go b/awsproviderlint/vendor/github.com/hashicorp/go-getter/checksum.go index eeccfea9d3bf..f1090839fbe0 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/go-getter/checksum.go +++ b/awsproviderlint/vendor/github.com/hashicorp/go-getter/checksum.go @@ -259,7 +259,10 @@ func (c *Client) ChecksumFromFile(checksumFile string, src *url.URL) (*FileCheck return nil, fmt.Errorf( "Error reading checksum file: %s", err) } - break + if line == "" { + break + } + // parse the line, if we hit EOF, but the line is not empty } checksum, err := parseChecksumLine(line) if err != nil || checksum == nil { diff --git a/awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress.go b/awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress.go index 62ca1060f6f9..d0ad43900363 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress.go +++ b/awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress.go @@ -26,6 +26,7 @@ func init() { tbzDecompressor := new(TarBzip2Decompressor) tgzDecompressor := new(TarGzipDecompressor) txzDecompressor := new(TarXzDecompressor) + tzstDecompressor := new(TarZstdDecompressor) Decompressors = map[string]Decompressor{ "bz2": new(Bzip2Decompressor), @@ -34,10 +35,13 @@ func init() { "tar.bz2": tbzDecompressor, "tar.gz": tgzDecompressor, "tar.xz": txzDecompressor, + "tar.zst": tzstDecompressor, "tbz2": tbzDecompressor, "tgz": tgzDecompressor, "txz": txzDecompressor, + "tzst": tzstDecompressor, "zip": new(ZipDecompressor), + "zst": new(ZstdDecompressor), } } diff --git a/awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress_tzst.go b/awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress_tzst.go new file mode 100644 index 000000000000..a9f3da51e400 --- /dev/null +++ b/awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress_tzst.go @@ -0,0 +1,39 @@ +package getter + +import ( + "fmt" + "github.com/klauspost/compress/zstd" + "os" + "path/filepath" +) + +// TarZstdDecompressor is an implementation of Decompressor that can +// decompress tar.zstd files. +type TarZstdDecompressor struct{} + +func (d *TarZstdDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error { + // If we're going into a directory we should make that first + mkdir := dst + if !dir { + mkdir = filepath.Dir(dst) + } + if err := os.MkdirAll(mkdir, mode(0755, umask)); err != nil { + return err + } + + // File first + f, err := os.Open(src) + if err != nil { + return err + } + defer f.Close() + + // Zstd compression is second + zstdR, err := zstd.NewReader(f) + if err != nil { + return fmt.Errorf("Error opening a zstd reader for %s: %s", src, err) + } + defer zstdR.Close() + + return untar(zstdR, dst, src, dir, umask) +} diff --git a/awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress_zstd.go b/awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress_zstd.go new file mode 100644 index 000000000000..6ff6c86a945b --- /dev/null +++ b/awsproviderlint/vendor/github.com/hashicorp/go-getter/decompress_zstd.go @@ -0,0 +1,40 @@ +package getter + +import ( + "fmt" + "github.com/klauspost/compress/zstd" + "os" + "path/filepath" +) + +// ZstdDecompressor is an implementation of Decompressor that +// can decompress .zst files. +type ZstdDecompressor struct{} + +func (d *ZstdDecompressor) Decompress(dst, src string, dir bool, umask os.FileMode) error { + if dir { + return fmt.Errorf("zstd-compressed files can only unarchive to a single file") + } + + // If we're going into a directory we should make that first + if err := os.MkdirAll(filepath.Dir(dst), mode(0755, umask)); err != nil { + return err + } + + // File first + f, err := os.Open(src) + if err != nil { + return err + } + defer f.Close() + + // zstd compression is second + zstdR, err := zstd.NewReader(f) + if err != nil { + return err + } + defer zstdR.Close() + + // Copy it out + return copyReader(dst, zstdR, 0622, umask) +} diff --git a/awsproviderlint/vendor/github.com/hashicorp/go-getter/get_s3.go b/awsproviderlint/vendor/github.com/hashicorp/go-getter/get_s3.go index 5b2dd5e0c808..dc577c070424 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/go-getter/get_s3.go +++ b/awsproviderlint/vendor/github.com/hashicorp/go-getter/get_s3.go @@ -213,28 +213,49 @@ func (g *S3Getter) parseUrl(u *url.URL) (region, bucket, path, version string, c // any other S3 compliant service. S3 has a predictable // url as others do not if strings.Contains(u.Host, "amazonaws.com") { - // Expected host style: s3.amazonaws.com. They always have 3 parts, - // although the first may differ if we're accessing a specific region. + // Amazon S3 supports both virtual-hosted–style and path-style URLs to access a bucket, although path-style is deprecated + // In both cases few older regions supports dash-style region indication (s3-Region) even if AWS discourages their use. + // The same bucket could be reached with: + // bucket.s3.region.amazonaws.com/path + // bucket.s3-region.amazonaws.com/path + // s3.amazonaws.com/bucket/path + // s3-region.amazonaws.com/bucket/path + hostParts := strings.Split(u.Host, ".") - if len(hostParts) != 3 { - err = fmt.Errorf("URL is not a valid S3 URL") - return - } + switch len(hostParts) { + // path-style + case 3: + // Parse the region out of the first part of the host + region = strings.TrimPrefix(strings.TrimPrefix(hostParts[0], "s3-"), "s3") + if region == "" { + region = "us-east-1" + } + pathParts := strings.SplitN(u.Path, "/", 3) + bucket = pathParts[1] + path = pathParts[2] + // vhost-style, dash region indication + case 4: + // Parse the region out of the first part of the host + region = strings.TrimPrefix(strings.TrimPrefix(hostParts[1], "s3-"), "s3") + if region == "" { + err = fmt.Errorf("URL is not a valid S3 URL") + return + } + pathParts := strings.SplitN(u.Path, "/", 2) + bucket = hostParts[0] + path = pathParts[1] + //vhost-style, dot region indication + case 5: + region = hostParts[2] + pathParts := strings.SplitN(u.Path, "/", 2) + bucket = hostParts[0] + path = pathParts[1] - // Parse the region out of the first part of the host - region = strings.TrimPrefix(strings.TrimPrefix(hostParts[0], "s3-"), "s3") - if region == "" { - region = "us-east-1" } - - pathParts := strings.SplitN(u.Path, "/", 3) - if len(pathParts) != 3 { + if len(hostParts) < 3 && len(hostParts) > 5 { err = fmt.Errorf("URL is not a valid S3 URL") return } - - bucket = pathParts[1] - path = pathParts[2] version = u.Query().Get("version") } else { diff --git a/awsproviderlint/vendor/github.com/hashicorp/go-getter/go.mod b/awsproviderlint/vendor/github.com/hashicorp/go-getter/go.mod index 14af6b7181ab..9c0ae09b7a76 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/go-getter/go.mod +++ b/awsproviderlint/vendor/github.com/hashicorp/go-getter/go.mod @@ -10,6 +10,7 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.0 github.com/hashicorp/go-safetemp v1.0.0 github.com/hashicorp/go-version v1.1.0 + github.com/klauspost/compress v1.11.2 github.com/mattn/go-colorable v0.0.9 // indirect github.com/mattn/go-isatty v0.0.4 // indirect github.com/mattn/go-runewidth v0.0.4 // indirect diff --git a/awsproviderlint/vendor/github.com/hashicorp/go-getter/go.sum b/awsproviderlint/vendor/github.com/hashicorp/go-getter/go.sum index c16d1b4c26ab..99c5ea66b0c6 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/go-getter/go.sum +++ b/awsproviderlint/vendor/github.com/hashicorp/go-getter/go.sum @@ -54,6 +54,8 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 h1:12VvqtR6Aowv3l/EQUlocDHW2Cp4G9WJVH7uyH8QFJE= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/klauspost/compress v1.11.2 h1:MiK62aErc3gIiVEtyzKfeOHgW7atJb5g/KNX5m3c2nQ= +github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs= diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md index 4c644fcfb12d..025c4a1a4142 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/CHANGELOG.md @@ -1,5 +1,95 @@ # HCL Changelog +## v2.8.2 (Unreleased) + +### Bugs Fixed + +* hclsyntax: Fix panic for marked collection splat. ([#436](https://github.com/hashicorp/hcl/pull/436)) +* hclsyntax: Fix panic for marked template loops. ([#437](https://github.com/hashicorp/hcl/pull/437)) +* hclsyntax: Fix `for` expression marked conditional.([#438](https://github.com/hashicorp/hcl/pull/438)) +* hclsyntax: Mark objects with keys that are sensitive ([#440](https://github.com/hashicorp/hcl/pull/440)) + +## v2.8.1 (December 17, 2020) + +### Bugs Fixed + +* hclsyntax: Fix panic when expanding marked function arguments. ([#429](https://github.com/hashicorp/hcl/pull/429)) +* hclsyntax: Error when attempting to use a marked value as an object key. ([#434](https://github.com/hashicorp/hcl/pull/434)) +* hclsyntax: Error when attempting to use a marked value as an object key in expressions. ([#433](https://github.com/hashicorp/hcl/pull/433)) + +## v2.8.0 (December 7, 2020) + +### Enhancements + +* hclsyntax: Expression grouping parentheses will now be reflected by an explicit node in the AST, whereas before they were only considered during parsing. ([#426](https://github.com/hashicorp/hcl/pull/426)) + +### Bugs Fixed + +* hclwrite: The parser will now correctly include the `(` and `)` tokens when an expression is surrounded by parentheses. Previously it would incorrectly recognize those tokens as being extraneous tokens outside of the expression. ([#426](https://github.com/hashicorp/hcl/pull/426)) +* hclwrite: The formatter will now remove (rather than insert) spaces between the `!` (unary boolean "not") operator and its subsequent operand. ([#403](https://github.com/hashicorp/hcl/pull/403)) +* hclsyntax: Unmark conditional values in expressions before checking their truthfulness ([#427](https://github.com/hashicorp/hcl/pull/427)) + +## v2.7.2 (November 30, 2020) + +### Bugs Fixed + +* gohcl: Fix panic when decoding into type containing value slices. ([#335](https://github.com/hashicorp/hcl/pull/335)) +* hclsyntax: The unusual expression `null[*]` was previously always returning an unknown value, even though the rules for `[*]` normally call for it to return an empty tuple when applied to a null. As well as being a surprising result, it was particularly problematic because it violated the rule that a calling application may assume that an expression result will always be known unless the application itself introduces unknown values via the evaluation context. `null[*]` will now produce an empty tuple. ([#416](https://github.com/hashicorp/hcl/pull/416)) +* hclsyntax: Fix panic when traversing a list, tuple, or map with cty "marks" ([#424](https://github.com/hashicorp/hcl/pull/424)) + +## v2.7.1 (November 18, 2020) + +### Bugs Fixed + +* hclwrite: Correctly handle blank quoted string block labels, instead of dropping them ([#422](https://github.com/hashicorp/hcl/pull/422)) + +## v2.7.0 (October 14, 2020) + +### Enhancements + +* json: There is a new function `ParseWithStartPos`, which allows overriding the starting position for parsing in case the given JSON bytes are a fragment of a larger document, such as might happen when decoding with `encoding/json` into a `json.RawMessage`. ([#389](https://github.com/hashicorp/hcl/pull/389)) +* json: There is a new function `ParseExpression`, which allows parsing a JSON string directly in expression mode, whereas previously it was only possible to parse a JSON string in body mode. ([#381](https://github.com/hashicorp/hcl/pull/381)) +* hclwrite: `Block` type now supports `SetType` and `SetLabels`, allowing surgical changes to the type and labels of an existing block without having to reconstruct the entire block. ([#340](https://github.com/hashicorp/hcl/pull/340)) + +### Bugs Fixed + +* hclsyntax: Fix confusing error message for bitwise OR operator ([#380](https://github.com/hashicorp/hcl/pull/380)) +* hclsyntax: Several bug fixes for using HCL with values containing cty "marks" ([#404](https://github.com/hashicorp/hcl/pull/404), [#406](https://github.com/hashicorp/hcl/pull/404), [#407](https://github.com/hashicorp/hcl/pull/404)) + +## v2.6.0 (June 4, 2020) + +### Enhancements + +* hcldec: Add a new `Spec`, `ValidateSpec`, which allows custom validation of values at decode-time. ([#387](https://github.com/hashicorp/hcl/pull/387)) + +### Bugs Fixed + +* hclsyntax: Fix panic with combination of sequences and null arguments ([#386](https://github.com/hashicorp/hcl/pull/386)) +* hclsyntax: Fix handling of unknown values and sequences ([#386](https://github.com/hashicorp/hcl/pull/386)) + +## v2.5.1 (May 14, 2020) + +### Bugs Fixed + +* hclwrite: handle legacy dot access of numeric indexes. ([#369](https://github.com/hashicorp/hcl/pull/369)) +* hclwrite: Fix panic for dotted full splat (`foo.*`) ([#374](https://github.com/hashicorp/hcl/pull/374)) + +## v2.5.0 (May 6, 2020) + +### Enhancements + +* hclwrite: Generate multi-line objects and maps. ([#372](https://github.com/hashicorp/hcl/pull/372)) + +## v2.4.0 (Apr 13, 2020) + +### Enhancements + +* The Unicode data tables that HCL uses to produce user-perceived "column" positions in diagnostics and other source ranges are now updated to Unicode 12.0.0, which will cause HCL to produce more accurate column numbers for combining characters introduced to Unicode since Unicode 9.0.0. + +### Bugs Fixed + +* json: Fix panic when parsing malformed JSON. ([#358](https://github.com/hashicorp/hcl/pull/358)) + ## v2.3.0 (Jan 3, 2020) ### Enhancements diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/README.md b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/README.md index 3d0d509d53e4..9af736c9dd5c 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/README.md +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/README.md @@ -33,11 +33,25 @@ package main import ( "log" + "github.com/hashicorp/hcl/v2/hclsimple" ) type Config struct { - LogLevel string `hcl:"log_level"` + IOMode string `hcl:"io_mode"` + Service ServiceConfig `hcl:"service,block"` +} + +type ServiceConfig struct { + Protocol string `hcl:"protocol,label"` + Type string `hcl:"type,label"` + ListenAddr string `hcl:"listen_addr"` + Processes []ProcessConfig `hcl:"process,block"` +} + +type ProcessConfig struct { + Type string `hcl:"type,label"` + Command []string `hcl:"command"` } func main() { diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/appveyor.yml b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/appveyor.yml deleted file mode 100644 index e382f8f57174..000000000000 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/appveyor.yml +++ /dev/null @@ -1,13 +0,0 @@ -build: off - -clone_folder: c:\gopath\src\github.com\hashicorp\hcl - -environment: - GOPATH: c:\gopath - GO111MODULE: on - GOPROXY: https://goproxy.io - -stack: go 1.12 - -test_script: - - go test ./... diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/diagnostic.go b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/diagnostic.go index c320961e11ed..c80535b7a73f 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/diagnostic.go +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/diagnostic.go @@ -22,14 +22,14 @@ const ( ) // Diagnostic represents information to be presented to a user about an -// error or anomoly in parsing or evaluating configuration. +// error or anomaly in parsing or evaluating configuration. type Diagnostic struct { Severity DiagnosticSeverity // Summary and Detail contain the English-language description of the // problem. Summary is a terse description of the general problem and // detail is a more elaborate, often-multi-sentence description of - // the probem and what might be done to solve it. + // the problem and what might be done to solve it. Summary string Detail string diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/go.mod b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/go.mod index d80c99d9b6d3..c8c289d9fa42 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/go.mod +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/go.mod @@ -1,9 +1,11 @@ module github.com/hashicorp/hcl/v2 +go 1.12 + require ( github.com/agext/levenshtein v1.2.1 github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 - github.com/apparentlymart/go-textseg v1.0.0 + github.com/apparentlymart/go-textseg/v12 v12.0.0 github.com/davecgh/go-spew v1.1.1 github.com/go-test/deep v1.0.3 github.com/google/go-cmp v0.3.1 diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/go.sum b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/go.sum index 76b135fb473f..2a1073d117b4 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/go.sum +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/go.sum @@ -4,6 +4,8 @@ github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3 h1:ZSTrOEhi github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= +github.com/apparentlymart/go-textseg/v12 v12.0.0 h1:bNEQyAGak9tojivJNkoqWErVCQbjdL7GzRt3F8NvfJ0= +github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go index 3fe84ddc383e..63f2e88ec778 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression.go @@ -27,6 +27,32 @@ type Expression interface { // Assert that Expression implements hcl.Expression var assertExprImplExpr hcl.Expression = Expression(nil) +// ParenthesesExpr represents an expression written in grouping +// parentheses. +// +// The parser takes care of the precedence effect of the parentheses, so the +// only purpose of this separate expression node is to capture the source range +// of the parentheses themselves, rather than the source range of the +// expression within. All of the other expression operations just pass through +// to the underlying expression. +type ParenthesesExpr struct { + Expression + SrcRange hcl.Range +} + +var _ hcl.Expression = (*ParenthesesExpr)(nil) + +func (e *ParenthesesExpr) Range() hcl.Range { + return e.SrcRange +} + +func (e *ParenthesesExpr) walkChildNodes(w internalWalkFunc) { + // We override the walkChildNodes from the embedded Expression to + // ensure that both the parentheses _and_ the content are visible + // in a walk. + w(e.Expression) +} + // LiteralValueExpr is an expression that just always returns a given value. type LiteralValueExpr struct { Val cty.Value @@ -260,6 +286,20 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti } switch { + case expandVal.Type().Equals(cty.DynamicPseudoType): + if expandVal.IsNull() { + diags = append(diags, &hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid expanding argument value", + Detail: "The expanding argument (indicated by ...) must not be null.", + Subject: expandExpr.Range().Ptr(), + Context: e.Range().Ptr(), + Expression: expandExpr, + EvalContext: ctx, + }) + return cty.DynamicVal, diags + } + return cty.DynamicVal, diags case expandVal.Type().IsTupleType() || expandVal.Type().IsListType() || expandVal.Type().IsSetType(): if expandVal.IsNull() { diags = append(diags, &hcl.Diagnostic{ @@ -277,13 +317,17 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti return cty.DynamicVal, diags } + // When expanding arguments from a collection, we must first unmark + // the collection itself, and apply any marks directly to the + // elements. This ensures that marks propagate correctly. + expandVal, marks := expandVal.Unmark() newArgs := make([]Expression, 0, (len(args)-1)+expandVal.LengthInt()) newArgs = append(newArgs, args[:len(args)-1]...) it := expandVal.ElementIterator() for it.Next() { _, val := it.Element() newArgs = append(newArgs, &LiteralValueExpr{ - Val: val, + Val: val.WithMarks(marks), SrcRange: expandExpr.Range(), }) } @@ -406,22 +450,39 @@ func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti } else { param = varParam } - argExpr := e.Args[i] - // TODO: we should also unpick a PathError here and show the - // path to the deep value where the error was detected. - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid function argument", - Detail: fmt.Sprintf( - "Invalid value for %q parameter: %s.", - param.Name, err, - ), - Subject: argExpr.StartRange().Ptr(), - Context: e.Range().Ptr(), - Expression: argExpr, - EvalContext: ctx, - }) + // this can happen if an argument is (incorrectly) null. + if i > len(e.Args)-1 { + diags = append(diags, &hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid function argument", + Detail: fmt.Sprintf( + "Invalid value for %q parameter: %s.", + param.Name, err, + ), + Subject: args[len(params)].StartRange().Ptr(), + Context: e.Range().Ptr(), + Expression: e, + EvalContext: ctx, + }) + } else { + argExpr := e.Args[i] + + // TODO: we should also unpick a PathError here and show the + // path to the deep value where the error was detected. + diags = append(diags, &hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid function argument", + Detail: fmt.Sprintf( + "Invalid value for %q parameter: %s.", + param.Name, err, + ), + Subject: argExpr.StartRange().Ptr(), + Context: e.Range().Ptr(), + Expression: argExpr, + EvalContext: ctx, + }) + } default: diags = append(diags, &hcl.Diagnostic{ @@ -567,6 +628,8 @@ func (e *ConditionalExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostic return cty.UnknownVal(resultType), diags } + // Unmark result before testing for truthiness + condResult, _ = condResult.UnmarkDeep() if condResult.True() { diags = append(diags, trueDiags...) if convs[0] != nil { @@ -725,6 +788,7 @@ func (e *ObjectConsExpr) walkChildNodes(w internalWalkFunc) { func (e *ObjectConsExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { var vals map[string]cty.Value var diags hcl.Diagnostics + var marks []cty.ValueMarks // This will get set to true if we fail to produce any of our keys, // either because they are actually unknown or if the evaluation produces @@ -762,6 +826,9 @@ func (e *ObjectConsExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics continue } + key, keyMarks := key.Unmark() + marks = append(marks, keyMarks) + var err error key, err = convert.Convert(key, cty.String) if err != nil { @@ -791,7 +858,7 @@ func (e *ObjectConsExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics return cty.DynamicVal, diags } - return cty.ObjectVal(vals), diags + return cty.ObjectVal(vals).WithMarks(marks...), diags } func (e *ObjectConsExpr) Range() hcl.Range { @@ -921,6 +988,7 @@ type ForExpr struct { func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { var diags hcl.Diagnostics + var marks []cty.ValueMarks collVal, collDiags := e.CollExpr.Value(ctx) diags = append(diags, collDiags...) @@ -940,6 +1008,10 @@ func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { if collVal.Type() == cty.DynamicPseudoType { return cty.DynamicVal, diags } + // Unmark collection before checking for iterability, because marked + // values cannot be iterated + collVal, collMarks := collVal.Unmark() + marks = append(marks, collMarks) if !collVal.CanIterateElements() { diags = append(diags, &hcl.Diagnostic{ Severity: hcl.DiagError, @@ -1064,7 +1136,11 @@ func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { continue } - if include.False() { + // Extract and merge marks from the include expression into the + // main set of marks + includeUnmarked, includeMarks := include.Unmark() + marks = append(marks, includeMarks) + if includeUnmarked.False() { // Skip this element continue } @@ -1109,6 +1185,9 @@ func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { continue } + key, keyMarks := key.Unmark() + marks = append(marks, keyMarks) + val, valDiags := e.ValExpr.Value(childCtx) diags = append(diags, valDiags...) @@ -1147,7 +1226,7 @@ func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { } } - return cty.ObjectVal(vals), diags + return cty.ObjectVal(vals).WithMarks(marks...), diags } else { // Producing a tuple @@ -1208,7 +1287,11 @@ func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { continue } - if include.False() { + // Extract and merge marks from the include expression into the + // main set of marks + includeUnmarked, includeMarks := include.Unmark() + marks = append(marks, includeMarks) + if includeUnmarked.False() { // Skip this element continue } @@ -1223,7 +1306,7 @@ func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { return cty.DynamicVal, diags } - return cty.TupleVal(vals), diags + return cty.TupleVal(vals).WithMarks(marks...), diags } } @@ -1286,12 +1369,6 @@ func (e *SplatExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { } sourceTy := sourceVal.Type() - if sourceTy == cty.DynamicPseudoType { - // If we don't even know the _type_ of our source value yet then - // we'll need to defer all processing, since we can't decide our - // result type either. - return cty.DynamicVal, diags - } // A "special power" of splat expressions is that they can be applied // both to tuples/lists and to other values, and in the latter case @@ -1315,6 +1392,13 @@ func (e *SplatExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { return cty.DynamicVal, diags } + if sourceTy == cty.DynamicPseudoType { + // If we don't even know the _type_ of our source value yet then + // we'll need to defer all processing, since we can't decide our + // result type either. + return cty.DynamicVal, diags + } + if autoUpgrade { sourceVal = cty.TupleVal([]cty.Value{sourceVal}) sourceTy = sourceVal.Type() @@ -1359,6 +1443,9 @@ func (e *SplatExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { return cty.UnknownVal(ty), diags } + // Unmark the collection, and save the marks to apply to the returned + // collection result + sourceVal, marks := sourceVal.Unmark() vals := make([]cty.Value, 0, sourceVal.LengthInt()) it := sourceVal.ElementIterator() if ctx == nil { @@ -1393,9 +1480,9 @@ func (e *SplatExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { diags = append(diags, tyDiags...) return cty.ListValEmpty(ty.ElementType()), diags } - return cty.ListVal(vals), diags + return cty.ListVal(vals).WithMarks(marks), diags default: - return cty.TupleVal(vals), diags + return cty.TupleVal(vals).WithMarks(marks), diags } } diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_template.go b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_template.go index 9d425115f957..0b7e07a5b157 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_template.go +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/expression_template.go @@ -26,6 +26,9 @@ func (e *TemplateExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) var diags hcl.Diagnostics isKnown := true + // Maintain a set of marks for values used in the template + marks := make(cty.ValueMarks) + for _, part := range e.Parts { partVal, partDiags := part.Value(ctx) diags = append(diags, partDiags...) @@ -71,14 +74,24 @@ func (e *TemplateExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) continue } - buf.WriteString(strVal.AsString()) + // Unmark the part and merge its marks into the set + unmarked, partMarks := strVal.Unmark() + for k, v := range partMarks { + marks[k] = v + } + + buf.WriteString(unmarked.AsString()) } + var ret cty.Value if !isKnown { - return cty.UnknownVal(cty.String), diags + ret = cty.UnknownVal(cty.String) + } else { + ret = cty.StringVal(buf.String()) } - return cty.StringVal(buf.String()), diags + // Apply the full set of marks to the returned value + return ret.WithMarks(marks), diags } func (e *TemplateExpr) Range() hcl.Range { @@ -139,6 +152,8 @@ func (e *TemplateJoinExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti return cty.UnknownVal(cty.String), diags } + tuple, marks := tuple.Unmark() + allMarks := []cty.ValueMarks{marks} buf := &bytes.Buffer{} it := tuple.ElementIterator() for it.Next() { @@ -158,7 +173,7 @@ func (e *TemplateJoinExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti continue } if val.Type() == cty.DynamicPseudoType { - return cty.UnknownVal(cty.String), diags + return cty.UnknownVal(cty.String).WithMarks(marks), diags } strVal, err := convert.Convert(val, cty.String) if err != nil { @@ -176,13 +191,17 @@ func (e *TemplateJoinExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnosti continue } if !val.IsKnown() { - return cty.UnknownVal(cty.String), diags + return cty.UnknownVal(cty.String).WithMarks(marks), diags } + strVal, strValMarks := strVal.Unmark() + if len(strValMarks) > 0 { + allMarks = append(allMarks, strValMarks) + } buf.WriteString(strVal.AsString()) } - return cty.StringVal(buf.String()), diags + return cty.StringVal(buf.String()).WithMarks(allMarks...), diags } func (e *TemplateJoinExpr) Range() hcl.Range { diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser.go b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser.go index f67d989e5416..0998cc41222e 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser.go +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser.go @@ -6,7 +6,7 @@ import ( "strconv" "unicode/utf8" - "github.com/apparentlymart/go-textseg/textseg" + "github.com/apparentlymart/go-textseg/v12/textseg" "github.com/hashicorp/hcl/v2" "github.com/zclconf/go-cty/cty" ) @@ -670,6 +670,7 @@ Traversal: trav := make(hcl.Traversal, 0, 1) var firstRange, lastRange hcl.Range firstRange = p.NextRange() + lastRange = marker.Range for p.Peek().Type == TokenDot { dot := p.Read() @@ -910,7 +911,7 @@ func (p *parser) parseExpressionTerm() (Expression, hcl.Diagnostics) { switch start.Type { case TokenOParen: - p.Read() // eat open paren + oParen := p.Read() // eat open paren p.PushIncludeNewlines(false) @@ -936,9 +937,19 @@ func (p *parser) parseExpressionTerm() (Expression, hcl.Diagnostics) { p.setRecovery() } - p.Read() // eat closing paren + cParen := p.Read() // eat closing paren p.PopIncludeNewlines() + // Our parser's already taken care of the precedence effect of the + // parentheses by considering them to be a kind of "term", but we + // still need to include the parentheses in our AST so we can give + // an accurate representation of the source range that includes the + // open and closing parentheses. + expr = &ParenthesesExpr{ + Expression: expr, + SrcRange: hcl.RangeBetween(oParen.Range, cParen.Range), + } + return expr, diags case TokenNumberLit: diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_template.go b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_template.go index eb8f7ea38cca..bb856461031d 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_template.go +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/parser_template.go @@ -5,7 +5,7 @@ import ( "strings" "unicode" - "github.com/apparentlymart/go-textseg/textseg" + "github.com/apparentlymart/go-textseg/v12/textseg" "github.com/hashicorp/hcl/v2" "github.com/zclconf/go-cty/cty" ) diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/spec.md b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/spec.md index 3fc5f5f1bfc6..550bd93adf15 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/spec.md +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/spec.md @@ -273,7 +273,7 @@ tuple = "[" ( object = "{" ( (objectelem ("," objectelem)* ","?)? ) "}"; -objectelem = (Identifier | Expression) "=" Expression; +objectelem = (Identifier | Expression) ("=" | ":") Expression; ``` Only tuple and object values can be directly constructed via native syntax. diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/token.go b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/token.go index c7ffe2073817..59f4c4347871 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/token.go +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/hclsyntax/token.go @@ -4,7 +4,7 @@ import ( "bytes" "fmt" - "github.com/apparentlymart/go-textseg/textseg" + "github.com/apparentlymart/go-textseg/v12/textseg" "github.com/hashicorp/hcl/v2" ) @@ -202,7 +202,7 @@ func checkInvalidTokens(tokens Tokens) hcl.Diagnostics { case TokenBitwiseAnd: suggestion = " Did you mean boolean AND (\"&&\")?" case TokenBitwiseOr: - suggestion = " Did you mean boolean OR (\"&&\")?" + suggestion = " Did you mean boolean OR (\"||\")?" case TokenBitwiseNot: suggestion = " Did you mean boolean NOT (\"!\")?" } @@ -294,12 +294,23 @@ func checkInvalidTokens(tokens Tokens) hcl.Diagnostics { Subject: &tok.Range, }) case TokenInvalid: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid character", - Detail: "This character is not used within the language.", - Subject: &tok.Range, - }) + chars := string(tok.Bytes) + switch chars { + case "“", "”": + diags = append(diags, &hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid character", + Detail: "\"Curly quotes\" are not valid here. These can sometimes be inadvertently introduced when sharing code via documents or discussion forums. It might help to replace the character with a \"straight quote\".", + Subject: &tok.Range, + }) + default: + diags = append(diags, &hcl.Diagnostic{ + Severity: hcl.DiagError, + Summary: "Invalid character", + Detail: "This character is not used within the language.", + Subject: &tok.Range, + }) + } } } return diags diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/ops.go b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/ops.go index 5d2910c13010..f69de5b93344 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/ops.go +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/ops.go @@ -76,7 +76,10 @@ func Index(collection, key cty.Value, srcRange *Range) (cty.Value, Diagnostics) } } - has := collection.HasIndex(key) + // Here we drop marks from HasIndex result, in order to allow basic + // traversal of a marked list, tuple, or map in the same way we can + // traverse a marked object + has, _ := collection.HasIndex(key).Unmark() if !has.IsKnown() { if ty.IsTupleType() { return cty.DynamicVal, nil @@ -217,7 +220,12 @@ func GetAttr(obj cty.Value, attrName string, srcRange *Range) (cty.Value, Diagno } idx := cty.StringVal(attrName) - if obj.HasIndex(idx).False() { + + // Here we drop marks from HasIndex result, in order to allow basic + // traversal of a marked map in the same way we can traverse a marked + // object + hasIndex, _ := obj.HasIndex(idx).Unmark() + if hasIndex.False() { return cty.DynamicVal, Diagnostics{ { Severity: DiagError, diff --git a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/pos_scanner.go b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/pos_scanner.go index 17c0d7c6b1e1..ef0aa1015b1b 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/pos_scanner.go +++ b/awsproviderlint/vendor/github.com/hashicorp/hcl/v2/pos_scanner.go @@ -4,7 +4,7 @@ import ( "bufio" "bytes" - "github.com/apparentlymart/go-textseg/textseg" + "github.com/apparentlymart/go-textseg/v12/textseg" ) // RangeScanner is a helper that will scan over a buffer using a bufio.SplitFunc diff --git a/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/grpc_provider.go b/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/grpc_provider.go index d9c824d26d8e..25108493c834 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/grpc_provider.go +++ b/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/grpc_provider.go @@ -1152,6 +1152,9 @@ func pathToAttributePath(path cty.Path) *tftypes.AttributePath { } } + if len(steps) < 1 { + return nil + } return &tftypes.AttributePath{Steps: steps} } diff --git a/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go b/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go index 2f5663d357e9..45dc9c2efcc7 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go +++ b/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema/resource.go @@ -142,6 +142,46 @@ type Resource struct { UpdateContext UpdateContextFunc DeleteContext DeleteContextFunc + // CreateWithoutTimeout is equivalent to CreateContext with no context timeout. + // + // Most resources should prefer CreateContext with properly implemented + // operation timeout values, however there are cases where operation + // synchronization across concurrent resources is necessary in the resource + // logic, such as a mutex, to prevent remote system errors. Since these + // operations would have an indeterminate timeout that scales with the + // number of resources, this allows resources to control timeout behavior. + CreateWithoutTimeout CreateContextFunc + + // ReadWithoutTimeout is equivalent to ReadContext with no context timeout. + // + // Most resources should prefer ReadContext with properly implemented + // operation timeout values, however there are cases where operation + // synchronization across concurrent resources is necessary in the resource + // logic, such as a mutex, to prevent remote system errors. Since these + // operations would have an indeterminate timeout that scales with the + // number of resources, this allows resources to control timeout behavior. + ReadWithoutTimeout ReadContextFunc + + // UpdateWithoutTimeout is equivalent to UpdateContext with no context timeout. + // + // Most resources should prefer UpdateContext with properly implemented + // operation timeout values, however there are cases where operation + // synchronization across concurrent resources is necessary in the resource + // logic, such as a mutex, to prevent remote system errors. Since these + // operations would have an indeterminate timeout that scales with the + // number of resources, this allows resources to control timeout behavior. + UpdateWithoutTimeout UpdateContextFunc + + // DeleteWithoutTimeout is equivalent to DeleteContext with no context timeout. + // + // Most resources should prefer DeleteContext with properly implemented + // operation timeout values, however there are cases where operation + // synchronization across concurrent resources is necessary in the resource + // logic, such as a mutex, to prevent remote system errors. Since these + // operations would have an indeterminate timeout that scales with the + // number of resources, this allows resources to control timeout behavior. + DeleteWithoutTimeout DeleteContextFunc + // CustomizeDiff is a custom function for working with the diff that // Terraform has created for this resource - it can be used to customize the // diff that has been created, diff values not controlled by configuration, @@ -280,6 +320,11 @@ func (r *Resource) create(ctx context.Context, d *ResourceData, meta interface{} } return nil } + + if r.CreateWithoutTimeout != nil { + return r.CreateWithoutTimeout(ctx, d, meta) + } + ctx, cancel := context.WithTimeout(ctx, d.Timeout(TimeoutCreate)) defer cancel() return r.CreateContext(ctx, d, meta) @@ -292,6 +337,11 @@ func (r *Resource) read(ctx context.Context, d *ResourceData, meta interface{}) } return nil } + + if r.ReadWithoutTimeout != nil { + return r.ReadWithoutTimeout(ctx, d, meta) + } + ctx, cancel := context.WithTimeout(ctx, d.Timeout(TimeoutRead)) defer cancel() return r.ReadContext(ctx, d, meta) @@ -304,6 +354,11 @@ func (r *Resource) update(ctx context.Context, d *ResourceData, meta interface{} } return nil } + + if r.UpdateWithoutTimeout != nil { + return r.UpdateWithoutTimeout(ctx, d, meta) + } + ctx, cancel := context.WithTimeout(ctx, d.Timeout(TimeoutUpdate)) defer cancel() return r.UpdateContext(ctx, d, meta) @@ -316,6 +371,11 @@ func (r *Resource) delete(ctx context.Context, d *ResourceData, meta interface{} } return nil } + + if r.DeleteWithoutTimeout != nil { + return r.DeleteWithoutTimeout(ctx, d, meta) + } + ctx, cancel := context.WithTimeout(ctx, d.Timeout(TimeoutDelete)) defer cancel() return r.DeleteContext(ctx, d, meta) @@ -571,19 +631,19 @@ func (r *Resource) RefreshWithoutUpgrade( } func (r *Resource) createFuncSet() bool { - return (r.Create != nil || r.CreateContext != nil) + return (r.Create != nil || r.CreateContext != nil || r.CreateWithoutTimeout != nil) } func (r *Resource) readFuncSet() bool { - return (r.Read != nil || r.ReadContext != nil) + return (r.Read != nil || r.ReadContext != nil || r.ReadWithoutTimeout != nil) } func (r *Resource) updateFuncSet() bool { - return (r.Update != nil || r.UpdateContext != nil) + return (r.Update != nil || r.UpdateContext != nil || r.UpdateWithoutTimeout != nil) } func (r *Resource) deleteFuncSet() bool { - return (r.Delete != nil || r.DeleteContext != nil) + return (r.Delete != nil || r.DeleteContext != nil || r.DeleteWithoutTimeout != nil) } // InternalValidate should be called to validate the structure @@ -722,6 +782,34 @@ func (r *Resource) InternalValidate(topSchemaMap schemaMap, writable bool) error return fmt.Errorf("DeleteContext and Delete should not both be set") } + // check context funcs are not set alongside their without timeout counterparts + if r.CreateContext != nil && r.CreateWithoutTimeout != nil { + return fmt.Errorf("CreateContext and CreateWithoutTimeout should not both be set") + } + if r.ReadContext != nil && r.ReadWithoutTimeout != nil { + return fmt.Errorf("ReadContext and ReadWithoutTimeout should not both be set") + } + if r.UpdateContext != nil && r.UpdateWithoutTimeout != nil { + return fmt.Errorf("UpdateContext and UpdateWithoutTimeout should not both be set") + } + if r.DeleteContext != nil && r.DeleteWithoutTimeout != nil { + return fmt.Errorf("DeleteContext and DeleteWithoutTimeout should not both be set") + } + + // check non-context funcs are not set alongside the context without timeout counterparts + if r.Create != nil && r.CreateWithoutTimeout != nil { + return fmt.Errorf("Create and CreateWithoutTimeout should not both be set") + } + if r.Read != nil && r.ReadWithoutTimeout != nil { + return fmt.Errorf("Read and ReadWithoutTimeout should not both be set") + } + if r.Update != nil && r.UpdateWithoutTimeout != nil { + return fmt.Errorf("Update and UpdateWithoutTimeout should not both be set") + } + if r.Delete != nil && r.DeleteWithoutTimeout != nil { + return fmt.Errorf("Delete and DeleteWithoutTimeout should not both be set") + } + return schemaMap(r.Schema).InternalValidate(tsm) } diff --git a/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugin/convert/diagnostics.go b/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugin/convert/diagnostics.go index ac66eb71e10b..799a2fb8a713 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugin/convert/diagnostics.go +++ b/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/internal/plugin/convert/diagnostics.go @@ -107,6 +107,9 @@ func AttributePathToPath(ap *tftypes.AttributePath) cty.Path { // PathToAttributePath takes a cty.Path and converts it to a proto-encoded path. func PathToAttributePath(p cty.Path) *tftypes.AttributePath { + if p == nil || len(p) < 1 { + return nil + } ap := &tftypes.AttributePath{} for _, step := range p { switch selector := step.(type) { diff --git a/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/meta/meta.go b/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/meta/meta.go index eb7b3f08e419..e8e2b62f9c2b 100644 --- a/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/meta/meta.go +++ b/awsproviderlint/vendor/github.com/hashicorp/terraform-plugin-sdk/v2/meta/meta.go @@ -11,7 +11,7 @@ import ( ) // The main version number that is being run at the moment. -var SDKVersion = "2.4.3" +var SDKVersion = "2.5.0" // A pre-release marker for the version. If this is "" (empty string) // then it means that it is a final release. Otherwise, this is a pre-release diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/LICENSE b/awsproviderlint/vendor/github.com/klauspost/compress/LICENSE new file mode 100644 index 000000000000..1eb75ef68e44 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/LICENSE @@ -0,0 +1,28 @@ +Copyright (c) 2012 The Go Authors. All rights reserved. +Copyright (c) 2019 Klaus Post. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/fse/README.md b/awsproviderlint/vendor/github.com/klauspost/compress/fse/README.md new file mode 100644 index 000000000000..ea7324da671f --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/fse/README.md @@ -0,0 +1,79 @@ +# Finite State Entropy + +This package provides Finite State Entropy encoding and decoding. + +Finite State Entropy (also referenced as [tANS](https://en.wikipedia.org/wiki/Asymmetric_numeral_systems#tANS)) +encoding provides a fast near-optimal symbol encoding/decoding +for byte blocks as implemented in [zstandard](https://github.com/facebook/zstd). + +This can be used for compressing input with a lot of similar input values to the smallest number of bytes. +This does not perform any multi-byte [dictionary coding](https://en.wikipedia.org/wiki/Dictionary_coder) as LZ coders, +but it can be used as a secondary step to compressors (like Snappy) that does not do entropy encoding. + +* [Godoc documentation](https://godoc.org/github.com/klauspost/compress/fse) + +## News + + * Feb 2018: First implementation released. Consider this beta software for now. + +# Usage + +This package provides a low level interface that allows to compress single independent blocks. + +Each block is separate, and there is no built in integrity checks. +This means that the caller should keep track of block sizes and also do checksums if needed. + +Compressing a block is done via the [`Compress`](https://godoc.org/github.com/klauspost/compress/fse#Compress) function. +You must provide input and will receive the output and maybe an error. + +These error values can be returned: + +| Error | Description | +|---------------------|-----------------------------------------------------------------------------| +| `` | Everything ok, output is returned | +| `ErrIncompressible` | Returned when input is judged to be too hard to compress | +| `ErrUseRLE` | Returned from the compressor when the input is a single byte value repeated | +| `(error)` | An internal error occurred. | + +As can be seen above there are errors that will be returned even under normal operation so it is important to handle these. + +To reduce allocations you can provide a [`Scratch`](https://godoc.org/github.com/klauspost/compress/fse#Scratch) object +that can be re-used for successive calls. Both compression and decompression accepts a `Scratch` object, and the same +object can be used for both. + +Be aware, that when re-using a `Scratch` object that the *output* buffer is also re-used, so if you are still using this +you must set the `Out` field in the scratch to nil. The same buffer is used for compression and decompression output. + +Decompressing is done by calling the [`Decompress`](https://godoc.org/github.com/klauspost/compress/fse#Decompress) function. +You must provide the output from the compression stage, at exactly the size you got back. If you receive an error back +your input was likely corrupted. + +It is important to note that a successful decoding does *not* mean your output matches your original input. +There are no integrity checks, so relying on errors from the decompressor does not assure your data is valid. + +For more detailed usage, see examples in the [godoc documentation](https://godoc.org/github.com/klauspost/compress/fse#pkg-examples). + +# Performance + +A lot of factors are affecting speed. Block sizes and compressibility of the material are primary factors. +All compression functions are currently only running on the calling goroutine so only one core will be used per block. + +The compressor is significantly faster if symbols are kept as small as possible. The highest byte value of the input +is used to reduce some of the processing, so if all your input is above byte value 64 for instance, it may be +beneficial to transpose all your input values down by 64. + +With moderate block sizes around 64k speed are typically 200MB/s per core for compression and +around 300MB/s decompression speed. + +The same hardware typically does Huffman (deflate) encoding at 125MB/s and decompression at 100MB/s. + +# Plans + +At one point, more internals will be exposed to facilitate more "expert" usage of the components. + +A streaming interface is also likely to be implemented. Likely compatible with [FSE stream format](https://github.com/Cyan4973/FiniteStateEntropy/blob/dev/programs/fileio.c#L261). + +# Contributing + +Contributions are always welcome. Be aware that adding public functions will require good justification and breaking +changes will likely not be accepted. If in doubt open an issue before writing the PR. \ No newline at end of file diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/fse/bitreader.go b/awsproviderlint/vendor/github.com/klauspost/compress/fse/bitreader.go new file mode 100644 index 000000000000..f65eb3909cf4 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/fse/bitreader.go @@ -0,0 +1,122 @@ +// Copyright 2018 Klaus Post. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// Based on work Copyright (c) 2013, Yann Collet, released under BSD License. + +package fse + +import ( + "encoding/binary" + "errors" + "io" +) + +// bitReader reads a bitstream in reverse. +// The last set bit indicates the start of the stream and is used +// for aligning the input. +type bitReader struct { + in []byte + off uint // next byte to read is at in[off - 1] + value uint64 + bitsRead uint8 +} + +// init initializes and resets the bit reader. +func (b *bitReader) init(in []byte) error { + if len(in) < 1 { + return errors.New("corrupt stream: too short") + } + b.in = in + b.off = uint(len(in)) + // The highest bit of the last byte indicates where to start + v := in[len(in)-1] + if v == 0 { + return errors.New("corrupt stream, did not find end of stream") + } + b.bitsRead = 64 + b.value = 0 + if len(in) >= 8 { + b.fillFastStart() + } else { + b.fill() + b.fill() + } + b.bitsRead += 8 - uint8(highBits(uint32(v))) + return nil +} + +// getBits will return n bits. n can be 0. +func (b *bitReader) getBits(n uint8) uint16 { + if n == 0 || b.bitsRead >= 64 { + return 0 + } + return b.getBitsFast(n) +} + +// getBitsFast requires that at least one bit is requested every time. +// There are no checks if the buffer is filled. +func (b *bitReader) getBitsFast(n uint8) uint16 { + const regMask = 64 - 1 + v := uint16((b.value << (b.bitsRead & regMask)) >> ((regMask + 1 - n) & regMask)) + b.bitsRead += n + return v +} + +// fillFast() will make sure at least 32 bits are available. +// There must be at least 4 bytes available. +func (b *bitReader) fillFast() { + if b.bitsRead < 32 { + return + } + // 2 bounds checks. + v := b.in[b.off-4:] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + b.value = (b.value << 32) | uint64(low) + b.bitsRead -= 32 + b.off -= 4 +} + +// fill() will make sure at least 32 bits are available. +func (b *bitReader) fill() { + if b.bitsRead < 32 { + return + } + if b.off > 4 { + v := b.in[b.off-4:] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + b.value = (b.value << 32) | uint64(low) + b.bitsRead -= 32 + b.off -= 4 + return + } + for b.off > 0 { + b.value = (b.value << 8) | uint64(b.in[b.off-1]) + b.bitsRead -= 8 + b.off-- + } +} + +// fillFastStart() assumes the bitreader is empty and there is at least 8 bytes to read. +func (b *bitReader) fillFastStart() { + // Do single re-slice to avoid bounds checks. + b.value = binary.LittleEndian.Uint64(b.in[b.off-8:]) + b.bitsRead = 0 + b.off -= 8 +} + +// finished returns true if all bits have been read from the bit stream. +func (b *bitReader) finished() bool { + return b.bitsRead >= 64 && b.off == 0 +} + +// close the bitstream and returns an error if out-of-buffer reads occurred. +func (b *bitReader) close() error { + // Release reference. + b.in = nil + if b.bitsRead > 64 { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/fse/bitwriter.go b/awsproviderlint/vendor/github.com/klauspost/compress/fse/bitwriter.go new file mode 100644 index 000000000000..43e463611b15 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/fse/bitwriter.go @@ -0,0 +1,168 @@ +// Copyright 2018 Klaus Post. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// Based on work Copyright (c) 2013, Yann Collet, released under BSD License. + +package fse + +import "fmt" + +// bitWriter will write bits. +// First bit will be LSB of the first byte of output. +type bitWriter struct { + bitContainer uint64 + nBits uint8 + out []byte +} + +// bitMask16 is bitmasks. Has extra to avoid bounds check. +var bitMask16 = [32]uint16{ + 0, 1, 3, 7, 0xF, 0x1F, + 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF, 0x7FF, + 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF} /* up to 16 bits */ + +// addBits16NC will add up to 16 bits. +// It will not check if there is space for them, +// so the caller must ensure that it has flushed recently. +func (b *bitWriter) addBits16NC(value uint16, bits uint8) { + b.bitContainer |= uint64(value&bitMask16[bits&31]) << (b.nBits & 63) + b.nBits += bits +} + +// addBits16Clean will add up to 16 bits. value may not contain more set bits than indicated. +// It will not check if there is space for them, so the caller must ensure that it has flushed recently. +func (b *bitWriter) addBits16Clean(value uint16, bits uint8) { + b.bitContainer |= uint64(value) << (b.nBits & 63) + b.nBits += bits +} + +// addBits16ZeroNC will add up to 16 bits. +// It will not check if there is space for them, +// so the caller must ensure that it has flushed recently. +// This is fastest if bits can be zero. +func (b *bitWriter) addBits16ZeroNC(value uint16, bits uint8) { + if bits == 0 { + return + } + value <<= (16 - bits) & 15 + value >>= (16 - bits) & 15 + b.bitContainer |= uint64(value) << (b.nBits & 63) + b.nBits += bits +} + +// flush will flush all pending full bytes. +// There will be at least 56 bits available for writing when this has been called. +// Using flush32 is faster, but leaves less space for writing. +func (b *bitWriter) flush() { + v := b.nBits >> 3 + switch v { + case 0: + case 1: + b.out = append(b.out, + byte(b.bitContainer), + ) + case 2: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + ) + case 3: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + ) + case 4: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + ) + case 5: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + ) + case 6: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + byte(b.bitContainer>>40), + ) + case 7: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + byte(b.bitContainer>>40), + byte(b.bitContainer>>48), + ) + case 8: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + byte(b.bitContainer>>40), + byte(b.bitContainer>>48), + byte(b.bitContainer>>56), + ) + default: + panic(fmt.Errorf("bits (%d) > 64", b.nBits)) + } + b.bitContainer >>= v << 3 + b.nBits &= 7 +} + +// flush32 will flush out, so there are at least 32 bits available for writing. +func (b *bitWriter) flush32() { + if b.nBits < 32 { + return + } + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24)) + b.nBits -= 32 + b.bitContainer >>= 32 +} + +// flushAlign will flush remaining full bytes and align to next byte boundary. +func (b *bitWriter) flushAlign() { + nbBytes := (b.nBits + 7) >> 3 + for i := uint8(0); i < nbBytes; i++ { + b.out = append(b.out, byte(b.bitContainer>>(i*8))) + } + b.nBits = 0 + b.bitContainer = 0 +} + +// close will write the alignment bit and write the final byte(s) +// to the output. +func (b *bitWriter) close() error { + // End mark + b.addBits16Clean(1, 1) + // flush until next byte. + b.flushAlign() + return nil +} + +// reset and continue writing by appending to out. +func (b *bitWriter) reset(out []byte) { + b.bitContainer = 0 + b.nBits = 0 + b.out = out +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/fse/bytereader.go b/awsproviderlint/vendor/github.com/klauspost/compress/fse/bytereader.go new file mode 100644 index 000000000000..abade2d60527 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/fse/bytereader.go @@ -0,0 +1,47 @@ +// Copyright 2018 Klaus Post. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// Based on work Copyright (c) 2013, Yann Collet, released under BSD License. + +package fse + +// byteReader provides a byte reader that reads +// little endian values from a byte stream. +// The input stream is manually advanced. +// The reader performs no bounds checks. +type byteReader struct { + b []byte + off int +} + +// init will initialize the reader and set the input. +func (b *byteReader) init(in []byte) { + b.b = in + b.off = 0 +} + +// advance the stream b n bytes. +func (b *byteReader) advance(n uint) { + b.off += int(n) +} + +// Uint32 returns a little endian uint32 starting at current offset. +func (b byteReader) Uint32() uint32 { + b2 := b.b[b.off:] + b2 = b2[:4] + v3 := uint32(b2[3]) + v2 := uint32(b2[2]) + v1 := uint32(b2[1]) + v0 := uint32(b2[0]) + return v0 | (v1 << 8) | (v2 << 16) | (v3 << 24) +} + +// unread returns the unread portion of the input. +func (b byteReader) unread() []byte { + return b.b[b.off:] +} + +// remain will return the number of bytes remaining. +func (b byteReader) remain() int { + return len(b.b) - b.off +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/fse/compress.go b/awsproviderlint/vendor/github.com/klauspost/compress/fse/compress.go new file mode 100644 index 000000000000..b69237c9b8f5 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/fse/compress.go @@ -0,0 +1,684 @@ +// Copyright 2018 Klaus Post. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// Based on work Copyright (c) 2013, Yann Collet, released under BSD License. + +package fse + +import ( + "errors" + "fmt" +) + +// Compress the input bytes. Input must be < 2GB. +// Provide a Scratch buffer to avoid memory allocations. +// Note that the output is also kept in the scratch buffer. +// If input is too hard to compress, ErrIncompressible is returned. +// If input is a single byte value repeated ErrUseRLE is returned. +func Compress(in []byte, s *Scratch) ([]byte, error) { + if len(in) <= 1 { + return nil, ErrIncompressible + } + if len(in) > (2<<30)-1 { + return nil, errors.New("input too big, must be < 2GB") + } + s, err := s.prepare(in) + if err != nil { + return nil, err + } + + // Create histogram, if none was provided. + maxCount := s.maxCount + if maxCount == 0 { + maxCount = s.countSimple(in) + } + // Reset for next run. + s.clearCount = true + s.maxCount = 0 + if maxCount == len(in) { + // One symbol, use RLE + return nil, ErrUseRLE + } + if maxCount == 1 || maxCount < (len(in)>>7) { + // Each symbol present maximum once or too well distributed. + return nil, ErrIncompressible + } + s.optimalTableLog() + err = s.normalizeCount() + if err != nil { + return nil, err + } + err = s.writeCount() + if err != nil { + return nil, err + } + + if false { + err = s.validateNorm() + if err != nil { + return nil, err + } + } + + err = s.buildCTable() + if err != nil { + return nil, err + } + err = s.compress(in) + if err != nil { + return nil, err + } + s.Out = s.bw.out + // Check if we compressed. + if len(s.Out) >= len(in) { + return nil, ErrIncompressible + } + return s.Out, nil +} + +// cState contains the compression state of a stream. +type cState struct { + bw *bitWriter + stateTable []uint16 + state uint16 +} + +// init will initialize the compression state to the first symbol of the stream. +func (c *cState) init(bw *bitWriter, ct *cTable, tableLog uint8, first symbolTransform) { + c.bw = bw + c.stateTable = ct.stateTable + + nbBitsOut := (first.deltaNbBits + (1 << 15)) >> 16 + im := int32((nbBitsOut << 16) - first.deltaNbBits) + lu := (im >> nbBitsOut) + first.deltaFindState + c.state = c.stateTable[lu] + return +} + +// encode the output symbol provided and write it to the bitstream. +func (c *cState) encode(symbolTT symbolTransform) { + nbBitsOut := (uint32(c.state) + symbolTT.deltaNbBits) >> 16 + dstState := int32(c.state>>(nbBitsOut&15)) + symbolTT.deltaFindState + c.bw.addBits16NC(c.state, uint8(nbBitsOut)) + c.state = c.stateTable[dstState] +} + +// encode the output symbol provided and write it to the bitstream. +func (c *cState) encodeZero(symbolTT symbolTransform) { + nbBitsOut := (uint32(c.state) + symbolTT.deltaNbBits) >> 16 + dstState := int32(c.state>>(nbBitsOut&15)) + symbolTT.deltaFindState + c.bw.addBits16ZeroNC(c.state, uint8(nbBitsOut)) + c.state = c.stateTable[dstState] +} + +// flush will write the tablelog to the output and flush the remaining full bytes. +func (c *cState) flush(tableLog uint8) { + c.bw.flush32() + c.bw.addBits16NC(c.state, tableLog) + c.bw.flush() +} + +// compress is the main compression loop that will encode the input from the last byte to the first. +func (s *Scratch) compress(src []byte) error { + if len(src) <= 2 { + return errors.New("compress: src too small") + } + tt := s.ct.symbolTT[:256] + s.bw.reset(s.Out) + + // Our two states each encodes every second byte. + // Last byte encoded (first byte decoded) will always be encoded by c1. + var c1, c2 cState + + // Encode so remaining size is divisible by 4. + ip := len(src) + if ip&1 == 1 { + c1.init(&s.bw, &s.ct, s.actualTableLog, tt[src[ip-1]]) + c2.init(&s.bw, &s.ct, s.actualTableLog, tt[src[ip-2]]) + c1.encodeZero(tt[src[ip-3]]) + ip -= 3 + } else { + c2.init(&s.bw, &s.ct, s.actualTableLog, tt[src[ip-1]]) + c1.init(&s.bw, &s.ct, s.actualTableLog, tt[src[ip-2]]) + ip -= 2 + } + if ip&2 != 0 { + c2.encodeZero(tt[src[ip-1]]) + c1.encodeZero(tt[src[ip-2]]) + ip -= 2 + } + + // Main compression loop. + switch { + case !s.zeroBits && s.actualTableLog <= 8: + // We can encode 4 symbols without requiring a flush. + // We do not need to check if any output is 0 bits. + for ip >= 4 { + s.bw.flush32() + v3, v2, v1, v0 := src[ip-4], src[ip-3], src[ip-2], src[ip-1] + c2.encode(tt[v0]) + c1.encode(tt[v1]) + c2.encode(tt[v2]) + c1.encode(tt[v3]) + ip -= 4 + } + case !s.zeroBits: + // We do not need to check if any output is 0 bits. + for ip >= 4 { + s.bw.flush32() + v3, v2, v1, v0 := src[ip-4], src[ip-3], src[ip-2], src[ip-1] + c2.encode(tt[v0]) + c1.encode(tt[v1]) + s.bw.flush32() + c2.encode(tt[v2]) + c1.encode(tt[v3]) + ip -= 4 + } + case s.actualTableLog <= 8: + // We can encode 4 symbols without requiring a flush + for ip >= 4 { + s.bw.flush32() + v3, v2, v1, v0 := src[ip-4], src[ip-3], src[ip-2], src[ip-1] + c2.encodeZero(tt[v0]) + c1.encodeZero(tt[v1]) + c2.encodeZero(tt[v2]) + c1.encodeZero(tt[v3]) + ip -= 4 + } + default: + for ip >= 4 { + s.bw.flush32() + v3, v2, v1, v0 := src[ip-4], src[ip-3], src[ip-2], src[ip-1] + c2.encodeZero(tt[v0]) + c1.encodeZero(tt[v1]) + s.bw.flush32() + c2.encodeZero(tt[v2]) + c1.encodeZero(tt[v3]) + ip -= 4 + } + } + + // Flush final state. + // Used to initialize state when decoding. + c2.flush(s.actualTableLog) + c1.flush(s.actualTableLog) + + return s.bw.close() +} + +// writeCount will write the normalized histogram count to header. +// This is read back by readNCount. +func (s *Scratch) writeCount() error { + var ( + tableLog = s.actualTableLog + tableSize = 1 << tableLog + previous0 bool + charnum uint16 + + maxHeaderSize = ((int(s.symbolLen) * int(tableLog)) >> 3) + 3 + + // Write Table Size + bitStream = uint32(tableLog - minTablelog) + bitCount = uint(4) + remaining = int16(tableSize + 1) /* +1 for extra accuracy */ + threshold = int16(tableSize) + nbBits = uint(tableLog + 1) + ) + if cap(s.Out) < maxHeaderSize { + s.Out = make([]byte, 0, s.br.remain()+maxHeaderSize) + } + outP := uint(0) + out := s.Out[:maxHeaderSize] + + // stops at 1 + for remaining > 1 { + if previous0 { + start := charnum + for s.norm[charnum] == 0 { + charnum++ + } + for charnum >= start+24 { + start += 24 + bitStream += uint32(0xFFFF) << bitCount + out[outP] = byte(bitStream) + out[outP+1] = byte(bitStream >> 8) + outP += 2 + bitStream >>= 16 + } + for charnum >= start+3 { + start += 3 + bitStream += 3 << bitCount + bitCount += 2 + } + bitStream += uint32(charnum-start) << bitCount + bitCount += 2 + if bitCount > 16 { + out[outP] = byte(bitStream) + out[outP+1] = byte(bitStream >> 8) + outP += 2 + bitStream >>= 16 + bitCount -= 16 + } + } + + count := s.norm[charnum] + charnum++ + max := (2*threshold - 1) - remaining + if count < 0 { + remaining += count + } else { + remaining -= count + } + count++ // +1 for extra accuracy + if count >= threshold { + count += max // [0..max[ [max..threshold[ (...) [threshold+max 2*threshold[ + } + bitStream += uint32(count) << bitCount + bitCount += nbBits + if count < max { + bitCount-- + } + + previous0 = count == 1 + if remaining < 1 { + return errors.New("internal error: remaining<1") + } + for remaining < threshold { + nbBits-- + threshold >>= 1 + } + + if bitCount > 16 { + out[outP] = byte(bitStream) + out[outP+1] = byte(bitStream >> 8) + outP += 2 + bitStream >>= 16 + bitCount -= 16 + } + } + + out[outP] = byte(bitStream) + out[outP+1] = byte(bitStream >> 8) + outP += (bitCount + 7) / 8 + + if uint16(charnum) > s.symbolLen { + return errors.New("internal error: charnum > s.symbolLen") + } + s.Out = out[:outP] + return nil +} + +// symbolTransform contains the state transform for a symbol. +type symbolTransform struct { + deltaFindState int32 + deltaNbBits uint32 +} + +// String prints values as a human readable string. +func (s symbolTransform) String() string { + return fmt.Sprintf("dnbits: %08x, fs:%d", s.deltaNbBits, s.deltaFindState) +} + +// cTable contains tables used for compression. +type cTable struct { + tableSymbol []byte + stateTable []uint16 + symbolTT []symbolTransform +} + +// allocCtable will allocate tables needed for compression. +// If existing tables a re big enough, they are simply re-used. +func (s *Scratch) allocCtable() { + tableSize := 1 << s.actualTableLog + // get tableSymbol that is big enough. + if cap(s.ct.tableSymbol) < int(tableSize) { + s.ct.tableSymbol = make([]byte, tableSize) + } + s.ct.tableSymbol = s.ct.tableSymbol[:tableSize] + + ctSize := tableSize + if cap(s.ct.stateTable) < ctSize { + s.ct.stateTable = make([]uint16, ctSize) + } + s.ct.stateTable = s.ct.stateTable[:ctSize] + + if cap(s.ct.symbolTT) < 256 { + s.ct.symbolTT = make([]symbolTransform, 256) + } + s.ct.symbolTT = s.ct.symbolTT[:256] +} + +// buildCTable will populate the compression table so it is ready to be used. +func (s *Scratch) buildCTable() error { + tableSize := uint32(1 << s.actualTableLog) + highThreshold := tableSize - 1 + var cumul [maxSymbolValue + 2]int16 + + s.allocCtable() + tableSymbol := s.ct.tableSymbol[:tableSize] + // symbol start positions + { + cumul[0] = 0 + for ui, v := range s.norm[:s.symbolLen-1] { + u := byte(ui) // one less than reference + if v == -1 { + // Low proba symbol + cumul[u+1] = cumul[u] + 1 + tableSymbol[highThreshold] = u + highThreshold-- + } else { + cumul[u+1] = cumul[u] + v + } + } + // Encode last symbol separately to avoid overflowing u + u := int(s.symbolLen - 1) + v := s.norm[s.symbolLen-1] + if v == -1 { + // Low proba symbol + cumul[u+1] = cumul[u] + 1 + tableSymbol[highThreshold] = byte(u) + highThreshold-- + } else { + cumul[u+1] = cumul[u] + v + } + if uint32(cumul[s.symbolLen]) != tableSize { + return fmt.Errorf("internal error: expected cumul[s.symbolLen] (%d) == tableSize (%d)", cumul[s.symbolLen], tableSize) + } + cumul[s.symbolLen] = int16(tableSize) + 1 + } + // Spread symbols + s.zeroBits = false + { + step := tableStep(tableSize) + tableMask := tableSize - 1 + var position uint32 + // if any symbol > largeLimit, we may have 0 bits output. + largeLimit := int16(1 << (s.actualTableLog - 1)) + for ui, v := range s.norm[:s.symbolLen] { + symbol := byte(ui) + if v > largeLimit { + s.zeroBits = true + } + for nbOccurrences := int16(0); nbOccurrences < v; nbOccurrences++ { + tableSymbol[position] = symbol + position = (position + step) & tableMask + for position > highThreshold { + position = (position + step) & tableMask + } /* Low proba area */ + } + } + + // Check if we have gone through all positions + if position != 0 { + return errors.New("position!=0") + } + } + + // Build table + table := s.ct.stateTable + { + tsi := int(tableSize) + for u, v := range tableSymbol { + // TableU16 : sorted by symbol order; gives next state value + table[cumul[v]] = uint16(tsi + u) + cumul[v]++ + } + } + + // Build Symbol Transformation Table + { + total := int16(0) + symbolTT := s.ct.symbolTT[:s.symbolLen] + tableLog := s.actualTableLog + tl := (uint32(tableLog) << 16) - (1 << tableLog) + for i, v := range s.norm[:s.symbolLen] { + switch v { + case 0: + case -1, 1: + symbolTT[i].deltaNbBits = tl + symbolTT[i].deltaFindState = int32(total - 1) + total++ + default: + maxBitsOut := uint32(tableLog) - highBits(uint32(v-1)) + minStatePlus := uint32(v) << maxBitsOut + symbolTT[i].deltaNbBits = (maxBitsOut << 16) - minStatePlus + symbolTT[i].deltaFindState = int32(total - v) + total += v + } + } + if total != int16(tableSize) { + return fmt.Errorf("total mismatch %d (got) != %d (want)", total, tableSize) + } + } + return nil +} + +// countSimple will create a simple histogram in s.count. +// Returns the biggest count. +// Does not update s.clearCount. +func (s *Scratch) countSimple(in []byte) (max int) { + for _, v := range in { + s.count[v]++ + } + m := uint32(0) + for i, v := range s.count[:] { + if v > m { + m = v + } + if v > 0 { + s.symbolLen = uint16(i) + 1 + } + } + return int(m) +} + +// minTableLog provides the minimum logSize to safely represent a distribution. +func (s *Scratch) minTableLog() uint8 { + minBitsSrc := highBits(uint32(s.br.remain()-1)) + 1 + minBitsSymbols := highBits(uint32(s.symbolLen-1)) + 2 + if minBitsSrc < minBitsSymbols { + return uint8(minBitsSrc) + } + return uint8(minBitsSymbols) +} + +// optimalTableLog calculates and sets the optimal tableLog in s.actualTableLog +func (s *Scratch) optimalTableLog() { + tableLog := s.TableLog + minBits := s.minTableLog() + maxBitsSrc := uint8(highBits(uint32(s.br.remain()-1))) - 2 + if maxBitsSrc < tableLog { + // Accuracy can be reduced + tableLog = maxBitsSrc + } + if minBits > tableLog { + tableLog = minBits + } + // Need a minimum to safely represent all symbol values + if tableLog < minTablelog { + tableLog = minTablelog + } + if tableLog > maxTableLog { + tableLog = maxTableLog + } + s.actualTableLog = tableLog +} + +var rtbTable = [...]uint32{0, 473195, 504333, 520860, 550000, 700000, 750000, 830000} + +// normalizeCount will normalize the count of the symbols so +// the total is equal to the table size. +func (s *Scratch) normalizeCount() error { + var ( + tableLog = s.actualTableLog + scale = 62 - uint64(tableLog) + step = (1 << 62) / uint64(s.br.remain()) + vStep = uint64(1) << (scale - 20) + stillToDistribute = int16(1 << tableLog) + largest int + largestP int16 + lowThreshold = (uint32)(s.br.remain() >> tableLog) + ) + + for i, cnt := range s.count[:s.symbolLen] { + // already handled + // if (count[s] == s.length) return 0; /* rle special case */ + + if cnt == 0 { + s.norm[i] = 0 + continue + } + if cnt <= lowThreshold { + s.norm[i] = -1 + stillToDistribute-- + } else { + proba := (int16)((uint64(cnt) * step) >> scale) + if proba < 8 { + restToBeat := vStep * uint64(rtbTable[proba]) + v := uint64(cnt)*step - (uint64(proba) << scale) + if v > restToBeat { + proba++ + } + } + if proba > largestP { + largestP = proba + largest = i + } + s.norm[i] = proba + stillToDistribute -= proba + } + } + + if -stillToDistribute >= (s.norm[largest] >> 1) { + // corner case, need another normalization method + return s.normalizeCount2() + } + s.norm[largest] += stillToDistribute + return nil +} + +// Secondary normalization method. +// To be used when primary method fails. +func (s *Scratch) normalizeCount2() error { + const notYetAssigned = -2 + var ( + distributed uint32 + total = uint32(s.br.remain()) + tableLog = s.actualTableLog + lowThreshold = uint32(total >> tableLog) + lowOne = uint32((total * 3) >> (tableLog + 1)) + ) + for i, cnt := range s.count[:s.symbolLen] { + if cnt == 0 { + s.norm[i] = 0 + continue + } + if cnt <= lowThreshold { + s.norm[i] = -1 + distributed++ + total -= cnt + continue + } + if cnt <= lowOne { + s.norm[i] = 1 + distributed++ + total -= cnt + continue + } + s.norm[i] = notYetAssigned + } + toDistribute := (1 << tableLog) - distributed + + if (total / toDistribute) > lowOne { + // risk of rounding to zero + lowOne = uint32((total * 3) / (toDistribute * 2)) + for i, cnt := range s.count[:s.symbolLen] { + if (s.norm[i] == notYetAssigned) && (cnt <= lowOne) { + s.norm[i] = 1 + distributed++ + total -= cnt + continue + } + } + toDistribute = (1 << tableLog) - distributed + } + if distributed == uint32(s.symbolLen)+1 { + // all values are pretty poor; + // probably incompressible data (should have already been detected); + // find max, then give all remaining points to max + var maxV int + var maxC uint32 + for i, cnt := range s.count[:s.symbolLen] { + if cnt > maxC { + maxV = i + maxC = cnt + } + } + s.norm[maxV] += int16(toDistribute) + return nil + } + + if total == 0 { + // all of the symbols were low enough for the lowOne or lowThreshold + for i := uint32(0); toDistribute > 0; i = (i + 1) % (uint32(s.symbolLen)) { + if s.norm[i] > 0 { + toDistribute-- + s.norm[i]++ + } + } + return nil + } + + var ( + vStepLog = 62 - uint64(tableLog) + mid = uint64((1 << (vStepLog - 1)) - 1) + rStep = (((1 << vStepLog) * uint64(toDistribute)) + mid) / uint64(total) // scale on remaining + tmpTotal = mid + ) + for i, cnt := range s.count[:s.symbolLen] { + if s.norm[i] == notYetAssigned { + var ( + end = tmpTotal + uint64(cnt)*rStep + sStart = uint32(tmpTotal >> vStepLog) + sEnd = uint32(end >> vStepLog) + weight = sEnd - sStart + ) + if weight < 1 { + return errors.New("weight < 1") + } + s.norm[i] = int16(weight) + tmpTotal = end + } + } + return nil +} + +// validateNorm validates the normalized histogram table. +func (s *Scratch) validateNorm() (err error) { + var total int + for _, v := range s.norm[:s.symbolLen] { + if v >= 0 { + total += int(v) + } else { + total -= int(v) + } + } + defer func() { + if err == nil { + return + } + fmt.Printf("selected TableLog: %d, Symbol length: %d\n", s.actualTableLog, s.symbolLen) + for i, v := range s.norm[:s.symbolLen] { + fmt.Printf("%3d: %5d -> %4d \n", i, s.count[i], v) + } + }() + if total != (1 << s.actualTableLog) { + return fmt.Errorf("warning: Total == %d != %d", total, 1< tablelogAbsoluteMax { + return errors.New("tableLog too large") + } + bitStream >>= 4 + bitCount := uint(4) + + s.actualTableLog = uint8(nbBits) + remaining := int32((1 << nbBits) + 1) + threshold := int32(1 << nbBits) + gotTotal := int32(0) + nbBits++ + + for remaining > 1 { + if previous0 { + n0 := charnum + for (bitStream & 0xFFFF) == 0xFFFF { + n0 += 24 + if b.off < iend-5 { + b.advance(2) + bitStream = b.Uint32() >> bitCount + } else { + bitStream >>= 16 + bitCount += 16 + } + } + for (bitStream & 3) == 3 { + n0 += 3 + bitStream >>= 2 + bitCount += 2 + } + n0 += uint16(bitStream & 3) + bitCount += 2 + if n0 > maxSymbolValue { + return errors.New("maxSymbolValue too small") + } + for charnum < n0 { + s.norm[charnum&0xff] = 0 + charnum++ + } + + if b.off <= iend-7 || b.off+int(bitCount>>3) <= iend-4 { + b.advance(bitCount >> 3) + bitCount &= 7 + bitStream = b.Uint32() >> bitCount + } else { + bitStream >>= 2 + } + } + + max := (2*(threshold) - 1) - (remaining) + var count int32 + + if (int32(bitStream) & (threshold - 1)) < max { + count = int32(bitStream) & (threshold - 1) + bitCount += nbBits - 1 + } else { + count = int32(bitStream) & (2*threshold - 1) + if count >= threshold { + count -= max + } + bitCount += nbBits + } + + count-- // extra accuracy + if count < 0 { + // -1 means +1 + remaining += count + gotTotal -= count + } else { + remaining -= count + gotTotal += count + } + s.norm[charnum&0xff] = int16(count) + charnum++ + previous0 = count == 0 + for remaining < threshold { + nbBits-- + threshold >>= 1 + } + if b.off <= iend-7 || b.off+int(bitCount>>3) <= iend-4 { + b.advance(bitCount >> 3) + bitCount &= 7 + } else { + bitCount -= (uint)(8 * (len(b.b) - 4 - b.off)) + b.off = len(b.b) - 4 + } + bitStream = b.Uint32() >> (bitCount & 31) + } + s.symbolLen = charnum + + if s.symbolLen <= 1 { + return fmt.Errorf("symbolLen (%d) too small", s.symbolLen) + } + if s.symbolLen > maxSymbolValue+1 { + return fmt.Errorf("symbolLen (%d) too big", s.symbolLen) + } + if remaining != 1 { + return fmt.Errorf("corruption detected (remaining %d != 1)", remaining) + } + if bitCount > 32 { + return fmt.Errorf("corruption detected (bitCount %d > 32)", bitCount) + } + if gotTotal != 1<> 3) + return nil +} + +// decSymbol contains information about a state entry, +// Including the state offset base, the output symbol and +// the number of bits to read for the low part of the destination state. +type decSymbol struct { + newState uint16 + symbol uint8 + nbBits uint8 +} + +// allocDtable will allocate decoding tables if they are not big enough. +func (s *Scratch) allocDtable() { + tableSize := 1 << s.actualTableLog + if cap(s.decTable) < int(tableSize) { + s.decTable = make([]decSymbol, tableSize) + } + s.decTable = s.decTable[:tableSize] + + if cap(s.ct.tableSymbol) < 256 { + s.ct.tableSymbol = make([]byte, 256) + } + s.ct.tableSymbol = s.ct.tableSymbol[:256] + + if cap(s.ct.stateTable) < 256 { + s.ct.stateTable = make([]uint16, 256) + } + s.ct.stateTable = s.ct.stateTable[:256] +} + +// buildDtable will build the decoding table. +func (s *Scratch) buildDtable() error { + tableSize := uint32(1 << s.actualTableLog) + highThreshold := tableSize - 1 + s.allocDtable() + symbolNext := s.ct.stateTable[:256] + + // Init, lay down lowprob symbols + s.zeroBits = false + { + largeLimit := int16(1 << (s.actualTableLog - 1)) + for i, v := range s.norm[:s.symbolLen] { + if v == -1 { + s.decTable[highThreshold].symbol = uint8(i) + highThreshold-- + symbolNext[i] = 1 + } else { + if v >= largeLimit { + s.zeroBits = true + } + symbolNext[i] = uint16(v) + } + } + } + // Spread symbols + { + tableMask := tableSize - 1 + step := tableStep(tableSize) + position := uint32(0) + for ss, v := range s.norm[:s.symbolLen] { + for i := 0; i < int(v); i++ { + s.decTable[position].symbol = uint8(ss) + position = (position + step) & tableMask + for position > highThreshold { + // lowprob area + position = (position + step) & tableMask + } + } + } + if position != 0 { + // position must reach all cells once, otherwise normalizedCounter is incorrect + return errors.New("corrupted input (position != 0)") + } + } + + // Build Decoding table + { + tableSize := uint16(1 << s.actualTableLog) + for u, v := range s.decTable { + symbol := v.symbol + nextState := symbolNext[symbol] + symbolNext[symbol] = nextState + 1 + nBits := s.actualTableLog - byte(highBits(uint32(nextState))) + s.decTable[u].nbBits = nBits + newState := (nextState << nBits) - tableSize + if newState >= tableSize { + return fmt.Errorf("newState (%d) outside table size (%d)", newState, tableSize) + } + if newState == uint16(u) && nBits == 0 { + // Seems weird that this is possible with nbits > 0. + return fmt.Errorf("newState (%d) == oldState (%d) and no bits", newState, u) + } + s.decTable[u].newState = newState + } + } + return nil +} + +// decompress will decompress the bitstream. +// If the buffer is over-read an error is returned. +func (s *Scratch) decompress() error { + br := &s.bits + br.init(s.br.unread()) + + var s1, s2 decoder + // Initialize and decode first state and symbol. + s1.init(br, s.decTable, s.actualTableLog) + s2.init(br, s.decTable, s.actualTableLog) + + // Use temp table to avoid bound checks/append penalty. + var tmp = s.ct.tableSymbol[:256] + var off uint8 + + // Main part + if !s.zeroBits { + for br.off >= 8 { + br.fillFast() + tmp[off+0] = s1.nextFast() + tmp[off+1] = s2.nextFast() + br.fillFast() + tmp[off+2] = s1.nextFast() + tmp[off+3] = s2.nextFast() + off += 4 + // When off is 0, we have overflowed and should write. + if off == 0 { + s.Out = append(s.Out, tmp...) + if len(s.Out) >= s.DecompressLimit { + return fmt.Errorf("output size (%d) > DecompressLimit (%d)", len(s.Out), s.DecompressLimit) + } + } + } + } else { + for br.off >= 8 { + br.fillFast() + tmp[off+0] = s1.next() + tmp[off+1] = s2.next() + br.fillFast() + tmp[off+2] = s1.next() + tmp[off+3] = s2.next() + off += 4 + if off == 0 { + s.Out = append(s.Out, tmp...) + // When off is 0, we have overflowed and should write. + if len(s.Out) >= s.DecompressLimit { + return fmt.Errorf("output size (%d) > DecompressLimit (%d)", len(s.Out), s.DecompressLimit) + } + } + } + } + s.Out = append(s.Out, tmp[:off]...) + + // Final bits, a bit more expensive check + for { + if s1.finished() { + s.Out = append(s.Out, s1.final(), s2.final()) + break + } + br.fill() + s.Out = append(s.Out, s1.next()) + if s2.finished() { + s.Out = append(s.Out, s2.final(), s1.final()) + break + } + s.Out = append(s.Out, s2.next()) + if len(s.Out) >= s.DecompressLimit { + return fmt.Errorf("output size (%d) > DecompressLimit (%d)", len(s.Out), s.DecompressLimit) + } + } + return br.close() +} + +// decoder keeps track of the current state and updates it from the bitstream. +type decoder struct { + state uint16 + br *bitReader + dt []decSymbol +} + +// init will initialize the decoder and read the first state from the stream. +func (d *decoder) init(in *bitReader, dt []decSymbol, tableLog uint8) { + d.dt = dt + d.br = in + d.state = uint16(in.getBits(tableLog)) +} + +// next returns the next symbol and sets the next state. +// At least tablelog bits must be available in the bit reader. +func (d *decoder) next() uint8 { + n := &d.dt[d.state] + lowBits := d.br.getBits(n.nbBits) + d.state = n.newState + lowBits + return n.symbol +} + +// finished returns true if all bits have been read from the bitstream +// and the next state would require reading bits from the input. +func (d *decoder) finished() bool { + return d.br.finished() && d.dt[d.state].nbBits > 0 +} + +// final returns the current state symbol without decoding the next. +func (d *decoder) final() uint8 { + return d.dt[d.state].symbol +} + +// nextFast returns the next symbol and sets the next state. +// This can only be used if no symbols are 0 bits. +// At least tablelog bits must be available in the bit reader. +func (d *decoder) nextFast() uint8 { + n := d.dt[d.state] + lowBits := d.br.getBitsFast(n.nbBits) + d.state = n.newState + lowBits + return n.symbol +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/fse/fse.go b/awsproviderlint/vendor/github.com/klauspost/compress/fse/fse.go new file mode 100644 index 000000000000..535cbadfdea1 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/fse/fse.go @@ -0,0 +1,144 @@ +// Copyright 2018 Klaus Post. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// Based on work Copyright (c) 2013, Yann Collet, released under BSD License. + +// Package fse provides Finite State Entropy encoding and decoding. +// +// Finite State Entropy encoding provides a fast near-optimal symbol encoding/decoding +// for byte blocks as implemented in zstd. +// +// See https://github.com/klauspost/compress/tree/master/fse for more information. +package fse + +import ( + "errors" + "fmt" + "math/bits" +) + +const ( + /*!MEMORY_USAGE : + * Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) + * Increasing memory usage improves compression ratio + * Reduced memory usage can improve speed, due to cache effect + * Recommended max value is 14, for 16KB, which nicely fits into Intel x86 L1 cache */ + maxMemoryUsage = 14 + defaultMemoryUsage = 13 + + maxTableLog = maxMemoryUsage - 2 + maxTablesize = 1 << maxTableLog + defaultTablelog = defaultMemoryUsage - 2 + minTablelog = 5 + maxSymbolValue = 255 +) + +var ( + // ErrIncompressible is returned when input is judged to be too hard to compress. + ErrIncompressible = errors.New("input is not compressible") + + // ErrUseRLE is returned from the compressor when the input is a single byte value repeated. + ErrUseRLE = errors.New("input is single value repeated") +) + +// Scratch provides temporary storage for compression and decompression. +type Scratch struct { + // Private + count [maxSymbolValue + 1]uint32 + norm [maxSymbolValue + 1]int16 + br byteReader + bits bitReader + bw bitWriter + ct cTable // Compression tables. + decTable []decSymbol // Decompression table. + maxCount int // count of the most probable symbol + + // Per block parameters. + // These can be used to override compression parameters of the block. + // Do not touch, unless you know what you are doing. + + // Out is output buffer. + // If the scratch is re-used before the caller is done processing the output, + // set this field to nil. + // Otherwise the output buffer will be re-used for next Compression/Decompression step + // and allocation will be avoided. + Out []byte + + // DecompressLimit limits the maximum decoded size acceptable. + // If > 0 decompression will stop when approximately this many bytes + // has been decoded. + // If 0, maximum size will be 2GB. + DecompressLimit int + + symbolLen uint16 // Length of active part of the symbol table. + actualTableLog uint8 // Selected tablelog. + zeroBits bool // no bits has prob > 50%. + clearCount bool // clear count + + // MaxSymbolValue will override the maximum symbol value of the next block. + MaxSymbolValue uint8 + + // TableLog will attempt to override the tablelog for the next block. + TableLog uint8 +} + +// Histogram allows to populate the histogram and skip that step in the compression, +// It otherwise allows to inspect the histogram when compression is done. +// To indicate that you have populated the histogram call HistogramFinished +// with the value of the highest populated symbol, as well as the number of entries +// in the most populated entry. These are accepted at face value. +// The returned slice will always be length 256. +func (s *Scratch) Histogram() []uint32 { + return s.count[:] +} + +// HistogramFinished can be called to indicate that the histogram has been populated. +// maxSymbol is the index of the highest set symbol of the next data segment. +// maxCount is the number of entries in the most populated entry. +// These are accepted at face value. +func (s *Scratch) HistogramFinished(maxSymbol uint8, maxCount int) { + s.maxCount = maxCount + s.symbolLen = uint16(maxSymbol) + 1 + s.clearCount = maxCount != 0 +} + +// prepare will prepare and allocate scratch tables used for both compression and decompression. +func (s *Scratch) prepare(in []byte) (*Scratch, error) { + if s == nil { + s = &Scratch{} + } + if s.MaxSymbolValue == 0 { + s.MaxSymbolValue = 255 + } + if s.TableLog == 0 { + s.TableLog = defaultTablelog + } + if s.TableLog > maxTableLog { + return nil, fmt.Errorf("tableLog (%d) > maxTableLog (%d)", s.TableLog, maxTableLog) + } + if cap(s.Out) == 0 { + s.Out = make([]byte, 0, len(in)) + } + if s.clearCount && s.maxCount == 0 { + for i := range s.count { + s.count[i] = 0 + } + s.clearCount = false + } + s.br.init(in) + if s.DecompressLimit == 0 { + // Max size 2GB. + s.DecompressLimit = (2 << 30) - 1 + } + + return s, nil +} + +// tableStep returns the next table index. +func tableStep(tableSize uint32) uint32 { + return (tableSize >> 1) + (tableSize >> 3) + 3 +} + +func highBits(val uint32) (n uint32) { + return uint32(bits.Len32(val) - 1) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/huff0/.gitignore b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/.gitignore new file mode 100644 index 000000000000..b3d262958f85 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/.gitignore @@ -0,0 +1 @@ +/huff0-fuzz.zip diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/huff0/README.md b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/README.md new file mode 100644 index 000000000000..e12da4db2fd1 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/README.md @@ -0,0 +1,87 @@ +# Huff0 entropy compression + +This package provides Huff0 encoding and decoding as used in zstd. + +[Huff0](https://github.com/Cyan4973/FiniteStateEntropy#new-generation-entropy-coders), +a Huffman codec designed for modern CPU, featuring OoO (Out of Order) operations on multiple ALU +(Arithmetic Logic Unit), achieving extremely fast compression and decompression speeds. + +This can be used for compressing input with a lot of similar input values to the smallest number of bytes. +This does not perform any multi-byte [dictionary coding](https://en.wikipedia.org/wiki/Dictionary_coder) as LZ coders, +but it can be used as a secondary step to compressors (like Snappy) that does not do entropy encoding. + +* [Godoc documentation](https://godoc.org/github.com/klauspost/compress/huff0) + +## News + + * Mar 2018: First implementation released. Consider this beta software for now. + +# Usage + +This package provides a low level interface that allows to compress single independent blocks. + +Each block is separate, and there is no built in integrity checks. +This means that the caller should keep track of block sizes and also do checksums if needed. + +Compressing a block is done via the [`Compress1X`](https://godoc.org/github.com/klauspost/compress/huff0#Compress1X) and +[`Compress4X`](https://godoc.org/github.com/klauspost/compress/huff0#Compress4X) functions. +You must provide input and will receive the output and maybe an error. + +These error values can be returned: + +| Error | Description | +|---------------------|-----------------------------------------------------------------------------| +| `` | Everything ok, output is returned | +| `ErrIncompressible` | Returned when input is judged to be too hard to compress | +| `ErrUseRLE` | Returned from the compressor when the input is a single byte value repeated | +| `ErrTooBig` | Returned if the input block exceeds the maximum allowed size (128 Kib) | +| `(error)` | An internal error occurred. | + + +As can be seen above some of there are errors that will be returned even under normal operation so it is important to handle these. + +To reduce allocations you can provide a [`Scratch`](https://godoc.org/github.com/klauspost/compress/huff0#Scratch) object +that can be re-used for successive calls. Both compression and decompression accepts a `Scratch` object, and the same +object can be used for both. + +Be aware, that when re-using a `Scratch` object that the *output* buffer is also re-used, so if you are still using this +you must set the `Out` field in the scratch to nil. The same buffer is used for compression and decompression output. + +The `Scratch` object will retain state that allows to re-use previous tables for encoding and decoding. + +## Tables and re-use + +Huff0 allows for reusing tables from the previous block to save space if that is expected to give better/faster results. + +The Scratch object allows you to set a [`ReusePolicy`](https://godoc.org/github.com/klauspost/compress/huff0#ReusePolicy) +that controls this behaviour. See the documentation for details. This can be altered between each block. + +Do however note that this information is *not* stored in the output block and it is up to the users of the package to +record whether [`ReadTable`](https://godoc.org/github.com/klauspost/compress/huff0#ReadTable) should be called, +based on the boolean reported back from the CompressXX call. + +If you want to store the table separate from the data, you can access them as `OutData` and `OutTable` on the +[`Scratch`](https://godoc.org/github.com/klauspost/compress/huff0#Scratch) object. + +## Decompressing + +The first part of decoding is to initialize the decoding table through [`ReadTable`](https://godoc.org/github.com/klauspost/compress/huff0#ReadTable). +This will initialize the decoding tables. +You can supply the complete block to `ReadTable` and it will return the data part of the block +which can be given to the decompressor. + +Decompressing is done by calling the [`Decompress1X`](https://godoc.org/github.com/klauspost/compress/huff0#Scratch.Decompress1X) +or [`Decompress4X`](https://godoc.org/github.com/klauspost/compress/huff0#Scratch.Decompress4X) function. + +For concurrently decompressing content with a fixed table a stateless [`Decoder`](https://godoc.org/github.com/klauspost/compress/huff0#Decoder) can be requested which will remain correct as long as the scratch is unchanged. The capacity of the provided slice indicates the expected output size. + +You must provide the output from the compression stage, at exactly the size you got back. If you receive an error back +your input was likely corrupted. + +It is important to note that a successful decoding does *not* mean your output matches your original input. +There are no integrity checks, so relying on errors from the decompressor does not assure your data is valid. + +# Contributing + +Contributions are always welcome. Be aware that adding public functions will require good justification and breaking +changes will likely not be accepted. If in doubt open an issue before writing the PR. diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/huff0/bitreader.go b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/bitreader.go new file mode 100644 index 000000000000..a4979e8868a5 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/bitreader.go @@ -0,0 +1,329 @@ +// Copyright 2018 Klaus Post. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// Based on work Copyright (c) 2013, Yann Collet, released under BSD License. + +package huff0 + +import ( + "encoding/binary" + "errors" + "io" +) + +// bitReader reads a bitstream in reverse. +// The last set bit indicates the start of the stream and is used +// for aligning the input. +type bitReader struct { + in []byte + off uint // next byte to read is at in[off - 1] + value uint64 + bitsRead uint8 +} + +// init initializes and resets the bit reader. +func (b *bitReader) init(in []byte) error { + if len(in) < 1 { + return errors.New("corrupt stream: too short") + } + b.in = in + b.off = uint(len(in)) + // The highest bit of the last byte indicates where to start + v := in[len(in)-1] + if v == 0 { + return errors.New("corrupt stream, did not find end of stream") + } + b.bitsRead = 64 + b.value = 0 + if len(in) >= 8 { + b.fillFastStart() + } else { + b.fill() + b.fill() + } + b.bitsRead += 8 - uint8(highBit32(uint32(v))) + return nil +} + +// peekBitsFast requires that at least one bit is requested every time. +// There are no checks if the buffer is filled. +func (b *bitReader) peekBitsFast(n uint8) uint16 { + const regMask = 64 - 1 + v := uint16((b.value << (b.bitsRead & regMask)) >> ((regMask + 1 - n) & regMask)) + return v +} + +// fillFast() will make sure at least 32 bits are available. +// There must be at least 4 bytes available. +func (b *bitReader) fillFast() { + if b.bitsRead < 32 { + return + } + + // 2 bounds checks. + v := b.in[b.off-4 : b.off] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + b.value = (b.value << 32) | uint64(low) + b.bitsRead -= 32 + b.off -= 4 +} + +func (b *bitReader) advance(n uint8) { + b.bitsRead += n +} + +// fillFastStart() assumes the bitreader is empty and there is at least 8 bytes to read. +func (b *bitReader) fillFastStart() { + // Do single re-slice to avoid bounds checks. + b.value = binary.LittleEndian.Uint64(b.in[b.off-8:]) + b.bitsRead = 0 + b.off -= 8 +} + +// fill() will make sure at least 32 bits are available. +func (b *bitReader) fill() { + if b.bitsRead < 32 { + return + } + if b.off > 4 { + v := b.in[b.off-4:] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + b.value = (b.value << 32) | uint64(low) + b.bitsRead -= 32 + b.off -= 4 + return + } + for b.off > 0 { + b.value = (b.value << 8) | uint64(b.in[b.off-1]) + b.bitsRead -= 8 + b.off-- + } +} + +// finished returns true if all bits have been read from the bit stream. +func (b *bitReader) finished() bool { + return b.off == 0 && b.bitsRead >= 64 +} + +// close the bitstream and returns an error if out-of-buffer reads occurred. +func (b *bitReader) close() error { + // Release reference. + b.in = nil + if b.bitsRead > 64 { + return io.ErrUnexpectedEOF + } + return nil +} + +// bitReader reads a bitstream in reverse. +// The last set bit indicates the start of the stream and is used +// for aligning the input. +type bitReaderBytes struct { + in []byte + off uint // next byte to read is at in[off - 1] + value uint64 + bitsRead uint8 +} + +// init initializes and resets the bit reader. +func (b *bitReaderBytes) init(in []byte) error { + if len(in) < 1 { + return errors.New("corrupt stream: too short") + } + b.in = in + b.off = uint(len(in)) + // The highest bit of the last byte indicates where to start + v := in[len(in)-1] + if v == 0 { + return errors.New("corrupt stream, did not find end of stream") + } + b.bitsRead = 64 + b.value = 0 + if len(in) >= 8 { + b.fillFastStart() + } else { + b.fill() + b.fill() + } + b.advance(8 - uint8(highBit32(uint32(v)))) + return nil +} + +// peekBitsFast requires that at least one bit is requested every time. +// There are no checks if the buffer is filled. +func (b *bitReaderBytes) peekByteFast() uint8 { + got := uint8(b.value >> 56) + return got +} + +func (b *bitReaderBytes) advance(n uint8) { + b.bitsRead += n + b.value <<= n & 63 +} + +// fillFast() will make sure at least 32 bits are available. +// There must be at least 4 bytes available. +func (b *bitReaderBytes) fillFast() { + if b.bitsRead < 32 { + return + } + + // 2 bounds checks. + v := b.in[b.off-4 : b.off] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + b.value |= uint64(low) << (b.bitsRead - 32) + b.bitsRead -= 32 + b.off -= 4 +} + +// fillFastStart() assumes the bitReaderBytes is empty and there is at least 8 bytes to read. +func (b *bitReaderBytes) fillFastStart() { + // Do single re-slice to avoid bounds checks. + b.value = binary.LittleEndian.Uint64(b.in[b.off-8:]) + b.bitsRead = 0 + b.off -= 8 +} + +// fill() will make sure at least 32 bits are available. +func (b *bitReaderBytes) fill() { + if b.bitsRead < 32 { + return + } + if b.off > 4 { + v := b.in[b.off-4:] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + b.value |= uint64(low) << (b.bitsRead - 32) + b.bitsRead -= 32 + b.off -= 4 + return + } + for b.off > 0 { + b.value |= uint64(b.in[b.off-1]) << (b.bitsRead - 8) + b.bitsRead -= 8 + b.off-- + } +} + +// finished returns true if all bits have been read from the bit stream. +func (b *bitReaderBytes) finished() bool { + return b.off == 0 && b.bitsRead >= 64 +} + +// close the bitstream and returns an error if out-of-buffer reads occurred. +func (b *bitReaderBytes) close() error { + // Release reference. + b.in = nil + if b.bitsRead > 64 { + return io.ErrUnexpectedEOF + } + return nil +} + +// bitReaderShifted reads a bitstream in reverse. +// The last set bit indicates the start of the stream and is used +// for aligning the input. +type bitReaderShifted struct { + in []byte + off uint // next byte to read is at in[off - 1] + value uint64 + bitsRead uint8 +} + +// init initializes and resets the bit reader. +func (b *bitReaderShifted) init(in []byte) error { + if len(in) < 1 { + return errors.New("corrupt stream: too short") + } + b.in = in + b.off = uint(len(in)) + // The highest bit of the last byte indicates where to start + v := in[len(in)-1] + if v == 0 { + return errors.New("corrupt stream, did not find end of stream") + } + b.bitsRead = 64 + b.value = 0 + if len(in) >= 8 { + b.fillFastStart() + } else { + b.fill() + b.fill() + } + b.advance(8 - uint8(highBit32(uint32(v)))) + return nil +} + +// peekBitsFast requires that at least one bit is requested every time. +// There are no checks if the buffer is filled. +func (b *bitReaderShifted) peekBitsFast(n uint8) uint16 { + return uint16(b.value >> ((64 - n) & 63)) +} + +func (b *bitReaderShifted) advance(n uint8) { + b.bitsRead += n + b.value <<= n & 63 +} + +// fillFast() will make sure at least 32 bits are available. +// There must be at least 4 bytes available. +func (b *bitReaderShifted) fillFast() { + if b.bitsRead < 32 { + return + } + + // 2 bounds checks. + v := b.in[b.off-4 : b.off] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + b.value |= uint64(low) << ((b.bitsRead - 32) & 63) + b.bitsRead -= 32 + b.off -= 4 +} + +// fillFastStart() assumes the bitReaderShifted is empty and there is at least 8 bytes to read. +func (b *bitReaderShifted) fillFastStart() { + // Do single re-slice to avoid bounds checks. + b.value = binary.LittleEndian.Uint64(b.in[b.off-8:]) + b.bitsRead = 0 + b.off -= 8 +} + +// fill() will make sure at least 32 bits are available. +func (b *bitReaderShifted) fill() { + if b.bitsRead < 32 { + return + } + if b.off > 4 { + v := b.in[b.off-4:] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + b.value |= uint64(low) << ((b.bitsRead - 32) & 63) + b.bitsRead -= 32 + b.off -= 4 + return + } + for b.off > 0 { + b.value |= uint64(b.in[b.off-1]) << ((b.bitsRead - 8) & 63) + b.bitsRead -= 8 + b.off-- + } +} + +// finished returns true if all bits have been read from the bit stream. +func (b *bitReaderShifted) finished() bool { + return b.off == 0 && b.bitsRead >= 64 +} + +// close the bitstream and returns an error if out-of-buffer reads occurred. +func (b *bitReaderShifted) close() error { + // Release reference. + b.in = nil + if b.bitsRead > 64 { + return io.ErrUnexpectedEOF + } + return nil +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/huff0/bitwriter.go b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/bitwriter.go new file mode 100644 index 000000000000..6bce4e87d4ff --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/bitwriter.go @@ -0,0 +1,210 @@ +// Copyright 2018 Klaus Post. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// Based on work Copyright (c) 2013, Yann Collet, released under BSD License. + +package huff0 + +import "fmt" + +// bitWriter will write bits. +// First bit will be LSB of the first byte of output. +type bitWriter struct { + bitContainer uint64 + nBits uint8 + out []byte +} + +// bitMask16 is bitmasks. Has extra to avoid bounds check. +var bitMask16 = [32]uint16{ + 0, 1, 3, 7, 0xF, 0x1F, + 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF, 0x7FF, + 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF} /* up to 16 bits */ + +// addBits16NC will add up to 16 bits. +// It will not check if there is space for them, +// so the caller must ensure that it has flushed recently. +func (b *bitWriter) addBits16NC(value uint16, bits uint8) { + b.bitContainer |= uint64(value&bitMask16[bits&31]) << (b.nBits & 63) + b.nBits += bits +} + +// addBits16Clean will add up to 16 bits. value may not contain more set bits than indicated. +// It will not check if there is space for them, so the caller must ensure that it has flushed recently. +func (b *bitWriter) addBits16Clean(value uint16, bits uint8) { + b.bitContainer |= uint64(value) << (b.nBits & 63) + b.nBits += bits +} + +// encSymbol will add up to 16 bits. value may not contain more set bits than indicated. +// It will not check if there is space for them, so the caller must ensure that it has flushed recently. +func (b *bitWriter) encSymbol(ct cTable, symbol byte) { + enc := ct[symbol] + b.bitContainer |= uint64(enc.val) << (b.nBits & 63) + if false { + if enc.nBits == 0 { + panic("nbits 0") + } + } + b.nBits += enc.nBits +} + +// encTwoSymbols will add up to 32 bits. value may not contain more set bits than indicated. +// It will not check if there is space for them, so the caller must ensure that it has flushed recently. +func (b *bitWriter) encTwoSymbols(ct cTable, av, bv byte) { + encA := ct[av] + encB := ct[bv] + sh := b.nBits & 63 + combined := uint64(encA.val) | (uint64(encB.val) << (encA.nBits & 63)) + b.bitContainer |= combined << sh + if false { + if encA.nBits == 0 { + panic("nbitsA 0") + } + if encB.nBits == 0 { + panic("nbitsB 0") + } + } + b.nBits += encA.nBits + encB.nBits +} + +// addBits16ZeroNC will add up to 16 bits. +// It will not check if there is space for them, +// so the caller must ensure that it has flushed recently. +// This is fastest if bits can be zero. +func (b *bitWriter) addBits16ZeroNC(value uint16, bits uint8) { + if bits == 0 { + return + } + value <<= (16 - bits) & 15 + value >>= (16 - bits) & 15 + b.bitContainer |= uint64(value) << (b.nBits & 63) + b.nBits += bits +} + +// flush will flush all pending full bytes. +// There will be at least 56 bits available for writing when this has been called. +// Using flush32 is faster, but leaves less space for writing. +func (b *bitWriter) flush() { + v := b.nBits >> 3 + switch v { + case 0: + return + case 1: + b.out = append(b.out, + byte(b.bitContainer), + ) + b.bitContainer >>= 1 << 3 + case 2: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + ) + b.bitContainer >>= 2 << 3 + case 3: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + ) + b.bitContainer >>= 3 << 3 + case 4: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + ) + b.bitContainer >>= 4 << 3 + case 5: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + ) + b.bitContainer >>= 5 << 3 + case 6: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + byte(b.bitContainer>>40), + ) + b.bitContainer >>= 6 << 3 + case 7: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + byte(b.bitContainer>>40), + byte(b.bitContainer>>48), + ) + b.bitContainer >>= 7 << 3 + case 8: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + byte(b.bitContainer>>40), + byte(b.bitContainer>>48), + byte(b.bitContainer>>56), + ) + b.bitContainer = 0 + b.nBits = 0 + return + default: + panic(fmt.Errorf("bits (%d) > 64", b.nBits)) + } + b.nBits &= 7 +} + +// flush32 will flush out, so there are at least 32 bits available for writing. +func (b *bitWriter) flush32() { + if b.nBits < 32 { + return + } + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24)) + b.nBits -= 32 + b.bitContainer >>= 32 +} + +// flushAlign will flush remaining full bytes and align to next byte boundary. +func (b *bitWriter) flushAlign() { + nbBytes := (b.nBits + 7) >> 3 + for i := uint8(0); i < nbBytes; i++ { + b.out = append(b.out, byte(b.bitContainer>>(i*8))) + } + b.nBits = 0 + b.bitContainer = 0 +} + +// close will write the alignment bit and write the final byte(s) +// to the output. +func (b *bitWriter) close() error { + // End mark + b.addBits16Clean(1, 1) + // flush until next byte. + b.flushAlign() + return nil +} + +// reset and continue writing by appending to out. +func (b *bitWriter) reset(out []byte) { + b.bitContainer = 0 + b.nBits = 0 + b.out = out +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/huff0/bytereader.go b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/bytereader.go new file mode 100644 index 000000000000..50bcdf6ea99c --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/bytereader.go @@ -0,0 +1,54 @@ +// Copyright 2018 Klaus Post. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// Based on work Copyright (c) 2013, Yann Collet, released under BSD License. + +package huff0 + +// byteReader provides a byte reader that reads +// little endian values from a byte stream. +// The input stream is manually advanced. +// The reader performs no bounds checks. +type byteReader struct { + b []byte + off int +} + +// init will initialize the reader and set the input. +func (b *byteReader) init(in []byte) { + b.b = in + b.off = 0 +} + +// advance the stream b n bytes. +func (b *byteReader) advance(n uint) { + b.off += int(n) +} + +// Int32 returns a little endian int32 starting at current offset. +func (b byteReader) Int32() int32 { + v3 := int32(b.b[b.off+3]) + v2 := int32(b.b[b.off+2]) + v1 := int32(b.b[b.off+1]) + v0 := int32(b.b[b.off]) + return (v3 << 24) | (v2 << 16) | (v1 << 8) | v0 +} + +// Uint32 returns a little endian uint32 starting at current offset. +func (b byteReader) Uint32() uint32 { + v3 := uint32(b.b[b.off+3]) + v2 := uint32(b.b[b.off+2]) + v1 := uint32(b.b[b.off+1]) + v0 := uint32(b.b[b.off]) + return (v3 << 24) | (v2 << 16) | (v1 << 8) | v0 +} + +// unread returns the unread portion of the input. +func (b byteReader) unread() []byte { + return b.b[b.off:] +} + +// remain will return the number of bytes remaining. +func (b byteReader) remain() int { + return len(b.b) - b.off +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/huff0/compress.go b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/compress.go new file mode 100644 index 000000000000..f9ed5f8306ec --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/compress.go @@ -0,0 +1,657 @@ +package huff0 + +import ( + "fmt" + "runtime" + "sync" +) + +// Compress1X will compress the input. +// The output can be decoded using Decompress1X. +// Supply a Scratch object. The scratch object contains state about re-use, +// So when sharing across independent encodes, be sure to set the re-use policy. +func Compress1X(in []byte, s *Scratch) (out []byte, reUsed bool, err error) { + s, err = s.prepare(in) + if err != nil { + return nil, false, err + } + return compress(in, s, s.compress1X) +} + +// Compress4X will compress the input. The input is split into 4 independent blocks +// and compressed similar to Compress1X. +// The output can be decoded using Decompress4X. +// Supply a Scratch object. The scratch object contains state about re-use, +// So when sharing across independent encodes, be sure to set the re-use policy. +func Compress4X(in []byte, s *Scratch) (out []byte, reUsed bool, err error) { + s, err = s.prepare(in) + if err != nil { + return nil, false, err + } + if false { + // TODO: compress4Xp only slightly faster. + const parallelThreshold = 8 << 10 + if len(in) < parallelThreshold || runtime.GOMAXPROCS(0) == 1 { + return compress(in, s, s.compress4X) + } + return compress(in, s, s.compress4Xp) + } + return compress(in, s, s.compress4X) +} + +func compress(in []byte, s *Scratch, compressor func(src []byte) ([]byte, error)) (out []byte, reUsed bool, err error) { + // Nuke previous table if we cannot reuse anyway. + if s.Reuse == ReusePolicyNone { + s.prevTable = s.prevTable[:0] + } + + // Create histogram, if none was provided. + maxCount := s.maxCount + var canReuse = false + if maxCount == 0 { + maxCount, canReuse = s.countSimple(in) + } else { + canReuse = s.canUseTable(s.prevTable) + } + + // We want the output size to be less than this: + wantSize := len(in) + if s.WantLogLess > 0 { + wantSize -= wantSize >> s.WantLogLess + } + + // Reset for next run. + s.clearCount = true + s.maxCount = 0 + if maxCount >= len(in) { + if maxCount > len(in) { + return nil, false, fmt.Errorf("maxCount (%d) > length (%d)", maxCount, len(in)) + } + if len(in) == 1 { + return nil, false, ErrIncompressible + } + // One symbol, use RLE + return nil, false, ErrUseRLE + } + if maxCount == 1 || maxCount < (len(in)>>7) { + // Each symbol present maximum once or too well distributed. + return nil, false, ErrIncompressible + } + if s.Reuse == ReusePolicyMust && !canReuse { + // We must reuse, but we can't. + return nil, false, ErrIncompressible + } + if (s.Reuse == ReusePolicyPrefer || s.Reuse == ReusePolicyMust) && canReuse { + keepTable := s.cTable + keepTL := s.actualTableLog + s.cTable = s.prevTable + s.actualTableLog = s.prevTableLog + s.Out, err = compressor(in) + s.cTable = keepTable + s.actualTableLog = keepTL + if err == nil && len(s.Out) < wantSize { + s.OutData = s.Out + return s.Out, true, nil + } + if s.Reuse == ReusePolicyMust { + return nil, false, ErrIncompressible + } + // Do not attempt to re-use later. + s.prevTable = s.prevTable[:0] + } + + // Calculate new table. + err = s.buildCTable() + if err != nil { + return nil, false, err + } + + if false && !s.canUseTable(s.cTable) { + panic("invalid table generated") + } + + if s.Reuse == ReusePolicyAllow && canReuse { + hSize := len(s.Out) + oldSize := s.prevTable.estimateSize(s.count[:s.symbolLen]) + newSize := s.cTable.estimateSize(s.count[:s.symbolLen]) + if oldSize <= hSize+newSize || hSize+12 >= wantSize { + // Retain cTable even if we re-use. + keepTable := s.cTable + keepTL := s.actualTableLog + + s.cTable = s.prevTable + s.actualTableLog = s.prevTableLog + s.Out, err = compressor(in) + + // Restore ctable. + s.cTable = keepTable + s.actualTableLog = keepTL + if err != nil { + return nil, false, err + } + if len(s.Out) >= wantSize { + return nil, false, ErrIncompressible + } + s.OutData = s.Out + return s.Out, true, nil + } + } + + // Use new table + err = s.cTable.write(s) + if err != nil { + s.OutTable = nil + return nil, false, err + } + s.OutTable = s.Out + + // Compress using new table + s.Out, err = compressor(in) + if err != nil { + s.OutTable = nil + return nil, false, err + } + if len(s.Out) >= wantSize { + s.OutTable = nil + return nil, false, ErrIncompressible + } + // Move current table into previous. + s.prevTable, s.prevTableLog, s.cTable = s.cTable, s.actualTableLog, s.prevTable[:0] + s.OutData = s.Out[len(s.OutTable):] + return s.Out, false, nil +} + +func (s *Scratch) compress1X(src []byte) ([]byte, error) { + return s.compress1xDo(s.Out, src) +} + +func (s *Scratch) compress1xDo(dst, src []byte) ([]byte, error) { + var bw = bitWriter{out: dst} + + // N is length divisible by 4. + n := len(src) + n -= n & 3 + cTable := s.cTable[:256] + + // Encode last bytes. + for i := len(src) & 3; i > 0; i-- { + bw.encSymbol(cTable, src[n+i-1]) + } + n -= 4 + if s.actualTableLog <= 8 { + for ; n >= 0; n -= 4 { + tmp := src[n : n+4] + // tmp should be len 4 + bw.flush32() + bw.encTwoSymbols(cTable, tmp[3], tmp[2]) + bw.encTwoSymbols(cTable, tmp[1], tmp[0]) + } + } else { + for ; n >= 0; n -= 4 { + tmp := src[n : n+4] + // tmp should be len 4 + bw.flush32() + bw.encTwoSymbols(cTable, tmp[3], tmp[2]) + bw.flush32() + bw.encTwoSymbols(cTable, tmp[1], tmp[0]) + } + } + err := bw.close() + return bw.out, err +} + +var sixZeros [6]byte + +func (s *Scratch) compress4X(src []byte) ([]byte, error) { + if len(src) < 12 { + return nil, ErrIncompressible + } + segmentSize := (len(src) + 3) / 4 + + // Add placeholder for output length + offsetIdx := len(s.Out) + s.Out = append(s.Out, sixZeros[:]...) + + for i := 0; i < 4; i++ { + toDo := src + if len(toDo) > segmentSize { + toDo = toDo[:segmentSize] + } + src = src[len(toDo):] + + var err error + idx := len(s.Out) + s.Out, err = s.compress1xDo(s.Out, toDo) + if err != nil { + return nil, err + } + // Write compressed length as little endian before block. + if i < 3 { + // Last length is not written. + length := len(s.Out) - idx + s.Out[i*2+offsetIdx] = byte(length) + s.Out[i*2+offsetIdx+1] = byte(length >> 8) + } + } + + return s.Out, nil +} + +// compress4Xp will compress 4 streams using separate goroutines. +func (s *Scratch) compress4Xp(src []byte) ([]byte, error) { + if len(src) < 12 { + return nil, ErrIncompressible + } + // Add placeholder for output length + s.Out = s.Out[:6] + + segmentSize := (len(src) + 3) / 4 + var wg sync.WaitGroup + var errs [4]error + wg.Add(4) + for i := 0; i < 4; i++ { + toDo := src + if len(toDo) > segmentSize { + toDo = toDo[:segmentSize] + } + src = src[len(toDo):] + + // Separate goroutine for each block. + go func(i int) { + s.tmpOut[i], errs[i] = s.compress1xDo(s.tmpOut[i][:0], toDo) + wg.Done() + }(i) + } + wg.Wait() + for i := 0; i < 4; i++ { + if errs[i] != nil { + return nil, errs[i] + } + o := s.tmpOut[i] + // Write compressed length as little endian before block. + if i < 3 { + // Last length is not written. + s.Out[i*2] = byte(len(o)) + s.Out[i*2+1] = byte(len(o) >> 8) + } + + // Write output. + s.Out = append(s.Out, o...) + } + return s.Out, nil +} + +// countSimple will create a simple histogram in s.count. +// Returns the biggest count. +// Does not update s.clearCount. +func (s *Scratch) countSimple(in []byte) (max int, reuse bool) { + reuse = true + for _, v := range in { + s.count[v]++ + } + m := uint32(0) + if len(s.prevTable) > 0 { + for i, v := range s.count[:] { + if v > m { + m = v + } + if v > 0 { + s.symbolLen = uint16(i) + 1 + if i >= len(s.prevTable) { + reuse = false + } else { + if s.prevTable[i].nBits == 0 { + reuse = false + } + } + } + } + return int(m), reuse + } + for i, v := range s.count[:] { + if v > m { + m = v + } + if v > 0 { + s.symbolLen = uint16(i) + 1 + } + } + return int(m), false +} + +func (s *Scratch) canUseTable(c cTable) bool { + if len(c) < int(s.symbolLen) { + return false + } + for i, v := range s.count[:s.symbolLen] { + if v != 0 && c[i].nBits == 0 { + return false + } + } + return true +} + +func (s *Scratch) validateTable(c cTable) bool { + if len(c) < int(s.symbolLen) { + return false + } + for i, v := range s.count[:s.symbolLen] { + if v != 0 { + if c[i].nBits == 0 { + return false + } + if c[i].nBits > s.actualTableLog { + return false + } + } + } + return true +} + +// minTableLog provides the minimum logSize to safely represent a distribution. +func (s *Scratch) minTableLog() uint8 { + minBitsSrc := highBit32(uint32(s.br.remain())) + 1 + minBitsSymbols := highBit32(uint32(s.symbolLen-1)) + 2 + if minBitsSrc < minBitsSymbols { + return uint8(minBitsSrc) + } + return uint8(minBitsSymbols) +} + +// optimalTableLog calculates and sets the optimal tableLog in s.actualTableLog +func (s *Scratch) optimalTableLog() { + tableLog := s.TableLog + minBits := s.minTableLog() + maxBitsSrc := uint8(highBit32(uint32(s.br.remain()-1))) - 1 + if maxBitsSrc < tableLog { + // Accuracy can be reduced + tableLog = maxBitsSrc + } + if minBits > tableLog { + tableLog = minBits + } + // Need a minimum to safely represent all symbol values + if tableLog < minTablelog { + tableLog = minTablelog + } + if tableLog > tableLogMax { + tableLog = tableLogMax + } + s.actualTableLog = tableLog +} + +type cTableEntry struct { + val uint16 + nBits uint8 + // We have 8 bits extra +} + +const huffNodesMask = huffNodesLen - 1 + +func (s *Scratch) buildCTable() error { + s.optimalTableLog() + s.huffSort() + if cap(s.cTable) < maxSymbolValue+1 { + s.cTable = make([]cTableEntry, s.symbolLen, maxSymbolValue+1) + } else { + s.cTable = s.cTable[:s.symbolLen] + for i := range s.cTable { + s.cTable[i] = cTableEntry{} + } + } + + var startNode = int16(s.symbolLen) + nonNullRank := s.symbolLen - 1 + + nodeNb := int16(startNode) + huffNode := s.nodes[1 : huffNodesLen+1] + + // This overlays the slice above, but allows "-1" index lookups. + // Different from reference implementation. + huffNode0 := s.nodes[0 : huffNodesLen+1] + + for huffNode[nonNullRank].count == 0 { + nonNullRank-- + } + + lowS := int16(nonNullRank) + nodeRoot := nodeNb + lowS - 1 + lowN := nodeNb + huffNode[nodeNb].count = huffNode[lowS].count + huffNode[lowS-1].count + huffNode[lowS].parent, huffNode[lowS-1].parent = uint16(nodeNb), uint16(nodeNb) + nodeNb++ + lowS -= 2 + for n := nodeNb; n <= nodeRoot; n++ { + huffNode[n].count = 1 << 30 + } + // fake entry, strong barrier + huffNode0[0].count = 1 << 31 + + // create parents + for nodeNb <= nodeRoot { + var n1, n2 int16 + if huffNode0[lowS+1].count < huffNode0[lowN+1].count { + n1 = lowS + lowS-- + } else { + n1 = lowN + lowN++ + } + if huffNode0[lowS+1].count < huffNode0[lowN+1].count { + n2 = lowS + lowS-- + } else { + n2 = lowN + lowN++ + } + + huffNode[nodeNb].count = huffNode0[n1+1].count + huffNode0[n2+1].count + huffNode0[n1+1].parent, huffNode0[n2+1].parent = uint16(nodeNb), uint16(nodeNb) + nodeNb++ + } + + // distribute weights (unlimited tree height) + huffNode[nodeRoot].nbBits = 0 + for n := nodeRoot - 1; n >= startNode; n-- { + huffNode[n].nbBits = huffNode[huffNode[n].parent].nbBits + 1 + } + for n := uint16(0); n <= nonNullRank; n++ { + huffNode[n].nbBits = huffNode[huffNode[n].parent].nbBits + 1 + } + s.actualTableLog = s.setMaxHeight(int(nonNullRank)) + maxNbBits := s.actualTableLog + + // fill result into tree (val, nbBits) + if maxNbBits > tableLogMax { + return fmt.Errorf("internal error: maxNbBits (%d) > tableLogMax (%d)", maxNbBits, tableLogMax) + } + var nbPerRank [tableLogMax + 1]uint16 + var valPerRank [16]uint16 + for _, v := range huffNode[:nonNullRank+1] { + nbPerRank[v.nbBits]++ + } + // determine stating value per rank + { + min := uint16(0) + for n := maxNbBits; n > 0; n-- { + // get starting value within each rank + valPerRank[n] = min + min += nbPerRank[n] + min >>= 1 + } + } + + // push nbBits per symbol, symbol order + for _, v := range huffNode[:nonNullRank+1] { + s.cTable[v.symbol].nBits = v.nbBits + } + + // assign value within rank, symbol order + t := s.cTable[:s.symbolLen] + for n, val := range t { + nbits := val.nBits & 15 + v := valPerRank[nbits] + t[n].val = v + valPerRank[nbits] = v + 1 + } + + return nil +} + +// huffSort will sort symbols, decreasing order. +func (s *Scratch) huffSort() { + type rankPos struct { + base uint32 + current uint32 + } + + // Clear nodes + nodes := s.nodes[:huffNodesLen+1] + s.nodes = nodes + nodes = nodes[1 : huffNodesLen+1] + + // Sort into buckets based on length of symbol count. + var rank [32]rankPos + for _, v := range s.count[:s.symbolLen] { + r := highBit32(v+1) & 31 + rank[r].base++ + } + // maxBitLength is log2(BlockSizeMax) + 1 + const maxBitLength = 18 + 1 + for n := maxBitLength; n > 0; n-- { + rank[n-1].base += rank[n].base + } + for n := range rank[:maxBitLength] { + rank[n].current = rank[n].base + } + for n, c := range s.count[:s.symbolLen] { + r := (highBit32(c+1) + 1) & 31 + pos := rank[r].current + rank[r].current++ + prev := nodes[(pos-1)&huffNodesMask] + for pos > rank[r].base && c > prev.count { + nodes[pos&huffNodesMask] = prev + pos-- + prev = nodes[(pos-1)&huffNodesMask] + } + nodes[pos&huffNodesMask] = nodeElt{count: c, symbol: byte(n)} + } + return +} + +func (s *Scratch) setMaxHeight(lastNonNull int) uint8 { + maxNbBits := s.actualTableLog + huffNode := s.nodes[1 : huffNodesLen+1] + //huffNode = huffNode[: huffNodesLen] + + largestBits := huffNode[lastNonNull].nbBits + + // early exit : no elt > maxNbBits + if largestBits <= maxNbBits { + return largestBits + } + totalCost := int(0) + baseCost := int(1) << (largestBits - maxNbBits) + n := uint32(lastNonNull) + + for huffNode[n].nbBits > maxNbBits { + totalCost += baseCost - (1 << (largestBits - huffNode[n].nbBits)) + huffNode[n].nbBits = maxNbBits + n-- + } + // n stops at huffNode[n].nbBits <= maxNbBits + + for huffNode[n].nbBits == maxNbBits { + n-- + } + // n end at index of smallest symbol using < maxNbBits + + // renorm totalCost + totalCost >>= largestBits - maxNbBits /* note : totalCost is necessarily a multiple of baseCost */ + + // repay normalized cost + { + const noSymbol = 0xF0F0F0F0 + var rankLast [tableLogMax + 2]uint32 + + for i := range rankLast[:] { + rankLast[i] = noSymbol + } + + // Get pos of last (smallest) symbol per rank + { + currentNbBits := uint8(maxNbBits) + for pos := int(n); pos >= 0; pos-- { + if huffNode[pos].nbBits >= currentNbBits { + continue + } + currentNbBits = huffNode[pos].nbBits // < maxNbBits + rankLast[maxNbBits-currentNbBits] = uint32(pos) + } + } + + for totalCost > 0 { + nBitsToDecrease := uint8(highBit32(uint32(totalCost))) + 1 + + for ; nBitsToDecrease > 1; nBitsToDecrease-- { + highPos := rankLast[nBitsToDecrease] + lowPos := rankLast[nBitsToDecrease-1] + if highPos == noSymbol { + continue + } + if lowPos == noSymbol { + break + } + highTotal := huffNode[highPos].count + lowTotal := 2 * huffNode[lowPos].count + if highTotal <= lowTotal { + break + } + } + // only triggered when no more rank 1 symbol left => find closest one (note : there is necessarily at least one !) + // HUF_MAX_TABLELOG test just to please gcc 5+; but it should not be necessary + // FIXME: try to remove + for (nBitsToDecrease <= tableLogMax) && (rankLast[nBitsToDecrease] == noSymbol) { + nBitsToDecrease++ + } + totalCost -= 1 << (nBitsToDecrease - 1) + if rankLast[nBitsToDecrease-1] == noSymbol { + // this rank is no longer empty + rankLast[nBitsToDecrease-1] = rankLast[nBitsToDecrease] + } + huffNode[rankLast[nBitsToDecrease]].nbBits++ + if rankLast[nBitsToDecrease] == 0 { + /* special case, reached largest symbol */ + rankLast[nBitsToDecrease] = noSymbol + } else { + rankLast[nBitsToDecrease]-- + if huffNode[rankLast[nBitsToDecrease]].nbBits != maxNbBits-nBitsToDecrease { + rankLast[nBitsToDecrease] = noSymbol /* this rank is now empty */ + } + } + } + + for totalCost < 0 { /* Sometimes, cost correction overshoot */ + if rankLast[1] == noSymbol { /* special case : no rank 1 symbol (using maxNbBits-1); let's create one from largest rank 0 (using maxNbBits) */ + for huffNode[n].nbBits == maxNbBits { + n-- + } + huffNode[n+1].nbBits-- + rankLast[1] = n + 1 + totalCost++ + continue + } + huffNode[rankLast[1]+1].nbBits-- + rankLast[1]++ + totalCost++ + } + } + return maxNbBits +} + +type nodeElt struct { + count uint32 + parent uint16 + symbol byte + nbBits uint8 +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/huff0/decompress.go b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/decompress.go new file mode 100644 index 000000000000..41703bba4d65 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/decompress.go @@ -0,0 +1,1164 @@ +package huff0 + +import ( + "errors" + "fmt" + "io" + + "github.com/klauspost/compress/fse" +) + +type dTable struct { + single []dEntrySingle + double []dEntryDouble +} + +// single-symbols decoding +type dEntrySingle struct { + entry uint16 +} + +// double-symbols decoding +type dEntryDouble struct { + seq uint16 + nBits uint8 + len uint8 +} + +// Uses special code for all tables that are < 8 bits. +const use8BitTables = true + +// ReadTable will read a table from the input. +// The size of the input may be larger than the table definition. +// Any content remaining after the table definition will be returned. +// If no Scratch is provided a new one is allocated. +// The returned Scratch can be used for encoding or decoding input using this table. +func ReadTable(in []byte, s *Scratch) (s2 *Scratch, remain []byte, err error) { + s, err = s.prepare(in) + if err != nil { + return s, nil, err + } + if len(in) <= 1 { + return s, nil, errors.New("input too small for table") + } + iSize := in[0] + in = in[1:] + if iSize >= 128 { + // Uncompressed + oSize := iSize - 127 + iSize = (oSize + 1) / 2 + if int(iSize) > len(in) { + return s, nil, errors.New("input too small for table") + } + for n := uint8(0); n < oSize; n += 2 { + v := in[n/2] + s.huffWeight[n] = v >> 4 + s.huffWeight[n+1] = v & 15 + } + s.symbolLen = uint16(oSize) + in = in[iSize:] + } else { + if len(in) < int(iSize) { + return s, nil, fmt.Errorf("input too small for table, want %d bytes, have %d", iSize, len(in)) + } + // FSE compressed weights + s.fse.DecompressLimit = 255 + hw := s.huffWeight[:] + s.fse.Out = hw + b, err := fse.Decompress(in[:iSize], s.fse) + s.fse.Out = nil + if err != nil { + return s, nil, err + } + if len(b) > 255 { + return s, nil, errors.New("corrupt input: output table too large") + } + s.symbolLen = uint16(len(b)) + in = in[iSize:] + } + + // collect weight stats + var rankStats [16]uint32 + weightTotal := uint32(0) + for _, v := range s.huffWeight[:s.symbolLen] { + if v > tableLogMax { + return s, nil, errors.New("corrupt input: weight too large") + } + v2 := v & 15 + rankStats[v2]++ + // (1 << (v2-1)) is slower since the compiler cannot prove that v2 isn't 0. + weightTotal += (1 << v2) >> 1 + } + if weightTotal == 0 { + return s, nil, errors.New("corrupt input: weights zero") + } + + // get last non-null symbol weight (implied, total must be 2^n) + { + tableLog := highBit32(weightTotal) + 1 + if tableLog > tableLogMax { + return s, nil, errors.New("corrupt input: tableLog too big") + } + s.actualTableLog = uint8(tableLog) + // determine last weight + { + total := uint32(1) << tableLog + rest := total - weightTotal + verif := uint32(1) << highBit32(rest) + lastWeight := highBit32(rest) + 1 + if verif != rest { + // last value must be a clean power of 2 + return s, nil, errors.New("corrupt input: last value not power of two") + } + s.huffWeight[s.symbolLen] = uint8(lastWeight) + s.symbolLen++ + rankStats[lastWeight]++ + } + } + + if (rankStats[1] < 2) || (rankStats[1]&1 != 0) { + // by construction : at least 2 elts of rank 1, must be even + return s, nil, errors.New("corrupt input: min elt size, even check failed ") + } + + // TODO: Choose between single/double symbol decoding + + // Calculate starting value for each rank + { + var nextRankStart uint32 + for n := uint8(1); n < s.actualTableLog+1; n++ { + current := nextRankStart + nextRankStart += rankStats[n] << (n - 1) + rankStats[n] = current + } + } + + // fill DTable (always full size) + tSize := 1 << tableLogMax + if len(s.dt.single) != tSize { + s.dt.single = make([]dEntrySingle, tSize) + } + cTable := s.prevTable + if cap(cTable) < maxSymbolValue+1 { + cTable = make([]cTableEntry, 0, maxSymbolValue+1) + } + cTable = cTable[:maxSymbolValue+1] + s.prevTable = cTable[:s.symbolLen] + s.prevTableLog = s.actualTableLog + + for n, w := range s.huffWeight[:s.symbolLen] { + if w == 0 { + cTable[n] = cTableEntry{ + val: 0, + nBits: 0, + } + continue + } + length := (uint32(1) << w) >> 1 + d := dEntrySingle{ + entry: uint16(s.actualTableLog+1-w) | (uint16(n) << 8), + } + + rank := &rankStats[w] + cTable[n] = cTableEntry{ + val: uint16(*rank >> (w - 1)), + nBits: uint8(d.entry), + } + + single := s.dt.single[*rank : *rank+length] + for i := range single { + single[i] = d + } + *rank += length + } + + return s, in, nil +} + +// Decompress1X will decompress a 1X encoded stream. +// The length of the supplied input must match the end of a block exactly. +// Before this is called, the table must be initialized with ReadTable unless +// the encoder re-used the table. +// deprecated: Use the stateless Decoder() to get a concurrent version. +func (s *Scratch) Decompress1X(in []byte) (out []byte, err error) { + if cap(s.Out) < s.MaxDecodedSize { + s.Out = make([]byte, s.MaxDecodedSize) + } + s.Out = s.Out[:0:s.MaxDecodedSize] + s.Out, err = s.Decoder().Decompress1X(s.Out, in) + return s.Out, err +} + +// Decompress4X will decompress a 4X encoded stream. +// Before this is called, the table must be initialized with ReadTable unless +// the encoder re-used the table. +// The length of the supplied input must match the end of a block exactly. +// The destination size of the uncompressed data must be known and provided. +// deprecated: Use the stateless Decoder() to get a concurrent version. +func (s *Scratch) Decompress4X(in []byte, dstSize int) (out []byte, err error) { + if dstSize > s.MaxDecodedSize { + return nil, ErrMaxDecodedSizeExceeded + } + if cap(s.Out) < dstSize { + s.Out = make([]byte, s.MaxDecodedSize) + } + s.Out = s.Out[:0:dstSize] + s.Out, err = s.Decoder().Decompress4X(s.Out, in) + return s.Out, err +} + +// Decoder will return a stateless decoder that can be used by multiple +// decompressors concurrently. +// Before this is called, the table must be initialized with ReadTable. +// The Decoder is still linked to the scratch buffer so that cannot be reused. +// However, it is safe to discard the scratch. +func (s *Scratch) Decoder() *Decoder { + return &Decoder{ + dt: s.dt, + actualTableLog: s.actualTableLog, + } +} + +// Decoder provides stateless decoding. +type Decoder struct { + dt dTable + actualTableLog uint8 +} + +// Decompress1X will decompress a 1X encoded stream. +// The cap of the output buffer will be the maximum decompressed size. +// The length of the supplied input must match the end of a block exactly. +func (d *Decoder) Decompress1X(dst, src []byte) ([]byte, error) { + if len(d.dt.single) == 0 { + return nil, errors.New("no table loaded") + } + if use8BitTables && d.actualTableLog <= 8 { + return d.decompress1X8Bit(dst, src) + } + var br bitReaderShifted + err := br.init(src) + if err != nil { + return dst, err + } + maxDecodedSize := cap(dst) + dst = dst[:0] + + // Avoid bounds check by always having full sized table. + const tlSize = 1 << tableLogMax + const tlMask = tlSize - 1 + dt := d.dt.single[:tlSize] + + // Use temp table to avoid bound checks/append penalty. + var buf [256]byte + var off uint8 + + for br.off >= 8 { + br.fillFast() + v := dt[br.peekBitsFast(d.actualTableLog)&tlMask] + br.advance(uint8(v.entry)) + buf[off+0] = uint8(v.entry >> 8) + + v = dt[br.peekBitsFast(d.actualTableLog)&tlMask] + br.advance(uint8(v.entry)) + buf[off+1] = uint8(v.entry >> 8) + + // Refill + br.fillFast() + + v = dt[br.peekBitsFast(d.actualTableLog)&tlMask] + br.advance(uint8(v.entry)) + buf[off+2] = uint8(v.entry >> 8) + + v = dt[br.peekBitsFast(d.actualTableLog)&tlMask] + br.advance(uint8(v.entry)) + buf[off+3] = uint8(v.entry >> 8) + + off += 4 + if off == 0 { + if len(dst)+256 > maxDecodedSize { + br.close() + return nil, ErrMaxDecodedSizeExceeded + } + dst = append(dst, buf[:]...) + } + } + + if len(dst)+int(off) > maxDecodedSize { + br.close() + return nil, ErrMaxDecodedSizeExceeded + } + dst = append(dst, buf[:off]...) + + // br < 8, so uint8 is fine + bitsLeft := uint8(br.off)*8 + 64 - br.bitsRead + for bitsLeft > 0 { + br.fill() + if false && br.bitsRead >= 32 { + if br.off >= 4 { + v := br.in[br.off-4:] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + br.value = (br.value << 32) | uint64(low) + br.bitsRead -= 32 + br.off -= 4 + } else { + for br.off > 0 { + br.value = (br.value << 8) | uint64(br.in[br.off-1]) + br.bitsRead -= 8 + br.off-- + } + } + } + if len(dst) >= maxDecodedSize { + br.close() + return nil, ErrMaxDecodedSizeExceeded + } + v := d.dt.single[br.peekBitsFast(d.actualTableLog)&tlMask] + nBits := uint8(v.entry) + br.advance(nBits) + bitsLeft -= nBits + dst = append(dst, uint8(v.entry>>8)) + } + return dst, br.close() +} + +// decompress1X8Bit will decompress a 1X encoded stream with tablelog <= 8. +// The cap of the output buffer will be the maximum decompressed size. +// The length of the supplied input must match the end of a block exactly. +func (d *Decoder) decompress1X8Bit(dst, src []byte) ([]byte, error) { + if d.actualTableLog == 8 { + return d.decompress1X8BitExactly(dst, src) + } + var br bitReaderBytes + err := br.init(src) + if err != nil { + return dst, err + } + maxDecodedSize := cap(dst) + dst = dst[:0] + + // Avoid bounds check by always having full sized table. + dt := d.dt.single[:256] + + // Use temp table to avoid bound checks/append penalty. + var buf [256]byte + var off uint8 + + shift := (8 - d.actualTableLog) & 7 + + //fmt.Printf("mask: %b, tl:%d\n", mask, d.actualTableLog) + for br.off >= 4 { + br.fillFast() + v := dt[br.peekByteFast()>>shift] + br.advance(uint8(v.entry)) + buf[off+0] = uint8(v.entry >> 8) + + v = dt[br.peekByteFast()>>shift] + br.advance(uint8(v.entry)) + buf[off+1] = uint8(v.entry >> 8) + + v = dt[br.peekByteFast()>>shift] + br.advance(uint8(v.entry)) + buf[off+2] = uint8(v.entry >> 8) + + v = dt[br.peekByteFast()>>shift] + br.advance(uint8(v.entry)) + buf[off+3] = uint8(v.entry >> 8) + + off += 4 + if off == 0 { + if len(dst)+256 > maxDecodedSize { + br.close() + return nil, ErrMaxDecodedSizeExceeded + } + dst = append(dst, buf[:]...) + } + } + + if len(dst)+int(off) > maxDecodedSize { + br.close() + return nil, ErrMaxDecodedSizeExceeded + } + dst = append(dst, buf[:off]...) + + // br < 4, so uint8 is fine + bitsLeft := int8(uint8(br.off)*8 + (64 - br.bitsRead)) + for bitsLeft > 0 { + if br.bitsRead >= 64-8 { + for br.off > 0 { + br.value |= uint64(br.in[br.off-1]) << (br.bitsRead - 8) + br.bitsRead -= 8 + br.off-- + } + } + if len(dst) >= maxDecodedSize { + br.close() + return nil, ErrMaxDecodedSizeExceeded + } + v := dt[br.peekByteFast()>>shift] + nBits := uint8(v.entry) + br.advance(nBits) + bitsLeft -= int8(nBits) + dst = append(dst, uint8(v.entry>>8)) + } + return dst, br.close() +} + +// decompress1X8Bit will decompress a 1X encoded stream with tablelog <= 8. +// The cap of the output buffer will be the maximum decompressed size. +// The length of the supplied input must match the end of a block exactly. +func (d *Decoder) decompress1X8BitExactly(dst, src []byte) ([]byte, error) { + var br bitReaderBytes + err := br.init(src) + if err != nil { + return dst, err + } + maxDecodedSize := cap(dst) + dst = dst[:0] + + // Avoid bounds check by always having full sized table. + dt := d.dt.single[:256] + + // Use temp table to avoid bound checks/append penalty. + var buf [256]byte + var off uint8 + + const shift = 0 + + //fmt.Printf("mask: %b, tl:%d\n", mask, d.actualTableLog) + for br.off >= 4 { + br.fillFast() + v := dt[br.peekByteFast()>>shift] + br.advance(uint8(v.entry)) + buf[off+0] = uint8(v.entry >> 8) + + v = dt[br.peekByteFast()>>shift] + br.advance(uint8(v.entry)) + buf[off+1] = uint8(v.entry >> 8) + + v = dt[br.peekByteFast()>>shift] + br.advance(uint8(v.entry)) + buf[off+2] = uint8(v.entry >> 8) + + v = dt[br.peekByteFast()>>shift] + br.advance(uint8(v.entry)) + buf[off+3] = uint8(v.entry >> 8) + + off += 4 + if off == 0 { + if len(dst)+256 > maxDecodedSize { + br.close() + return nil, ErrMaxDecodedSizeExceeded + } + dst = append(dst, buf[:]...) + } + } + + if len(dst)+int(off) > maxDecodedSize { + br.close() + return nil, ErrMaxDecodedSizeExceeded + } + dst = append(dst, buf[:off]...) + + // br < 4, so uint8 is fine + bitsLeft := int8(uint8(br.off)*8 + (64 - br.bitsRead)) + for bitsLeft > 0 { + if br.bitsRead >= 64-8 { + for br.off > 0 { + br.value |= uint64(br.in[br.off-1]) << (br.bitsRead - 8) + br.bitsRead -= 8 + br.off-- + } + } + if len(dst) >= maxDecodedSize { + br.close() + return nil, ErrMaxDecodedSizeExceeded + } + v := dt[br.peekByteFast()>>shift] + nBits := uint8(v.entry) + br.advance(nBits) + bitsLeft -= int8(nBits) + dst = append(dst, uint8(v.entry>>8)) + } + return dst, br.close() +} + +// Decompress4X will decompress a 4X encoded stream. +// The length of the supplied input must match the end of a block exactly. +// The *capacity* of the dst slice must match the destination size of +// the uncompressed data exactly. +func (d *Decoder) Decompress4X(dst, src []byte) ([]byte, error) { + if len(d.dt.single) == 0 { + return nil, errors.New("no table loaded") + } + if len(src) < 6+(4*1) { + return nil, errors.New("input too small") + } + if use8BitTables && d.actualTableLog <= 8 { + return d.decompress4X8bit(dst, src) + } + + var br [4]bitReaderShifted + start := 6 + for i := 0; i < 3; i++ { + length := int(src[i*2]) | (int(src[i*2+1]) << 8) + if start+length >= len(src) { + return nil, errors.New("truncated input (or invalid offset)") + } + err := br[i].init(src[start : start+length]) + if err != nil { + return nil, err + } + start += length + } + err := br[3].init(src[start:]) + if err != nil { + return nil, err + } + + // destination, offset to match first output + dstSize := cap(dst) + dst = dst[:dstSize] + out := dst + dstEvery := (dstSize + 3) / 4 + + const tlSize = 1 << tableLogMax + const tlMask = tlSize - 1 + single := d.dt.single[:tlSize] + + // Use temp table to avoid bound checks/append penalty. + var buf [256]byte + var off uint8 + var decoded int + + // Decode 2 values from each decoder/loop. + const bufoff = 256 / 4 + for { + if br[0].off < 4 || br[1].off < 4 || br[2].off < 4 || br[3].off < 4 { + break + } + + { + const stream = 0 + const stream2 = 1 + br[stream].fillFast() + br[stream2].fillFast() + + val := br[stream].peekBitsFast(d.actualTableLog) + v := single[val&tlMask] + br[stream].advance(uint8(v.entry)) + buf[off+bufoff*stream] = uint8(v.entry >> 8) + + val2 := br[stream2].peekBitsFast(d.actualTableLog) + v2 := single[val2&tlMask] + br[stream2].advance(uint8(v2.entry)) + buf[off+bufoff*stream2] = uint8(v2.entry >> 8) + + val = br[stream].peekBitsFast(d.actualTableLog) + v = single[val&tlMask] + br[stream].advance(uint8(v.entry)) + buf[off+bufoff*stream+1] = uint8(v.entry >> 8) + + val2 = br[stream2].peekBitsFast(d.actualTableLog) + v2 = single[val2&tlMask] + br[stream2].advance(uint8(v2.entry)) + buf[off+bufoff*stream2+1] = uint8(v2.entry >> 8) + } + + { + const stream = 2 + const stream2 = 3 + br[stream].fillFast() + br[stream2].fillFast() + + val := br[stream].peekBitsFast(d.actualTableLog) + v := single[val&tlMask] + br[stream].advance(uint8(v.entry)) + buf[off+bufoff*stream] = uint8(v.entry >> 8) + + val2 := br[stream2].peekBitsFast(d.actualTableLog) + v2 := single[val2&tlMask] + br[stream2].advance(uint8(v2.entry)) + buf[off+bufoff*stream2] = uint8(v2.entry >> 8) + + val = br[stream].peekBitsFast(d.actualTableLog) + v = single[val&tlMask] + br[stream].advance(uint8(v.entry)) + buf[off+bufoff*stream+1] = uint8(v.entry >> 8) + + val2 = br[stream2].peekBitsFast(d.actualTableLog) + v2 = single[val2&tlMask] + br[stream2].advance(uint8(v2.entry)) + buf[off+bufoff*stream2+1] = uint8(v2.entry >> 8) + } + + off += 2 + + if off == bufoff { + if bufoff > dstEvery { + return nil, errors.New("corruption detected: stream overrun 1") + } + copy(out, buf[:bufoff]) + copy(out[dstEvery:], buf[bufoff:bufoff*2]) + copy(out[dstEvery*2:], buf[bufoff*2:bufoff*3]) + copy(out[dstEvery*3:], buf[bufoff*3:bufoff*4]) + off = 0 + out = out[bufoff:] + decoded += 256 + // There must at least be 3 buffers left. + if len(out) < dstEvery*3 { + return nil, errors.New("corruption detected: stream overrun 2") + } + } + } + if off > 0 { + ioff := int(off) + if len(out) < dstEvery*3+ioff { + return nil, errors.New("corruption detected: stream overrun 3") + } + copy(out, buf[:off]) + copy(out[dstEvery:dstEvery+ioff], buf[bufoff:bufoff*2]) + copy(out[dstEvery*2:dstEvery*2+ioff], buf[bufoff*2:bufoff*3]) + copy(out[dstEvery*3:dstEvery*3+ioff], buf[bufoff*3:bufoff*4]) + decoded += int(off) * 4 + out = out[off:] + } + + // Decode remaining. + for i := range br { + offset := dstEvery * i + br := &br[i] + bitsLeft := br.off*8 + uint(64-br.bitsRead) + for bitsLeft > 0 { + br.fill() + if false && br.bitsRead >= 32 { + if br.off >= 4 { + v := br.in[br.off-4:] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + br.value = (br.value << 32) | uint64(low) + br.bitsRead -= 32 + br.off -= 4 + } else { + for br.off > 0 { + br.value = (br.value << 8) | uint64(br.in[br.off-1]) + br.bitsRead -= 8 + br.off-- + } + } + } + // end inline... + if offset >= len(out) { + return nil, errors.New("corruption detected: stream overrun 4") + } + + // Read value and increment offset. + val := br.peekBitsFast(d.actualTableLog) + v := single[val&tlMask].entry + nBits := uint8(v) + br.advance(nBits) + bitsLeft -= uint(nBits) + out[offset] = uint8(v >> 8) + offset++ + } + decoded += offset - dstEvery*i + err = br.close() + if err != nil { + return nil, err + } + } + if dstSize != decoded { + return nil, errors.New("corruption detected: short output block") + } + return dst, nil +} + +// Decompress4X will decompress a 4X encoded stream. +// The length of the supplied input must match the end of a block exactly. +// The *capacity* of the dst slice must match the destination size of +// the uncompressed data exactly. +func (d *Decoder) decompress4X8bit(dst, src []byte) ([]byte, error) { + if d.actualTableLog == 8 { + return d.decompress4X8bitExactly(dst, src) + } + + var br [4]bitReaderBytes + start := 6 + for i := 0; i < 3; i++ { + length := int(src[i*2]) | (int(src[i*2+1]) << 8) + if start+length >= len(src) { + return nil, errors.New("truncated input (or invalid offset)") + } + err := br[i].init(src[start : start+length]) + if err != nil { + return nil, err + } + start += length + } + err := br[3].init(src[start:]) + if err != nil { + return nil, err + } + + // destination, offset to match first output + dstSize := cap(dst) + dst = dst[:dstSize] + out := dst + dstEvery := (dstSize + 3) / 4 + + shift := (8 - d.actualTableLog) & 7 + + const tlSize = 1 << 8 + const tlMask = tlSize - 1 + single := d.dt.single[:tlSize] + + // Use temp table to avoid bound checks/append penalty. + var buf [256]byte + var off uint8 + var decoded int + + // Decode 4 values from each decoder/loop. + const bufoff = 256 / 4 + for { + if br[0].off < 4 || br[1].off < 4 || br[2].off < 4 || br[3].off < 4 { + break + } + + { + // Interleave 2 decodes. + const stream = 0 + const stream2 = 1 + br[stream].fillFast() + br[stream2].fillFast() + + v := single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 := single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+1] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+1] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+2] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+2] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+3] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+3] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + } + + { + const stream = 2 + const stream2 = 3 + br[stream].fillFast() + br[stream2].fillFast() + + v := single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 := single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+1] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+1] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+2] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+2] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+3] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+3] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + } + + off += 4 + + if off == bufoff { + if bufoff > dstEvery { + return nil, errors.New("corruption detected: stream overrun 1") + } + copy(out, buf[:bufoff]) + copy(out[dstEvery:], buf[bufoff:bufoff*2]) + copy(out[dstEvery*2:], buf[bufoff*2:bufoff*3]) + copy(out[dstEvery*3:], buf[bufoff*3:bufoff*4]) + off = 0 + out = out[bufoff:] + decoded += 256 + // There must at least be 3 buffers left. + if len(out) < dstEvery*3 { + return nil, errors.New("corruption detected: stream overrun 2") + } + } + } + if off > 0 { + ioff := int(off) + if len(out) < dstEvery*3+ioff { + return nil, errors.New("corruption detected: stream overrun 3") + } + copy(out, buf[:off]) + copy(out[dstEvery:dstEvery+ioff], buf[bufoff:bufoff*2]) + copy(out[dstEvery*2:dstEvery*2+ioff], buf[bufoff*2:bufoff*3]) + copy(out[dstEvery*3:dstEvery*3+ioff], buf[bufoff*3:bufoff*4]) + decoded += int(off) * 4 + out = out[off:] + } + + // Decode remaining. + for i := range br { + offset := dstEvery * i + br := &br[i] + bitsLeft := int(br.off*8) + int(64-br.bitsRead) + for bitsLeft > 0 { + if br.finished() { + return nil, io.ErrUnexpectedEOF + } + if br.bitsRead >= 56 { + if br.off >= 4 { + v := br.in[br.off-4:] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + br.value |= uint64(low) << (br.bitsRead - 32) + br.bitsRead -= 32 + br.off -= 4 + } else { + for br.off > 0 { + br.value |= uint64(br.in[br.off-1]) << (br.bitsRead - 8) + br.bitsRead -= 8 + br.off-- + } + } + } + // end inline... + if offset >= len(out) { + return nil, errors.New("corruption detected: stream overrun 4") + } + + // Read value and increment offset. + v := single[br.peekByteFast()>>shift].entry + nBits := uint8(v) + br.advance(nBits) + bitsLeft -= int(nBits) + out[offset] = uint8(v >> 8) + offset++ + } + decoded += offset - dstEvery*i + err = br.close() + if err != nil { + return nil, err + } + } + if dstSize != decoded { + return nil, errors.New("corruption detected: short output block") + } + return dst, nil +} + +// Decompress4X will decompress a 4X encoded stream. +// The length of the supplied input must match the end of a block exactly. +// The *capacity* of the dst slice must match the destination size of +// the uncompressed data exactly. +func (d *Decoder) decompress4X8bitExactly(dst, src []byte) ([]byte, error) { + var br [4]bitReaderBytes + start := 6 + for i := 0; i < 3; i++ { + length := int(src[i*2]) | (int(src[i*2+1]) << 8) + if start+length >= len(src) { + return nil, errors.New("truncated input (or invalid offset)") + } + err := br[i].init(src[start : start+length]) + if err != nil { + return nil, err + } + start += length + } + err := br[3].init(src[start:]) + if err != nil { + return nil, err + } + + // destination, offset to match first output + dstSize := cap(dst) + dst = dst[:dstSize] + out := dst + dstEvery := (dstSize + 3) / 4 + + const shift = 0 + const tlSize = 1 << 8 + const tlMask = tlSize - 1 + single := d.dt.single[:tlSize] + + // Use temp table to avoid bound checks/append penalty. + var buf [256]byte + var off uint8 + var decoded int + + // Decode 4 values from each decoder/loop. + const bufoff = 256 / 4 + for { + if br[0].off < 4 || br[1].off < 4 || br[2].off < 4 || br[3].off < 4 { + break + } + + { + // Interleave 2 decodes. + const stream = 0 + const stream2 = 1 + br[stream].fillFast() + br[stream2].fillFast() + + v := single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 := single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+1] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+1] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+2] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+2] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+3] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+3] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + } + + { + const stream = 2 + const stream2 = 3 + br[stream].fillFast() + br[stream2].fillFast() + + v := single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 := single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+1] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+1] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+2] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+2] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + + v = single[br[stream].peekByteFast()>>shift].entry + buf[off+bufoff*stream+3] = uint8(v >> 8) + br[stream].advance(uint8(v)) + + v2 = single[br[stream2].peekByteFast()>>shift].entry + buf[off+bufoff*stream2+3] = uint8(v2 >> 8) + br[stream2].advance(uint8(v2)) + } + + off += 4 + + if off == bufoff { + if bufoff > dstEvery { + return nil, errors.New("corruption detected: stream overrun 1") + } + copy(out, buf[:bufoff]) + copy(out[dstEvery:], buf[bufoff:bufoff*2]) + copy(out[dstEvery*2:], buf[bufoff*2:bufoff*3]) + copy(out[dstEvery*3:], buf[bufoff*3:bufoff*4]) + off = 0 + out = out[bufoff:] + decoded += 256 + // There must at least be 3 buffers left. + if len(out) < dstEvery*3 { + return nil, errors.New("corruption detected: stream overrun 2") + } + } + } + if off > 0 { + ioff := int(off) + if len(out) < dstEvery*3+ioff { + return nil, errors.New("corruption detected: stream overrun 3") + } + copy(out, buf[:off]) + copy(out[dstEvery:dstEvery+ioff], buf[bufoff:bufoff*2]) + copy(out[dstEvery*2:dstEvery*2+ioff], buf[bufoff*2:bufoff*3]) + copy(out[dstEvery*3:dstEvery*3+ioff], buf[bufoff*3:bufoff*4]) + decoded += int(off) * 4 + out = out[off:] + } + + // Decode remaining. + for i := range br { + offset := dstEvery * i + br := &br[i] + bitsLeft := int(br.off*8) + int(64-br.bitsRead) + for bitsLeft > 0 { + if br.finished() { + return nil, io.ErrUnexpectedEOF + } + if br.bitsRead >= 56 { + if br.off >= 4 { + v := br.in[br.off-4:] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + br.value |= uint64(low) << (br.bitsRead - 32) + br.bitsRead -= 32 + br.off -= 4 + } else { + for br.off > 0 { + br.value |= uint64(br.in[br.off-1]) << (br.bitsRead - 8) + br.bitsRead -= 8 + br.off-- + } + } + } + // end inline... + if offset >= len(out) { + return nil, errors.New("corruption detected: stream overrun 4") + } + + // Read value and increment offset. + v := single[br.peekByteFast()>>shift].entry + nBits := uint8(v) + br.advance(nBits) + bitsLeft -= int(nBits) + out[offset] = uint8(v >> 8) + offset++ + } + decoded += offset - dstEvery*i + err = br.close() + if err != nil { + return nil, err + } + } + if dstSize != decoded { + return nil, errors.New("corruption detected: short output block") + } + return dst, nil +} + +// matches will compare a decoding table to a coding table. +// Errors are written to the writer. +// Nothing will be written if table is ok. +func (s *Scratch) matches(ct cTable, w io.Writer) { + if s == nil || len(s.dt.single) == 0 { + return + } + dt := s.dt.single[:1<>8) == byte(sym) { + fmt.Fprintf(w, "symbol %x has decoder, but no encoder\n", sym) + errs++ + break + } + } + if errs == 0 { + broken-- + } + continue + } + // Unused bits in input + ub := tablelog - enc.nBits + top := enc.val << ub + // decoder looks at top bits. + dec := dt[top] + if uint8(dec.entry) != enc.nBits { + fmt.Fprintf(w, "symbol 0x%x bit size mismatch (enc: %d, dec:%d).\n", sym, enc.nBits, uint8(dec.entry)) + errs++ + } + if uint8(dec.entry>>8) != uint8(sym) { + fmt.Fprintf(w, "symbol 0x%x decoder output mismatch (enc: %d, dec:%d).\n", sym, sym, uint8(dec.entry>>8)) + errs++ + } + if errs > 0 { + fmt.Fprintf(w, "%d errros in base, stopping\n", errs) + continue + } + // Ensure that all combinations are covered. + for i := uint16(0); i < (1 << ub); i++ { + vval := top | i + dec := dt[vval] + if uint8(dec.entry) != enc.nBits { + fmt.Fprintf(w, "symbol 0x%x bit size mismatch (enc: %d, dec:%d).\n", vval, enc.nBits, uint8(dec.entry)) + errs++ + } + if uint8(dec.entry>>8) != uint8(sym) { + fmt.Fprintf(w, "symbol 0x%x decoder output mismatch (enc: %d, dec:%d).\n", vval, sym, uint8(dec.entry>>8)) + errs++ + } + if errs > 20 { + fmt.Fprintf(w, "%d errros, stopping\n", errs) + break + } + } + if errs == 0 { + ok++ + broken-- + } + } + if broken > 0 { + fmt.Fprintf(w, "%d broken, %d ok\n", broken, ok) + } +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/huff0/huff0.go b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/huff0.go new file mode 100644 index 000000000000..7ec2022b6506 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/huff0/huff0.go @@ -0,0 +1,273 @@ +// Package huff0 provides fast huffman encoding as used in zstd. +// +// See README.md at https://github.com/klauspost/compress/tree/master/huff0 for details. +package huff0 + +import ( + "errors" + "fmt" + "math" + "math/bits" + + "github.com/klauspost/compress/fse" +) + +const ( + maxSymbolValue = 255 + + // zstandard limits tablelog to 11, see: + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#huffman-tree-description + tableLogMax = 11 + tableLogDefault = 11 + minTablelog = 5 + huffNodesLen = 512 + + // BlockSizeMax is maximum input size for a single block uncompressed. + BlockSizeMax = 1<<18 - 1 +) + +var ( + // ErrIncompressible is returned when input is judged to be too hard to compress. + ErrIncompressible = errors.New("input is not compressible") + + // ErrUseRLE is returned from the compressor when the input is a single byte value repeated. + ErrUseRLE = errors.New("input is single value repeated") + + // ErrTooBig is return if input is too large for a single block. + ErrTooBig = errors.New("input too big") + + // ErrMaxDecodedSizeExceeded is return if input is too large for a single block. + ErrMaxDecodedSizeExceeded = errors.New("maximum output size exceeded") +) + +type ReusePolicy uint8 + +const ( + // ReusePolicyAllow will allow reuse if it produces smaller output. + ReusePolicyAllow ReusePolicy = iota + + // ReusePolicyPrefer will re-use aggressively if possible. + // This will not check if a new table will produce smaller output, + // except if the current table is impossible to use or + // compressed output is bigger than input. + ReusePolicyPrefer + + // ReusePolicyNone will disable re-use of tables. + // This is slightly faster than ReusePolicyAllow but may produce larger output. + ReusePolicyNone + + // ReusePolicyMust must allow reuse and produce smaller output. + ReusePolicyMust +) + +type Scratch struct { + count [maxSymbolValue + 1]uint32 + + // Per block parameters. + // These can be used to override compression parameters of the block. + // Do not touch, unless you know what you are doing. + + // Out is output buffer. + // If the scratch is re-used before the caller is done processing the output, + // set this field to nil. + // Otherwise the output buffer will be re-used for next Compression/Decompression step + // and allocation will be avoided. + Out []byte + + // OutTable will contain the table data only, if a new table has been generated. + // Slice of the returned data. + OutTable []byte + + // OutData will contain the compressed data. + // Slice of the returned data. + OutData []byte + + // MaxDecodedSize will set the maximum allowed output size. + // This value will automatically be set to BlockSizeMax if not set. + // Decoders will return ErrMaxDecodedSizeExceeded is this limit is exceeded. + MaxDecodedSize int + + br byteReader + + // MaxSymbolValue will override the maximum symbol value of the next block. + MaxSymbolValue uint8 + + // TableLog will attempt to override the tablelog for the next block. + // Must be <= 11 and >= 5. + TableLog uint8 + + // Reuse will specify the reuse policy + Reuse ReusePolicy + + // WantLogLess allows to specify a log 2 reduction that should at least be achieved, + // otherwise the block will be returned as incompressible. + // The reduction should then at least be (input size >> WantLogLess) + // If WantLogLess == 0 any improvement will do. + WantLogLess uint8 + + symbolLen uint16 // Length of active part of the symbol table. + maxCount int // count of the most probable symbol + clearCount bool // clear count + actualTableLog uint8 // Selected tablelog. + prevTableLog uint8 // Tablelog for previous table + prevTable cTable // Table used for previous compression. + cTable cTable // compression table + dt dTable // decompression table + nodes []nodeElt + tmpOut [4][]byte + fse *fse.Scratch + huffWeight [maxSymbolValue + 1]byte +} + +// TransferCTable will transfer the previously used compression table. +func (s *Scratch) TransferCTable(src *Scratch) { + if cap(s.prevTable) < len(src.prevTable) { + s.prevTable = make(cTable, 0, maxSymbolValue+1) + } + s.prevTable = s.prevTable[:len(src.prevTable)] + copy(s.prevTable, src.prevTable) + s.prevTableLog = src.prevTableLog +} + +func (s *Scratch) prepare(in []byte) (*Scratch, error) { + if len(in) > BlockSizeMax { + return nil, ErrTooBig + } + if s == nil { + s = &Scratch{} + } + if s.MaxSymbolValue == 0 { + s.MaxSymbolValue = maxSymbolValue + } + if s.TableLog == 0 { + s.TableLog = tableLogDefault + } + if s.TableLog > tableLogMax || s.TableLog < minTablelog { + return nil, fmt.Errorf(" invalid tableLog %d (%d -> %d)", s.TableLog, minTablelog, tableLogMax) + } + if s.MaxDecodedSize <= 0 || s.MaxDecodedSize > BlockSizeMax { + s.MaxDecodedSize = BlockSizeMax + } + if s.clearCount && s.maxCount == 0 { + for i := range s.count { + s.count[i] = 0 + } + s.clearCount = false + } + if cap(s.Out) == 0 { + s.Out = make([]byte, 0, len(in)) + } + s.Out = s.Out[:0] + + s.OutTable = nil + s.OutData = nil + if cap(s.nodes) < huffNodesLen+1 { + s.nodes = make([]nodeElt, 0, huffNodesLen+1) + } + s.nodes = s.nodes[:0] + if s.fse == nil { + s.fse = &fse.Scratch{} + } + s.br.init(in) + + return s, nil +} + +type cTable []cTableEntry + +func (c cTable) write(s *Scratch) error { + var ( + // precomputed conversion table + bitsToWeight [tableLogMax + 1]byte + huffLog = s.actualTableLog + // last weight is not saved. + maxSymbolValue = uint8(s.symbolLen - 1) + huffWeight = s.huffWeight[:256] + ) + const ( + maxFSETableLog = 6 + ) + // convert to weight + bitsToWeight[0] = 0 + for n := uint8(1); n < huffLog+1; n++ { + bitsToWeight[n] = huffLog + 1 - n + } + + // Acquire histogram for FSE. + hist := s.fse.Histogram() + hist = hist[:256] + for i := range hist[:16] { + hist[i] = 0 + } + for n := uint8(0); n < maxSymbolValue; n++ { + v := bitsToWeight[c[n].nBits] & 15 + huffWeight[n] = v + hist[v]++ + } + + // FSE compress if feasible. + if maxSymbolValue >= 2 { + huffMaxCnt := uint32(0) + huffMax := uint8(0) + for i, v := range hist[:16] { + if v == 0 { + continue + } + huffMax = byte(i) + if v > huffMaxCnt { + huffMaxCnt = v + } + } + s.fse.HistogramFinished(huffMax, int(huffMaxCnt)) + s.fse.TableLog = maxFSETableLog + b, err := fse.Compress(huffWeight[:maxSymbolValue], s.fse) + if err == nil && len(b) < int(s.symbolLen>>1) { + s.Out = append(s.Out, uint8(len(b))) + s.Out = append(s.Out, b...) + return nil + } + // Unable to compress (RLE/uncompressible) + } + // write raw values as 4-bits (max : 15) + if maxSymbolValue > (256 - 128) { + // should not happen : likely means source cannot be compressed + return ErrIncompressible + } + op := s.Out + // special case, pack weights 4 bits/weight. + op = append(op, 128|(maxSymbolValue-1)) + // be sure it doesn't cause msan issue in final combination + huffWeight[maxSymbolValue] = 0 + for n := uint16(0); n < uint16(maxSymbolValue); n += 2 { + op = append(op, (huffWeight[n]<<4)|huffWeight[n+1]) + } + s.Out = op + return nil +} + +// estimateSize returns the estimated size in bytes of the input represented in the +// histogram supplied. +func (c cTable) estimateSize(hist []uint32) int { + nbBits := uint32(7) + for i, v := range c[:len(hist)] { + nbBits += uint32(v.nBits) * hist[i] + } + return int(nbBits >> 3) +} + +// minSize returns the minimum possible size considering the shannon limit. +func (s *Scratch) minSize(total int) int { + nbBits := float64(7) + fTotal := float64(total) + for _, v := range s.count[:s.symbolLen] { + n := float64(v) + if n > 0 { + nbBits += math.Log2(fTotal/n) * n + } + } + return int(nbBits) >> 3 +} + +func highBit32(val uint32) (n uint32) { + return uint32(bits.Len32(val) - 1) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/.gitignore b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/.gitignore new file mode 100644 index 000000000000..042091d9b3b0 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/.gitignore @@ -0,0 +1,16 @@ +cmd/snappytool/snappytool +testdata/bench + +# These explicitly listed benchmark data files are for an obsolete version of +# snappy_test.go. +testdata/alice29.txt +testdata/asyoulik.txt +testdata/fireworks.jpeg +testdata/geo.protodata +testdata/html +testdata/html_x_4 +testdata/kppkn.gtb +testdata/lcet10.txt +testdata/paper-100k.pdf +testdata/plrabn12.txt +testdata/urls.10K diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/AUTHORS b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/AUTHORS new file mode 100644 index 000000000000..bcfa19520af9 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/AUTHORS @@ -0,0 +1,15 @@ +# This is the official list of Snappy-Go authors for copyright purposes. +# This file is distinct from the CONTRIBUTORS files. +# See the latter for an explanation. + +# Names should be added to this file as +# Name or Organization +# The email address is not required for organizations. + +# Please keep the list sorted. + +Damian Gryski +Google Inc. +Jan Mercl <0xjnml@gmail.com> +Rodolfo Carvalho +Sebastien Binet diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/CONTRIBUTORS b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/CONTRIBUTORS new file mode 100644 index 000000000000..931ae31606f8 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/CONTRIBUTORS @@ -0,0 +1,37 @@ +# This is the official list of people who can contribute +# (and typically have contributed) code to the Snappy-Go repository. +# The AUTHORS file lists the copyright holders; this file +# lists people. For example, Google employees are listed here +# but not in AUTHORS, because Google holds the copyright. +# +# The submission process automatically checks to make sure +# that people submitting code are listed in this file (by email address). +# +# Names should be added to this file only after verifying that +# the individual or the individual's organization has agreed to +# the appropriate Contributor License Agreement, found here: +# +# http://code.google.com/legal/individual-cla-v1.0.html +# http://code.google.com/legal/corporate-cla-v1.0.html +# +# The agreement for individuals can be filled out on the web. +# +# When adding J Random Contributor's name to this file, +# either J's name or J's organization's name should be +# added to the AUTHORS file, depending on whether the +# individual or corporate CLA was used. + +# Names should be added to this file like so: +# Name + +# Please keep the list sorted. + +Damian Gryski +Jan Mercl <0xjnml@gmail.com> +Kai Backman +Marc-Antoine Ruel +Nigel Tao +Rob Pike +Rodolfo Carvalho +Russ Cox +Sebastien Binet diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/LICENSE b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/LICENSE new file mode 100644 index 000000000000..6050c10f4c8b --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2011 The Snappy-Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/README b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/README new file mode 100644 index 000000000000..cea12879a0ea --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/README @@ -0,0 +1,107 @@ +The Snappy compression format in the Go programming language. + +To download and install from source: +$ go get github.com/golang/snappy + +Unless otherwise noted, the Snappy-Go source files are distributed +under the BSD-style license found in the LICENSE file. + + + +Benchmarks. + +The golang/snappy benchmarks include compressing (Z) and decompressing (U) ten +or so files, the same set used by the C++ Snappy code (github.com/google/snappy +and note the "google", not "golang"). On an "Intel(R) Core(TM) i7-3770 CPU @ +3.40GHz", Go's GOARCH=amd64 numbers as of 2016-05-29: + +"go test -test.bench=." + +_UFlat0-8 2.19GB/s ± 0% html +_UFlat1-8 1.41GB/s ± 0% urls +_UFlat2-8 23.5GB/s ± 2% jpg +_UFlat3-8 1.91GB/s ± 0% jpg_200 +_UFlat4-8 14.0GB/s ± 1% pdf +_UFlat5-8 1.97GB/s ± 0% html4 +_UFlat6-8 814MB/s ± 0% txt1 +_UFlat7-8 785MB/s ± 0% txt2 +_UFlat8-8 857MB/s ± 0% txt3 +_UFlat9-8 719MB/s ± 1% txt4 +_UFlat10-8 2.84GB/s ± 0% pb +_UFlat11-8 1.05GB/s ± 0% gaviota + +_ZFlat0-8 1.04GB/s ± 0% html +_ZFlat1-8 534MB/s ± 0% urls +_ZFlat2-8 15.7GB/s ± 1% jpg +_ZFlat3-8 740MB/s ± 3% jpg_200 +_ZFlat4-8 9.20GB/s ± 1% pdf +_ZFlat5-8 991MB/s ± 0% html4 +_ZFlat6-8 379MB/s ± 0% txt1 +_ZFlat7-8 352MB/s ± 0% txt2 +_ZFlat8-8 396MB/s ± 1% txt3 +_ZFlat9-8 327MB/s ± 1% txt4 +_ZFlat10-8 1.33GB/s ± 1% pb +_ZFlat11-8 605MB/s ± 1% gaviota + + + +"go test -test.bench=. -tags=noasm" + +_UFlat0-8 621MB/s ± 2% html +_UFlat1-8 494MB/s ± 1% urls +_UFlat2-8 23.2GB/s ± 1% jpg +_UFlat3-8 1.12GB/s ± 1% jpg_200 +_UFlat4-8 4.35GB/s ± 1% pdf +_UFlat5-8 609MB/s ± 0% html4 +_UFlat6-8 296MB/s ± 0% txt1 +_UFlat7-8 288MB/s ± 0% txt2 +_UFlat8-8 309MB/s ± 1% txt3 +_UFlat9-8 280MB/s ± 1% txt4 +_UFlat10-8 753MB/s ± 0% pb +_UFlat11-8 400MB/s ± 0% gaviota + +_ZFlat0-8 409MB/s ± 1% html +_ZFlat1-8 250MB/s ± 1% urls +_ZFlat2-8 12.3GB/s ± 1% jpg +_ZFlat3-8 132MB/s ± 0% jpg_200 +_ZFlat4-8 2.92GB/s ± 0% pdf +_ZFlat5-8 405MB/s ± 1% html4 +_ZFlat6-8 179MB/s ± 1% txt1 +_ZFlat7-8 170MB/s ± 1% txt2 +_ZFlat8-8 189MB/s ± 1% txt3 +_ZFlat9-8 164MB/s ± 1% txt4 +_ZFlat10-8 479MB/s ± 1% pb +_ZFlat11-8 270MB/s ± 1% gaviota + + + +For comparison (Go's encoded output is byte-for-byte identical to C++'s), here +are the numbers from C++ Snappy's + +make CXXFLAGS="-O2 -DNDEBUG -g" clean snappy_unittest.log && cat snappy_unittest.log + +BM_UFlat/0 2.4GB/s html +BM_UFlat/1 1.4GB/s urls +BM_UFlat/2 21.8GB/s jpg +BM_UFlat/3 1.5GB/s jpg_200 +BM_UFlat/4 13.3GB/s pdf +BM_UFlat/5 2.1GB/s html4 +BM_UFlat/6 1.0GB/s txt1 +BM_UFlat/7 959.4MB/s txt2 +BM_UFlat/8 1.0GB/s txt3 +BM_UFlat/9 864.5MB/s txt4 +BM_UFlat/10 2.9GB/s pb +BM_UFlat/11 1.2GB/s gaviota + +BM_ZFlat/0 944.3MB/s html (22.31 %) +BM_ZFlat/1 501.6MB/s urls (47.78 %) +BM_ZFlat/2 14.3GB/s jpg (99.95 %) +BM_ZFlat/3 538.3MB/s jpg_200 (73.00 %) +BM_ZFlat/4 8.3GB/s pdf (83.30 %) +BM_ZFlat/5 903.5MB/s html4 (22.52 %) +BM_ZFlat/6 336.0MB/s txt1 (57.88 %) +BM_ZFlat/7 312.3MB/s txt2 (61.91 %) +BM_ZFlat/8 353.1MB/s txt3 (54.99 %) +BM_ZFlat/9 289.9MB/s txt4 (66.26 %) +BM_ZFlat/10 1.2GB/s pb (19.68 %) +BM_ZFlat/11 527.4MB/s gaviota (37.72 %) diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode.go b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode.go new file mode 100644 index 000000000000..72efb0353ddf --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode.go @@ -0,0 +1,237 @@ +// Copyright 2011 The Snappy-Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package snappy + +import ( + "encoding/binary" + "errors" + "io" +) + +var ( + // ErrCorrupt reports that the input is invalid. + ErrCorrupt = errors.New("snappy: corrupt input") + // ErrTooLarge reports that the uncompressed length is too large. + ErrTooLarge = errors.New("snappy: decoded block is too large") + // ErrUnsupported reports that the input isn't supported. + ErrUnsupported = errors.New("snappy: unsupported input") + + errUnsupportedLiteralLength = errors.New("snappy: unsupported literal length") +) + +// DecodedLen returns the length of the decoded block. +func DecodedLen(src []byte) (int, error) { + v, _, err := decodedLen(src) + return v, err +} + +// decodedLen returns the length of the decoded block and the number of bytes +// that the length header occupied. +func decodedLen(src []byte) (blockLen, headerLen int, err error) { + v, n := binary.Uvarint(src) + if n <= 0 || v > 0xffffffff { + return 0, 0, ErrCorrupt + } + + const wordSize = 32 << (^uint(0) >> 32 & 1) + if wordSize == 32 && v > 0x7fffffff { + return 0, 0, ErrTooLarge + } + return int(v), n, nil +} + +const ( + decodeErrCodeCorrupt = 1 + decodeErrCodeUnsupportedLiteralLength = 2 +) + +// Decode returns the decoded form of src. The returned slice may be a sub- +// slice of dst if dst was large enough to hold the entire decoded block. +// Otherwise, a newly allocated slice will be returned. +// +// The dst and src must not overlap. It is valid to pass a nil dst. +func Decode(dst, src []byte) ([]byte, error) { + dLen, s, err := decodedLen(src) + if err != nil { + return nil, err + } + if dLen <= len(dst) { + dst = dst[:dLen] + } else { + dst = make([]byte, dLen) + } + switch decode(dst, src[s:]) { + case 0: + return dst, nil + case decodeErrCodeUnsupportedLiteralLength: + return nil, errUnsupportedLiteralLength + } + return nil, ErrCorrupt +} + +// NewReader returns a new Reader that decompresses from r, using the framing +// format described at +// https://github.com/google/snappy/blob/master/framing_format.txt +func NewReader(r io.Reader) *Reader { + return &Reader{ + r: r, + decoded: make([]byte, maxBlockSize), + buf: make([]byte, maxEncodedLenOfMaxBlockSize+checksumSize), + } +} + +// Reader is an io.Reader that can read Snappy-compressed bytes. +type Reader struct { + r io.Reader + err error + decoded []byte + buf []byte + // decoded[i:j] contains decoded bytes that have not yet been passed on. + i, j int + readHeader bool +} + +// Reset discards any buffered data, resets all state, and switches the Snappy +// reader to read from r. This permits reusing a Reader rather than allocating +// a new one. +func (r *Reader) Reset(reader io.Reader) { + r.r = reader + r.err = nil + r.i = 0 + r.j = 0 + r.readHeader = false +} + +func (r *Reader) readFull(p []byte, allowEOF bool) (ok bool) { + if _, r.err = io.ReadFull(r.r, p); r.err != nil { + if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) { + r.err = ErrCorrupt + } + return false + } + return true +} + +// Read satisfies the io.Reader interface. +func (r *Reader) Read(p []byte) (int, error) { + if r.err != nil { + return 0, r.err + } + for { + if r.i < r.j { + n := copy(p, r.decoded[r.i:r.j]) + r.i += n + return n, nil + } + if !r.readFull(r.buf[:4], true) { + return 0, r.err + } + chunkType := r.buf[0] + if !r.readHeader { + if chunkType != chunkTypeStreamIdentifier { + r.err = ErrCorrupt + return 0, r.err + } + r.readHeader = true + } + chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16 + if chunkLen > len(r.buf) { + r.err = ErrUnsupported + return 0, r.err + } + + // The chunk types are specified at + // https://github.com/google/snappy/blob/master/framing_format.txt + switch chunkType { + case chunkTypeCompressedData: + // Section 4.2. Compressed data (chunk type 0x00). + if chunkLen < checksumSize { + r.err = ErrCorrupt + return 0, r.err + } + buf := r.buf[:chunkLen] + if !r.readFull(buf, false) { + return 0, r.err + } + checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + buf = buf[checksumSize:] + + n, err := DecodedLen(buf) + if err != nil { + r.err = err + return 0, r.err + } + if n > len(r.decoded) { + r.err = ErrCorrupt + return 0, r.err + } + if _, err := Decode(r.decoded, buf); err != nil { + r.err = err + return 0, r.err + } + if crc(r.decoded[:n]) != checksum { + r.err = ErrCorrupt + return 0, r.err + } + r.i, r.j = 0, n + continue + + case chunkTypeUncompressedData: + // Section 4.3. Uncompressed data (chunk type 0x01). + if chunkLen < checksumSize { + r.err = ErrCorrupt + return 0, r.err + } + buf := r.buf[:checksumSize] + if !r.readFull(buf, false) { + return 0, r.err + } + checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + // Read directly into r.decoded instead of via r.buf. + n := chunkLen - checksumSize + if n > len(r.decoded) { + r.err = ErrCorrupt + return 0, r.err + } + if !r.readFull(r.decoded[:n], false) { + return 0, r.err + } + if crc(r.decoded[:n]) != checksum { + r.err = ErrCorrupt + return 0, r.err + } + r.i, r.j = 0, n + continue + + case chunkTypeStreamIdentifier: + // Section 4.1. Stream identifier (chunk type 0xff). + if chunkLen != len(magicBody) { + r.err = ErrCorrupt + return 0, r.err + } + if !r.readFull(r.buf[:len(magicBody)], false) { + return 0, r.err + } + for i := 0; i < len(magicBody); i++ { + if r.buf[i] != magicBody[i] { + r.err = ErrCorrupt + return 0, r.err + } + } + continue + } + + if chunkType <= 0x7f { + // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f). + r.err = ErrUnsupported + return 0, r.err + } + // Section 4.4 Padding (chunk type 0xfe). + // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd). + if !r.readFull(r.buf[:chunkLen], false) { + return 0, r.err + } + } +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_amd64.go b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_amd64.go new file mode 100644 index 000000000000..fcd192b849ed --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_amd64.go @@ -0,0 +1,14 @@ +// Copyright 2016 The Snappy-Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !appengine +// +build gc +// +build !noasm + +package snappy + +// decode has the same semantics as in decode_other.go. +// +//go:noescape +func decode(dst, src []byte) int diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_amd64.s b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_amd64.s new file mode 100644 index 000000000000..1c66e37234dc --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_amd64.s @@ -0,0 +1,482 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !appengine +// +build gc +// +build !noasm + +#include "textflag.h" + +// The asm code generally follows the pure Go code in decode_other.go, except +// where marked with a "!!!". + +// func decode(dst, src []byte) int +// +// All local variables fit into registers. The non-zero stack size is only to +// spill registers and push args when issuing a CALL. The register allocation: +// - AX scratch +// - BX scratch +// - CX length or x +// - DX offset +// - SI &src[s] +// - DI &dst[d] +// + R8 dst_base +// + R9 dst_len +// + R10 dst_base + dst_len +// + R11 src_base +// + R12 src_len +// + R13 src_base + src_len +// - R14 used by doCopy +// - R15 used by doCopy +// +// The registers R8-R13 (marked with a "+") are set at the start of the +// function, and after a CALL returns, and are not otherwise modified. +// +// The d variable is implicitly DI - R8, and len(dst)-d is R10 - DI. +// The s variable is implicitly SI - R11, and len(src)-s is R13 - SI. +TEXT ·decode(SB), NOSPLIT, $48-56 + // Initialize SI, DI and R8-R13. + MOVQ dst_base+0(FP), R8 + MOVQ dst_len+8(FP), R9 + MOVQ R8, DI + MOVQ R8, R10 + ADDQ R9, R10 + MOVQ src_base+24(FP), R11 + MOVQ src_len+32(FP), R12 + MOVQ R11, SI + MOVQ R11, R13 + ADDQ R12, R13 + +loop: + // for s < len(src) + CMPQ SI, R13 + JEQ end + + // CX = uint32(src[s]) + // + // switch src[s] & 0x03 + MOVBLZX (SI), CX + MOVL CX, BX + ANDL $3, BX + CMPL BX, $1 + JAE tagCopy + + // ---------------------------------------- + // The code below handles literal tags. + + // case tagLiteral: + // x := uint32(src[s] >> 2) + // switch + SHRL $2, CX + CMPL CX, $60 + JAE tagLit60Plus + + // case x < 60: + // s++ + INCQ SI + +doLit: + // This is the end of the inner "switch", when we have a literal tag. + // + // We assume that CX == x and x fits in a uint32, where x is the variable + // used in the pure Go decode_other.go code. + + // length = int(x) + 1 + // + // Unlike the pure Go code, we don't need to check if length <= 0 because + // CX can hold 64 bits, so the increment cannot overflow. + INCQ CX + + // Prepare to check if copying length bytes will run past the end of dst or + // src. + // + // AX = len(dst) - d + // BX = len(src) - s + MOVQ R10, AX + SUBQ DI, AX + MOVQ R13, BX + SUBQ SI, BX + + // !!! Try a faster technique for short (16 or fewer bytes) copies. + // + // if length > 16 || len(dst)-d < 16 || len(src)-s < 16 { + // goto callMemmove // Fall back on calling runtime·memmove. + // } + // + // The C++ snappy code calls this TryFastAppend. It also checks len(src)-s + // against 21 instead of 16, because it cannot assume that all of its input + // is contiguous in memory and so it needs to leave enough source bytes to + // read the next tag without refilling buffers, but Go's Decode assumes + // contiguousness (the src argument is a []byte). + CMPQ CX, $16 + JGT callMemmove + CMPQ AX, $16 + JLT callMemmove + CMPQ BX, $16 + JLT callMemmove + + // !!! Implement the copy from src to dst as a 16-byte load and store. + // (Decode's documentation says that dst and src must not overlap.) + // + // This always copies 16 bytes, instead of only length bytes, but that's + // OK. If the input is a valid Snappy encoding then subsequent iterations + // will fix up the overrun. Otherwise, Decode returns a nil []byte (and a + // non-nil error), so the overrun will be ignored. + // + // Note that on amd64, it is legal and cheap to issue unaligned 8-byte or + // 16-byte loads and stores. This technique probably wouldn't be as + // effective on architectures that are fussier about alignment. + MOVOU 0(SI), X0 + MOVOU X0, 0(DI) + + // d += length + // s += length + ADDQ CX, DI + ADDQ CX, SI + JMP loop + +callMemmove: + // if length > len(dst)-d || length > len(src)-s { etc } + CMPQ CX, AX + JGT errCorrupt + CMPQ CX, BX + JGT errCorrupt + + // copy(dst[d:], src[s:s+length]) + // + // This means calling runtime·memmove(&dst[d], &src[s], length), so we push + // DI, SI and CX as arguments. Coincidentally, we also need to spill those + // three registers to the stack, to save local variables across the CALL. + MOVQ DI, 0(SP) + MOVQ SI, 8(SP) + MOVQ CX, 16(SP) + MOVQ DI, 24(SP) + MOVQ SI, 32(SP) + MOVQ CX, 40(SP) + CALL runtime·memmove(SB) + + // Restore local variables: unspill registers from the stack and + // re-calculate R8-R13. + MOVQ 24(SP), DI + MOVQ 32(SP), SI + MOVQ 40(SP), CX + MOVQ dst_base+0(FP), R8 + MOVQ dst_len+8(FP), R9 + MOVQ R8, R10 + ADDQ R9, R10 + MOVQ src_base+24(FP), R11 + MOVQ src_len+32(FP), R12 + MOVQ R11, R13 + ADDQ R12, R13 + + // d += length + // s += length + ADDQ CX, DI + ADDQ CX, SI + JMP loop + +tagLit60Plus: + // !!! This fragment does the + // + // s += x - 58; if uint(s) > uint(len(src)) { etc } + // + // checks. In the asm version, we code it once instead of once per switch case. + ADDQ CX, SI + SUBQ $58, SI + CMPQ SI, R13 + JA errCorrupt + + // case x == 60: + CMPL CX, $61 + JEQ tagLit61 + JA tagLit62Plus + + // x = uint32(src[s-1]) + MOVBLZX -1(SI), CX + JMP doLit + +tagLit61: + // case x == 61: + // x = uint32(src[s-2]) | uint32(src[s-1])<<8 + MOVWLZX -2(SI), CX + JMP doLit + +tagLit62Plus: + CMPL CX, $62 + JA tagLit63 + + // case x == 62: + // x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16 + MOVWLZX -3(SI), CX + MOVBLZX -1(SI), BX + SHLL $16, BX + ORL BX, CX + JMP doLit + +tagLit63: + // case x == 63: + // x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24 + MOVL -4(SI), CX + JMP doLit + +// The code above handles literal tags. +// ---------------------------------------- +// The code below handles copy tags. + +tagCopy4: + // case tagCopy4: + // s += 5 + ADDQ $5, SI + + // if uint(s) > uint(len(src)) { etc } + CMPQ SI, R13 + JA errCorrupt + + // length = 1 + int(src[s-5])>>2 + SHRQ $2, CX + INCQ CX + + // offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24) + MOVLQZX -4(SI), DX + JMP doCopy + +tagCopy2: + // case tagCopy2: + // s += 3 + ADDQ $3, SI + + // if uint(s) > uint(len(src)) { etc } + CMPQ SI, R13 + JA errCorrupt + + // length = 1 + int(src[s-3])>>2 + SHRQ $2, CX + INCQ CX + + // offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8) + MOVWQZX -2(SI), DX + JMP doCopy + +tagCopy: + // We have a copy tag. We assume that: + // - BX == src[s] & 0x03 + // - CX == src[s] + CMPQ BX, $2 + JEQ tagCopy2 + JA tagCopy4 + + // case tagCopy1: + // s += 2 + ADDQ $2, SI + + // if uint(s) > uint(len(src)) { etc } + CMPQ SI, R13 + JA errCorrupt + + // offset = int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1])) + MOVQ CX, DX + ANDQ $0xe0, DX + SHLQ $3, DX + MOVBQZX -1(SI), BX + ORQ BX, DX + + // length = 4 + int(src[s-2])>>2&0x7 + SHRQ $2, CX + ANDQ $7, CX + ADDQ $4, CX + +doCopy: + // This is the end of the outer "switch", when we have a copy tag. + // + // We assume that: + // - CX == length && CX > 0 + // - DX == offset + + // if offset <= 0 { etc } + CMPQ DX, $0 + JLE errCorrupt + + // if d < offset { etc } + MOVQ DI, BX + SUBQ R8, BX + CMPQ BX, DX + JLT errCorrupt + + // if length > len(dst)-d { etc } + MOVQ R10, BX + SUBQ DI, BX + CMPQ CX, BX + JGT errCorrupt + + // forwardCopy(dst[d:d+length], dst[d-offset:]); d += length + // + // Set: + // - R14 = len(dst)-d + // - R15 = &dst[d-offset] + MOVQ R10, R14 + SUBQ DI, R14 + MOVQ DI, R15 + SUBQ DX, R15 + + // !!! Try a faster technique for short (16 or fewer bytes) forward copies. + // + // First, try using two 8-byte load/stores, similar to the doLit technique + // above. Even if dst[d:d+length] and dst[d-offset:] can overlap, this is + // still OK if offset >= 8. Note that this has to be two 8-byte load/stores + // and not one 16-byte load/store, and the first store has to be before the + // second load, due to the overlap if offset is in the range [8, 16). + // + // if length > 16 || offset < 8 || len(dst)-d < 16 { + // goto slowForwardCopy + // } + // copy 16 bytes + // d += length + CMPQ CX, $16 + JGT slowForwardCopy + CMPQ DX, $8 + JLT slowForwardCopy + CMPQ R14, $16 + JLT slowForwardCopy + MOVQ 0(R15), AX + MOVQ AX, 0(DI) + MOVQ 8(R15), BX + MOVQ BX, 8(DI) + ADDQ CX, DI + JMP loop + +slowForwardCopy: + // !!! If the forward copy is longer than 16 bytes, or if offset < 8, we + // can still try 8-byte load stores, provided we can overrun up to 10 extra + // bytes. As above, the overrun will be fixed up by subsequent iterations + // of the outermost loop. + // + // The C++ snappy code calls this technique IncrementalCopyFastPath. Its + // commentary says: + // + // ---- + // + // The main part of this loop is a simple copy of eight bytes at a time + // until we've copied (at least) the requested amount of bytes. However, + // if d and d-offset are less than eight bytes apart (indicating a + // repeating pattern of length < 8), we first need to expand the pattern in + // order to get the correct results. For instance, if the buffer looks like + // this, with the eight-byte and patterns marked as + // intervals: + // + // abxxxxxxxxxxxx + // [------] d-offset + // [------] d + // + // a single eight-byte copy from to will repeat the pattern + // once, after which we can move two bytes without moving : + // + // ababxxxxxxxxxx + // [------] d-offset + // [------] d + // + // and repeat the exercise until the two no longer overlap. + // + // This allows us to do very well in the special case of one single byte + // repeated many times, without taking a big hit for more general cases. + // + // The worst case of extra writing past the end of the match occurs when + // offset == 1 and length == 1; the last copy will read from byte positions + // [0..7] and write to [4..11], whereas it was only supposed to write to + // position 1. Thus, ten excess bytes. + // + // ---- + // + // That "10 byte overrun" worst case is confirmed by Go's + // TestSlowForwardCopyOverrun, which also tests the fixUpSlowForwardCopy + // and finishSlowForwardCopy algorithm. + // + // if length > len(dst)-d-10 { + // goto verySlowForwardCopy + // } + SUBQ $10, R14 + CMPQ CX, R14 + JGT verySlowForwardCopy + +makeOffsetAtLeast8: + // !!! As above, expand the pattern so that offset >= 8 and we can use + // 8-byte load/stores. + // + // for offset < 8 { + // copy 8 bytes from dst[d-offset:] to dst[d:] + // length -= offset + // d += offset + // offset += offset + // // The two previous lines together means that d-offset, and therefore + // // R15, is unchanged. + // } + CMPQ DX, $8 + JGE fixUpSlowForwardCopy + MOVQ (R15), BX + MOVQ BX, (DI) + SUBQ DX, CX + ADDQ DX, DI + ADDQ DX, DX + JMP makeOffsetAtLeast8 + +fixUpSlowForwardCopy: + // !!! Add length (which might be negative now) to d (implied by DI being + // &dst[d]) so that d ends up at the right place when we jump back to the + // top of the loop. Before we do that, though, we save DI to AX so that, if + // length is positive, copying the remaining length bytes will write to the + // right place. + MOVQ DI, AX + ADDQ CX, DI + +finishSlowForwardCopy: + // !!! Repeat 8-byte load/stores until length <= 0. Ending with a negative + // length means that we overrun, but as above, that will be fixed up by + // subsequent iterations of the outermost loop. + CMPQ CX, $0 + JLE loop + MOVQ (R15), BX + MOVQ BX, (AX) + ADDQ $8, R15 + ADDQ $8, AX + SUBQ $8, CX + JMP finishSlowForwardCopy + +verySlowForwardCopy: + // verySlowForwardCopy is a simple implementation of forward copy. In C + // parlance, this is a do/while loop instead of a while loop, since we know + // that length > 0. In Go syntax: + // + // for { + // dst[d] = dst[d - offset] + // d++ + // length-- + // if length == 0 { + // break + // } + // } + MOVB (R15), BX + MOVB BX, (DI) + INCQ R15 + INCQ DI + DECQ CX + JNZ verySlowForwardCopy + JMP loop + +// The code above handles copy tags. +// ---------------------------------------- + +end: + // This is the end of the "for s < len(src)". + // + // if d != len(dst) { etc } + CMPQ DI, R10 + JNE errCorrupt + + // return 0 + MOVQ $0, ret+48(FP) + RET + +errCorrupt: + // return decodeErrCodeCorrupt + MOVQ $1, ret+48(FP) + RET diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_other.go b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_other.go new file mode 100644 index 000000000000..94a96c5d7b85 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/decode_other.go @@ -0,0 +1,115 @@ +// Copyright 2016 The Snappy-Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !amd64 appengine !gc noasm + +package snappy + +// decode writes the decoding of src to dst. It assumes that the varint-encoded +// length of the decompressed bytes has already been read, and that len(dst) +// equals that length. +// +// It returns 0 on success or a decodeErrCodeXxx error code on failure. +func decode(dst, src []byte) int { + var d, s, offset, length int + for s < len(src) { + switch src[s] & 0x03 { + case tagLiteral: + x := uint32(src[s] >> 2) + switch { + case x < 60: + s++ + case x == 60: + s += 2 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-1]) + case x == 61: + s += 3 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-2]) | uint32(src[s-1])<<8 + case x == 62: + s += 4 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16 + case x == 63: + s += 5 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24 + } + length = int(x) + 1 + if length <= 0 { + return decodeErrCodeUnsupportedLiteralLength + } + if length > len(dst)-d || length > len(src)-s { + return decodeErrCodeCorrupt + } + copy(dst[d:], src[s:s+length]) + d += length + s += length + continue + + case tagCopy1: + s += 2 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + length = 4 + int(src[s-2])>>2&0x7 + offset = int(uint32(src[s-2])&0xe0<<3 | uint32(src[s-1])) + + case tagCopy2: + s += 3 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + length = 1 + int(src[s-3])>>2 + offset = int(uint32(src[s-2]) | uint32(src[s-1])<<8) + + case tagCopy4: + s += 5 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + return decodeErrCodeCorrupt + } + length = 1 + int(src[s-5])>>2 + offset = int(uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24) + } + + if offset <= 0 || d < offset || length > len(dst)-d { + return decodeErrCodeCorrupt + } + // Copy from an earlier sub-slice of dst to a later sub-slice. + // If no overlap, use the built-in copy: + if offset > length { + copy(dst[d:d+length], dst[d-offset:]) + d += length + continue + } + + // Unlike the built-in copy function, this byte-by-byte copy always runs + // forwards, even if the slices overlap. Conceptually, this is: + // + // d += forwardCopy(dst[d:d+length], dst[d-offset:]) + // + // We align the slices into a and b and show the compiler they are the same size. + // This allows the loop to run without bounds checks. + a := dst[d : d+length] + b := dst[d-offset:] + b = b[:len(a)] + for i := range a { + a[i] = b[i] + } + d += length + } + if d != len(dst) { + return decodeErrCodeCorrupt + } + return 0 +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode.go b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode.go new file mode 100644 index 000000000000..8d393e904bb3 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode.go @@ -0,0 +1,285 @@ +// Copyright 2011 The Snappy-Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package snappy + +import ( + "encoding/binary" + "errors" + "io" +) + +// Encode returns the encoded form of src. The returned slice may be a sub- +// slice of dst if dst was large enough to hold the entire encoded block. +// Otherwise, a newly allocated slice will be returned. +// +// The dst and src must not overlap. It is valid to pass a nil dst. +func Encode(dst, src []byte) []byte { + if n := MaxEncodedLen(len(src)); n < 0 { + panic(ErrTooLarge) + } else if len(dst) < n { + dst = make([]byte, n) + } + + // The block starts with the varint-encoded length of the decompressed bytes. + d := binary.PutUvarint(dst, uint64(len(src))) + + for len(src) > 0 { + p := src + src = nil + if len(p) > maxBlockSize { + p, src = p[:maxBlockSize], p[maxBlockSize:] + } + if len(p) < minNonLiteralBlockSize { + d += emitLiteral(dst[d:], p) + } else { + d += encodeBlock(dst[d:], p) + } + } + return dst[:d] +} + +// inputMargin is the minimum number of extra input bytes to keep, inside +// encodeBlock's inner loop. On some architectures, this margin lets us +// implement a fast path for emitLiteral, where the copy of short (<= 16 byte) +// literals can be implemented as a single load to and store from a 16-byte +// register. That literal's actual length can be as short as 1 byte, so this +// can copy up to 15 bytes too much, but that's OK as subsequent iterations of +// the encoding loop will fix up the copy overrun, and this inputMargin ensures +// that we don't overrun the dst and src buffers. +const inputMargin = 16 - 1 + +// minNonLiteralBlockSize is the minimum size of the input to encodeBlock that +// could be encoded with a copy tag. This is the minimum with respect to the +// algorithm used by encodeBlock, not a minimum enforced by the file format. +// +// The encoded output must start with at least a 1 byte literal, as there are +// no previous bytes to copy. A minimal (1 byte) copy after that, generated +// from an emitCopy call in encodeBlock's main loop, would require at least +// another inputMargin bytes, for the reason above: we want any emitLiteral +// calls inside encodeBlock's main loop to use the fast path if possible, which +// requires being able to overrun by inputMargin bytes. Thus, +// minNonLiteralBlockSize equals 1 + 1 + inputMargin. +// +// The C++ code doesn't use this exact threshold, but it could, as discussed at +// https://groups.google.com/d/topic/snappy-compression/oGbhsdIJSJ8/discussion +// The difference between Go (2+inputMargin) and C++ (inputMargin) is purely an +// optimization. It should not affect the encoded form. This is tested by +// TestSameEncodingAsCppShortCopies. +const minNonLiteralBlockSize = 1 + 1 + inputMargin + +// MaxEncodedLen returns the maximum length of a snappy block, given its +// uncompressed length. +// +// It will return a negative value if srcLen is too large to encode. +func MaxEncodedLen(srcLen int) int { + n := uint64(srcLen) + if n > 0xffffffff { + return -1 + } + // Compressed data can be defined as: + // compressed := item* literal* + // item := literal* copy + // + // The trailing literal sequence has a space blowup of at most 62/60 + // since a literal of length 60 needs one tag byte + one extra byte + // for length information. + // + // Item blowup is trickier to measure. Suppose the "copy" op copies + // 4 bytes of data. Because of a special check in the encoding code, + // we produce a 4-byte copy only if the offset is < 65536. Therefore + // the copy op takes 3 bytes to encode, and this type of item leads + // to at most the 62/60 blowup for representing literals. + // + // Suppose the "copy" op copies 5 bytes of data. If the offset is big + // enough, it will take 5 bytes to encode the copy op. Therefore the + // worst case here is a one-byte literal followed by a five-byte copy. + // That is, 6 bytes of input turn into 7 bytes of "compressed" data. + // + // This last factor dominates the blowup, so the final estimate is: + n = 32 + n + n/6 + if n > 0xffffffff { + return -1 + } + return int(n) +} + +var errClosed = errors.New("snappy: Writer is closed") + +// NewWriter returns a new Writer that compresses to w. +// +// The Writer returned does not buffer writes. There is no need to Flush or +// Close such a Writer. +// +// Deprecated: the Writer returned is not suitable for many small writes, only +// for few large writes. Use NewBufferedWriter instead, which is efficient +// regardless of the frequency and shape of the writes, and remember to Close +// that Writer when done. +func NewWriter(w io.Writer) *Writer { + return &Writer{ + w: w, + obuf: make([]byte, obufLen), + } +} + +// NewBufferedWriter returns a new Writer that compresses to w, using the +// framing format described at +// https://github.com/google/snappy/blob/master/framing_format.txt +// +// The Writer returned buffers writes. Users must call Close to guarantee all +// data has been forwarded to the underlying io.Writer. They may also call +// Flush zero or more times before calling Close. +func NewBufferedWriter(w io.Writer) *Writer { + return &Writer{ + w: w, + ibuf: make([]byte, 0, maxBlockSize), + obuf: make([]byte, obufLen), + } +} + +// Writer is an io.Writer that can write Snappy-compressed bytes. +type Writer struct { + w io.Writer + err error + + // ibuf is a buffer for the incoming (uncompressed) bytes. + // + // Its use is optional. For backwards compatibility, Writers created by the + // NewWriter function have ibuf == nil, do not buffer incoming bytes, and + // therefore do not need to be Flush'ed or Close'd. + ibuf []byte + + // obuf is a buffer for the outgoing (compressed) bytes. + obuf []byte + + // wroteStreamHeader is whether we have written the stream header. + wroteStreamHeader bool +} + +// Reset discards the writer's state and switches the Snappy writer to write to +// w. This permits reusing a Writer rather than allocating a new one. +func (w *Writer) Reset(writer io.Writer) { + w.w = writer + w.err = nil + if w.ibuf != nil { + w.ibuf = w.ibuf[:0] + } + w.wroteStreamHeader = false +} + +// Write satisfies the io.Writer interface. +func (w *Writer) Write(p []byte) (nRet int, errRet error) { + if w.ibuf == nil { + // Do not buffer incoming bytes. This does not perform or compress well + // if the caller of Writer.Write writes many small slices. This + // behavior is therefore deprecated, but still supported for backwards + // compatibility with code that doesn't explicitly Flush or Close. + return w.write(p) + } + + // The remainder of this method is based on bufio.Writer.Write from the + // standard library. + + for len(p) > (cap(w.ibuf)-len(w.ibuf)) && w.err == nil { + var n int + if len(w.ibuf) == 0 { + // Large write, empty buffer. + // Write directly from p to avoid copy. + n, _ = w.write(p) + } else { + n = copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p) + w.ibuf = w.ibuf[:len(w.ibuf)+n] + w.Flush() + } + nRet += n + p = p[n:] + } + if w.err != nil { + return nRet, w.err + } + n := copy(w.ibuf[len(w.ibuf):cap(w.ibuf)], p) + w.ibuf = w.ibuf[:len(w.ibuf)+n] + nRet += n + return nRet, nil +} + +func (w *Writer) write(p []byte) (nRet int, errRet error) { + if w.err != nil { + return 0, w.err + } + for len(p) > 0 { + obufStart := len(magicChunk) + if !w.wroteStreamHeader { + w.wroteStreamHeader = true + copy(w.obuf, magicChunk) + obufStart = 0 + } + + var uncompressed []byte + if len(p) > maxBlockSize { + uncompressed, p = p[:maxBlockSize], p[maxBlockSize:] + } else { + uncompressed, p = p, nil + } + checksum := crc(uncompressed) + + // Compress the buffer, discarding the result if the improvement + // isn't at least 12.5%. + compressed := Encode(w.obuf[obufHeaderLen:], uncompressed) + chunkType := uint8(chunkTypeCompressedData) + chunkLen := 4 + len(compressed) + obufEnd := obufHeaderLen + len(compressed) + if len(compressed) >= len(uncompressed)-len(uncompressed)/8 { + chunkType = chunkTypeUncompressedData + chunkLen = 4 + len(uncompressed) + obufEnd = obufHeaderLen + } + + // Fill in the per-chunk header that comes before the body. + w.obuf[len(magicChunk)+0] = chunkType + w.obuf[len(magicChunk)+1] = uint8(chunkLen >> 0) + w.obuf[len(magicChunk)+2] = uint8(chunkLen >> 8) + w.obuf[len(magicChunk)+3] = uint8(chunkLen >> 16) + w.obuf[len(magicChunk)+4] = uint8(checksum >> 0) + w.obuf[len(magicChunk)+5] = uint8(checksum >> 8) + w.obuf[len(magicChunk)+6] = uint8(checksum >> 16) + w.obuf[len(magicChunk)+7] = uint8(checksum >> 24) + + if _, err := w.w.Write(w.obuf[obufStart:obufEnd]); err != nil { + w.err = err + return nRet, err + } + if chunkType == chunkTypeUncompressedData { + if _, err := w.w.Write(uncompressed); err != nil { + w.err = err + return nRet, err + } + } + nRet += len(uncompressed) + } + return nRet, nil +} + +// Flush flushes the Writer to its underlying io.Writer. +func (w *Writer) Flush() error { + if w.err != nil { + return w.err + } + if len(w.ibuf) == 0 { + return nil + } + w.write(w.ibuf) + w.ibuf = w.ibuf[:0] + return w.err +} + +// Close calls Flush and then closes the Writer. +func (w *Writer) Close() error { + w.Flush() + ret := w.err + if w.err == nil { + w.err = errClosed + } + return ret +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_amd64.go b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_amd64.go new file mode 100644 index 000000000000..150d91bc8be5 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_amd64.go @@ -0,0 +1,29 @@ +// Copyright 2016 The Snappy-Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !appengine +// +build gc +// +build !noasm + +package snappy + +// emitLiteral has the same semantics as in encode_other.go. +// +//go:noescape +func emitLiteral(dst, lit []byte) int + +// emitCopy has the same semantics as in encode_other.go. +// +//go:noescape +func emitCopy(dst []byte, offset, length int) int + +// extendMatch has the same semantics as in encode_other.go. +// +//go:noescape +func extendMatch(src []byte, i, j int) int + +// encodeBlock has the same semantics as in encode_other.go. +// +//go:noescape +func encodeBlock(dst, src []byte) (d int) diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_amd64.s b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_amd64.s new file mode 100644 index 000000000000..adfd979fe277 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_amd64.s @@ -0,0 +1,730 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !appengine +// +build gc +// +build !noasm + +#include "textflag.h" + +// The XXX lines assemble on Go 1.4, 1.5 and 1.7, but not 1.6, due to a +// Go toolchain regression. See https://github.com/golang/go/issues/15426 and +// https://github.com/golang/snappy/issues/29 +// +// As a workaround, the package was built with a known good assembler, and +// those instructions were disassembled by "objdump -d" to yield the +// 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15 +// style comments, in AT&T asm syntax. Note that rsp here is a physical +// register, not Go/asm's SP pseudo-register (see https://golang.org/doc/asm). +// The instructions were then encoded as "BYTE $0x.." sequences, which assemble +// fine on Go 1.6. + +// The asm code generally follows the pure Go code in encode_other.go, except +// where marked with a "!!!". + +// ---------------------------------------------------------------------------- + +// func emitLiteral(dst, lit []byte) int +// +// All local variables fit into registers. The register allocation: +// - AX len(lit) +// - BX n +// - DX return value +// - DI &dst[i] +// - R10 &lit[0] +// +// The 24 bytes of stack space is to call runtime·memmove. +// +// The unusual register allocation of local variables, such as R10 for the +// source pointer, matches the allocation used at the call site in encodeBlock, +// which makes it easier to manually inline this function. +TEXT ·emitLiteral(SB), NOSPLIT, $24-56 + MOVQ dst_base+0(FP), DI + MOVQ lit_base+24(FP), R10 + MOVQ lit_len+32(FP), AX + MOVQ AX, DX + MOVL AX, BX + SUBL $1, BX + + CMPL BX, $60 + JLT oneByte + CMPL BX, $256 + JLT twoBytes + +threeBytes: + MOVB $0xf4, 0(DI) + MOVW BX, 1(DI) + ADDQ $3, DI + ADDQ $3, DX + JMP memmove + +twoBytes: + MOVB $0xf0, 0(DI) + MOVB BX, 1(DI) + ADDQ $2, DI + ADDQ $2, DX + JMP memmove + +oneByte: + SHLB $2, BX + MOVB BX, 0(DI) + ADDQ $1, DI + ADDQ $1, DX + +memmove: + MOVQ DX, ret+48(FP) + + // copy(dst[i:], lit) + // + // This means calling runtime·memmove(&dst[i], &lit[0], len(lit)), so we push + // DI, R10 and AX as arguments. + MOVQ DI, 0(SP) + MOVQ R10, 8(SP) + MOVQ AX, 16(SP) + CALL runtime·memmove(SB) + RET + +// ---------------------------------------------------------------------------- + +// func emitCopy(dst []byte, offset, length int) int +// +// All local variables fit into registers. The register allocation: +// - AX length +// - SI &dst[0] +// - DI &dst[i] +// - R11 offset +// +// The unusual register allocation of local variables, such as R11 for the +// offset, matches the allocation used at the call site in encodeBlock, which +// makes it easier to manually inline this function. +TEXT ·emitCopy(SB), NOSPLIT, $0-48 + MOVQ dst_base+0(FP), DI + MOVQ DI, SI + MOVQ offset+24(FP), R11 + MOVQ length+32(FP), AX + +loop0: + // for length >= 68 { etc } + CMPL AX, $68 + JLT step1 + + // Emit a length 64 copy, encoded as 3 bytes. + MOVB $0xfe, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $64, AX + JMP loop0 + +step1: + // if length > 64 { etc } + CMPL AX, $64 + JLE step2 + + // Emit a length 60 copy, encoded as 3 bytes. + MOVB $0xee, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $60, AX + +step2: + // if length >= 12 || offset >= 2048 { goto step3 } + CMPL AX, $12 + JGE step3 + CMPL R11, $2048 + JGE step3 + + // Emit the remaining copy, encoded as 2 bytes. + MOVB R11, 1(DI) + SHRL $8, R11 + SHLB $5, R11 + SUBB $4, AX + SHLB $2, AX + ORB AX, R11 + ORB $1, R11 + MOVB R11, 0(DI) + ADDQ $2, DI + + // Return the number of bytes written. + SUBQ SI, DI + MOVQ DI, ret+40(FP) + RET + +step3: + // Emit the remaining copy, encoded as 3 bytes. + SUBL $1, AX + SHLB $2, AX + ORB $2, AX + MOVB AX, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + + // Return the number of bytes written. + SUBQ SI, DI + MOVQ DI, ret+40(FP) + RET + +// ---------------------------------------------------------------------------- + +// func extendMatch(src []byte, i, j int) int +// +// All local variables fit into registers. The register allocation: +// - DX &src[0] +// - SI &src[j] +// - R13 &src[len(src) - 8] +// - R14 &src[len(src)] +// - R15 &src[i] +// +// The unusual register allocation of local variables, such as R15 for a source +// pointer, matches the allocation used at the call site in encodeBlock, which +// makes it easier to manually inline this function. +TEXT ·extendMatch(SB), NOSPLIT, $0-48 + MOVQ src_base+0(FP), DX + MOVQ src_len+8(FP), R14 + MOVQ i+24(FP), R15 + MOVQ j+32(FP), SI + ADDQ DX, R14 + ADDQ DX, R15 + ADDQ DX, SI + MOVQ R14, R13 + SUBQ $8, R13 + +cmp8: + // As long as we are 8 or more bytes before the end of src, we can load and + // compare 8 bytes at a time. If those 8 bytes are equal, repeat. + CMPQ SI, R13 + JA cmp1 + MOVQ (R15), AX + MOVQ (SI), BX + CMPQ AX, BX + JNE bsf + ADDQ $8, R15 + ADDQ $8, SI + JMP cmp8 + +bsf: + // If those 8 bytes were not equal, XOR the two 8 byte values, and return + // the index of the first byte that differs. The BSF instruction finds the + // least significant 1 bit, the amd64 architecture is little-endian, and + // the shift by 3 converts a bit index to a byte index. + XORQ AX, BX + BSFQ BX, BX + SHRQ $3, BX + ADDQ BX, SI + + // Convert from &src[ret] to ret. + SUBQ DX, SI + MOVQ SI, ret+40(FP) + RET + +cmp1: + // In src's tail, compare 1 byte at a time. + CMPQ SI, R14 + JAE extendMatchEnd + MOVB (R15), AX + MOVB (SI), BX + CMPB AX, BX + JNE extendMatchEnd + ADDQ $1, R15 + ADDQ $1, SI + JMP cmp1 + +extendMatchEnd: + // Convert from &src[ret] to ret. + SUBQ DX, SI + MOVQ SI, ret+40(FP) + RET + +// ---------------------------------------------------------------------------- + +// func encodeBlock(dst, src []byte) (d int) +// +// All local variables fit into registers, other than "var table". The register +// allocation: +// - AX . . +// - BX . . +// - CX 56 shift (note that amd64 shifts by non-immediates must use CX). +// - DX 64 &src[0], tableSize +// - SI 72 &src[s] +// - DI 80 &dst[d] +// - R9 88 sLimit +// - R10 . &src[nextEmit] +// - R11 96 prevHash, currHash, nextHash, offset +// - R12 104 &src[base], skip +// - R13 . &src[nextS], &src[len(src) - 8] +// - R14 . len(src), bytesBetweenHashLookups, &src[len(src)], x +// - R15 112 candidate +// +// The second column (56, 64, etc) is the stack offset to spill the registers +// when calling other functions. We could pack this slightly tighter, but it's +// simpler to have a dedicated spill map independent of the function called. +// +// "var table [maxTableSize]uint16" takes up 32768 bytes of stack space. An +// extra 56 bytes, to call other functions, and an extra 64 bytes, to spill +// local variables (registers) during calls gives 32768 + 56 + 64 = 32888. +TEXT ·encodeBlock(SB), 0, $32888-56 + MOVQ dst_base+0(FP), DI + MOVQ src_base+24(FP), SI + MOVQ src_len+32(FP), R14 + + // shift, tableSize := uint32(32-8), 1<<8 + MOVQ $24, CX + MOVQ $256, DX + +calcShift: + // for ; tableSize < maxTableSize && tableSize < len(src); tableSize *= 2 { + // shift-- + // } + CMPQ DX, $16384 + JGE varTable + CMPQ DX, R14 + JGE varTable + SUBQ $1, CX + SHLQ $1, DX + JMP calcShift + +varTable: + // var table [maxTableSize]uint16 + // + // In the asm code, unlike the Go code, we can zero-initialize only the + // first tableSize elements. Each uint16 element is 2 bytes and each MOVOU + // writes 16 bytes, so we can do only tableSize/8 writes instead of the + // 2048 writes that would zero-initialize all of table's 32768 bytes. + SHRQ $3, DX + LEAQ table-32768(SP), BX + PXOR X0, X0 + +memclr: + MOVOU X0, 0(BX) + ADDQ $16, BX + SUBQ $1, DX + JNZ memclr + + // !!! DX = &src[0] + MOVQ SI, DX + + // sLimit := len(src) - inputMargin + MOVQ R14, R9 + SUBQ $15, R9 + + // !!! Pre-emptively spill CX, DX and R9 to the stack. Their values don't + // change for the rest of the function. + MOVQ CX, 56(SP) + MOVQ DX, 64(SP) + MOVQ R9, 88(SP) + + // nextEmit := 0 + MOVQ DX, R10 + + // s := 1 + ADDQ $1, SI + + // nextHash := hash(load32(src, s), shift) + MOVL 0(SI), R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + +outer: + // for { etc } + + // skip := 32 + MOVQ $32, R12 + + // nextS := s + MOVQ SI, R13 + + // candidate := 0 + MOVQ $0, R15 + +inner0: + // for { etc } + + // s := nextS + MOVQ R13, SI + + // bytesBetweenHashLookups := skip >> 5 + MOVQ R12, R14 + SHRQ $5, R14 + + // nextS = s + bytesBetweenHashLookups + ADDQ R14, R13 + + // skip += bytesBetweenHashLookups + ADDQ R14, R12 + + // if nextS > sLimit { goto emitRemainder } + MOVQ R13, AX + SUBQ DX, AX + CMPQ AX, R9 + JA emitRemainder + + // candidate = int(table[nextHash]) + // XXX: MOVWQZX table-32768(SP)(R11*2), R15 + // XXX: 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15 + BYTE $0x4e + BYTE $0x0f + BYTE $0xb7 + BYTE $0x7c + BYTE $0x5c + BYTE $0x78 + + // table[nextHash] = uint16(s) + MOVQ SI, AX + SUBQ DX, AX + + // XXX: MOVW AX, table-32768(SP)(R11*2) + // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2) + BYTE $0x66 + BYTE $0x42 + BYTE $0x89 + BYTE $0x44 + BYTE $0x5c + BYTE $0x78 + + // nextHash = hash(load32(src, nextS), shift) + MOVL 0(R13), R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // if load32(src, s) != load32(src, candidate) { continue } break + MOVL 0(SI), AX + MOVL (DX)(R15*1), BX + CMPL AX, BX + JNE inner0 + +fourByteMatch: + // As per the encode_other.go code: + // + // A 4-byte match has been found. We'll later see etc. + + // !!! Jump to a fast path for short (<= 16 byte) literals. See the comment + // on inputMargin in encode.go. + MOVQ SI, AX + SUBQ R10, AX + CMPQ AX, $16 + JLE emitLiteralFastPath + + // ---------------------------------------- + // Begin inline of the emitLiteral call. + // + // d += emitLiteral(dst[d:], src[nextEmit:s]) + + MOVL AX, BX + SUBL $1, BX + + CMPL BX, $60 + JLT inlineEmitLiteralOneByte + CMPL BX, $256 + JLT inlineEmitLiteralTwoBytes + +inlineEmitLiteralThreeBytes: + MOVB $0xf4, 0(DI) + MOVW BX, 1(DI) + ADDQ $3, DI + JMP inlineEmitLiteralMemmove + +inlineEmitLiteralTwoBytes: + MOVB $0xf0, 0(DI) + MOVB BX, 1(DI) + ADDQ $2, DI + JMP inlineEmitLiteralMemmove + +inlineEmitLiteralOneByte: + SHLB $2, BX + MOVB BX, 0(DI) + ADDQ $1, DI + +inlineEmitLiteralMemmove: + // Spill local variables (registers) onto the stack; call; unspill. + // + // copy(dst[i:], lit) + // + // This means calling runtime·memmove(&dst[i], &lit[0], len(lit)), so we push + // DI, R10 and AX as arguments. + MOVQ DI, 0(SP) + MOVQ R10, 8(SP) + MOVQ AX, 16(SP) + ADDQ AX, DI // Finish the "d +=" part of "d += emitLiteral(etc)". + MOVQ SI, 72(SP) + MOVQ DI, 80(SP) + MOVQ R15, 112(SP) + CALL runtime·memmove(SB) + MOVQ 56(SP), CX + MOVQ 64(SP), DX + MOVQ 72(SP), SI + MOVQ 80(SP), DI + MOVQ 88(SP), R9 + MOVQ 112(SP), R15 + JMP inner1 + +inlineEmitLiteralEnd: + // End inline of the emitLiteral call. + // ---------------------------------------- + +emitLiteralFastPath: + // !!! Emit the 1-byte encoding "uint8(len(lit)-1)<<2". + MOVB AX, BX + SUBB $1, BX + SHLB $2, BX + MOVB BX, (DI) + ADDQ $1, DI + + // !!! Implement the copy from lit to dst as a 16-byte load and store. + // (Encode's documentation says that dst and src must not overlap.) + // + // This always copies 16 bytes, instead of only len(lit) bytes, but that's + // OK. Subsequent iterations will fix up the overrun. + // + // Note that on amd64, it is legal and cheap to issue unaligned 8-byte or + // 16-byte loads and stores. This technique probably wouldn't be as + // effective on architectures that are fussier about alignment. + MOVOU 0(R10), X0 + MOVOU X0, 0(DI) + ADDQ AX, DI + +inner1: + // for { etc } + + // base := s + MOVQ SI, R12 + + // !!! offset := base - candidate + MOVQ R12, R11 + SUBQ R15, R11 + SUBQ DX, R11 + + // ---------------------------------------- + // Begin inline of the extendMatch call. + // + // s = extendMatch(src, candidate+4, s+4) + + // !!! R14 = &src[len(src)] + MOVQ src_len+32(FP), R14 + ADDQ DX, R14 + + // !!! R13 = &src[len(src) - 8] + MOVQ R14, R13 + SUBQ $8, R13 + + // !!! R15 = &src[candidate + 4] + ADDQ $4, R15 + ADDQ DX, R15 + + // !!! s += 4 + ADDQ $4, SI + +inlineExtendMatchCmp8: + // As long as we are 8 or more bytes before the end of src, we can load and + // compare 8 bytes at a time. If those 8 bytes are equal, repeat. + CMPQ SI, R13 + JA inlineExtendMatchCmp1 + MOVQ (R15), AX + MOVQ (SI), BX + CMPQ AX, BX + JNE inlineExtendMatchBSF + ADDQ $8, R15 + ADDQ $8, SI + JMP inlineExtendMatchCmp8 + +inlineExtendMatchBSF: + // If those 8 bytes were not equal, XOR the two 8 byte values, and return + // the index of the first byte that differs. The BSF instruction finds the + // least significant 1 bit, the amd64 architecture is little-endian, and + // the shift by 3 converts a bit index to a byte index. + XORQ AX, BX + BSFQ BX, BX + SHRQ $3, BX + ADDQ BX, SI + JMP inlineExtendMatchEnd + +inlineExtendMatchCmp1: + // In src's tail, compare 1 byte at a time. + CMPQ SI, R14 + JAE inlineExtendMatchEnd + MOVB (R15), AX + MOVB (SI), BX + CMPB AX, BX + JNE inlineExtendMatchEnd + ADDQ $1, R15 + ADDQ $1, SI + JMP inlineExtendMatchCmp1 + +inlineExtendMatchEnd: + // End inline of the extendMatch call. + // ---------------------------------------- + + // ---------------------------------------- + // Begin inline of the emitCopy call. + // + // d += emitCopy(dst[d:], base-candidate, s-base) + + // !!! length := s - base + MOVQ SI, AX + SUBQ R12, AX + +inlineEmitCopyLoop0: + // for length >= 68 { etc } + CMPL AX, $68 + JLT inlineEmitCopyStep1 + + // Emit a length 64 copy, encoded as 3 bytes. + MOVB $0xfe, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $64, AX + JMP inlineEmitCopyLoop0 + +inlineEmitCopyStep1: + // if length > 64 { etc } + CMPL AX, $64 + JLE inlineEmitCopyStep2 + + // Emit a length 60 copy, encoded as 3 bytes. + MOVB $0xee, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + SUBL $60, AX + +inlineEmitCopyStep2: + // if length >= 12 || offset >= 2048 { goto inlineEmitCopyStep3 } + CMPL AX, $12 + JGE inlineEmitCopyStep3 + CMPL R11, $2048 + JGE inlineEmitCopyStep3 + + // Emit the remaining copy, encoded as 2 bytes. + MOVB R11, 1(DI) + SHRL $8, R11 + SHLB $5, R11 + SUBB $4, AX + SHLB $2, AX + ORB AX, R11 + ORB $1, R11 + MOVB R11, 0(DI) + ADDQ $2, DI + JMP inlineEmitCopyEnd + +inlineEmitCopyStep3: + // Emit the remaining copy, encoded as 3 bytes. + SUBL $1, AX + SHLB $2, AX + ORB $2, AX + MOVB AX, 0(DI) + MOVW R11, 1(DI) + ADDQ $3, DI + +inlineEmitCopyEnd: + // End inline of the emitCopy call. + // ---------------------------------------- + + // nextEmit = s + MOVQ SI, R10 + + // if s >= sLimit { goto emitRemainder } + MOVQ SI, AX + SUBQ DX, AX + CMPQ AX, R9 + JAE emitRemainder + + // As per the encode_other.go code: + // + // We could immediately etc. + + // x := load64(src, s-1) + MOVQ -1(SI), R14 + + // prevHash := hash(uint32(x>>0), shift) + MOVL R14, R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // table[prevHash] = uint16(s-1) + MOVQ SI, AX + SUBQ DX, AX + SUBQ $1, AX + + // XXX: MOVW AX, table-32768(SP)(R11*2) + // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2) + BYTE $0x66 + BYTE $0x42 + BYTE $0x89 + BYTE $0x44 + BYTE $0x5c + BYTE $0x78 + + // currHash := hash(uint32(x>>8), shift) + SHRQ $8, R14 + MOVL R14, R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // candidate = int(table[currHash]) + // XXX: MOVWQZX table-32768(SP)(R11*2), R15 + // XXX: 4e 0f b7 7c 5c 78 movzwq 0x78(%rsp,%r11,2),%r15 + BYTE $0x4e + BYTE $0x0f + BYTE $0xb7 + BYTE $0x7c + BYTE $0x5c + BYTE $0x78 + + // table[currHash] = uint16(s) + ADDQ $1, AX + + // XXX: MOVW AX, table-32768(SP)(R11*2) + // XXX: 66 42 89 44 5c 78 mov %ax,0x78(%rsp,%r11,2) + BYTE $0x66 + BYTE $0x42 + BYTE $0x89 + BYTE $0x44 + BYTE $0x5c + BYTE $0x78 + + // if uint32(x>>8) == load32(src, candidate) { continue } + MOVL (DX)(R15*1), BX + CMPL R14, BX + JEQ inner1 + + // nextHash = hash(uint32(x>>16), shift) + SHRQ $8, R14 + MOVL R14, R11 + IMULL $0x1e35a7bd, R11 + SHRL CX, R11 + + // s++ + ADDQ $1, SI + + // break out of the inner1 for loop, i.e. continue the outer loop. + JMP outer + +emitRemainder: + // if nextEmit < len(src) { etc } + MOVQ src_len+32(FP), AX + ADDQ DX, AX + CMPQ R10, AX + JEQ encodeBlockEnd + + // d += emitLiteral(dst[d:], src[nextEmit:]) + // + // Push args. + MOVQ DI, 0(SP) + MOVQ $0, 8(SP) // Unnecessary, as the callee ignores it, but conservative. + MOVQ $0, 16(SP) // Unnecessary, as the callee ignores it, but conservative. + MOVQ R10, 24(SP) + SUBQ R10, AX + MOVQ AX, 32(SP) + MOVQ AX, 40(SP) // Unnecessary, as the callee ignores it, but conservative. + + // Spill local variables (registers) onto the stack; call; unspill. + MOVQ DI, 80(SP) + CALL ·emitLiteral(SB) + MOVQ 80(SP), DI + + // Finish the "d +=" part of "d += emitLiteral(etc)". + ADDQ 48(SP), DI + +encodeBlockEnd: + MOVQ dst_base+0(FP), AX + SUBQ AX, DI + MOVQ DI, d+48(FP) + RET diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_other.go b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_other.go new file mode 100644 index 000000000000..dbcae905e6e0 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/encode_other.go @@ -0,0 +1,238 @@ +// Copyright 2016 The Snappy-Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build !amd64 appengine !gc noasm + +package snappy + +func load32(b []byte, i int) uint32 { + b = b[i : i+4 : len(b)] // Help the compiler eliminate bounds checks on the next line. + return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 +} + +func load64(b []byte, i int) uint64 { + b = b[i : i+8 : len(b)] // Help the compiler eliminate bounds checks on the next line. + return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | + uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 +} + +// emitLiteral writes a literal chunk and returns the number of bytes written. +// +// It assumes that: +// dst is long enough to hold the encoded bytes +// 1 <= len(lit) && len(lit) <= 65536 +func emitLiteral(dst, lit []byte) int { + i, n := 0, uint(len(lit)-1) + switch { + case n < 60: + dst[0] = uint8(n)<<2 | tagLiteral + i = 1 + case n < 1<<8: + dst[0] = 60<<2 | tagLiteral + dst[1] = uint8(n) + i = 2 + default: + dst[0] = 61<<2 | tagLiteral + dst[1] = uint8(n) + dst[2] = uint8(n >> 8) + i = 3 + } + return i + copy(dst[i:], lit) +} + +// emitCopy writes a copy chunk and returns the number of bytes written. +// +// It assumes that: +// dst is long enough to hold the encoded bytes +// 1 <= offset && offset <= 65535 +// 4 <= length && length <= 65535 +func emitCopy(dst []byte, offset, length int) int { + i := 0 + // The maximum length for a single tagCopy1 or tagCopy2 op is 64 bytes. The + // threshold for this loop is a little higher (at 68 = 64 + 4), and the + // length emitted down below is is a little lower (at 60 = 64 - 4), because + // it's shorter to encode a length 67 copy as a length 60 tagCopy2 followed + // by a length 7 tagCopy1 (which encodes as 3+2 bytes) than to encode it as + // a length 64 tagCopy2 followed by a length 3 tagCopy2 (which encodes as + // 3+3 bytes). The magic 4 in the 64±4 is because the minimum length for a + // tagCopy1 op is 4 bytes, which is why a length 3 copy has to be an + // encodes-as-3-bytes tagCopy2 instead of an encodes-as-2-bytes tagCopy1. + for length >= 68 { + // Emit a length 64 copy, encoded as 3 bytes. + dst[i+0] = 63<<2 | tagCopy2 + dst[i+1] = uint8(offset) + dst[i+2] = uint8(offset >> 8) + i += 3 + length -= 64 + } + if length > 64 { + // Emit a length 60 copy, encoded as 3 bytes. + dst[i+0] = 59<<2 | tagCopy2 + dst[i+1] = uint8(offset) + dst[i+2] = uint8(offset >> 8) + i += 3 + length -= 60 + } + if length >= 12 || offset >= 2048 { + // Emit the remaining copy, encoded as 3 bytes. + dst[i+0] = uint8(length-1)<<2 | tagCopy2 + dst[i+1] = uint8(offset) + dst[i+2] = uint8(offset >> 8) + return i + 3 + } + // Emit the remaining copy, encoded as 2 bytes. + dst[i+0] = uint8(offset>>8)<<5 | uint8(length-4)<<2 | tagCopy1 + dst[i+1] = uint8(offset) + return i + 2 +} + +// extendMatch returns the largest k such that k <= len(src) and that +// src[i:i+k-j] and src[j:k] have the same contents. +// +// It assumes that: +// 0 <= i && i < j && j <= len(src) +func extendMatch(src []byte, i, j int) int { + for ; j < len(src) && src[i] == src[j]; i, j = i+1, j+1 { + } + return j +} + +func hash(u, shift uint32) uint32 { + return (u * 0x1e35a7bd) >> shift +} + +// encodeBlock encodes a non-empty src to a guaranteed-large-enough dst. It +// assumes that the varint-encoded length of the decompressed bytes has already +// been written. +// +// It also assumes that: +// len(dst) >= MaxEncodedLen(len(src)) && +// minNonLiteralBlockSize <= len(src) && len(src) <= maxBlockSize +func encodeBlock(dst, src []byte) (d int) { + // Initialize the hash table. Its size ranges from 1<<8 to 1<<14 inclusive. + // The table element type is uint16, as s < sLimit and sLimit < len(src) + // and len(src) <= maxBlockSize and maxBlockSize == 65536. + const ( + maxTableSize = 1 << 14 + // tableMask is redundant, but helps the compiler eliminate bounds + // checks. + tableMask = maxTableSize - 1 + ) + shift := uint32(32 - 8) + for tableSize := 1 << 8; tableSize < maxTableSize && tableSize < len(src); tableSize *= 2 { + shift-- + } + // In Go, all array elements are zero-initialized, so there is no advantage + // to a smaller tableSize per se. However, it matches the C++ algorithm, + // and in the asm versions of this code, we can get away with zeroing only + // the first tableSize elements. + var table [maxTableSize]uint16 + + // sLimit is when to stop looking for offset/length copies. The inputMargin + // lets us use a fast path for emitLiteral in the main loop, while we are + // looking for copies. + sLimit := len(src) - inputMargin + + // nextEmit is where in src the next emitLiteral should start from. + nextEmit := 0 + + // The encoded form must start with a literal, as there are no previous + // bytes to copy, so we start looking for hash matches at s == 1. + s := 1 + nextHash := hash(load32(src, s), shift) + + for { + // Copied from the C++ snappy implementation: + // + // Heuristic match skipping: If 32 bytes are scanned with no matches + // found, start looking only at every other byte. If 32 more bytes are + // scanned (or skipped), look at every third byte, etc.. When a match + // is found, immediately go back to looking at every byte. This is a + // small loss (~5% performance, ~0.1% density) for compressible data + // due to more bookkeeping, but for non-compressible data (such as + // JPEG) it's a huge win since the compressor quickly "realizes" the + // data is incompressible and doesn't bother looking for matches + // everywhere. + // + // The "skip" variable keeps track of how many bytes there are since + // the last match; dividing it by 32 (ie. right-shifting by five) gives + // the number of bytes to move ahead for each iteration. + skip := 32 + + nextS := s + candidate := 0 + for { + s = nextS + bytesBetweenHashLookups := skip >> 5 + nextS = s + bytesBetweenHashLookups + skip += bytesBetweenHashLookups + if nextS > sLimit { + goto emitRemainder + } + candidate = int(table[nextHash&tableMask]) + table[nextHash&tableMask] = uint16(s) + nextHash = hash(load32(src, nextS), shift) + if load32(src, s) == load32(src, candidate) { + break + } + } + + // A 4-byte match has been found. We'll later see if more than 4 bytes + // match. But, prior to the match, src[nextEmit:s] are unmatched. Emit + // them as literal bytes. + d += emitLiteral(dst[d:], src[nextEmit:s]) + + // Call emitCopy, and then see if another emitCopy could be our next + // move. Repeat until we find no match for the input immediately after + // what was consumed by the last emitCopy call. + // + // If we exit this loop normally then we need to call emitLiteral next, + // though we don't yet know how big the literal will be. We handle that + // by proceeding to the next iteration of the main loop. We also can + // exit this loop via goto if we get close to exhausting the input. + for { + // Invariant: we have a 4-byte match at s, and no need to emit any + // literal bytes prior to s. + base := s + + // Extend the 4-byte match as long as possible. + // + // This is an inlined version of: + // s = extendMatch(src, candidate+4, s+4) + s += 4 + for i := candidate + 4; s < len(src) && src[i] == src[s]; i, s = i+1, s+1 { + } + + d += emitCopy(dst[d:], base-candidate, s-base) + nextEmit = s + if s >= sLimit { + goto emitRemainder + } + + // We could immediately start working at s now, but to improve + // compression we first update the hash table at s-1 and at s. If + // another emitCopy is not our next move, also calculate nextHash + // at s+1. At least on GOARCH=amd64, these three hash calculations + // are faster as one load64 call (with some shifts) instead of + // three load32 calls. + x := load64(src, s-1) + prevHash := hash(uint32(x>>0), shift) + table[prevHash&tableMask] = uint16(s - 1) + currHash := hash(uint32(x>>8), shift) + candidate = int(table[currHash&tableMask]) + table[currHash&tableMask] = uint16(s) + if uint32(x>>8) != load32(src, candidate) { + nextHash = hash(uint32(x>>16), shift) + s++ + break + } + } + } + +emitRemainder: + if nextEmit < len(src) { + d += emitLiteral(dst[d:], src[nextEmit:]) + } + return d +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/runbench.cmd b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/runbench.cmd new file mode 100644 index 000000000000..d24eb4b47c37 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/runbench.cmd @@ -0,0 +1,2 @@ +del old.txt +go test -bench=. >>old.txt && go test -bench=. >>old.txt && go test -bench=. >>old.txt && benchstat -delta-test=ttest old.txt new.txt diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/snappy/snappy.go b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/snappy.go new file mode 100644 index 000000000000..74a36689e878 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/snappy/snappy.go @@ -0,0 +1,98 @@ +// Copyright 2011 The Snappy-Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package snappy implements the Snappy compression format. It aims for very +// high speeds and reasonable compression. +// +// There are actually two Snappy formats: block and stream. They are related, +// but different: trying to decompress block-compressed data as a Snappy stream +// will fail, and vice versa. The block format is the Decode and Encode +// functions and the stream format is the Reader and Writer types. +// +// The block format, the more common case, is used when the complete size (the +// number of bytes) of the original data is known upfront, at the time +// compression starts. The stream format, also known as the framing format, is +// for when that isn't always true. +// +// The canonical, C++ implementation is at https://github.com/google/snappy and +// it only implements the block format. +package snappy + +import ( + "hash/crc32" +) + +/* +Each encoded block begins with the varint-encoded length of the decoded data, +followed by a sequence of chunks. Chunks begin and end on byte boundaries. The +first byte of each chunk is broken into its 2 least and 6 most significant bits +called l and m: l ranges in [0, 4) and m ranges in [0, 64). l is the chunk tag. +Zero means a literal tag. All other values mean a copy tag. + +For literal tags: + - If m < 60, the next 1 + m bytes are literal bytes. + - Otherwise, let n be the little-endian unsigned integer denoted by the next + m - 59 bytes. The next 1 + n bytes after that are literal bytes. + +For copy tags, length bytes are copied from offset bytes ago, in the style of +Lempel-Ziv compression algorithms. In particular: + - For l == 1, the offset ranges in [0, 1<<11) and the length in [4, 12). + The length is 4 + the low 3 bits of m. The high 3 bits of m form bits 8-10 + of the offset. The next byte is bits 0-7 of the offset. + - For l == 2, the offset ranges in [0, 1<<16) and the length in [1, 65). + The length is 1 + m. The offset is the little-endian unsigned integer + denoted by the next 2 bytes. + - For l == 3, this tag is a legacy format that is no longer issued by most + encoders. Nonetheless, the offset ranges in [0, 1<<32) and the length in + [1, 65). The length is 1 + m. The offset is the little-endian unsigned + integer denoted by the next 4 bytes. +*/ +const ( + tagLiteral = 0x00 + tagCopy1 = 0x01 + tagCopy2 = 0x02 + tagCopy4 = 0x03 +) + +const ( + checksumSize = 4 + chunkHeaderSize = 4 + magicChunk = "\xff\x06\x00\x00" + magicBody + magicBody = "sNaPpY" + + // maxBlockSize is the maximum size of the input to encodeBlock. It is not + // part of the wire format per se, but some parts of the encoder assume + // that an offset fits into a uint16. + // + // Also, for the framing format (Writer type instead of Encode function), + // https://github.com/google/snappy/blob/master/framing_format.txt says + // that "the uncompressed data in a chunk must be no longer than 65536 + // bytes". + maxBlockSize = 65536 + + // maxEncodedLenOfMaxBlockSize equals MaxEncodedLen(maxBlockSize), but is + // hard coded to be a const instead of a variable, so that obufLen can also + // be a const. Their equivalence is confirmed by + // TestMaxEncodedLenOfMaxBlockSize. + maxEncodedLenOfMaxBlockSize = 76490 + + obufHeaderLen = len(magicChunk) + checksumSize + chunkHeaderSize + obufLen = obufHeaderLen + maxEncodedLenOfMaxBlockSize +) + +const ( + chunkTypeCompressedData = 0x00 + chunkTypeUncompressedData = 0x01 + chunkTypePadding = 0xfe + chunkTypeStreamIdentifier = 0xff +) + +var crcTable = crc32.MakeTable(crc32.Castagnoli) + +// crc implements the checksum specified in section 3 of +// https://github.com/google/snappy/blob/master/framing_format.txt +func crc(b []byte) uint32 { + c := crc32.Update(0, crcTable, b) + return uint32(c>>15|c<<17) + 0xa282ead8 +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/README.md b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/README.md new file mode 100644 index 000000000000..07f7285f0878 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/README.md @@ -0,0 +1,406 @@ +# zstd + +[Zstandard](https://facebook.github.io/zstd/) is a real-time compression algorithm, providing high compression ratios. +It offers a very wide range of compression / speed trade-off, while being backed by a very fast decoder. +A high performance compression algorithm is implemented. For now focused on speed. + +This package provides [compression](#Compressor) to and [decompression](#Decompressor) of Zstandard content. + +This package is pure Go and without use of "unsafe". + +The `zstd` package is provided as open source software using a Go standard license. + +Currently the package is heavily optimized for 64 bit processors and will be significantly slower on 32 bit processors. + +## Installation + +Install using `go get -u github.com/klauspost/compress`. The package is located in `github.com/klauspost/compress/zstd`. + +Godoc Documentation: https://godoc.org/github.com/klauspost/compress/zstd + + +## Compressor + +### Status: + +STABLE - there may always be subtle bugs, a wide variety of content has been tested and the library is actively +used by several projects. This library is being continuously [fuzz-tested](https://github.com/klauspost/compress-fuzz), +kindly supplied by [fuzzit.dev](https://fuzzit.dev/). + +There may still be specific combinations of data types/size/settings that could lead to edge cases, +so as always, testing is recommended. + +For now, a high speed (fastest) and medium-fast (default) compressor has been implemented. + +The "Fastest" compression ratio is roughly equivalent to zstd level 1. +The "Default" compression ratio is roughly equivalent to zstd level 3 (default). + +In terms of speed, it is typically 2x as fast as the stdlib deflate/gzip in its fastest mode. +The compression ratio compared to stdlib is around level 3, but usually 3x as fast. + +Compared to cgo zstd, the speed is around level 3 (default), but compression slightly worse, between level 1&2. + + +### Usage + +An Encoder can be used for either compressing a stream via the +`io.WriteCloser` interface supported by the Encoder or as multiple independent +tasks via the `EncodeAll` function. +Smaller encodes are encouraged to use the EncodeAll function. +Use `NewWriter` to create a new instance that can be used for both. + +To create a writer with default options, do like this: + +```Go +// Compress input to output. +func Compress(in io.Reader, out io.Writer) error { + w, err := NewWriter(output) + if err != nil { + return err + } + _, err := io.Copy(w, input) + if err != nil { + enc.Close() + return err + } + return enc.Close() +} +``` + +Now you can encode by writing data to `enc`. The output will be finished writing when `Close()` is called. +Even if your encode fails, you should still call `Close()` to release any resources that may be held up. + +The above is fine for big encodes. However, whenever possible try to *reuse* the writer. + +To reuse the encoder, you can use the `Reset(io.Writer)` function to change to another output. +This will allow the encoder to reuse all resources and avoid wasteful allocations. + +Currently stream encoding has 'light' concurrency, meaning up to 2 goroutines can be working on part +of a stream. This is independent of the `WithEncoderConcurrency(n)`, but that is likely to change +in the future. So if you want to limit concurrency for future updates, specify the concurrency +you would like. + +You can specify your desired compression level using `WithEncoderLevel()` option. Currently only pre-defined +compression settings can be specified. + +#### Future Compatibility Guarantees + +This will be an evolving project. When using this package it is important to note that both the compression efficiency and speed may change. + +The goal will be to keep the default efficiency at the default zstd (level 3). +However the encoding should never be assumed to remain the same, +and you should not use hashes of compressed output for similarity checks. + +The Encoder can be assumed to produce the same output from the exact same code version. +However, the may be modes in the future that break this, +although they will not be enabled without an explicit option. + +This encoder is not designed to (and will probably never) output the exact same bitstream as the reference encoder. + +Also note, that the cgo decompressor currently does not [report all errors on invalid input](https://github.com/DataDog/zstd/issues/59), +[omits error checks](https://github.com/DataDog/zstd/issues/61), [ignores checksums](https://github.com/DataDog/zstd/issues/43) +and seems to ignore concatenated streams, even though [it is part of the spec](https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#frames). + +#### Blocks + +For compressing small blocks, the returned encoder has a function called `EncodeAll(src, dst []byte) []byte`. + +`EncodeAll` will encode all input in src and append it to dst. +This function can be called concurrently, but each call will only run on a single goroutine. + +Encoded blocks can be concatenated and the result will be the combined input stream. +Data compressed with EncodeAll can be decoded with the Decoder, using either a stream or `DecodeAll`. + +Especially when encoding blocks you should take special care to reuse the encoder. +This will effectively make it run without allocations after a warmup period. +To make it run completely without allocations, supply a destination buffer with space for all content. + +```Go +import "github.com/klauspost/compress/zstd" + +// Create a writer that caches compressors. +// For this operation type we supply a nil Reader. +var encoder, _ = zstd.NewWriter(nil) + +// Compress a buffer. +// If you have a destination buffer, the allocation in the call can also be eliminated. +func Compress(src []byte) []byte { + return encoder.EncodeAll(src, make([]byte, 0, len(src))) +} +``` + +You can control the maximum number of concurrent encodes using the `WithEncoderConcurrency(n)` +option when creating the writer. + +Using the Encoder for both a stream and individual blocks concurrently is safe. + +### Performance + +I have collected some speed examples to compare speed and compression against other compressors. + +* `file` is the input file. +* `out` is the compressor used. `zskp` is this package. `zstd` is the Datadog cgo library. `gzstd/gzkp` is gzip standard and this library. +* `level` is the compression level used. For `zskp` level 1 is "fastest", level 2 is "default". +* `insize`/`outsize` is the input/output size. +* `millis` is the number of milliseconds used for compression. +* `mb/s` is megabytes (2^20 bytes) per second. + +``` +Silesia Corpus: +http://sun.aei.polsl.pl/~sdeor/corpus/silesia.zip + +This package: +file out level insize outsize millis mb/s +silesia.tar zskp 1 211947520 73101992 643 313.87 +silesia.tar zskp 2 211947520 67504318 969 208.38 +silesia.tar zskp 3 211947520 65177448 1899 106.44 + +cgo zstd: +silesia.tar zstd 1 211947520 73605392 543 371.56 +silesia.tar zstd 3 211947520 66793289 864 233.68 +silesia.tar zstd 6 211947520 62916450 1913 105.66 + +gzip, stdlib/this package: +silesia.tar gzstd 1 211947520 80007735 1654 122.21 +silesia.tar gzkp 1 211947520 80369488 1168 173.06 + +GOB stream of binary data. Highly compressible. +https://files.klauspost.com/compress/gob-stream.7z + +file out level insize outsize millis mb/s +gob-stream zskp 1 1911399616 235022249 3088 590.30 +gob-stream zskp 2 1911399616 205669791 3786 481.34 +gob-stream zskp 3 1911399616 185792019 9324 195.48 +gob-stream zstd 1 1911399616 249810424 2637 691.26 +gob-stream zstd 3 1911399616 208192146 3490 522.31 +gob-stream zstd 6 1911399616 193632038 6687 272.56 +gob-stream gzstd 1 1911399616 357382641 10251 177.82 +gob-stream gzkp 1 1911399616 362156523 5695 320.08 + +The test data for the Large Text Compression Benchmark is the first +10^9 bytes of the English Wikipedia dump on Mar. 3, 2006. +http://mattmahoney.net/dc/textdata.html + +file out level insize outsize millis mb/s +enwik9 zskp 1 1000000000 343848582 3609 264.18 +enwik9 zskp 2 1000000000 317276632 5746 165.97 +enwik9 zskp 3 1000000000 294540704 11725 81.34 +enwik9 zstd 1 1000000000 358072021 3110 306.65 +enwik9 zstd 3 1000000000 313734672 4784 199.35 +enwik9 zstd 6 1000000000 295138875 10290 92.68 +enwik9 gzstd 1 1000000000 382578136 9604 99.30 +enwik9 gzkp 1 1000000000 383825945 6544 145.73 + +Highly compressible JSON file. +https://files.klauspost.com/compress/github-june-2days-2019.json.zst + +file out level insize outsize millis mb/s +github-june-2days-2019.json zskp 1 6273951764 699045015 10620 563.40 +github-june-2days-2019.json zskp 2 6273951764 617881763 11687 511.96 +github-june-2days-2019.json zskp 3 6273951764 537511906 29252 204.54 +github-june-2days-2019.json zstd 1 6273951764 766284037 8450 708.00 +github-june-2days-2019.json zstd 3 6273951764 661889476 10927 547.57 +github-june-2days-2019.json zstd 6 6273951764 642756859 22996 260.18 +github-june-2days-2019.json gzstd 1 6273951764 1164400847 29948 199.79 +github-june-2days-2019.json gzkp 1 6273951764 1128755542 19236 311.03 + +VM Image, Linux mint with a few installed applications: +https://files.klauspost.com/compress/rawstudio-mint14.7z + +file out level insize outsize millis mb/s +rawstudio-mint14.tar zskp 1 8558382592 3667489370 20210 403.84 +rawstudio-mint14.tar zskp 2 8558382592 3364592300 31873 256.07 +rawstudio-mint14.tar zskp 3 8558382592 3224594213 71751 113.75 +rawstudio-mint14.tar zstd 1 8558382592 3609250104 17136 476.27 +rawstudio-mint14.tar zstd 3 8558382592 3341679997 29262 278.92 +rawstudio-mint14.tar zstd 6 8558382592 3235846406 77904 104.77 +rawstudio-mint14.tar gzstd 1 8558382592 3926257486 57722 141.40 +rawstudio-mint14.tar gzkp 1 8558382592 3970463184 41749 195.49 + +CSV data: +https://files.klauspost.com/compress/nyc-taxi-data-10M.csv.zst + +file out level insize outsize millis mb/s +nyc-taxi-data-10M.csv zskp 1 3325605752 641339945 8925 355.35 +nyc-taxi-data-10M.csv zskp 2 3325605752 591748091 11268 281.44 +nyc-taxi-data-10M.csv zskp 3 3325605752 538490114 19880 159.53 +nyc-taxi-data-10M.csv zstd 1 3325605752 687399637 8233 385.18 +nyc-taxi-data-10M.csv zstd 3 3325605752 598514411 10065 315.07 +nyc-taxi-data-10M.csv zstd 6 3325605752 570522953 20038 158.27 +nyc-taxi-data-10M.csv gzstd 1 3325605752 928656485 23876 132.83 +nyc-taxi-data-10M.csv gzkp 1 3325605752 924718719 16388 193.53 +``` + +## Decompressor + +Staus: STABLE - there may still be subtle bugs, but a wide variety of content has been tested. + +This library is being continuously [fuzz-tested](https://github.com/klauspost/compress-fuzz), +kindly supplied by [fuzzit.dev](https://fuzzit.dev/). +The main purpose of the fuzz testing is to ensure that it is not possible to crash the decoder, +or run it past its limits with ANY input provided. + +### Usage + +The package has been designed for two main usages, big streams of data and smaller in-memory buffers. +There are two main usages of the package for these. Both of them are accessed by creating a `Decoder`. + +For streaming use a simple setup could look like this: + +```Go +import "github.com/klauspost/compress/zstd" + +func Decompress(in io.Reader, out io.Writer) error { + d, err := zstd.NewReader(in) + if err != nil { + return err + } + defer d.Close() + + // Copy content... + _, err = io.Copy(out, d) + return err +} +``` + +It is important to use the "Close" function when you no longer need the Reader to stop running goroutines. +See "Allocation-less operation" below. + +For decoding buffers, it could look something like this: + +```Go +import "github.com/klauspost/compress/zstd" + +// Create a reader that caches decompressors. +// For this operation type we supply a nil Reader. +var decoder, _ = zstd.NewReader(nil) + +// Decompress a buffer. We don't supply a destination buffer, +// so it will be allocated by the decoder. +func Decompress(src []byte) ([]byte, error) { + return decoder.DecodeAll(src, nil) +} +``` + +Both of these cases should provide the functionality needed. +The decoder can be used for *concurrent* decompression of multiple buffers. +It will only allow a certain number of concurrent operations to run. +To tweak that yourself use the `WithDecoderConcurrency(n)` option when creating the decoder. + +### Dictionaries + +Data compressed with [dictionaries](https://github.com/facebook/zstd#the-case-for-small-data-compression) can be decompressed. + +Dictionaries are added individually to Decoders. +Dictionaries are generated by the `zstd --train` command and contains an initial state for the decoder. +To add a dictionary use the `WithDecoderDicts(dicts ...[]byte)` option with the dictionary data. +Several dictionaries can be added at once. + +The dictionary will be used automatically for the data that specifies them. +A re-used Decoder will still contain the dictionaries registered. + +When registering multiple dictionaries with the same ID, the last one will be used. + +It is possible to use dictionaries when compressing data. + +To enable a dictionary use `WithEncoderDict(dict []byte)`. Here only one dictionary will be used +and it will likely be used even if it doesn't improve compression. + +The used dictionary must be used to decompress the content. + +For any real gains, the dictionary should be built with similar data. +If an unsuitable dictionary is used the output may be slightly larger than using no dictionary. +Use the [zstd commandline tool](https://github.com/facebook/zstd/releases) to build a dictionary from sample data. +For information see [zstd dictionary information](https://github.com/facebook/zstd#the-case-for-small-data-compression). + +For now there is a fixed startup performance penalty for compressing content with dictionaries. +This will likely be improved over time. Just be aware to test performance when implementing. + +### Allocation-less operation + +The decoder has been designed to operate without allocations after a warmup. + +This means that you should *store* the decoder for best performance. +To re-use a stream decoder, use the `Reset(r io.Reader) error` to switch to another stream. +A decoder can safely be re-used even if the previous stream failed. + +To release the resources, you must call the `Close()` function on a decoder. +After this it can *no longer be reused*, but all running goroutines will be stopped. +So you *must* use this if you will no longer need the Reader. + +For decompressing smaller buffers a single decoder can be used. +When decoding buffers, you can supply a destination slice with length 0 and your expected capacity. +In this case no unneeded allocations should be made. + +### Concurrency + +The buffer decoder does everything on the same goroutine and does nothing concurrently. +It can however decode several buffers concurrently. Use `WithDecoderConcurrency(n)` to limit that. + +The stream decoder operates on + +* One goroutine reads input and splits the input to several block decoders. +* A number of decoders will decode blocks. +* A goroutine coordinates these blocks and sends history from one to the next. + +So effectively this also means the decoder will "read ahead" and prepare data to always be available for output. + +Since "blocks" are quite dependent on the output of the previous block stream decoding will only have limited concurrency. + +In practice this means that concurrency is often limited to utilizing about 2 cores effectively. + + +### Benchmarks + +These are some examples of performance compared to [datadog cgo library](https://github.com/DataDog/zstd). + +The first two are streaming decodes and the last are smaller inputs. + +``` +BenchmarkDecoderSilesia-8 3 385000067 ns/op 550.51 MB/s 5498 B/op 8 allocs/op +BenchmarkDecoderSilesiaCgo-8 6 197666567 ns/op 1072.25 MB/s 270672 B/op 8 allocs/op + +BenchmarkDecoderEnwik9-8 1 2027001600 ns/op 493.34 MB/s 10496 B/op 18 allocs/op +BenchmarkDecoderEnwik9Cgo-8 2 979499200 ns/op 1020.93 MB/s 270672 B/op 8 allocs/op + +Concurrent performance: + +BenchmarkDecoder_DecodeAllParallel/kppkn.gtb.zst-16 28915 42469 ns/op 4340.07 MB/s 114 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallel/geo.protodata.zst-16 116505 9965 ns/op 11900.16 MB/s 16 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallel/plrabn12.txt.zst-16 8952 134272 ns/op 3588.70 MB/s 915 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallel/lcet10.txt.zst-16 11820 102538 ns/op 4161.90 MB/s 594 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallel/asyoulik.txt.zst-16 34782 34184 ns/op 3661.88 MB/s 60 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallel/alice29.txt.zst-16 27712 43447 ns/op 3500.58 MB/s 99 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallel/html_x_4.zst-16 62826 18750 ns/op 21845.10 MB/s 104 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallel/paper-100k.pdf.zst-16 631545 1794 ns/op 57078.74 MB/s 2 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallel/fireworks.jpeg.zst-16 1690140 712 ns/op 172938.13 MB/s 1 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallel/urls.10K.zst-16 10432 113593 ns/op 6180.73 MB/s 1143 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallel/html.zst-16 113206 10671 ns/op 9596.27 MB/s 15 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallel/comp-data.bin.zst-16 1530615 779 ns/op 5229.49 MB/s 0 B/op 0 allocs/op + +BenchmarkDecoder_DecodeAllParallelCgo/kppkn.gtb.zst-16 65217 16192 ns/op 11383.34 MB/s 46 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallelCgo/geo.protodata.zst-16 292671 4039 ns/op 29363.19 MB/s 6 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallelCgo/plrabn12.txt.zst-16 26314 46021 ns/op 10470.43 MB/s 293 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallelCgo/lcet10.txt.zst-16 33897 34900 ns/op 12227.96 MB/s 205 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallelCgo/asyoulik.txt.zst-16 104348 11433 ns/op 10949.01 MB/s 20 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallelCgo/alice29.txt.zst-16 75949 15510 ns/op 9805.60 MB/s 32 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallelCgo/html_x_4.zst-16 173910 6756 ns/op 60624.29 MB/s 37 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallelCgo/paper-100k.pdf.zst-16 923076 1339 ns/op 76474.87 MB/s 1 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallelCgo/fireworks.jpeg.zst-16 922920 1351 ns/op 91102.57 MB/s 2 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallelCgo/urls.10K.zst-16 27649 43618 ns/op 16096.19 MB/s 407 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallelCgo/html.zst-16 279073 4160 ns/op 24614.18 MB/s 6 B/op 0 allocs/op +BenchmarkDecoder_DecodeAllParallelCgo/comp-data.bin.zst-16 749938 1579 ns/op 2581.71 MB/s 0 B/op 0 allocs/op +``` + +This reflects the performance around May 2020, but this may be out of date. + +# Contributions + +Contributions are always welcome. +For new features/fixes, remember to add tests and for performance enhancements include benchmarks. + +For sending files for reproducing errors use a service like [goobox](https://goobox.io/#/upload) or similar to share your files. + +For general feedback and experience reports, feel free to open an issue or write me on [Twitter](https://twitter.com/sh0dan). + +This package includes the excellent [`github.com/cespare/xxhash`](https://github.com/cespare/xxhash) package Copyright (c) 2016 Caleb Spare. diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bitreader.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bitreader.go new file mode 100644 index 000000000000..854458537154 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bitreader.go @@ -0,0 +1,136 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "encoding/binary" + "errors" + "io" + "math/bits" +) + +// bitReader reads a bitstream in reverse. +// The last set bit indicates the start of the stream and is used +// for aligning the input. +type bitReader struct { + in []byte + off uint // next byte to read is at in[off - 1] + value uint64 // Maybe use [16]byte, but shifting is awkward. + bitsRead uint8 +} + +// init initializes and resets the bit reader. +func (b *bitReader) init(in []byte) error { + if len(in) < 1 { + return errors.New("corrupt stream: too short") + } + b.in = in + b.off = uint(len(in)) + // The highest bit of the last byte indicates where to start + v := in[len(in)-1] + if v == 0 { + return errors.New("corrupt stream, did not find end of stream") + } + b.bitsRead = 64 + b.value = 0 + if len(in) >= 8 { + b.fillFastStart() + } else { + b.fill() + b.fill() + } + b.bitsRead += 8 - uint8(highBits(uint32(v))) + return nil +} + +// getBits will return n bits. n can be 0. +func (b *bitReader) getBits(n uint8) int { + if n == 0 /*|| b.bitsRead >= 64 */ { + return 0 + } + return b.getBitsFast(n) +} + +// getBitsFast requires that at least one bit is requested every time. +// There are no checks if the buffer is filled. +func (b *bitReader) getBitsFast(n uint8) int { + const regMask = 64 - 1 + v := uint32((b.value << (b.bitsRead & regMask)) >> ((regMask + 1 - n) & regMask)) + b.bitsRead += n + return int(v) +} + +// fillFast() will make sure at least 32 bits are available. +// There must be at least 4 bytes available. +func (b *bitReader) fillFast() { + if b.bitsRead < 32 { + return + } + // 2 bounds checks. + v := b.in[b.off-4:] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + b.value = (b.value << 32) | uint64(low) + b.bitsRead -= 32 + b.off -= 4 +} + +// fillFastStart() assumes the bitreader is empty and there is at least 8 bytes to read. +func (b *bitReader) fillFastStart() { + // Do single re-slice to avoid bounds checks. + b.value = binary.LittleEndian.Uint64(b.in[b.off-8:]) + b.bitsRead = 0 + b.off -= 8 +} + +// fill() will make sure at least 32 bits are available. +func (b *bitReader) fill() { + if b.bitsRead < 32 { + return + } + if b.off >= 4 { + v := b.in[b.off-4:] + v = v[:4] + low := (uint32(v[0])) | (uint32(v[1]) << 8) | (uint32(v[2]) << 16) | (uint32(v[3]) << 24) + b.value = (b.value << 32) | uint64(low) + b.bitsRead -= 32 + b.off -= 4 + return + } + for b.off > 0 { + b.value = (b.value << 8) | uint64(b.in[b.off-1]) + b.bitsRead -= 8 + b.off-- + } +} + +// finished returns true if all bits have been read from the bit stream. +func (b *bitReader) finished() bool { + return b.off == 0 && b.bitsRead >= 64 +} + +// overread returns true if more bits have been requested than is on the stream. +func (b *bitReader) overread() bool { + return b.bitsRead > 64 +} + +// remain returns the number of bits remaining. +func (b *bitReader) remain() uint { + return b.off*8 + 64 - uint(b.bitsRead) +} + +// close the bitstream and returns an error if out-of-buffer reads occurred. +func (b *bitReader) close() error { + // Release reference. + b.in = nil + if b.bitsRead > 64 { + return io.ErrUnexpectedEOF + } + return nil +} + +func highBits(val uint32) (n uint32) { + return uint32(bits.Len32(val) - 1) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bitwriter.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bitwriter.go new file mode 100644 index 000000000000..303ae90f9447 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bitwriter.go @@ -0,0 +1,169 @@ +// Copyright 2018 Klaus Post. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +// Based on work Copyright (c) 2013, Yann Collet, released under BSD License. + +package zstd + +import "fmt" + +// bitWriter will write bits. +// First bit will be LSB of the first byte of output. +type bitWriter struct { + bitContainer uint64 + nBits uint8 + out []byte +} + +// bitMask16 is bitmasks. Has extra to avoid bounds check. +var bitMask16 = [32]uint16{ + 0, 1, 3, 7, 0xF, 0x1F, + 0x3F, 0x7F, 0xFF, 0x1FF, 0x3FF, 0x7FF, + 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, + 0xFFFF, 0xFFFF} /* up to 16 bits */ + +var bitMask32 = [32]uint32{ + 0, 1, 3, 7, 0xF, 0x1F, 0x3F, 0x7F, 0xFF, + 0x1FF, 0x3FF, 0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF, 0xFFFF, + 0x1ffff, 0x3ffff, 0x7FFFF, 0xfFFFF, 0x1fFFFF, 0x3fFFFF, 0x7fFFFF, 0xffFFFF, + 0x1ffFFFF, 0x3ffFFFF, 0x7ffFFFF, 0xfffFFFF, 0x1fffFFFF, 0x3fffFFFF, 0x7fffFFFF, +} // up to 32 bits + +// addBits16NC will add up to 16 bits. +// It will not check if there is space for them, +// so the caller must ensure that it has flushed recently. +func (b *bitWriter) addBits16NC(value uint16, bits uint8) { + b.bitContainer |= uint64(value&bitMask16[bits&31]) << (b.nBits & 63) + b.nBits += bits +} + +// addBits32NC will add up to 32 bits. +// It will not check if there is space for them, +// so the caller must ensure that it has flushed recently. +func (b *bitWriter) addBits32NC(value uint32, bits uint8) { + b.bitContainer |= uint64(value&bitMask32[bits&31]) << (b.nBits & 63) + b.nBits += bits +} + +// addBits16Clean will add up to 16 bits. value may not contain more set bits than indicated. +// It will not check if there is space for them, so the caller must ensure that it has flushed recently. +func (b *bitWriter) addBits16Clean(value uint16, bits uint8) { + b.bitContainer |= uint64(value) << (b.nBits & 63) + b.nBits += bits +} + +// flush will flush all pending full bytes. +// There will be at least 56 bits available for writing when this has been called. +// Using flush32 is faster, but leaves less space for writing. +func (b *bitWriter) flush() { + v := b.nBits >> 3 + switch v { + case 0: + case 1: + b.out = append(b.out, + byte(b.bitContainer), + ) + case 2: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + ) + case 3: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + ) + case 4: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + ) + case 5: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + ) + case 6: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + byte(b.bitContainer>>40), + ) + case 7: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + byte(b.bitContainer>>40), + byte(b.bitContainer>>48), + ) + case 8: + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24), + byte(b.bitContainer>>32), + byte(b.bitContainer>>40), + byte(b.bitContainer>>48), + byte(b.bitContainer>>56), + ) + default: + panic(fmt.Errorf("bits (%d) > 64", b.nBits)) + } + b.bitContainer >>= v << 3 + b.nBits &= 7 +} + +// flush32 will flush out, so there are at least 32 bits available for writing. +func (b *bitWriter) flush32() { + if b.nBits < 32 { + return + } + b.out = append(b.out, + byte(b.bitContainer), + byte(b.bitContainer>>8), + byte(b.bitContainer>>16), + byte(b.bitContainer>>24)) + b.nBits -= 32 + b.bitContainer >>= 32 +} + +// flushAlign will flush remaining full bytes and align to next byte boundary. +func (b *bitWriter) flushAlign() { + nbBytes := (b.nBits + 7) >> 3 + for i := uint8(0); i < nbBytes; i++ { + b.out = append(b.out, byte(b.bitContainer>>(i*8))) + } + b.nBits = 0 + b.bitContainer = 0 +} + +// close will write the alignment bit and write the final byte(s) +// to the output. +func (b *bitWriter) close() error { + // End mark + b.addBits16Clean(1, 1) + // flush until next byte. + b.flushAlign() + return nil +} + +// reset and continue writing by appending to out. +func (b *bitWriter) reset(out []byte) { + b.bitContainer = 0 + b.nBits = 0 + b.out = out +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/blockdec.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/blockdec.go new file mode 100644 index 000000000000..4733ea876a1d --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/blockdec.go @@ -0,0 +1,739 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "errors" + "fmt" + "io" + "sync" + + "github.com/klauspost/compress/huff0" + "github.com/klauspost/compress/zstd/internal/xxhash" +) + +type blockType uint8 + +//go:generate stringer -type=blockType,literalsBlockType,seqCompMode,tableIndex + +const ( + blockTypeRaw blockType = iota + blockTypeRLE + blockTypeCompressed + blockTypeReserved +) + +type literalsBlockType uint8 + +const ( + literalsBlockRaw literalsBlockType = iota + literalsBlockRLE + literalsBlockCompressed + literalsBlockTreeless +) + +const ( + // maxCompressedBlockSize is the biggest allowed compressed block size (128KB) + maxCompressedBlockSize = 128 << 10 + + // Maximum possible block size (all Raw+Uncompressed). + maxBlockSize = (1 << 21) - 1 + + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#literals_section_header + maxCompressedLiteralSize = 1 << 18 + maxRLELiteralSize = 1 << 20 + maxMatchLen = 131074 + maxSequences = 0x7f00 + 0xffff + + // We support slightly less than the reference decoder to be able to + // use ints on 32 bit archs. + maxOffsetBits = 30 +) + +var ( + huffDecoderPool = sync.Pool{New: func() interface{} { + return &huff0.Scratch{} + }} + + fseDecoderPool = sync.Pool{New: func() interface{} { + return &fseDecoder{} + }} +) + +type blockDec struct { + // Raw source data of the block. + data []byte + dataStorage []byte + + // Destination of the decoded data. + dst []byte + + // Buffer for literals data. + literalBuf []byte + + // Window size of the block. + WindowSize uint64 + + history chan *history + input chan struct{} + result chan decodeOutput + sequenceBuf []seq + err error + decWG sync.WaitGroup + + // Frame to use for singlethreaded decoding. + // Should not be used by the decoder itself since parent may be another frame. + localFrame *frameDec + + // Block is RLE, this is the size. + RLESize uint32 + tmp [4]byte + + Type blockType + + // Is this the last block of a frame? + Last bool + + // Use less memory + lowMem bool +} + +func (b *blockDec) String() string { + if b == nil { + return "" + } + return fmt.Sprintf("Steam Size: %d, Type: %v, Last: %t, Window: %d", len(b.data), b.Type, b.Last, b.WindowSize) +} + +func newBlockDec(lowMem bool) *blockDec { + b := blockDec{ + lowMem: lowMem, + result: make(chan decodeOutput, 1), + input: make(chan struct{}, 1), + history: make(chan *history, 1), + } + b.decWG.Add(1) + go b.startDecoder() + return &b +} + +// reset will reset the block. +// Input must be a start of a block and will be at the end of the block when returned. +func (b *blockDec) reset(br byteBuffer, windowSize uint64) error { + b.WindowSize = windowSize + tmp := br.readSmall(3) + if tmp == nil { + if debug { + println("Reading block header:", io.ErrUnexpectedEOF) + } + return io.ErrUnexpectedEOF + } + bh := uint32(tmp[0]) | (uint32(tmp[1]) << 8) | (uint32(tmp[2]) << 16) + b.Last = bh&1 != 0 + b.Type = blockType((bh >> 1) & 3) + // find size. + cSize := int(bh >> 3) + maxSize := maxBlockSize + switch b.Type { + case blockTypeReserved: + return ErrReservedBlockType + case blockTypeRLE: + b.RLESize = uint32(cSize) + if b.lowMem { + maxSize = cSize + } + cSize = 1 + case blockTypeCompressed: + if debug { + println("Data size on stream:", cSize) + } + b.RLESize = 0 + maxSize = maxCompressedBlockSize + if windowSize < maxCompressedBlockSize && b.lowMem { + maxSize = int(windowSize) + } + if cSize > maxCompressedBlockSize || uint64(cSize) > b.WindowSize { + if debug { + printf("compressed block too big: csize:%d block: %+v\n", uint64(cSize), b) + } + return ErrCompressedSizeTooBig + } + case blockTypeRaw: + b.RLESize = 0 + // We do not need a destination for raw blocks. + maxSize = -1 + default: + panic("Invalid block type") + } + + // Read block data. + if cap(b.dataStorage) < cSize { + if b.lowMem { + b.dataStorage = make([]byte, 0, cSize) + } else { + b.dataStorage = make([]byte, 0, maxBlockSize) + } + } + if cap(b.dst) <= maxSize { + b.dst = make([]byte, 0, maxSize+1) + } + var err error + b.data, err = br.readBig(cSize, b.dataStorage) + if err != nil { + if debug { + println("Reading block:", err, "(", cSize, ")", len(b.data)) + printf("%T", br) + } + return err + } + return nil +} + +// sendEOF will make the decoder send EOF on this frame. +func (b *blockDec) sendErr(err error) { + b.Last = true + b.Type = blockTypeReserved + b.err = err + b.input <- struct{}{} +} + +// Close will release resources. +// Closed blockDec cannot be reset. +func (b *blockDec) Close() { + close(b.input) + close(b.history) + close(b.result) + b.decWG.Wait() +} + +// decodeAsync will prepare decoding the block when it receives input. +// This will separate output and history. +func (b *blockDec) startDecoder() { + defer b.decWG.Done() + for range b.input { + //println("blockDec: Got block input") + switch b.Type { + case blockTypeRLE: + if cap(b.dst) < int(b.RLESize) { + if b.lowMem { + b.dst = make([]byte, b.RLESize) + } else { + b.dst = make([]byte, maxBlockSize) + } + } + o := decodeOutput{ + d: b, + b: b.dst[:b.RLESize], + err: nil, + } + v := b.data[0] + for i := range o.b { + o.b[i] = v + } + hist := <-b.history + hist.append(o.b) + b.result <- o + case blockTypeRaw: + o := decodeOutput{ + d: b, + b: b.data, + err: nil, + } + hist := <-b.history + hist.append(o.b) + b.result <- o + case blockTypeCompressed: + b.dst = b.dst[:0] + err := b.decodeCompressed(nil) + o := decodeOutput{ + d: b, + b: b.dst, + err: err, + } + if debug { + println("Decompressed to", len(b.dst), "bytes, error:", err) + } + b.result <- o + case blockTypeReserved: + // Used for returning errors. + <-b.history + b.result <- decodeOutput{ + d: b, + b: nil, + err: b.err, + } + default: + panic("Invalid block type") + } + if debug { + println("blockDec: Finished block") + } + } +} + +// decodeAsync will prepare decoding the block when it receives the history. +// If history is provided, it will not fetch it from the channel. +func (b *blockDec) decodeBuf(hist *history) error { + switch b.Type { + case blockTypeRLE: + if cap(b.dst) < int(b.RLESize) { + if b.lowMem { + b.dst = make([]byte, b.RLESize) + } else { + b.dst = make([]byte, maxBlockSize) + } + } + b.dst = b.dst[:b.RLESize] + v := b.data[0] + for i := range b.dst { + b.dst[i] = v + } + hist.appendKeep(b.dst) + return nil + case blockTypeRaw: + hist.appendKeep(b.data) + return nil + case blockTypeCompressed: + saved := b.dst + b.dst = hist.b + hist.b = nil + err := b.decodeCompressed(hist) + if debug { + println("Decompressed to total", len(b.dst), "bytes, hash:", xxhash.Sum64(b.dst), "error:", err) + } + hist.b = b.dst + b.dst = saved + return err + case blockTypeReserved: + // Used for returning errors. + return b.err + default: + panic("Invalid block type") + } +} + +// decodeCompressed will start decompressing a block. +// If no history is supplied the decoder will decodeAsync as much as possible +// before fetching from blockDec.history +func (b *blockDec) decodeCompressed(hist *history) error { + in := b.data + delayedHistory := hist == nil + + if delayedHistory { + // We must always grab history. + defer func() { + if hist == nil { + <-b.history + } + }() + } + // There must be at least one byte for Literals_Block_Type and one for Sequences_Section_Header + if len(in) < 2 { + return ErrBlockTooSmall + } + litType := literalsBlockType(in[0] & 3) + var litRegenSize int + var litCompSize int + sizeFormat := (in[0] >> 2) & 3 + var fourStreams bool + switch litType { + case literalsBlockRaw, literalsBlockRLE: + switch sizeFormat { + case 0, 2: + // Regenerated_Size uses 5 bits (0-31). Literals_Section_Header uses 1 byte. + litRegenSize = int(in[0] >> 3) + in = in[1:] + case 1: + // Regenerated_Size uses 12 bits (0-4095). Literals_Section_Header uses 2 bytes. + litRegenSize = int(in[0]>>4) + (int(in[1]) << 4) + in = in[2:] + case 3: + // Regenerated_Size uses 20 bits (0-1048575). Literals_Section_Header uses 3 bytes. + if len(in) < 3 { + println("too small: litType:", litType, " sizeFormat", sizeFormat, len(in)) + return ErrBlockTooSmall + } + litRegenSize = int(in[0]>>4) + (int(in[1]) << 4) + (int(in[2]) << 12) + in = in[3:] + } + case literalsBlockCompressed, literalsBlockTreeless: + switch sizeFormat { + case 0, 1: + // Both Regenerated_Size and Compressed_Size use 10 bits (0-1023). + if len(in) < 3 { + println("too small: litType:", litType, " sizeFormat", sizeFormat, len(in)) + return ErrBlockTooSmall + } + n := uint64(in[0]>>4) + (uint64(in[1]) << 4) + (uint64(in[2]) << 12) + litRegenSize = int(n & 1023) + litCompSize = int(n >> 10) + fourStreams = sizeFormat == 1 + in = in[3:] + case 2: + fourStreams = true + if len(in) < 4 { + println("too small: litType:", litType, " sizeFormat", sizeFormat, len(in)) + return ErrBlockTooSmall + } + n := uint64(in[0]>>4) + (uint64(in[1]) << 4) + (uint64(in[2]) << 12) + (uint64(in[3]) << 20) + litRegenSize = int(n & 16383) + litCompSize = int(n >> 14) + in = in[4:] + case 3: + fourStreams = true + if len(in) < 5 { + println("too small: litType:", litType, " sizeFormat", sizeFormat, len(in)) + return ErrBlockTooSmall + } + n := uint64(in[0]>>4) + (uint64(in[1]) << 4) + (uint64(in[2]) << 12) + (uint64(in[3]) << 20) + (uint64(in[4]) << 28) + litRegenSize = int(n & 262143) + litCompSize = int(n >> 18) + in = in[5:] + } + } + if debug { + println("literals type:", litType, "litRegenSize:", litRegenSize, "litCompSize:", litCompSize, "sizeFormat:", sizeFormat, "4X:", fourStreams) + } + var literals []byte + var huff *huff0.Scratch + switch litType { + case literalsBlockRaw: + if len(in) < litRegenSize { + println("too small: litType:", litType, " sizeFormat", sizeFormat, "remain:", len(in), "want:", litRegenSize) + return ErrBlockTooSmall + } + literals = in[:litRegenSize] + in = in[litRegenSize:] + //printf("Found %d uncompressed literals\n", litRegenSize) + case literalsBlockRLE: + if len(in) < 1 { + println("too small: litType:", litType, " sizeFormat", sizeFormat, "remain:", len(in), "want:", 1) + return ErrBlockTooSmall + } + if cap(b.literalBuf) < litRegenSize { + if b.lowMem { + b.literalBuf = make([]byte, litRegenSize) + } else { + if litRegenSize > maxCompressedLiteralSize { + // Exceptional + b.literalBuf = make([]byte, litRegenSize) + } else { + b.literalBuf = make([]byte, litRegenSize, maxCompressedLiteralSize) + + } + } + } + literals = b.literalBuf[:litRegenSize] + v := in[0] + for i := range literals { + literals[i] = v + } + in = in[1:] + if debug { + printf("Found %d RLE compressed literals\n", litRegenSize) + } + case literalsBlockTreeless: + if len(in) < litCompSize { + println("too small: litType:", litType, " sizeFormat", sizeFormat, "remain:", len(in), "want:", litCompSize) + return ErrBlockTooSmall + } + // Store compressed literals, so we defer decoding until we get history. + literals = in[:litCompSize] + in = in[litCompSize:] + if debug { + printf("Found %d compressed literals\n", litCompSize) + } + case literalsBlockCompressed: + if len(in) < litCompSize { + println("too small: litType:", litType, " sizeFormat", sizeFormat, "remain:", len(in), "want:", litCompSize) + return ErrBlockTooSmall + } + literals = in[:litCompSize] + in = in[litCompSize:] + huff = huffDecoderPool.Get().(*huff0.Scratch) + var err error + // Ensure we have space to store it. + if cap(b.literalBuf) < litRegenSize { + if b.lowMem { + b.literalBuf = make([]byte, 0, litRegenSize) + } else { + b.literalBuf = make([]byte, 0, maxCompressedLiteralSize) + } + } + if huff == nil { + huff = &huff0.Scratch{} + } + huff, literals, err = huff0.ReadTable(literals, huff) + if err != nil { + println("reading huffman table:", err) + return err + } + // Use our out buffer. + if fourStreams { + literals, err = huff.Decoder().Decompress4X(b.literalBuf[:0:litRegenSize], literals) + } else { + literals, err = huff.Decoder().Decompress1X(b.literalBuf[:0:litRegenSize], literals) + } + if err != nil { + println("decoding compressed literals:", err) + return err + } + // Make sure we don't leak our literals buffer + if len(literals) != litRegenSize { + return fmt.Errorf("literal output size mismatch want %d, got %d", litRegenSize, len(literals)) + } + if debug { + printf("Decompressed %d literals into %d bytes\n", litCompSize, litRegenSize) + } + } + + // Decode Sequences + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#sequences-section + if len(in) < 1 { + return ErrBlockTooSmall + } + seqHeader := in[0] + nSeqs := 0 + switch { + case seqHeader == 0: + in = in[1:] + case seqHeader < 128: + nSeqs = int(seqHeader) + in = in[1:] + case seqHeader < 255: + if len(in) < 2 { + return ErrBlockTooSmall + } + nSeqs = int(seqHeader-128)<<8 | int(in[1]) + in = in[2:] + case seqHeader == 255: + if len(in) < 3 { + return ErrBlockTooSmall + } + nSeqs = 0x7f00 + int(in[1]) + (int(in[2]) << 8) + in = in[3:] + } + // Allocate sequences + if cap(b.sequenceBuf) < nSeqs { + if b.lowMem { + b.sequenceBuf = make([]seq, nSeqs) + } else { + // Allocate max + b.sequenceBuf = make([]seq, nSeqs, maxSequences) + } + } else { + // Reuse buffer + b.sequenceBuf = b.sequenceBuf[:nSeqs] + } + var seqs = &sequenceDecs{} + if nSeqs > 0 { + if len(in) < 1 { + return ErrBlockTooSmall + } + br := byteReader{b: in, off: 0} + compMode := br.Uint8() + br.advance(1) + if debug { + printf("Compression modes: 0b%b", compMode) + } + for i := uint(0); i < 3; i++ { + mode := seqCompMode((compMode >> (6 - i*2)) & 3) + if debug { + println("Table", tableIndex(i), "is", mode) + } + var seq *sequenceDec + switch tableIndex(i) { + case tableLiteralLengths: + seq = &seqs.litLengths + case tableOffsets: + seq = &seqs.offsets + case tableMatchLengths: + seq = &seqs.matchLengths + default: + panic("unknown table") + } + switch mode { + case compModePredefined: + seq.fse = &fsePredef[i] + case compModeRLE: + if br.remain() < 1 { + return ErrBlockTooSmall + } + v := br.Uint8() + br.advance(1) + dec := fseDecoderPool.Get().(*fseDecoder) + symb, err := decSymbolValue(v, symbolTableX[i]) + if err != nil { + printf("RLE Transform table (%v) error: %v", tableIndex(i), err) + return err + } + dec.setRLE(symb) + seq.fse = dec + if debug { + printf("RLE set to %+v, code: %v", symb, v) + } + case compModeFSE: + println("Reading table for", tableIndex(i)) + dec := fseDecoderPool.Get().(*fseDecoder) + err := dec.readNCount(&br, uint16(maxTableSymbol[i])) + if err != nil { + println("Read table error:", err) + return err + } + err = dec.transform(symbolTableX[i]) + if err != nil { + println("Transform table error:", err) + return err + } + if debug { + println("Read table ok", "symbolLen:", dec.symbolLen) + } + seq.fse = dec + case compModeRepeat: + seq.repeat = true + } + if br.overread() { + return io.ErrUnexpectedEOF + } + } + in = br.unread() + } + + // Wait for history. + // All time spent after this is critical since it is strictly sequential. + if hist == nil { + hist = <-b.history + if hist.error { + return ErrDecoderClosed + } + } + + // Decode treeless literal block. + if litType == literalsBlockTreeless { + // TODO: We could send the history early WITHOUT the stream history. + // This would allow decoding treeless literials before the byte history is available. + // Silencia stats: Treeless 4393, with: 32775, total: 37168, 11% treeless. + // So not much obvious gain here. + + if hist.huffTree == nil { + return errors.New("literal block was treeless, but no history was defined") + } + // Ensure we have space to store it. + if cap(b.literalBuf) < litRegenSize { + if b.lowMem { + b.literalBuf = make([]byte, 0, litRegenSize) + } else { + b.literalBuf = make([]byte, 0, maxCompressedLiteralSize) + } + } + var err error + // Use our out buffer. + huff = hist.huffTree + if fourStreams { + literals, err = huff.Decoder().Decompress4X(b.literalBuf[:0:litRegenSize], literals) + } else { + literals, err = huff.Decoder().Decompress1X(b.literalBuf[:0:litRegenSize], literals) + } + // Make sure we don't leak our literals buffer + if err != nil { + println("decompressing literals:", err) + return err + } + if len(literals) != litRegenSize { + return fmt.Errorf("literal output size mismatch want %d, got %d", litRegenSize, len(literals)) + } + } else { + if hist.huffTree != nil && huff != nil { + if hist.dict == nil || hist.dict.litEnc != hist.huffTree { + huffDecoderPool.Put(hist.huffTree) + } + hist.huffTree = nil + } + } + if huff != nil { + hist.huffTree = huff + } + if debug { + println("Final literals:", len(literals), "hash:", xxhash.Sum64(literals), "and", nSeqs, "sequences.") + } + + if nSeqs == 0 { + // Decompressed content is defined entirely as Literals Section content. + b.dst = append(b.dst, literals...) + if delayedHistory { + hist.append(literals) + } + return nil + } + + seqs, err := seqs.mergeHistory(&hist.decoders) + if err != nil { + return err + } + if debug { + println("History merged ok") + } + br := &bitReader{} + if err := br.init(in); err != nil { + return err + } + + // TODO: Investigate if sending history without decoders are faster. + // This would allow the sequences to be decoded async and only have to construct stream history. + // If only recent offsets were not transferred, this would be an obvious win. + // Also, if first 3 sequences don't reference recent offsets, all sequences can be decoded. + + hbytes := hist.b + if len(hbytes) > hist.windowSize { + hbytes = hbytes[len(hbytes)-hist.windowSize:] + // We do not need history any more. + if hist.dict != nil { + hist.dict.content = nil + } + } + + if err := seqs.initialize(br, hist, literals, b.dst); err != nil { + println("initializing sequences:", err) + return err + } + + err = seqs.decode(nSeqs, br, hbytes) + if err != nil { + return err + } + if !br.finished() { + return fmt.Errorf("%d extra bits on block, should be 0", br.remain()) + } + + err = br.close() + if err != nil { + printf("Closing sequences: %v, %+v\n", err, *br) + } + if len(b.data) > maxCompressedBlockSize { + return fmt.Errorf("compressed block size too large (%d)", len(b.data)) + } + // Set output and release references. + b.dst = seqs.out + seqs.out, seqs.literals, seqs.hist = nil, nil, nil + + if !delayedHistory { + // If we don't have delayed history, no need to update. + hist.recentOffsets = seqs.prevOffset + return nil + } + if b.Last { + // if last block we don't care about history. + println("Last block, no history returned") + hist.b = hist.b[:0] + return nil + } + hist.append(b.dst) + hist.recentOffsets = seqs.prevOffset + if debug { + println("Finished block with literals:", len(literals), "and", nSeqs, "sequences.") + } + + return nil +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/blockenc.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/blockenc.go new file mode 100644 index 000000000000..083fbb502f40 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/blockenc.go @@ -0,0 +1,854 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "errors" + "fmt" + "math" + "math/bits" + + "github.com/klauspost/compress/huff0" +) + +type blockEnc struct { + size int + literals []byte + sequences []seq + coders seqCoders + litEnc *huff0.Scratch + dictLitEnc *huff0.Scratch + wr bitWriter + + extraLits int + last bool + + output []byte + recentOffsets [3]uint32 + prevRecentOffsets [3]uint32 +} + +// init should be used once the block has been created. +// If called more than once, the effect is the same as calling reset. +func (b *blockEnc) init() { + if cap(b.literals) < maxCompressedLiteralSize { + b.literals = make([]byte, 0, maxCompressedLiteralSize) + } + const defSeqs = 200 + b.literals = b.literals[:0] + if cap(b.sequences) < defSeqs { + b.sequences = make([]seq, 0, defSeqs) + } + if cap(b.output) < maxCompressedBlockSize { + b.output = make([]byte, 0, maxCompressedBlockSize) + } + if b.coders.mlEnc == nil { + b.coders.mlEnc = &fseEncoder{} + b.coders.mlPrev = &fseEncoder{} + b.coders.ofEnc = &fseEncoder{} + b.coders.ofPrev = &fseEncoder{} + b.coders.llEnc = &fseEncoder{} + b.coders.llPrev = &fseEncoder{} + } + b.litEnc = &huff0.Scratch{WantLogLess: 4} + b.reset(nil) +} + +// initNewEncode can be used to reset offsets and encoders to the initial state. +func (b *blockEnc) initNewEncode() { + b.recentOffsets = [3]uint32{1, 4, 8} + b.litEnc.Reuse = huff0.ReusePolicyNone + b.coders.setPrev(nil, nil, nil) +} + +// reset will reset the block for a new encode, but in the same stream, +// meaning that state will be carried over, but the block content is reset. +// If a previous block is provided, the recent offsets are carried over. +func (b *blockEnc) reset(prev *blockEnc) { + b.extraLits = 0 + b.literals = b.literals[:0] + b.size = 0 + b.sequences = b.sequences[:0] + b.output = b.output[:0] + b.last = false + if prev != nil { + b.recentOffsets = prev.prevRecentOffsets + } +} + +// reset will reset the block for a new encode, but in the same stream, +// meaning that state will be carried over, but the block content is reset. +// If a previous block is provided, the recent offsets are carried over. +func (b *blockEnc) swapEncoders(prev *blockEnc) { + b.coders.swap(&prev.coders) + b.litEnc, prev.litEnc = prev.litEnc, b.litEnc +} + +// blockHeader contains the information for a block header. +type blockHeader uint32 + +// setLast sets the 'last' indicator on a block. +func (h *blockHeader) setLast(b bool) { + if b { + *h = *h | 1 + } else { + const mask = (1 << 24) - 2 + *h = *h & mask + } +} + +// setSize will store the compressed size of a block. +func (h *blockHeader) setSize(v uint32) { + const mask = 7 + *h = (*h)&mask | blockHeader(v<<3) +} + +// setType sets the block type. +func (h *blockHeader) setType(t blockType) { + const mask = 1 | (((1 << 24) - 1) ^ 7) + *h = (*h & mask) | blockHeader(t<<1) +} + +// appendTo will append the block header to a slice. +func (h blockHeader) appendTo(b []byte) []byte { + return append(b, uint8(h), uint8(h>>8), uint8(h>>16)) +} + +// String returns a string representation of the block. +func (h blockHeader) String() string { + return fmt.Sprintf("Type: %d, Size: %d, Last:%t", (h>>1)&3, h>>3, h&1 == 1) +} + +// literalsHeader contains literals header information. +type literalsHeader uint64 + +// setType can be used to set the type of literal block. +func (h *literalsHeader) setType(t literalsBlockType) { + const mask = math.MaxUint64 - 3 + *h = (*h & mask) | literalsHeader(t) +} + +// setSize can be used to set a single size, for uncompressed and RLE content. +func (h *literalsHeader) setSize(regenLen int) { + inBits := bits.Len32(uint32(regenLen)) + // Only retain 2 bits + const mask = 3 + lh := uint64(*h & mask) + switch { + case inBits < 5: + lh |= (uint64(regenLen) << 3) | (1 << 60) + if debug { + got := int(lh>>3) & 0xff + if got != regenLen { + panic(fmt.Sprint("litRegenSize = ", regenLen, "(want) != ", got, "(got)")) + } + } + case inBits < 12: + lh |= (1 << 2) | (uint64(regenLen) << 4) | (2 << 60) + case inBits < 20: + lh |= (3 << 2) | (uint64(regenLen) << 4) | (3 << 60) + default: + panic(fmt.Errorf("internal error: block too big (%d)", regenLen)) + } + *h = literalsHeader(lh) +} + +// setSizes will set the size of a compressed literals section and the input length. +func (h *literalsHeader) setSizes(compLen, inLen int, single bool) { + compBits, inBits := bits.Len32(uint32(compLen)), bits.Len32(uint32(inLen)) + // Only retain 2 bits + const mask = 3 + lh := uint64(*h & mask) + switch { + case compBits <= 10 && inBits <= 10: + if !single { + lh |= 1 << 2 + } + lh |= (uint64(inLen) << 4) | (uint64(compLen) << (10 + 4)) | (3 << 60) + if debug { + const mmask = (1 << 24) - 1 + n := (lh >> 4) & mmask + if int(n&1023) != inLen { + panic(fmt.Sprint("regensize:", int(n&1023), "!=", inLen, inBits)) + } + if int(n>>10) != compLen { + panic(fmt.Sprint("compsize:", int(n>>10), "!=", compLen, compBits)) + } + } + case compBits <= 14 && inBits <= 14: + lh |= (2 << 2) | (uint64(inLen) << 4) | (uint64(compLen) << (14 + 4)) | (4 << 60) + if single { + panic("single stream used with more than 10 bits length.") + } + case compBits <= 18 && inBits <= 18: + lh |= (3 << 2) | (uint64(inLen) << 4) | (uint64(compLen) << (18 + 4)) | (5 << 60) + if single { + panic("single stream used with more than 10 bits length.") + } + default: + panic("internal error: block too big") + } + *h = literalsHeader(lh) +} + +// appendTo will append the literals header to a byte slice. +func (h literalsHeader) appendTo(b []byte) []byte { + size := uint8(h >> 60) + switch size { + case 1: + b = append(b, uint8(h)) + case 2: + b = append(b, uint8(h), uint8(h>>8)) + case 3: + b = append(b, uint8(h), uint8(h>>8), uint8(h>>16)) + case 4: + b = append(b, uint8(h), uint8(h>>8), uint8(h>>16), uint8(h>>24)) + case 5: + b = append(b, uint8(h), uint8(h>>8), uint8(h>>16), uint8(h>>24), uint8(h>>32)) + default: + panic(fmt.Errorf("internal error: literalsHeader has invalid size (%d)", size)) + } + return b +} + +// size returns the output size with currently set values. +func (h literalsHeader) size() int { + return int(h >> 60) +} + +func (h literalsHeader) String() string { + return fmt.Sprintf("Type: %d, SizeFormat: %d, Size: 0x%d, Bytes:%d", literalsBlockType(h&3), (h>>2)&3, h&((1<<60)-1)>>4, h>>60) +} + +// pushOffsets will push the recent offsets to the backup store. +func (b *blockEnc) pushOffsets() { + b.prevRecentOffsets = b.recentOffsets +} + +// pushOffsets will push the recent offsets to the backup store. +func (b *blockEnc) popOffsets() { + b.recentOffsets = b.prevRecentOffsets +} + +// matchOffset will adjust recent offsets and return the adjusted one, +// if it matches a previous offset. +func (b *blockEnc) matchOffset(offset, lits uint32) uint32 { + // Check if offset is one of the recent offsets. + // Adjusts the output offset accordingly. + // Gives a tiny bit of compression, typically around 1%. + if true { + if lits > 0 { + switch offset { + case b.recentOffsets[0]: + offset = 1 + case b.recentOffsets[1]: + b.recentOffsets[1] = b.recentOffsets[0] + b.recentOffsets[0] = offset + offset = 2 + case b.recentOffsets[2]: + b.recentOffsets[2] = b.recentOffsets[1] + b.recentOffsets[1] = b.recentOffsets[0] + b.recentOffsets[0] = offset + offset = 3 + default: + b.recentOffsets[2] = b.recentOffsets[1] + b.recentOffsets[1] = b.recentOffsets[0] + b.recentOffsets[0] = offset + offset += 3 + } + } else { + switch offset { + case b.recentOffsets[1]: + b.recentOffsets[1] = b.recentOffsets[0] + b.recentOffsets[0] = offset + offset = 1 + case b.recentOffsets[2]: + b.recentOffsets[2] = b.recentOffsets[1] + b.recentOffsets[1] = b.recentOffsets[0] + b.recentOffsets[0] = offset + offset = 2 + case b.recentOffsets[0] - 1: + b.recentOffsets[2] = b.recentOffsets[1] + b.recentOffsets[1] = b.recentOffsets[0] + b.recentOffsets[0] = offset + offset = 3 + default: + b.recentOffsets[2] = b.recentOffsets[1] + b.recentOffsets[1] = b.recentOffsets[0] + b.recentOffsets[0] = offset + offset += 3 + } + } + } else { + offset += 3 + } + return offset +} + +// encodeRaw can be used to set the output to a raw representation of supplied bytes. +func (b *blockEnc) encodeRaw(a []byte) { + var bh blockHeader + bh.setLast(b.last) + bh.setSize(uint32(len(a))) + bh.setType(blockTypeRaw) + b.output = bh.appendTo(b.output[:0]) + b.output = append(b.output, a...) + if debug { + println("Adding RAW block, length", len(a), "last:", b.last) + } +} + +// encodeRaw can be used to set the output to a raw representation of supplied bytes. +func (b *blockEnc) encodeRawTo(dst, src []byte) []byte { + var bh blockHeader + bh.setLast(b.last) + bh.setSize(uint32(len(src))) + bh.setType(blockTypeRaw) + dst = bh.appendTo(dst) + dst = append(dst, src...) + if debug { + println("Adding RAW block, length", len(src), "last:", b.last) + } + return dst +} + +// encodeLits can be used if the block is only litLen. +func (b *blockEnc) encodeLits(lits []byte, raw bool) error { + var bh blockHeader + bh.setLast(b.last) + bh.setSize(uint32(len(lits))) + + // Don't compress extremely small blocks + if len(lits) < 8 || (len(lits) < 32 && b.dictLitEnc == nil) || raw { + if debug { + println("Adding RAW block, length", len(lits), "last:", b.last) + } + bh.setType(blockTypeRaw) + b.output = bh.appendTo(b.output) + b.output = append(b.output, lits...) + return nil + } + + var ( + out []byte + reUsed, single bool + err error + ) + if b.dictLitEnc != nil { + b.litEnc.TransferCTable(b.dictLitEnc) + b.litEnc.Reuse = huff0.ReusePolicyAllow + b.dictLitEnc = nil + } + if len(lits) >= 1024 { + // Use 4 Streams. + out, reUsed, err = huff0.Compress4X(lits, b.litEnc) + } else if len(lits) > 32 { + // Use 1 stream + single = true + out, reUsed, err = huff0.Compress1X(lits, b.litEnc) + } else { + err = huff0.ErrIncompressible + } + + switch err { + case huff0.ErrIncompressible: + if debug { + println("Adding RAW block, length", len(lits), "last:", b.last) + } + bh.setType(blockTypeRaw) + b.output = bh.appendTo(b.output) + b.output = append(b.output, lits...) + return nil + case huff0.ErrUseRLE: + if debug { + println("Adding RLE block, length", len(lits)) + } + bh.setType(blockTypeRLE) + b.output = bh.appendTo(b.output) + b.output = append(b.output, lits[0]) + return nil + default: + return err + case nil: + } + // Compressed... + // Now, allow reuse + b.litEnc.Reuse = huff0.ReusePolicyAllow + bh.setType(blockTypeCompressed) + var lh literalsHeader + if reUsed { + if debug { + println("Reused tree, compressed to", len(out)) + } + lh.setType(literalsBlockTreeless) + } else { + if debug { + println("New tree, compressed to", len(out), "tree size:", len(b.litEnc.OutTable)) + } + lh.setType(literalsBlockCompressed) + } + // Set sizes + lh.setSizes(len(out), len(lits), single) + bh.setSize(uint32(len(out) + lh.size() + 1)) + + // Write block headers. + b.output = bh.appendTo(b.output) + b.output = lh.appendTo(b.output) + // Add compressed data. + b.output = append(b.output, out...) + // No sequences. + b.output = append(b.output, 0) + return nil +} + +// fuzzFseEncoder can be used to fuzz the FSE encoder. +func fuzzFseEncoder(data []byte) int { + if len(data) > maxSequences || len(data) < 2 { + return 0 + } + enc := fseEncoder{} + hist := enc.Histogram()[:256] + maxSym := uint8(0) + for i, v := range data { + v = v & 63 + data[i] = v + hist[v]++ + if v > maxSym { + maxSym = v + } + } + if maxSym == 0 { + // All 0 + return 0 + } + maxCount := func(a []uint32) int { + var max uint32 + for _, v := range a { + if v > max { + max = v + } + } + return int(max) + } + cnt := maxCount(hist[:maxSym]) + if cnt == len(data) { + // RLE + return 0 + } + enc.HistogramFinished(maxSym, cnt) + err := enc.normalizeCount(len(data)) + if err != nil { + return 0 + } + _, err = enc.writeCount(nil) + if err != nil { + panic(err) + } + return 1 +} + +// encode will encode the block and append the output in b.output. +// Previous offset codes must be pushed if more blocks are expected. +func (b *blockEnc) encode(org []byte, raw, rawAllLits bool) error { + if len(b.sequences) == 0 { + return b.encodeLits(b.literals, rawAllLits) + } + // We want some difference to at least account for the headers. + saved := b.size - len(b.literals) - (b.size >> 5) + if saved < 16 { + if org == nil { + return errIncompressible + } + b.popOffsets() + return b.encodeLits(org, rawAllLits) + } + + var bh blockHeader + var lh literalsHeader + bh.setLast(b.last) + bh.setType(blockTypeCompressed) + // Store offset of the block header. Needed when we know the size. + bhOffset := len(b.output) + b.output = bh.appendTo(b.output) + + var ( + out []byte + reUsed, single bool + err error + ) + if b.dictLitEnc != nil { + b.litEnc.TransferCTable(b.dictLitEnc) + b.litEnc.Reuse = huff0.ReusePolicyAllow + b.dictLitEnc = nil + } + if len(b.literals) >= 1024 && !raw { + // Use 4 Streams. + out, reUsed, err = huff0.Compress4X(b.literals, b.litEnc) + } else if len(b.literals) > 32 && !raw { + // Use 1 stream + single = true + out, reUsed, err = huff0.Compress1X(b.literals, b.litEnc) + } else { + err = huff0.ErrIncompressible + } + + switch err { + case huff0.ErrIncompressible: + lh.setType(literalsBlockRaw) + lh.setSize(len(b.literals)) + b.output = lh.appendTo(b.output) + b.output = append(b.output, b.literals...) + if debug { + println("Adding literals RAW, length", len(b.literals)) + } + case huff0.ErrUseRLE: + lh.setType(literalsBlockRLE) + lh.setSize(len(b.literals)) + b.output = lh.appendTo(b.output) + b.output = append(b.output, b.literals[0]) + if debug { + println("Adding literals RLE") + } + default: + if debug { + println("Adding literals ERROR:", err) + } + return err + case nil: + // Compressed litLen... + if reUsed { + if debug { + println("reused tree") + } + lh.setType(literalsBlockTreeless) + } else { + if debug { + println("new tree, size:", len(b.litEnc.OutTable)) + } + lh.setType(literalsBlockCompressed) + if debug { + _, _, err := huff0.ReadTable(out, nil) + if err != nil { + panic(err) + } + } + } + lh.setSizes(len(out), len(b.literals), single) + if debug { + printf("Compressed %d literals to %d bytes", len(b.literals), len(out)) + println("Adding literal header:", lh) + } + b.output = lh.appendTo(b.output) + b.output = append(b.output, out...) + b.litEnc.Reuse = huff0.ReusePolicyAllow + if debug { + println("Adding literals compressed") + } + } + // Sequence compression + + // Write the number of sequences + switch { + case len(b.sequences) < 128: + b.output = append(b.output, uint8(len(b.sequences))) + case len(b.sequences) < 0x7f00: // TODO: this could be wrong + n := len(b.sequences) + b.output = append(b.output, 128+uint8(n>>8), uint8(n)) + default: + n := len(b.sequences) - 0x7f00 + b.output = append(b.output, 255, uint8(n), uint8(n>>8)) + } + if debug { + println("Encoding", len(b.sequences), "sequences") + } + b.genCodes() + llEnc := b.coders.llEnc + ofEnc := b.coders.ofEnc + mlEnc := b.coders.mlEnc + err = llEnc.normalizeCount(len(b.sequences)) + if err != nil { + return err + } + err = ofEnc.normalizeCount(len(b.sequences)) + if err != nil { + return err + } + err = mlEnc.normalizeCount(len(b.sequences)) + if err != nil { + return err + } + + // Choose the best compression mode for each type. + // Will evaluate the new vs predefined and previous. + chooseComp := func(cur, prev, preDef *fseEncoder) (*fseEncoder, seqCompMode) { + // See if predefined/previous is better + hist := cur.count[:cur.symbolLen] + nSize := cur.approxSize(hist) + cur.maxHeaderSize() + predefSize := preDef.approxSize(hist) + prevSize := prev.approxSize(hist) + + // Add a small penalty for new encoders. + // Don't bother with extremely small (<2 byte gains). + nSize = nSize + (nSize+2*8*16)>>4 + switch { + case predefSize <= prevSize && predefSize <= nSize || forcePreDef: + if debug { + println("Using predefined", predefSize>>3, "<=", nSize>>3) + } + return preDef, compModePredefined + case prevSize <= nSize: + if debug { + println("Using previous", prevSize>>3, "<=", nSize>>3) + } + return prev, compModeRepeat + default: + if debug { + println("Using new, predef", predefSize>>3, ". previous:", prevSize>>3, ">", nSize>>3, "header max:", cur.maxHeaderSize()>>3, "bytes") + println("tl:", cur.actualTableLog, "symbolLen:", cur.symbolLen, "norm:", cur.norm[:cur.symbolLen], "hist", cur.count[:cur.symbolLen]) + } + return cur, compModeFSE + } + } + + // Write compression mode + var mode uint8 + if llEnc.useRLE { + mode |= uint8(compModeRLE) << 6 + llEnc.setRLE(b.sequences[0].llCode) + if debug { + println("llEnc.useRLE") + } + } else { + var m seqCompMode + llEnc, m = chooseComp(llEnc, b.coders.llPrev, &fsePredefEnc[tableLiteralLengths]) + mode |= uint8(m) << 6 + } + if ofEnc.useRLE { + mode |= uint8(compModeRLE) << 4 + ofEnc.setRLE(b.sequences[0].ofCode) + if debug { + println("ofEnc.useRLE") + } + } else { + var m seqCompMode + ofEnc, m = chooseComp(ofEnc, b.coders.ofPrev, &fsePredefEnc[tableOffsets]) + mode |= uint8(m) << 4 + } + + if mlEnc.useRLE { + mode |= uint8(compModeRLE) << 2 + mlEnc.setRLE(b.sequences[0].mlCode) + if debug { + println("mlEnc.useRLE, code: ", b.sequences[0].mlCode, "value", b.sequences[0].matchLen) + } + } else { + var m seqCompMode + mlEnc, m = chooseComp(mlEnc, b.coders.mlPrev, &fsePredefEnc[tableMatchLengths]) + mode |= uint8(m) << 2 + } + b.output = append(b.output, mode) + if debug { + printf("Compression modes: 0b%b", mode) + } + b.output, err = llEnc.writeCount(b.output) + if err != nil { + return err + } + start := len(b.output) + b.output, err = ofEnc.writeCount(b.output) + if err != nil { + return err + } + if false { + println("block:", b.output[start:], "tablelog", ofEnc.actualTableLog, "maxcount:", ofEnc.maxCount) + fmt.Printf("selected TableLog: %d, Symbol length: %d\n", ofEnc.actualTableLog, ofEnc.symbolLen) + for i, v := range ofEnc.norm[:ofEnc.symbolLen] { + fmt.Printf("%3d: %5d -> %4d \n", i, ofEnc.count[i], v) + } + } + b.output, err = mlEnc.writeCount(b.output) + if err != nil { + return err + } + + // Maybe in block? + wr := &b.wr + wr.reset(b.output) + + var ll, of, ml cState + + // Current sequence + seq := len(b.sequences) - 1 + s := b.sequences[seq] + llEnc.setBits(llBitsTable[:]) + mlEnc.setBits(mlBitsTable[:]) + ofEnc.setBits(nil) + + llTT, ofTT, mlTT := llEnc.ct.symbolTT[:256], ofEnc.ct.symbolTT[:256], mlEnc.ct.symbolTT[:256] + + // We have 3 bounds checks here (and in the loop). + // Since we are iterating backwards it is kinda hard to avoid. + llB, ofB, mlB := llTT[s.llCode], ofTT[s.ofCode], mlTT[s.mlCode] + ll.init(wr, &llEnc.ct, llB) + of.init(wr, &ofEnc.ct, ofB) + wr.flush32() + ml.init(wr, &mlEnc.ct, mlB) + + // Each of these lookups also generates a bounds check. + wr.addBits32NC(s.litLen, llB.outBits) + wr.addBits32NC(s.matchLen, mlB.outBits) + wr.flush32() + wr.addBits32NC(s.offset, ofB.outBits) + if debugSequences { + println("Encoded seq", seq, s, "codes:", s.llCode, s.mlCode, s.ofCode, "states:", ll.state, ml.state, of.state, "bits:", llB, mlB, ofB) + } + seq-- + if llEnc.maxBits+mlEnc.maxBits+ofEnc.maxBits <= 32 { + // No need to flush (common) + for seq >= 0 { + s = b.sequences[seq] + wr.flush32() + llB, ofB, mlB := llTT[s.llCode], ofTT[s.ofCode], mlTT[s.mlCode] + // tabelog max is 8 for all. + of.encode(ofB) + ml.encode(mlB) + ll.encode(llB) + wr.flush32() + + // We checked that all can stay within 32 bits + wr.addBits32NC(s.litLen, llB.outBits) + wr.addBits32NC(s.matchLen, mlB.outBits) + wr.addBits32NC(s.offset, ofB.outBits) + + if debugSequences { + println("Encoded seq", seq, s) + } + + seq-- + } + } else { + for seq >= 0 { + s = b.sequences[seq] + wr.flush32() + llB, ofB, mlB := llTT[s.llCode], ofTT[s.ofCode], mlTT[s.mlCode] + // tabelog max is below 8 for each. + of.encode(ofB) + ml.encode(mlB) + ll.encode(llB) + wr.flush32() + + // ml+ll = max 32 bits total + wr.addBits32NC(s.litLen, llB.outBits) + wr.addBits32NC(s.matchLen, mlB.outBits) + wr.flush32() + wr.addBits32NC(s.offset, ofB.outBits) + + if debugSequences { + println("Encoded seq", seq, s) + } + + seq-- + } + } + ml.flush(mlEnc.actualTableLog) + of.flush(ofEnc.actualTableLog) + ll.flush(llEnc.actualTableLog) + err = wr.close() + if err != nil { + return err + } + b.output = wr.out + + if len(b.output)-3-bhOffset >= b.size { + // Maybe even add a bigger margin. + b.litEnc.Reuse = huff0.ReusePolicyNone + return errIncompressible + } + + // Size is output minus block header. + bh.setSize(uint32(len(b.output)-bhOffset) - 3) + if debug { + println("Rewriting block header", bh) + } + _ = bh.appendTo(b.output[bhOffset:bhOffset]) + b.coders.setPrev(llEnc, mlEnc, ofEnc) + return nil +} + +var errIncompressible = errors.New("incompressible") + +func (b *blockEnc) genCodes() { + if len(b.sequences) == 0 { + // nothing to do + return + } + + if len(b.sequences) > math.MaxUint16 { + panic("can only encode up to 64K sequences") + } + // No bounds checks after here: + llH := b.coders.llEnc.Histogram()[:256] + ofH := b.coders.ofEnc.Histogram()[:256] + mlH := b.coders.mlEnc.Histogram()[:256] + for i := range llH { + llH[i] = 0 + } + for i := range ofH { + ofH[i] = 0 + } + for i := range mlH { + mlH[i] = 0 + } + + var llMax, ofMax, mlMax uint8 + for i, seq := range b.sequences { + v := llCode(seq.litLen) + seq.llCode = v + llH[v]++ + if v > llMax { + llMax = v + } + + v = ofCode(seq.offset) + seq.ofCode = v + ofH[v]++ + if v > ofMax { + ofMax = v + } + + v = mlCode(seq.matchLen) + seq.mlCode = v + mlH[v]++ + if v > mlMax { + mlMax = v + if debugAsserts && mlMax > maxMatchLengthSymbol { + panic(fmt.Errorf("mlMax > maxMatchLengthSymbol (%d), matchlen: %d", mlMax, seq.matchLen)) + } + } + b.sequences[i] = seq + } + maxCount := func(a []uint32) int { + var max uint32 + for _, v := range a { + if v > max { + max = v + } + } + return int(max) + } + if debugAsserts && mlMax > maxMatchLengthSymbol { + panic(fmt.Errorf("mlMax > maxMatchLengthSymbol (%d)", mlMax)) + } + if debugAsserts && ofMax > maxOffsetBits { + panic(fmt.Errorf("ofMax > maxOffsetBits (%d)", ofMax)) + } + if debugAsserts && llMax > maxLiteralLengthSymbol { + panic(fmt.Errorf("llMax > maxLiteralLengthSymbol (%d)", llMax)) + } + + b.coders.mlEnc.HistogramFinished(mlMax, maxCount(mlH[:mlMax+1])) + b.coders.ofEnc.HistogramFinished(ofMax, maxCount(ofH[:ofMax+1])) + b.coders.llEnc.HistogramFinished(llMax, maxCount(llH[:llMax+1])) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/blocktype_string.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/blocktype_string.go new file mode 100644 index 000000000000..01a01e486e18 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/blocktype_string.go @@ -0,0 +1,85 @@ +// Code generated by "stringer -type=blockType,literalsBlockType,seqCompMode,tableIndex"; DO NOT EDIT. + +package zstd + +import "strconv" + +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[blockTypeRaw-0] + _ = x[blockTypeRLE-1] + _ = x[blockTypeCompressed-2] + _ = x[blockTypeReserved-3] +} + +const _blockType_name = "blockTypeRawblockTypeRLEblockTypeCompressedblockTypeReserved" + +var _blockType_index = [...]uint8{0, 12, 24, 43, 60} + +func (i blockType) String() string { + if i >= blockType(len(_blockType_index)-1) { + return "blockType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _blockType_name[_blockType_index[i]:_blockType_index[i+1]] +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[literalsBlockRaw-0] + _ = x[literalsBlockRLE-1] + _ = x[literalsBlockCompressed-2] + _ = x[literalsBlockTreeless-3] +} + +const _literalsBlockType_name = "literalsBlockRawliteralsBlockRLEliteralsBlockCompressedliteralsBlockTreeless" + +var _literalsBlockType_index = [...]uint8{0, 16, 32, 55, 76} + +func (i literalsBlockType) String() string { + if i >= literalsBlockType(len(_literalsBlockType_index)-1) { + return "literalsBlockType(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _literalsBlockType_name[_literalsBlockType_index[i]:_literalsBlockType_index[i+1]] +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[compModePredefined-0] + _ = x[compModeRLE-1] + _ = x[compModeFSE-2] + _ = x[compModeRepeat-3] +} + +const _seqCompMode_name = "compModePredefinedcompModeRLEcompModeFSEcompModeRepeat" + +var _seqCompMode_index = [...]uint8{0, 18, 29, 40, 54} + +func (i seqCompMode) String() string { + if i >= seqCompMode(len(_seqCompMode_index)-1) { + return "seqCompMode(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _seqCompMode_name[_seqCompMode_index[i]:_seqCompMode_index[i+1]] +} +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[tableLiteralLengths-0] + _ = x[tableOffsets-1] + _ = x[tableMatchLengths-2] +} + +const _tableIndex_name = "tableLiteralLengthstableOffsetstableMatchLengths" + +var _tableIndex_index = [...]uint8{0, 19, 31, 48} + +func (i tableIndex) String() string { + if i >= tableIndex(len(_tableIndex_index)-1) { + return "tableIndex(" + strconv.FormatInt(int64(i), 10) + ")" + } + return _tableIndex_name[_tableIndex_index[i]:_tableIndex_index[i+1]] +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bytebuf.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bytebuf.go new file mode 100644 index 000000000000..658ef78380e1 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bytebuf.go @@ -0,0 +1,127 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "fmt" + "io" + "io/ioutil" +) + +type byteBuffer interface { + // Read up to 8 bytes. + // Returns nil if no more input is available. + readSmall(n int) []byte + + // Read >8 bytes. + // MAY use the destination slice. + readBig(n int, dst []byte) ([]byte, error) + + // Read a single byte. + readByte() (byte, error) + + // Skip n bytes. + skipN(n int) error +} + +// in-memory buffer +type byteBuf []byte + +func (b *byteBuf) readSmall(n int) []byte { + if debugAsserts && n > 8 { + panic(fmt.Errorf("small read > 8 (%d). use readBig", n)) + } + bb := *b + if len(bb) < n { + return nil + } + r := bb[:n] + *b = bb[n:] + return r +} + +func (b *byteBuf) readBig(n int, dst []byte) ([]byte, error) { + bb := *b + if len(bb) < n { + return nil, io.ErrUnexpectedEOF + } + r := bb[:n] + *b = bb[n:] + return r, nil +} + +func (b *byteBuf) remain() []byte { + return *b +} + +func (b *byteBuf) readByte() (byte, error) { + bb := *b + if len(bb) < 1 { + return 0, nil + } + r := bb[0] + *b = bb[1:] + return r, nil +} + +func (b *byteBuf) skipN(n int) error { + bb := *b + if len(bb) < n { + return io.ErrUnexpectedEOF + } + *b = bb[n:] + return nil +} + +// wrapper around a reader. +type readerWrapper struct { + r io.Reader + tmp [8]byte +} + +func (r *readerWrapper) readSmall(n int) []byte { + if debugAsserts && n > 8 { + panic(fmt.Errorf("small read > 8 (%d). use readBig", n)) + } + n2, err := io.ReadFull(r.r, r.tmp[:n]) + // We only really care about the actual bytes read. + if n2 != n { + if debug { + println("readSmall: got", n2, "want", n, "err", err) + } + return nil + } + return r.tmp[:n] +} + +func (r *readerWrapper) readBig(n int, dst []byte) ([]byte, error) { + if cap(dst) < n { + dst = make([]byte, n) + } + n2, err := io.ReadFull(r.r, dst[:n]) + if err == io.EOF && n > 0 { + err = io.ErrUnexpectedEOF + } + return dst[:n2], err +} + +func (r *readerWrapper) readByte() (byte, error) { + n2, err := r.r.Read(r.tmp[:1]) + if err != nil { + return 0, err + } + if n2 != 1 { + return 0, io.ErrUnexpectedEOF + } + return r.tmp[0], nil +} + +func (r *readerWrapper) skipN(n int) error { + n2, err := io.CopyN(ioutil.Discard, r.r, int64(n)) + if n2 != int64(n) { + err = io.ErrUnexpectedEOF + } + return err +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bytereader.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bytereader.go new file mode 100644 index 000000000000..2c4fca17fa1d --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/bytereader.go @@ -0,0 +1,88 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +// byteReader provides a byte reader that reads +// little endian values from a byte stream. +// The input stream is manually advanced. +// The reader performs no bounds checks. +type byteReader struct { + b []byte + off int +} + +// init will initialize the reader and set the input. +func (b *byteReader) init(in []byte) { + b.b = in + b.off = 0 +} + +// advance the stream b n bytes. +func (b *byteReader) advance(n uint) { + b.off += int(n) +} + +// overread returns whether we have advanced too far. +func (b *byteReader) overread() bool { + return b.off > len(b.b) +} + +// Int32 returns a little endian int32 starting at current offset. +func (b byteReader) Int32() int32 { + b2 := b.b[b.off:] + b2 = b2[:4] + v3 := int32(b2[3]) + v2 := int32(b2[2]) + v1 := int32(b2[1]) + v0 := int32(b2[0]) + return v0 | (v1 << 8) | (v2 << 16) | (v3 << 24) +} + +// Uint8 returns the next byte +func (b *byteReader) Uint8() uint8 { + v := b.b[b.off] + return v +} + +// Uint32 returns a little endian uint32 starting at current offset. +func (b byteReader) Uint32() uint32 { + if r := b.remain(); r < 4 { + // Very rare + v := uint32(0) + for i := 1; i <= r; i++ { + v = (v << 8) | uint32(b.b[len(b.b)-i]) + } + return v + } + b2 := b.b[b.off:] + b2 = b2[:4] + v3 := uint32(b2[3]) + v2 := uint32(b2[2]) + v1 := uint32(b2[1]) + v0 := uint32(b2[0]) + return v0 | (v1 << 8) | (v2 << 16) | (v3 << 24) +} + +// Uint32NC returns a little endian uint32 starting at current offset. +// The caller must be sure if there are at least 4 bytes left. +func (b byteReader) Uint32NC() uint32 { + b2 := b.b[b.off:] + b2 = b2[:4] + v3 := uint32(b2[3]) + v2 := uint32(b2[2]) + v1 := uint32(b2[1]) + v0 := uint32(b2[0]) + return v0 | (v1 << 8) | (v2 << 16) | (v3 << 24) +} + +// unread returns the unread portion of the input. +func (b byteReader) unread() []byte { + return b.b[b.off:] +} + +// remain will return the number of bytes remaining. +func (b byteReader) remain() int { + return len(b.b) - b.off +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/decoder.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/decoder.go new file mode 100644 index 000000000000..d78be6d42360 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/decoder.go @@ -0,0 +1,546 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "bytes" + "errors" + "io" + "sync" +) + +// Decoder provides decoding of zstandard streams. +// The decoder has been designed to operate without allocations after a warmup. +// This means that you should store the decoder for best performance. +// To re-use a stream decoder, use the Reset(r io.Reader) error to switch to another stream. +// A decoder can safely be re-used even if the previous stream failed. +// To release the resources, you must call the Close() function on a decoder. +type Decoder struct { + o decoderOptions + + // Unreferenced decoders, ready for use. + decoders chan *blockDec + + // Streams ready to be decoded. + stream chan decodeStream + + // Current read position used for Reader functionality. + current decoderState + + // Custom dictionaries. + // Always uses copies. + dicts map[uint32]dict + + // streamWg is the waitgroup for all streams + streamWg sync.WaitGroup +} + +// decoderState is used for maintaining state when the decoder +// is used for streaming. +type decoderState struct { + // current block being written to stream. + decodeOutput + + // output in order to be written to stream. + output chan decodeOutput + + // cancel remaining output. + cancel chan struct{} + + flushed bool +} + +var ( + // Check the interfaces we want to support. + _ = io.WriterTo(&Decoder{}) + _ = io.Reader(&Decoder{}) +) + +// NewReader creates a new decoder. +// A nil Reader can be provided in which case Reset can be used to start a decode. +// +// A Decoder can be used in two modes: +// +// 1) As a stream, or +// 2) For stateless decoding using DecodeAll. +// +// Only a single stream can be decoded concurrently, but the same decoder +// can run multiple concurrent stateless decodes. It is even possible to +// use stateless decodes while a stream is being decoded. +// +// The Reset function can be used to initiate a new stream, which is will considerably +// reduce the allocations normally caused by NewReader. +func NewReader(r io.Reader, opts ...DOption) (*Decoder, error) { + initPredefined() + var d Decoder + d.o.setDefault() + for _, o := range opts { + err := o(&d.o) + if err != nil { + return nil, err + } + } + d.current.output = make(chan decodeOutput, d.o.concurrent) + d.current.flushed = true + + // Transfer option dicts. + d.dicts = make(map[uint32]dict, len(d.o.dicts)) + for _, dc := range d.o.dicts { + d.dicts[dc.id] = dc + } + d.o.dicts = nil + + // Create decoders + d.decoders = make(chan *blockDec, d.o.concurrent) + for i := 0; i < d.o.concurrent; i++ { + dec := newBlockDec(d.o.lowMem) + dec.localFrame = newFrameDec(d.o) + d.decoders <- dec + } + + if r == nil { + return &d, nil + } + return &d, d.Reset(r) +} + +// Read bytes from the decompressed stream into p. +// Returns the number of bytes written and any error that occurred. +// When the stream is done, io.EOF will be returned. +func (d *Decoder) Read(p []byte) (int, error) { + if d.stream == nil { + return 0, errors.New("no input has been initialized") + } + var n int + for { + if len(d.current.b) > 0 { + filled := copy(p, d.current.b) + p = p[filled:] + d.current.b = d.current.b[filled:] + n += filled + } + if len(p) == 0 { + break + } + if len(d.current.b) == 0 { + // We have an error and no more data + if d.current.err != nil { + break + } + if !d.nextBlock(n == 0) { + return n, nil + } + } + } + if len(d.current.b) > 0 { + if debug { + println("returning", n, "still bytes left:", len(d.current.b)) + } + // Only return error at end of block + return n, nil + } + if d.current.err != nil { + d.drainOutput() + } + if debug { + println("returning", n, d.current.err, len(d.decoders)) + } + return n, d.current.err +} + +// Reset will reset the decoder the supplied stream after the current has finished processing. +// Note that this functionality cannot be used after Close has been called. +func (d *Decoder) Reset(r io.Reader) error { + if d.current.err == ErrDecoderClosed { + return d.current.err + } + if r == nil { + return errors.New("nil Reader sent as input") + } + + if d.stream == nil { + d.stream = make(chan decodeStream, 1) + d.streamWg.Add(1) + go d.startStreamDecoder(d.stream) + } + + d.drainOutput() + + // If bytes buffer and < 1MB, do sync decoding anyway. + if bb, ok := r.(*bytes.Buffer); ok && bb.Len() < 1<<20 { + if debug { + println("*bytes.Buffer detected, doing sync decode, len:", bb.Len()) + } + b := bb.Bytes() + var dst []byte + if cap(d.current.b) > 0 { + dst = d.current.b + } + + dst, err := d.DecodeAll(b, dst[:0]) + if err == nil { + err = io.EOF + } + d.current.b = dst + d.current.err = err + d.current.flushed = true + if debug { + println("sync decode to", len(dst), "bytes, err:", err) + } + return nil + } + + // Remove current block. + d.current.decodeOutput = decodeOutput{} + d.current.err = nil + d.current.cancel = make(chan struct{}) + d.current.flushed = false + d.current.d = nil + + d.stream <- decodeStream{ + r: r, + output: d.current.output, + cancel: d.current.cancel, + } + return nil +} + +// drainOutput will drain the output until errEndOfStream is sent. +func (d *Decoder) drainOutput() { + if d.current.cancel != nil { + println("cancelling current") + close(d.current.cancel) + d.current.cancel = nil + } + if d.current.d != nil { + if debug { + printf("re-adding current decoder %p, decoders: %d", d.current.d, len(d.decoders)) + } + d.decoders <- d.current.d + d.current.d = nil + d.current.b = nil + } + if d.current.output == nil || d.current.flushed { + println("current already flushed") + return + } + for { + select { + case v := <-d.current.output: + if v.d != nil { + if debug { + printf("re-adding decoder %p", v.d) + } + d.decoders <- v.d + } + if v.err == errEndOfStream { + println("current flushed") + d.current.flushed = true + return + } + } + } +} + +// WriteTo writes data to w until there's no more data to write or when an error occurs. +// The return value n is the number of bytes written. +// Any error encountered during the write is also returned. +func (d *Decoder) WriteTo(w io.Writer) (int64, error) { + if d.stream == nil { + return 0, errors.New("no input has been initialized") + } + var n int64 + for { + if len(d.current.b) > 0 { + n2, err2 := w.Write(d.current.b) + n += int64(n2) + if err2 != nil && d.current.err == nil { + d.current.err = err2 + break + } + } + if d.current.err != nil { + break + } + d.nextBlock(true) + } + err := d.current.err + if err != nil { + d.drainOutput() + } + if err == io.EOF { + err = nil + } + return n, err +} + +// DecodeAll allows stateless decoding of a blob of bytes. +// Output will be appended to dst, so if the destination size is known +// you can pre-allocate the destination slice to avoid allocations. +// DecodeAll can be used concurrently. +// The Decoder concurrency limits will be respected. +func (d *Decoder) DecodeAll(input, dst []byte) ([]byte, error) { + if d.current.err == ErrDecoderClosed { + return dst, ErrDecoderClosed + } + + // Grab a block decoder and frame decoder. + block := <-d.decoders + frame := block.localFrame + defer func() { + if debug { + printf("re-adding decoder: %p", block) + } + frame.rawInput = nil + frame.bBuf = nil + d.decoders <- block + }() + frame.bBuf = input + + for { + frame.history.reset() + err := frame.reset(&frame.bBuf) + if err == io.EOF { + if debug { + println("frame reset return EOF") + } + return dst, nil + } + if frame.DictionaryID != nil { + dict, ok := d.dicts[*frame.DictionaryID] + if !ok { + return nil, ErrUnknownDictionary + } + frame.history.setDict(&dict) + } + if err != nil { + return dst, err + } + if frame.FrameContentSize > d.o.maxDecodedSize-uint64(len(dst)) { + return dst, ErrDecoderSizeExceeded + } + if frame.FrameContentSize > 0 && frame.FrameContentSize < 1<<30 { + // Never preallocate moe than 1 GB up front. + if uint64(cap(dst)) < frame.FrameContentSize { + dst2 := make([]byte, len(dst), len(dst)+int(frame.FrameContentSize)) + copy(dst2, dst) + dst = dst2 + } + } + if cap(dst) == 0 { + // Allocate window size * 2 by default if nothing is provided and we didn't get frame content size. + size := frame.WindowSize * 2 + // Cap to 1 MB. + if size > 1<<20 { + size = 1 << 20 + } + dst = make([]byte, 0, size) + } + + dst, err = frame.runDecoder(dst, block) + if err != nil { + return dst, err + } + if len(frame.bBuf) == 0 { + if debug { + println("frame dbuf empty") + } + break + } + } + return dst, nil +} + +// nextBlock returns the next block. +// If an error occurs d.err will be set. +// Optionally the function can block for new output. +// If non-blocking mode is used the returned boolean will be false +// if no data was available without blocking. +func (d *Decoder) nextBlock(blocking bool) (ok bool) { + if d.current.d != nil { + if debug { + printf("re-adding current decoder %p", d.current.d) + } + d.decoders <- d.current.d + d.current.d = nil + } + if d.current.err != nil { + // Keep error state. + return blocking + } + + if blocking { + d.current.decodeOutput = <-d.current.output + } else { + select { + case d.current.decodeOutput = <-d.current.output: + default: + return false + } + } + if debug { + println("got", len(d.current.b), "bytes, error:", d.current.err) + } + return true +} + +// Close will release all resources. +// It is NOT possible to reuse the decoder after this. +func (d *Decoder) Close() { + if d.current.err == ErrDecoderClosed { + return + } + d.drainOutput() + if d.stream != nil { + close(d.stream) + d.streamWg.Wait() + d.stream = nil + } + if d.decoders != nil { + close(d.decoders) + for dec := range d.decoders { + dec.Close() + } + d.decoders = nil + } + if d.current.d != nil { + d.current.d.Close() + d.current.d = nil + } + d.current.err = ErrDecoderClosed +} + +// IOReadCloser returns the decoder as an io.ReadCloser for convenience. +// Any changes to the decoder will be reflected, so the returned ReadCloser +// can be reused along with the decoder. +// io.WriterTo is also supported by the returned ReadCloser. +func (d *Decoder) IOReadCloser() io.ReadCloser { + return closeWrapper{d: d} +} + +// closeWrapper wraps a function call as a closer. +type closeWrapper struct { + d *Decoder +} + +// WriteTo forwards WriteTo calls to the decoder. +func (c closeWrapper) WriteTo(w io.Writer) (n int64, err error) { + return c.d.WriteTo(w) +} + +// Read forwards read calls to the decoder. +func (c closeWrapper) Read(p []byte) (n int, err error) { + return c.d.Read(p) +} + +// Close closes the decoder. +func (c closeWrapper) Close() error { + c.d.Close() + return nil +} + +type decodeOutput struct { + d *blockDec + b []byte + err error +} + +type decodeStream struct { + r io.Reader + + // Blocks ready to be written to output. + output chan decodeOutput + + // cancel reading from the input + cancel chan struct{} +} + +// errEndOfStream indicates that everything from the stream was read. +var errEndOfStream = errors.New("end-of-stream") + +// Create Decoder: +// Spawn n block decoders. These accept tasks to decode a block. +// Create goroutine that handles stream processing, this will send history to decoders as they are available. +// Decoders update the history as they decode. +// When a block is returned: +// a) history is sent to the next decoder, +// b) content written to CRC. +// c) return data to WRITER. +// d) wait for next block to return data. +// Once WRITTEN, the decoders reused by the writer frame decoder for re-use. +func (d *Decoder) startStreamDecoder(inStream chan decodeStream) { + defer d.streamWg.Done() + frame := newFrameDec(d.o) + for stream := range inStream { + if debug { + println("got new stream") + } + br := readerWrapper{r: stream.r} + decodeStream: + for { + frame.history.reset() + err := frame.reset(&br) + if debug && err != nil { + println("Frame decoder returned", err) + } + if err == nil && frame.DictionaryID != nil { + dict, ok := d.dicts[*frame.DictionaryID] + if !ok { + err = ErrUnknownDictionary + } else { + frame.history.setDict(&dict) + } + } + if err != nil { + stream.output <- decodeOutput{ + err: err, + } + break + } + if debug { + println("starting frame decoder") + } + + // This goroutine will forward history between frames. + frame.frameDone.Add(1) + frame.initAsync() + + go frame.startDecoder(stream.output) + decodeFrame: + // Go through all blocks of the frame. + for { + dec := <-d.decoders + select { + case <-stream.cancel: + if !frame.sendErr(dec, io.EOF) { + // To not let the decoder dangle, send it back. + stream.output <- decodeOutput{d: dec} + } + break decodeStream + default: + } + err := frame.next(dec) + switch err { + case io.EOF: + // End of current frame, no error + println("EOF on next block") + break decodeFrame + case nil: + continue + default: + println("block decoder returned", err) + break decodeStream + } + } + // All blocks have started decoding, check if there are more frames. + println("waiting for done") + frame.frameDone.Wait() + println("done waiting...") + } + frame.frameDone.Wait() + println("Sending EOS") + stream.output <- decodeOutput{err: errEndOfStream} + } +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/decoder_options.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/decoder_options.go new file mode 100644 index 000000000000..284d384492b1 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/decoder_options.go @@ -0,0 +1,84 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "errors" + "fmt" + "runtime" +) + +// DOption is an option for creating a decoder. +type DOption func(*decoderOptions) error + +// options retains accumulated state of multiple options. +type decoderOptions struct { + lowMem bool + concurrent int + maxDecodedSize uint64 + dicts []dict +} + +func (o *decoderOptions) setDefault() { + *o = decoderOptions{ + // use less ram: true for now, but may change. + lowMem: true, + concurrent: runtime.GOMAXPROCS(0), + } + o.maxDecodedSize = 1 << 63 +} + +// WithDecoderLowmem will set whether to use a lower amount of memory, +// but possibly have to allocate more while running. +func WithDecoderLowmem(b bool) DOption { + return func(o *decoderOptions) error { o.lowMem = b; return nil } +} + +// WithDecoderConcurrency will set the concurrency, +// meaning the maximum number of decoders to run concurrently. +// The value supplied must be at least 1. +// By default this will be set to GOMAXPROCS. +func WithDecoderConcurrency(n int) DOption { + return func(o *decoderOptions) error { + if n <= 0 { + return fmt.Errorf("Concurrency must be at least 1") + } + o.concurrent = n + return nil + } +} + +// WithDecoderMaxMemory allows to set a maximum decoded size for in-memory +// non-streaming operations or maximum window size for streaming operations. +// This can be used to control memory usage of potentially hostile content. +// For streaming operations, the maximum window size is capped at 1<<30 bytes. +// Maximum and default is 1 << 63 bytes. +func WithDecoderMaxMemory(n uint64) DOption { + return func(o *decoderOptions) error { + if n == 0 { + return errors.New("WithDecoderMaxMemory must be at least 1") + } + if n > 1<<63 { + return fmt.Errorf("WithDecoderMaxmemory must be less than 1 << 63") + } + o.maxDecodedSize = n + return nil + } +} + +// WithDecoderDicts allows to register one or more dictionaries for the decoder. +// If several dictionaries with the same ID is provided the last one will be used. +func WithDecoderDicts(dicts ...[]byte) DOption { + return func(o *decoderOptions) error { + for _, b := range dicts { + d, err := loadDict(b) + if err != nil { + return err + } + o.dicts = append(o.dicts, *d) + } + return nil + } +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/dict.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/dict.go new file mode 100644 index 000000000000..fa25a18d8644 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/dict.go @@ -0,0 +1,122 @@ +package zstd + +import ( + "bytes" + "encoding/binary" + "errors" + "fmt" + "io" + + "github.com/klauspost/compress/huff0" +) + +type dict struct { + id uint32 + + litEnc *huff0.Scratch + llDec, ofDec, mlDec sequenceDec + //llEnc, ofEnc, mlEnc []*fseEncoder + offsets [3]int + content []byte +} + +var dictMagic = [4]byte{0x37, 0xa4, 0x30, 0xec} + +// ID returns the dictionary id or 0 if d is nil. +func (d *dict) ID() uint32 { + if d == nil { + return 0 + } + return d.id +} + +// DictContentSize returns the dictionary content size or 0 if d is nil. +func (d *dict) DictContentSize() int { + if d == nil { + return 0 + } + return len(d.content) +} + +// Load a dictionary as described in +// https://github.com/facebook/zstd/blob/master/doc/zstd_compression_format.md#dictionary-format +func loadDict(b []byte) (*dict, error) { + // Check static field size. + if len(b) <= 8+(3*4) { + return nil, io.ErrUnexpectedEOF + } + d := dict{ + llDec: sequenceDec{fse: &fseDecoder{}}, + ofDec: sequenceDec{fse: &fseDecoder{}}, + mlDec: sequenceDec{fse: &fseDecoder{}}, + } + if !bytes.Equal(b[:4], dictMagic[:]) { + return nil, ErrMagicMismatch + } + d.id = binary.LittleEndian.Uint32(b[4:8]) + if d.id == 0 { + return nil, errors.New("dictionaries cannot have ID 0") + } + + // Read literal table + var err error + d.litEnc, b, err = huff0.ReadTable(b[8:], nil) + if err != nil { + return nil, err + } + d.litEnc.Reuse = huff0.ReusePolicyMust + + br := byteReader{ + b: b, + off: 0, + } + readDec := func(i tableIndex, dec *fseDecoder) error { + if err := dec.readNCount(&br, uint16(maxTableSymbol[i])); err != nil { + return err + } + if br.overread() { + return io.ErrUnexpectedEOF + } + err = dec.transform(symbolTableX[i]) + if err != nil { + println("Transform table error:", err) + return err + } + if debug { + println("Read table ok", "symbolLen:", dec.symbolLen) + } + // Set decoders as predefined so they aren't reused. + dec.preDefined = true + return nil + } + + if err := readDec(tableOffsets, d.ofDec.fse); err != nil { + return nil, err + } + if err := readDec(tableMatchLengths, d.mlDec.fse); err != nil { + return nil, err + } + if err := readDec(tableLiteralLengths, d.llDec.fse); err != nil { + return nil, err + } + if br.remain() < 12 { + return nil, io.ErrUnexpectedEOF + } + + d.offsets[0] = int(br.Uint32()) + br.advance(4) + d.offsets[1] = int(br.Uint32()) + br.advance(4) + d.offsets[2] = int(br.Uint32()) + br.advance(4) + if d.offsets[0] <= 0 || d.offsets[1] <= 0 || d.offsets[2] <= 0 { + return nil, errors.New("invalid offset in dictionary") + } + d.content = make([]byte, br.remain()) + copy(d.content, br.unread()) + if d.offsets[0] > len(d.content) || d.offsets[1] > len(d.content) || d.offsets[2] > len(d.content) { + return nil, fmt.Errorf("initial offset bigger than dictionary content size %d, offsets: %v", len(d.content), d.offsets) + } + + return &d, nil +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_base.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_base.go new file mode 100644 index 000000000000..b1b7c6e6a72d --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_base.go @@ -0,0 +1,155 @@ +package zstd + +import ( + "fmt" + "math/bits" + + "github.com/klauspost/compress/zstd/internal/xxhash" +) + +type fastBase struct { + // cur is the offset at the start of hist + cur int32 + // maximum offset. Should be at least 2x block size. + maxMatchOff int32 + hist []byte + crc *xxhash.Digest + tmp [8]byte + blk *blockEnc + lastDictID uint32 +} + +// CRC returns the underlying CRC writer. +func (e *fastBase) CRC() *xxhash.Digest { + return e.crc +} + +// AppendCRC will append the CRC to the destination slice and return it. +func (e *fastBase) AppendCRC(dst []byte) []byte { + crc := e.crc.Sum(e.tmp[:0]) + dst = append(dst, crc[7], crc[6], crc[5], crc[4]) + return dst +} + +// WindowSize returns the window size of the encoder, +// or a window size small enough to contain the input size, if > 0. +func (e *fastBase) WindowSize(size int) int32 { + if size > 0 && size < int(e.maxMatchOff) { + b := int32(1) << uint(bits.Len(uint(size))) + // Keep minimum window. + if b < 1024 { + b = 1024 + } + return b + } + return e.maxMatchOff +} + +// Block returns the current block. +func (e *fastBase) Block() *blockEnc { + return e.blk +} + +func (e *fastBase) addBlock(src []byte) int32 { + if debugAsserts && e.cur > bufferReset { + panic(fmt.Sprintf("ecur (%d) > buffer reset (%d)", e.cur, bufferReset)) + } + // check if we have space already + if len(e.hist)+len(src) > cap(e.hist) { + if cap(e.hist) == 0 { + l := e.maxMatchOff * 2 + // Make it at least 1MB. + if l < 1<<20 { + l = 1 << 20 + } + e.hist = make([]byte, 0, l) + } else { + if cap(e.hist) < int(e.maxMatchOff*2) { + panic("unexpected buffer size") + } + // Move down + offset := int32(len(e.hist)) - e.maxMatchOff + copy(e.hist[0:e.maxMatchOff], e.hist[offset:]) + e.cur += offset + e.hist = e.hist[:e.maxMatchOff] + } + } + s := int32(len(e.hist)) + e.hist = append(e.hist, src...) + return s +} + +// useBlock will replace the block with the provided one, +// but transfer recent offsets from the previous. +func (e *fastBase) UseBlock(enc *blockEnc) { + enc.reset(e.blk) + e.blk = enc +} + +func (e *fastBase) matchlenNoHist(s, t int32, src []byte) int32 { + // Extend the match to be as long as possible. + return int32(matchLen(src[s:], src[t:])) +} + +func (e *fastBase) matchlen(s, t int32, src []byte) int32 { + if debugAsserts { + if s < 0 { + err := fmt.Sprintf("s (%d) < 0", s) + panic(err) + } + if t < 0 { + err := fmt.Sprintf("s (%d) < 0", s) + panic(err) + } + if s-t > e.maxMatchOff { + err := fmt.Sprintf("s (%d) - t (%d) > maxMatchOff (%d)", s, t, e.maxMatchOff) + panic(err) + } + if len(src)-int(s) > maxCompressedBlockSize { + panic(fmt.Sprintf("len(src)-s (%d) > maxCompressedBlockSize (%d)", len(src)-int(s), maxCompressedBlockSize)) + } + } + + // Extend the match to be as long as possible. + return int32(matchLen(src[s:], src[t:])) +} + +// Reset the encoding table. +func (e *fastBase) resetBase(d *dict, singleBlock bool) { + if e.blk == nil { + e.blk = &blockEnc{} + e.blk.init() + } else { + e.blk.reset(nil) + } + e.blk.initNewEncode() + if e.crc == nil { + e.crc = xxhash.New() + } else { + e.crc.Reset() + } + if (!singleBlock || d.DictContentSize() > 0) && cap(e.hist) < int(e.maxMatchOff*2)+d.DictContentSize() { + l := e.maxMatchOff*2 + int32(d.DictContentSize()) + // Make it at least 1MB. + if l < 1<<20 { + l = 1 << 20 + } + e.hist = make([]byte, 0, l) + } + // We offset current position so everything will be out of reach. + // If above reset line, history will be purged. + if e.cur < bufferReset { + e.cur += e.maxMatchOff + int32(len(e.hist)) + } + e.hist = e.hist[:0] + if d != nil { + // Set offsets (currently not used) + for i, off := range d.offsets { + e.blk.recentOffsets[i] = uint32(off) + e.blk.prevRecentOffsets[i] = e.blk.recentOffsets[i] + } + // Transfer litenc. + e.blk.dictLitEnc = d.litEnc + e.hist = append(e.hist, d.content...) + } +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_better.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_better.go new file mode 100644 index 000000000000..94a5343d00ec --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_better.go @@ -0,0 +1,595 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import "fmt" + +const ( + betterLongTableBits = 19 // Bits used in the long match table + betterLongTableSize = 1 << betterLongTableBits // Size of the table + + // Note: Increasing the short table bits or making the hash shorter + // can actually lead to compression degradation since it will 'steal' more from the + // long match table and match offsets are quite big. + // This greatly depends on the type of input. + betterShortTableBits = 13 // Bits used in the short match table + betterShortTableSize = 1 << betterShortTableBits // Size of the table +) + +type prevEntry struct { + offset int32 + prev int32 +} + +// betterFastEncoder uses 2 tables, one for short matches (5 bytes) and one for long matches. +// The long match table contains the previous entry with the same hash, +// effectively making it a "chain" of length 2. +// When we find a long match we choose between the two values and select the longest. +// When we find a short match, after checking the long, we check if we can find a long at n+1 +// and that it is longer (lazy matching). +type betterFastEncoder struct { + fastBase + table [betterShortTableSize]tableEntry + longTable [betterLongTableSize]prevEntry + dictTable []tableEntry + dictLongTable []prevEntry +} + +// Encode improves compression... +func (e *betterFastEncoder) Encode(blk *blockEnc, src []byte) { + const ( + // Input margin is the number of bytes we read (8) + // and the maximum we will read ahead (2) + inputMargin = 8 + 2 + minNonLiteralBlockSize = 16 + ) + + // Protect against e.cur wraparound. + for e.cur >= bufferReset { + if len(e.hist) == 0 { + for i := range e.table[:] { + e.table[i] = tableEntry{} + } + for i := range e.longTable[:] { + e.longTable[i] = prevEntry{} + } + e.cur = e.maxMatchOff + break + } + // Shift down everything in the table that isn't already too far away. + minOff := e.cur + int32(len(e.hist)) - e.maxMatchOff + for i := range e.table[:] { + v := e.table[i].offset + if v < minOff { + v = 0 + } else { + v = v - e.cur + e.maxMatchOff + } + e.table[i].offset = v + } + for i := range e.longTable[:] { + v := e.longTable[i].offset + v2 := e.longTable[i].prev + if v < minOff { + v = 0 + v2 = 0 + } else { + v = v - e.cur + e.maxMatchOff + if v2 < minOff { + v2 = 0 + } else { + v2 = v2 - e.cur + e.maxMatchOff + } + } + e.longTable[i] = prevEntry{ + offset: v, + prev: v2, + } + } + e.cur = e.maxMatchOff + break + } + + s := e.addBlock(src) + blk.size = len(src) + if len(src) < minNonLiteralBlockSize { + blk.extraLits = len(src) + blk.literals = blk.literals[:len(src)] + copy(blk.literals, src) + return + } + + // Override src + src = e.hist + sLimit := int32(len(src)) - inputMargin + // stepSize is the number of bytes to skip on every main loop iteration. + // It should be >= 1. + const stepSize = 1 + + const kSearchStrength = 9 + + // nextEmit is where in src the next emitLiteral should start from. + nextEmit := s + cv := load6432(src, s) + + // Relative offsets + offset1 := int32(blk.recentOffsets[0]) + offset2 := int32(blk.recentOffsets[1]) + + addLiterals := func(s *seq, until int32) { + if until == nextEmit { + return + } + blk.literals = append(blk.literals, src[nextEmit:until]...) + s.litLen = uint32(until - nextEmit) + } + if debug { + println("recent offsets:", blk.recentOffsets) + } + +encodeLoop: + for { + var t int32 + // We allow the encoder to optionally turn off repeat offsets across blocks + canRepeat := len(blk.sequences) > 2 + var matched int32 + + for { + if debugAsserts && canRepeat && offset1 == 0 { + panic("offset0 was 0") + } + + nextHashS := hash5(cv, betterShortTableBits) + nextHashL := hash8(cv, betterLongTableBits) + candidateL := e.longTable[nextHashL] + candidateS := e.table[nextHashS] + + const repOff = 1 + repIndex := s - offset1 + repOff + off := s + e.cur + e.longTable[nextHashL] = prevEntry{offset: off, prev: candidateL.offset} + e.table[nextHashS] = tableEntry{offset: off, val: uint32(cv)} + + if canRepeat { + if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) { + // Consider history as well. + var seq seq + lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src) + + seq.matchLen = uint32(lenght - zstdMinMatch) + + // We might be able to match backwards. + // Extend as long as we can. + start := s + repOff + // We end the search early, so we don't risk 0 literals + // and have to do special offset treatment. + startLimit := nextEmit + 1 + + tMin := s - e.maxMatchOff + if tMin < 0 { + tMin = 0 + } + for repIndex > tMin && start > startLimit && src[repIndex-1] == src[start-1] && seq.matchLen < maxMatchLength-zstdMinMatch-1 { + repIndex-- + start-- + seq.matchLen++ + } + addLiterals(&seq, start) + + // rep 0 + seq.offset = 1 + if debugSequences { + println("repeat sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + + // Index match start+1 (long) -> s - 1 + index0 := s + repOff + s += lenght + repOff + + nextEmit = s + if s >= sLimit { + if debug { + println("repeat ended", s, lenght) + + } + break encodeLoop + } + // Index skipped... + for index0 < s-1 { + cv0 := load6432(src, index0) + cv1 := cv0 >> 8 + h0 := hash8(cv0, betterLongTableBits) + off := index0 + e.cur + e.longTable[h0] = prevEntry{offset: off, prev: e.longTable[h0].offset} + e.table[hash5(cv1, betterShortTableBits)] = tableEntry{offset: off + 1, val: uint32(cv1)} + index0 += 2 + } + cv = load6432(src, s) + continue + } + const repOff2 = 1 + + // We deviate from the reference encoder and also check offset 2. + // Still slower and not much better, so disabled. + // repIndex = s - offset2 + repOff2 + if false && repIndex >= 0 && load6432(src, repIndex) == load6432(src, s+repOff) { + // Consider history as well. + var seq seq + lenght := 8 + e.matchlen(s+8+repOff2, repIndex+8, src) + + seq.matchLen = uint32(lenght - zstdMinMatch) + + // We might be able to match backwards. + // Extend as long as we can. + start := s + repOff2 + // We end the search early, so we don't risk 0 literals + // and have to do special offset treatment. + startLimit := nextEmit + 1 + + tMin := s - e.maxMatchOff + if tMin < 0 { + tMin = 0 + } + for repIndex > tMin && start > startLimit && src[repIndex-1] == src[start-1] && seq.matchLen < maxMatchLength-zstdMinMatch-1 { + repIndex-- + start-- + seq.matchLen++ + } + addLiterals(&seq, start) + + // rep 2 + seq.offset = 2 + if debugSequences { + println("repeat sequence 2", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + + index0 := s + repOff2 + s += lenght + repOff2 + nextEmit = s + if s >= sLimit { + if debug { + println("repeat ended", s, lenght) + + } + break encodeLoop + } + + // Index skipped... + for index0 < s-1 { + cv0 := load6432(src, index0) + cv1 := cv0 >> 8 + h0 := hash8(cv0, betterLongTableBits) + off := index0 + e.cur + e.longTable[h0] = prevEntry{offset: off, prev: e.longTable[h0].offset} + e.table[hash5(cv1, betterShortTableBits)] = tableEntry{offset: off + 1, val: uint32(cv1)} + index0 += 2 + } + cv = load6432(src, s) + // Swap offsets + offset1, offset2 = offset2, offset1 + continue + } + } + // Find the offsets of our two matches. + coffsetL := candidateL.offset - e.cur + coffsetLP := candidateL.prev - e.cur + + // Check if we have a long match. + if s-coffsetL < e.maxMatchOff && cv == load6432(src, coffsetL) { + // Found a long match, at least 8 bytes. + matched = e.matchlen(s+8, coffsetL+8, src) + 8 + t = coffsetL + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + if debugMatches { + println("long match") + } + + if s-coffsetLP < e.maxMatchOff && cv == load6432(src, coffsetLP) { + // Found a long match, at least 8 bytes. + prevMatch := e.matchlen(s+8, coffsetLP+8, src) + 8 + if prevMatch > matched { + matched = prevMatch + t = coffsetLP + } + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + if debugMatches { + println("long match") + } + } + break + } + + // Check if we have a long match on prev. + if s-coffsetLP < e.maxMatchOff && cv == load6432(src, coffsetLP) { + // Found a long match, at least 8 bytes. + matched = e.matchlen(s+8, coffsetLP+8, src) + 8 + t = coffsetLP + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + if debugMatches { + println("long match") + } + break + } + + coffsetS := candidateS.offset - e.cur + + // Check if we have a short match. + if s-coffsetS < e.maxMatchOff && uint32(cv) == candidateS.val { + // found a regular match + matched = e.matchlen(s+4, coffsetS+4, src) + 4 + + // See if we can find a long match at s+1 + const checkAt = 1 + cv := load6432(src, s+checkAt) + nextHashL = hash8(cv, betterLongTableBits) + candidateL = e.longTable[nextHashL] + coffsetL = candidateL.offset - e.cur + + // We can store it, since we have at least a 4 byte match. + e.longTable[nextHashL] = prevEntry{offset: s + checkAt + e.cur, prev: candidateL.offset} + if s-coffsetL < e.maxMatchOff && cv == load6432(src, coffsetL) { + // Found a long match, at least 8 bytes. + matchedNext := e.matchlen(s+8+checkAt, coffsetL+8, src) + 8 + if matchedNext > matched { + t = coffsetL + s += checkAt + matched = matchedNext + if debugMatches { + println("long match (after short)") + } + break + } + } + + // Check prev long... + coffsetL = candidateL.prev - e.cur + if s-coffsetL < e.maxMatchOff && cv == load6432(src, coffsetL) { + // Found a long match, at least 8 bytes. + matchedNext := e.matchlen(s+8+checkAt, coffsetL+8, src) + 8 + if matchedNext > matched { + t = coffsetL + s += checkAt + matched = matchedNext + if debugMatches { + println("prev long match (after short)") + } + break + } + } + t = coffsetS + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + if debugAsserts && t < 0 { + panic("t<0") + } + if debugMatches { + println("short match") + } + break + } + + // No match found, move forward in input. + s += stepSize + ((s - nextEmit) >> (kSearchStrength - 1)) + if s >= sLimit { + break encodeLoop + } + cv = load6432(src, s) + } + + // A 4-byte match has been found. Update recent offsets. + // We'll later see if more than 4 bytes. + offset2 = offset1 + offset1 = s - t + + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + + if debugAsserts && canRepeat && int(offset1) > len(src) { + panic("invalid offset") + } + + // Extend the n-byte match as long as possible. + l := matched + + // Extend backwards + tMin := s - e.maxMatchOff + if tMin < 0 { + tMin = 0 + } + for t > tMin && s > nextEmit && src[t-1] == src[s-1] && l < maxMatchLength { + s-- + t-- + l++ + } + + // Write our sequence + var seq seq + seq.litLen = uint32(s - nextEmit) + seq.matchLen = uint32(l - zstdMinMatch) + if seq.litLen > 0 { + blk.literals = append(blk.literals, src[nextEmit:s]...) + } + seq.offset = uint32(s-t) + 3 + s += l + if debugSequences { + println("sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + nextEmit = s + if s >= sLimit { + break encodeLoop + } + + // Index match start+1 (long) -> s - 1 + index0 := s - l + 1 + for index0 < s-1 { + cv0 := load6432(src, index0) + cv1 := cv0 >> 8 + h0 := hash8(cv0, betterLongTableBits) + off := index0 + e.cur + e.longTable[h0] = prevEntry{offset: off, prev: e.longTable[h0].offset} + e.table[hash5(cv1, betterShortTableBits)] = tableEntry{offset: off + 1, val: uint32(cv1)} + index0 += 2 + } + + cv = load6432(src, s) + if !canRepeat { + continue + } + + // Check offset 2 + for { + o2 := s - offset2 + if load3232(src, o2) != uint32(cv) { + // Do regular search + break + } + + // Store this, since we have it. + nextHashS := hash5(cv, betterShortTableBits) + nextHashL := hash8(cv, betterLongTableBits) + + // We have at least 4 byte match. + // No need to check backwards. We come straight from a match + l := 4 + e.matchlen(s+4, o2+4, src) + + e.longTable[nextHashL] = prevEntry{offset: s + e.cur, prev: e.longTable[nextHashL].offset} + e.table[nextHashS] = tableEntry{offset: s + e.cur, val: uint32(cv)} + seq.matchLen = uint32(l) - zstdMinMatch + seq.litLen = 0 + + // Since litlen is always 0, this is offset 1. + seq.offset = 1 + s += l + nextEmit = s + if debugSequences { + println("sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + + // Swap offset 1 and 2. + offset1, offset2 = offset2, offset1 + if s >= sLimit { + // Finished + break encodeLoop + } + cv = load6432(src, s) + } + } + + if int(nextEmit) < len(src) { + blk.literals = append(blk.literals, src[nextEmit:]...) + blk.extraLits = len(src) - int(nextEmit) + } + blk.recentOffsets[0] = uint32(offset1) + blk.recentOffsets[1] = uint32(offset2) + if debug { + println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits) + } +} + +// EncodeNoHist will encode a block with no history and no following blocks. +// Most notable difference is that src will not be copied for history and +// we do not need to check for max match length. +func (e *betterFastEncoder) EncodeNoHist(blk *blockEnc, src []byte) { + e.Encode(blk, src) +} + +// ResetDict will reset and set a dictionary if not nil +func (e *betterFastEncoder) Reset(d *dict, singleBlock bool) { + e.resetBase(d, singleBlock) + if d == nil { + return + } + // Init or copy dict table + if len(e.dictTable) != len(e.table) || d.id != e.lastDictID { + if len(e.dictTable) != len(e.table) { + e.dictTable = make([]tableEntry, len(e.table)) + } + end := int32(len(d.content)) - 8 + e.maxMatchOff + for i := e.maxMatchOff; i < end; i += 4 { + const hashLog = betterShortTableBits + + cv := load6432(d.content, i-e.maxMatchOff) + nextHash := hash5(cv, hashLog) // 0 -> 4 + nextHash1 := hash5(cv>>8, hashLog) // 1 -> 5 + nextHash2 := hash5(cv>>16, hashLog) // 2 -> 6 + nextHash3 := hash5(cv>>24, hashLog) // 3 -> 7 + e.dictTable[nextHash] = tableEntry{ + val: uint32(cv), + offset: i, + } + e.dictTable[nextHash1] = tableEntry{ + val: uint32(cv >> 8), + offset: i + 1, + } + e.dictTable[nextHash2] = tableEntry{ + val: uint32(cv >> 16), + offset: i + 2, + } + e.dictTable[nextHash3] = tableEntry{ + val: uint32(cv >> 24), + offset: i + 3, + } + } + e.lastDictID = d.id + } + + // Init or copy dict table + if len(e.dictLongTable) != len(e.longTable) || d.id != e.lastDictID { + if len(e.dictLongTable) != len(e.longTable) { + e.dictLongTable = make([]prevEntry, len(e.longTable)) + } + if len(d.content) >= 8 { + cv := load6432(d.content, 0) + h := hash8(cv, betterLongTableBits) + e.dictLongTable[h] = prevEntry{ + offset: e.maxMatchOff, + prev: e.dictLongTable[h].offset, + } + + end := int32(len(d.content)) - 8 + e.maxMatchOff + off := 8 // First to read + for i := e.maxMatchOff + 1; i < end; i++ { + cv = cv>>8 | (uint64(d.content[off]) << 56) + h := hash8(cv, betterLongTableBits) + e.dictLongTable[h] = prevEntry{ + offset: i, + prev: e.dictLongTable[h].offset, + } + off++ + } + } + e.lastDictID = d.id + } + // Reset table to initial state + copy(e.longTable[:], e.dictLongTable) + + e.cur = e.maxMatchOff + // Reset table to initial state + copy(e.table[:], e.dictTable) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_dfast.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_dfast.go new file mode 100644 index 000000000000..19eebf66e502 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_dfast.go @@ -0,0 +1,713 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import "fmt" + +const ( + dFastLongTableBits = 17 // Bits used in the long match table + dFastLongTableSize = 1 << dFastLongTableBits // Size of the table + dFastLongTableMask = dFastLongTableSize - 1 // Mask for table indices. Redundant, but can eliminate bounds checks. + + dFastShortTableBits = tableBits // Bits used in the short match table + dFastShortTableSize = 1 << dFastShortTableBits // Size of the table + dFastShortTableMask = dFastShortTableSize - 1 // Mask for table indices. Redundant, but can eliminate bounds checks. +) + +type doubleFastEncoder struct { + fastEncoder + longTable [dFastLongTableSize]tableEntry + dictLongTable []tableEntry +} + +// Encode mimmics functionality in zstd_dfast.c +func (e *doubleFastEncoder) Encode(blk *blockEnc, src []byte) { + const ( + // Input margin is the number of bytes we read (8) + // and the maximum we will read ahead (2) + inputMargin = 8 + 2 + minNonLiteralBlockSize = 16 + ) + + // Protect against e.cur wraparound. + for e.cur >= bufferReset { + if len(e.hist) == 0 { + for i := range e.table[:] { + e.table[i] = tableEntry{} + } + for i := range e.longTable[:] { + e.longTable[i] = tableEntry{} + } + e.cur = e.maxMatchOff + break + } + // Shift down everything in the table that isn't already too far away. + minOff := e.cur + int32(len(e.hist)) - e.maxMatchOff + for i := range e.table[:] { + v := e.table[i].offset + if v < minOff { + v = 0 + } else { + v = v - e.cur + e.maxMatchOff + } + e.table[i].offset = v + } + for i := range e.longTable[:] { + v := e.longTable[i].offset + if v < minOff { + v = 0 + } else { + v = v - e.cur + e.maxMatchOff + } + e.longTable[i].offset = v + } + e.cur = e.maxMatchOff + break + } + + s := e.addBlock(src) + blk.size = len(src) + if len(src) < minNonLiteralBlockSize { + blk.extraLits = len(src) + blk.literals = blk.literals[:len(src)] + copy(blk.literals, src) + return + } + + // Override src + src = e.hist + sLimit := int32(len(src)) - inputMargin + // stepSize is the number of bytes to skip on every main loop iteration. + // It should be >= 1. + const stepSize = 1 + + const kSearchStrength = 8 + + // nextEmit is where in src the next emitLiteral should start from. + nextEmit := s + cv := load6432(src, s) + + // Relative offsets + offset1 := int32(blk.recentOffsets[0]) + offset2 := int32(blk.recentOffsets[1]) + + addLiterals := func(s *seq, until int32) { + if until == nextEmit { + return + } + blk.literals = append(blk.literals, src[nextEmit:until]...) + s.litLen = uint32(until - nextEmit) + } + if debug { + println("recent offsets:", blk.recentOffsets) + } + +encodeLoop: + for { + var t int32 + // We allow the encoder to optionally turn off repeat offsets across blocks + canRepeat := len(blk.sequences) > 2 + + for { + if debugAsserts && canRepeat && offset1 == 0 { + panic("offset0 was 0") + } + + nextHashS := hash5(cv, dFastShortTableBits) + nextHashL := hash8(cv, dFastLongTableBits) + candidateL := e.longTable[nextHashL] + candidateS := e.table[nextHashS] + + const repOff = 1 + repIndex := s - offset1 + repOff + entry := tableEntry{offset: s + e.cur, val: uint32(cv)} + e.longTable[nextHashL] = entry + e.table[nextHashS] = entry + + if canRepeat { + if repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>(repOff*8)) { + // Consider history as well. + var seq seq + lenght := 4 + e.matchlen(s+4+repOff, repIndex+4, src) + + seq.matchLen = uint32(lenght - zstdMinMatch) + + // We might be able to match backwards. + // Extend as long as we can. + start := s + repOff + // We end the search early, so we don't risk 0 literals + // and have to do special offset treatment. + startLimit := nextEmit + 1 + + tMin := s - e.maxMatchOff + if tMin < 0 { + tMin = 0 + } + for repIndex > tMin && start > startLimit && src[repIndex-1] == src[start-1] && seq.matchLen < maxMatchLength-zstdMinMatch-1 { + repIndex-- + start-- + seq.matchLen++ + } + addLiterals(&seq, start) + + // rep 0 + seq.offset = 1 + if debugSequences { + println("repeat sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + s += lenght + repOff + nextEmit = s + if s >= sLimit { + if debug { + println("repeat ended", s, lenght) + + } + break encodeLoop + } + cv = load6432(src, s) + continue + } + } + // Find the offsets of our two matches. + coffsetL := s - (candidateL.offset - e.cur) + coffsetS := s - (candidateS.offset - e.cur) + + // Check if we have a long match. + if coffsetL < e.maxMatchOff && uint32(cv) == candidateL.val { + // Found a long match, likely at least 8 bytes. + // Reference encoder checks all 8 bytes, we only check 4, + // but the likelihood of both the first 4 bytes and the hash matching should be enough. + t = candidateL.offset - e.cur + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + if debugMatches { + println("long match") + } + break + } + + // Check if we have a short match. + if coffsetS < e.maxMatchOff && uint32(cv) == candidateS.val { + // found a regular match + // See if we can find a long match at s+1 + const checkAt = 1 + cv := load6432(src, s+checkAt) + nextHashL = hash8(cv, dFastLongTableBits) + candidateL = e.longTable[nextHashL] + coffsetL = s - (candidateL.offset - e.cur) + checkAt + + // We can store it, since we have at least a 4 byte match. + e.longTable[nextHashL] = tableEntry{offset: s + checkAt + e.cur, val: uint32(cv)} + if coffsetL < e.maxMatchOff && uint32(cv) == candidateL.val { + // Found a long match, likely at least 8 bytes. + // Reference encoder checks all 8 bytes, we only check 4, + // but the likelihood of both the first 4 bytes and the hash matching should be enough. + t = candidateL.offset - e.cur + s += checkAt + if debugMatches { + println("long match (after short)") + } + break + } + + t = candidateS.offset - e.cur + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + if debugAsserts && t < 0 { + panic("t<0") + } + if debugMatches { + println("short match") + } + break + } + + // No match found, move forward in input. + s += stepSize + ((s - nextEmit) >> (kSearchStrength - 1)) + if s >= sLimit { + break encodeLoop + } + cv = load6432(src, s) + } + + // A 4-byte match has been found. Update recent offsets. + // We'll later see if more than 4 bytes. + offset2 = offset1 + offset1 = s - t + + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + + if debugAsserts && canRepeat && int(offset1) > len(src) { + panic("invalid offset") + } + + // Extend the 4-byte match as long as possible. + l := e.matchlen(s+4, t+4, src) + 4 + + // Extend backwards + tMin := s - e.maxMatchOff + if tMin < 0 { + tMin = 0 + } + for t > tMin && s > nextEmit && src[t-1] == src[s-1] && l < maxMatchLength { + s-- + t-- + l++ + } + + // Write our sequence + var seq seq + seq.litLen = uint32(s - nextEmit) + seq.matchLen = uint32(l - zstdMinMatch) + if seq.litLen > 0 { + blk.literals = append(blk.literals, src[nextEmit:s]...) + } + seq.offset = uint32(s-t) + 3 + s += l + if debugSequences { + println("sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + nextEmit = s + if s >= sLimit { + break encodeLoop + } + + // Index match start+1 (long) and start+2 (short) + index0 := s - l + 1 + // Index match end-2 (long) and end-1 (short) + index1 := s - 2 + + cv0 := load6432(src, index0) + cv1 := load6432(src, index1) + te0 := tableEntry{offset: index0 + e.cur, val: uint32(cv0)} + te1 := tableEntry{offset: index1 + e.cur, val: uint32(cv1)} + e.longTable[hash8(cv0, dFastLongTableBits)] = te0 + e.longTable[hash8(cv1, dFastLongTableBits)] = te1 + cv0 >>= 8 + cv1 >>= 8 + te0.offset++ + te1.offset++ + te0.val = uint32(cv0) + te1.val = uint32(cv1) + e.table[hash5(cv0, dFastShortTableBits)] = te0 + e.table[hash5(cv1, dFastShortTableBits)] = te1 + + cv = load6432(src, s) + + if !canRepeat { + continue + } + + // Check offset 2 + for { + o2 := s - offset2 + if load3232(src, o2) != uint32(cv) { + // Do regular search + break + } + + // Store this, since we have it. + nextHashS := hash5(cv, dFastShortTableBits) + nextHashL := hash8(cv, dFastLongTableBits) + + // We have at least 4 byte match. + // No need to check backwards. We come straight from a match + l := 4 + e.matchlen(s+4, o2+4, src) + + entry := tableEntry{offset: s + e.cur, val: uint32(cv)} + e.longTable[nextHashL] = entry + e.table[nextHashS] = entry + seq.matchLen = uint32(l) - zstdMinMatch + seq.litLen = 0 + + // Since litlen is always 0, this is offset 1. + seq.offset = 1 + s += l + nextEmit = s + if debugSequences { + println("sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + + // Swap offset 1 and 2. + offset1, offset2 = offset2, offset1 + if s >= sLimit { + // Finished + break encodeLoop + } + cv = load6432(src, s) + } + } + + if int(nextEmit) < len(src) { + blk.literals = append(blk.literals, src[nextEmit:]...) + blk.extraLits = len(src) - int(nextEmit) + } + blk.recentOffsets[0] = uint32(offset1) + blk.recentOffsets[1] = uint32(offset2) + if debug { + println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits) + } +} + +// EncodeNoHist will encode a block with no history and no following blocks. +// Most notable difference is that src will not be copied for history and +// we do not need to check for max match length. +func (e *doubleFastEncoder) EncodeNoHist(blk *blockEnc, src []byte) { + const ( + // Input margin is the number of bytes we read (8) + // and the maximum we will read ahead (2) + inputMargin = 8 + 2 + minNonLiteralBlockSize = 16 + ) + + // Protect against e.cur wraparound. + if e.cur >= bufferReset { + for i := range e.table[:] { + e.table[i] = tableEntry{} + } + for i := range e.longTable[:] { + e.longTable[i] = tableEntry{} + } + e.cur = e.maxMatchOff + } + + s := int32(0) + blk.size = len(src) + if len(src) < minNonLiteralBlockSize { + blk.extraLits = len(src) + blk.literals = blk.literals[:len(src)] + copy(blk.literals, src) + return + } + + // Override src + sLimit := int32(len(src)) - inputMargin + // stepSize is the number of bytes to skip on every main loop iteration. + // It should be >= 1. + const stepSize = 1 + + const kSearchStrength = 8 + + // nextEmit is where in src the next emitLiteral should start from. + nextEmit := s + cv := load6432(src, s) + + // Relative offsets + offset1 := int32(blk.recentOffsets[0]) + offset2 := int32(blk.recentOffsets[1]) + + addLiterals := func(s *seq, until int32) { + if until == nextEmit { + return + } + blk.literals = append(blk.literals, src[nextEmit:until]...) + s.litLen = uint32(until - nextEmit) + } + if debug { + println("recent offsets:", blk.recentOffsets) + } + +encodeLoop: + for { + var t int32 + for { + + nextHashS := hash5(cv, dFastShortTableBits) + nextHashL := hash8(cv, dFastLongTableBits) + candidateL := e.longTable[nextHashL] + candidateS := e.table[nextHashS] + + const repOff = 1 + repIndex := s - offset1 + repOff + entry := tableEntry{offset: s + e.cur, val: uint32(cv)} + e.longTable[nextHashL] = entry + e.table[nextHashS] = entry + + if len(blk.sequences) > 2 { + if load3232(src, repIndex) == uint32(cv>>(repOff*8)) { + // Consider history as well. + var seq seq + //length := 4 + e.matchlen(s+4+repOff, repIndex+4, src) + length := 4 + int32(matchLen(src[s+4+repOff:], src[repIndex+4:])) + + seq.matchLen = uint32(length - zstdMinMatch) + + // We might be able to match backwards. + // Extend as long as we can. + start := s + repOff + // We end the search early, so we don't risk 0 literals + // and have to do special offset treatment. + startLimit := nextEmit + 1 + + tMin := s - e.maxMatchOff + if tMin < 0 { + tMin = 0 + } + for repIndex > tMin && start > startLimit && src[repIndex-1] == src[start-1] { + repIndex-- + start-- + seq.matchLen++ + } + addLiterals(&seq, start) + + // rep 0 + seq.offset = 1 + if debugSequences { + println("repeat sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + s += length + repOff + nextEmit = s + if s >= sLimit { + if debug { + println("repeat ended", s, length) + + } + break encodeLoop + } + cv = load6432(src, s) + continue + } + } + // Find the offsets of our two matches. + coffsetL := s - (candidateL.offset - e.cur) + coffsetS := s - (candidateS.offset - e.cur) + + // Check if we have a long match. + if coffsetL < e.maxMatchOff && uint32(cv) == candidateL.val { + // Found a long match, likely at least 8 bytes. + // Reference encoder checks all 8 bytes, we only check 4, + // but the likelihood of both the first 4 bytes and the hash matching should be enough. + t = candidateL.offset - e.cur + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d). cur: %d", s, t, e.cur)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + if debugMatches { + println("long match") + } + break + } + + // Check if we have a short match. + if coffsetS < e.maxMatchOff && uint32(cv) == candidateS.val { + // found a regular match + // See if we can find a long match at s+1 + const checkAt = 1 + cv := load6432(src, s+checkAt) + nextHashL = hash8(cv, dFastLongTableBits) + candidateL = e.longTable[nextHashL] + coffsetL = s - (candidateL.offset - e.cur) + checkAt + + // We can store it, since we have at least a 4 byte match. + e.longTable[nextHashL] = tableEntry{offset: s + checkAt + e.cur, val: uint32(cv)} + if coffsetL < e.maxMatchOff && uint32(cv) == candidateL.val { + // Found a long match, likely at least 8 bytes. + // Reference encoder checks all 8 bytes, we only check 4, + // but the likelihood of both the first 4 bytes and the hash matching should be enough. + t = candidateL.offset - e.cur + s += checkAt + if debugMatches { + println("long match (after short)") + } + break + } + + t = candidateS.offset - e.cur + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + if debugAsserts && t < 0 { + panic("t<0") + } + if debugMatches { + println("short match") + } + break + } + + // No match found, move forward in input. + s += stepSize + ((s - nextEmit) >> (kSearchStrength - 1)) + if s >= sLimit { + break encodeLoop + } + cv = load6432(src, s) + } + + // A 4-byte match has been found. Update recent offsets. + // We'll later see if more than 4 bytes. + offset2 = offset1 + offset1 = s - t + + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + + // Extend the 4-byte match as long as possible. + //l := e.matchlen(s+4, t+4, src) + 4 + l := int32(matchLen(src[s+4:], src[t+4:])) + 4 + + // Extend backwards + tMin := s - e.maxMatchOff + if tMin < 0 { + tMin = 0 + } + for t > tMin && s > nextEmit && src[t-1] == src[s-1] { + s-- + t-- + l++ + } + + // Write our sequence + var seq seq + seq.litLen = uint32(s - nextEmit) + seq.matchLen = uint32(l - zstdMinMatch) + if seq.litLen > 0 { + blk.literals = append(blk.literals, src[nextEmit:s]...) + } + seq.offset = uint32(s-t) + 3 + s += l + if debugSequences { + println("sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + nextEmit = s + if s >= sLimit { + break encodeLoop + } + + // Index match start+1 (long) and start+2 (short) + index0 := s - l + 1 + // Index match end-2 (long) and end-1 (short) + index1 := s - 2 + + cv0 := load6432(src, index0) + cv1 := load6432(src, index1) + te0 := tableEntry{offset: index0 + e.cur, val: uint32(cv0)} + te1 := tableEntry{offset: index1 + e.cur, val: uint32(cv1)} + e.longTable[hash8(cv0, dFastLongTableBits)] = te0 + e.longTable[hash8(cv1, dFastLongTableBits)] = te1 + cv0 >>= 8 + cv1 >>= 8 + te0.offset++ + te1.offset++ + te0.val = uint32(cv0) + te1.val = uint32(cv1) + e.table[hash5(cv0, dFastShortTableBits)] = te0 + e.table[hash5(cv1, dFastShortTableBits)] = te1 + + cv = load6432(src, s) + + if len(blk.sequences) <= 2 { + continue + } + + // Check offset 2 + for { + o2 := s - offset2 + if load3232(src, o2) != uint32(cv) { + // Do regular search + break + } + + // Store this, since we have it. + nextHashS := hash5(cv1>>8, dFastShortTableBits) + nextHashL := hash8(cv, dFastLongTableBits) + + // We have at least 4 byte match. + // No need to check backwards. We come straight from a match + //l := 4 + e.matchlen(s+4, o2+4, src) + l := 4 + int32(matchLen(src[s+4:], src[o2+4:])) + + entry := tableEntry{offset: s + e.cur, val: uint32(cv)} + e.longTable[nextHashL] = entry + e.table[nextHashS] = entry + seq.matchLen = uint32(l) - zstdMinMatch + seq.litLen = 0 + + // Since litlen is always 0, this is offset 1. + seq.offset = 1 + s += l + nextEmit = s + if debugSequences { + println("sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + + // Swap offset 1 and 2. + offset1, offset2 = offset2, offset1 + if s >= sLimit { + // Finished + break encodeLoop + } + cv = load6432(src, s) + } + } + + if int(nextEmit) < len(src) { + blk.literals = append(blk.literals, src[nextEmit:]...) + blk.extraLits = len(src) - int(nextEmit) + } + if debug { + println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits) + } + + // We do not store history, so we must offset e.cur to avoid false matches for next user. + if e.cur < bufferReset { + e.cur += int32(len(src)) + } +} + +// ResetDict will reset and set a dictionary if not nil +func (e *doubleFastEncoder) Reset(d *dict, singleBlock bool) { + e.fastEncoder.Reset(d, singleBlock) + if d == nil { + return + } + + // Init or copy dict table + if len(e.dictLongTable) != len(e.longTable) || d.id != e.lastDictID { + if len(e.dictLongTable) != len(e.longTable) { + e.dictLongTable = make([]tableEntry, len(e.longTable)) + } + if len(d.content) >= 8 { + cv := load6432(d.content, 0) + e.dictLongTable[hash8(cv, dFastLongTableBits)] = tableEntry{ + val: uint32(cv), + offset: e.maxMatchOff, + } + end := int32(len(d.content)) - 8 + e.maxMatchOff + for i := e.maxMatchOff + 1; i < end; i++ { + cv = cv>>8 | (uint64(d.content[i-e.maxMatchOff+7]) << 56) + e.dictLongTable[hash8(cv, dFastLongTableBits)] = tableEntry{ + val: uint32(cv), + offset: i, + } + } + } + e.lastDictID = d.id + } + // Reset table to initial state + e.cur = e.maxMatchOff + copy(e.longTable[:], e.dictLongTable) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_fast.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_fast.go new file mode 100644 index 000000000000..0b301df43908 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/enc_fast.go @@ -0,0 +1,661 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "fmt" + "math" + "math/bits" +) + +const ( + tableBits = 15 // Bits used in the table + tableSize = 1 << tableBits // Size of the table + tableMask = tableSize - 1 // Mask for table indices. Redundant, but can eliminate bounds checks. + maxMatchLength = 131074 +) + +type tableEntry struct { + val uint32 + offset int32 +} + +type fastEncoder struct { + fastBase + table [tableSize]tableEntry + dictTable []tableEntry +} + +// Encode mimmics functionality in zstd_fast.c +func (e *fastEncoder) Encode(blk *blockEnc, src []byte) { + const ( + inputMargin = 8 + minNonLiteralBlockSize = 1 + 1 + inputMargin + ) + + // Protect against e.cur wraparound. + for e.cur >= bufferReset { + if len(e.hist) == 0 { + for i := range e.table[:] { + e.table[i] = tableEntry{} + } + e.cur = e.maxMatchOff + break + } + // Shift down everything in the table that isn't already too far away. + minOff := e.cur + int32(len(e.hist)) - e.maxMatchOff + for i := range e.table[:] { + v := e.table[i].offset + if v < minOff { + v = 0 + } else { + v = v - e.cur + e.maxMatchOff + } + e.table[i].offset = v + } + e.cur = e.maxMatchOff + break + } + + s := e.addBlock(src) + blk.size = len(src) + if len(src) < minNonLiteralBlockSize { + blk.extraLits = len(src) + blk.literals = blk.literals[:len(src)] + copy(blk.literals, src) + return + } + + // Override src + src = e.hist + sLimit := int32(len(src)) - inputMargin + // stepSize is the number of bytes to skip on every main loop iteration. + // It should be >= 2. + const stepSize = 2 + + // TEMPLATE + const hashLog = tableBits + // seems global, but would be nice to tweak. + const kSearchStrength = 8 + + // nextEmit is where in src the next emitLiteral should start from. + nextEmit := s + cv := load6432(src, s) + + // Relative offsets + offset1 := int32(blk.recentOffsets[0]) + offset2 := int32(blk.recentOffsets[1]) + + addLiterals := func(s *seq, until int32) { + if until == nextEmit { + return + } + blk.literals = append(blk.literals, src[nextEmit:until]...) + s.litLen = uint32(until - nextEmit) + } + if debug { + println("recent offsets:", blk.recentOffsets) + } + +encodeLoop: + for { + // t will contain the match offset when we find one. + // When existing the search loop, we have already checked 4 bytes. + var t int32 + + // We will not use repeat offsets across blocks. + // By not using them for the first 3 matches + canRepeat := len(blk.sequences) > 2 + + for { + if debugAsserts && canRepeat && offset1 == 0 { + panic("offset0 was 0") + } + + nextHash := hash6(cv, hashLog) + nextHash2 := hash6(cv>>8, hashLog) + candidate := e.table[nextHash] + candidate2 := e.table[nextHash2] + repIndex := s - offset1 + 2 + + e.table[nextHash] = tableEntry{offset: s + e.cur, val: uint32(cv)} + e.table[nextHash2] = tableEntry{offset: s + e.cur + 1, val: uint32(cv >> 8)} + + if canRepeat && repIndex >= 0 && load3232(src, repIndex) == uint32(cv>>16) { + // Consider history as well. + var seq seq + var length int32 + // length = 4 + e.matchlen(s+6, repIndex+4, src) + { + a := src[s+6:] + b := src[repIndex+4:] + endI := len(a) & (math.MaxInt32 - 7) + length = int32(endI) + 4 + for i := 0; i < endI; i += 8 { + if diff := load64(a, i) ^ load64(b, i); diff != 0 { + length = int32(i+bits.TrailingZeros64(diff)>>3) + 4 + break + } + } + } + + seq.matchLen = uint32(length - zstdMinMatch) + + // We might be able to match backwards. + // Extend as long as we can. + start := s + 2 + // We end the search early, so we don't risk 0 literals + // and have to do special offset treatment. + startLimit := nextEmit + 1 + + sMin := s - e.maxMatchOff + if sMin < 0 { + sMin = 0 + } + for repIndex > sMin && start > startLimit && src[repIndex-1] == src[start-1] && seq.matchLen < maxMatchLength-zstdMinMatch { + repIndex-- + start-- + seq.matchLen++ + } + addLiterals(&seq, start) + + // rep 0 + seq.offset = 1 + if debugSequences { + println("repeat sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + s += length + 2 + nextEmit = s + if s >= sLimit { + if debug { + println("repeat ended", s, length) + + } + break encodeLoop + } + cv = load6432(src, s) + continue + } + coffset0 := s - (candidate.offset - e.cur) + coffset1 := s - (candidate2.offset - e.cur) + 1 + if coffset0 < e.maxMatchOff && uint32(cv) == candidate.val { + // found a regular match + t = candidate.offset - e.cur + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + break + } + + if coffset1 < e.maxMatchOff && uint32(cv>>8) == candidate2.val { + // found a regular match + t = candidate2.offset - e.cur + s++ + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + if debugAsserts && t < 0 { + panic("t<0") + } + break + } + s += stepSize + ((s - nextEmit) >> (kSearchStrength - 1)) + if s >= sLimit { + break encodeLoop + } + cv = load6432(src, s) + } + // A 4-byte match has been found. We'll later see if more than 4 bytes. + offset2 = offset1 + offset1 = s - t + + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + + if debugAsserts && canRepeat && int(offset1) > len(src) { + panic("invalid offset") + } + + // Extend the 4-byte match as long as possible. + //l := e.matchlen(s+4, t+4, src) + 4 + var l int32 + { + a := src[s+4:] + b := src[t+4:] + endI := len(a) & (math.MaxInt32 - 7) + l = int32(endI) + 4 + for i := 0; i < endI; i += 8 { + if diff := load64(a, i) ^ load64(b, i); diff != 0 { + l = int32(i+bits.TrailingZeros64(diff)>>3) + 4 + break + } + } + } + + // Extend backwards + tMin := s - e.maxMatchOff + if tMin < 0 { + tMin = 0 + } + for t > tMin && s > nextEmit && src[t-1] == src[s-1] && l < maxMatchLength { + s-- + t-- + l++ + } + + // Write our sequence. + var seq seq + seq.litLen = uint32(s - nextEmit) + seq.matchLen = uint32(l - zstdMinMatch) + if seq.litLen > 0 { + blk.literals = append(blk.literals, src[nextEmit:s]...) + } + // Don't use repeat offsets + seq.offset = uint32(s-t) + 3 + s += l + if debugSequences { + println("sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + nextEmit = s + if s >= sLimit { + break encodeLoop + } + cv = load6432(src, s) + + // Check offset 2 + if o2 := s - offset2; canRepeat && load3232(src, o2) == uint32(cv) { + // We have at least 4 byte match. + // No need to check backwards. We come straight from a match + //l := 4 + e.matchlen(s+4, o2+4, src) + var l int32 + { + a := src[s+4:] + b := src[o2+4:] + endI := len(a) & (math.MaxInt32 - 7) + l = int32(endI) + 4 + for i := 0; i < endI; i += 8 { + if diff := load64(a, i) ^ load64(b, i); diff != 0 { + l = int32(i+bits.TrailingZeros64(diff)>>3) + 4 + break + } + } + } + + // Store this, since we have it. + nextHash := hash6(cv, hashLog) + e.table[nextHash] = tableEntry{offset: s + e.cur, val: uint32(cv)} + seq.matchLen = uint32(l) - zstdMinMatch + seq.litLen = 0 + // Since litlen is always 0, this is offset 1. + seq.offset = 1 + s += l + nextEmit = s + if debugSequences { + println("sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + + // Swap offset 1 and 2. + offset1, offset2 = offset2, offset1 + if s >= sLimit { + break encodeLoop + } + // Prepare next loop. + cv = load6432(src, s) + } + } + + if int(nextEmit) < len(src) { + blk.literals = append(blk.literals, src[nextEmit:]...) + blk.extraLits = len(src) - int(nextEmit) + } + blk.recentOffsets[0] = uint32(offset1) + blk.recentOffsets[1] = uint32(offset2) + if debug { + println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits) + } +} + +// EncodeNoHist will encode a block with no history and no following blocks. +// Most notable difference is that src will not be copied for history and +// we do not need to check for max match length. +func (e *fastEncoder) EncodeNoHist(blk *blockEnc, src []byte) { + const ( + inputMargin = 8 + minNonLiteralBlockSize = 1 + 1 + inputMargin + ) + if debug { + if len(src) > maxBlockSize { + panic("src too big") + } + } + + // Protect against e.cur wraparound. + if e.cur >= bufferReset { + for i := range e.table[:] { + e.table[i] = tableEntry{} + } + e.cur = e.maxMatchOff + } + + s := int32(0) + blk.size = len(src) + if len(src) < minNonLiteralBlockSize { + blk.extraLits = len(src) + blk.literals = blk.literals[:len(src)] + copy(blk.literals, src) + return + } + + sLimit := int32(len(src)) - inputMargin + // stepSize is the number of bytes to skip on every main loop iteration. + // It should be >= 2. + const stepSize = 2 + + // TEMPLATE + const hashLog = tableBits + // seems global, but would be nice to tweak. + const kSearchStrength = 8 + + // nextEmit is where in src the next emitLiteral should start from. + nextEmit := s + cv := load6432(src, s) + + // Relative offsets + offset1 := int32(blk.recentOffsets[0]) + offset2 := int32(blk.recentOffsets[1]) + + addLiterals := func(s *seq, until int32) { + if until == nextEmit { + return + } + blk.literals = append(blk.literals, src[nextEmit:until]...) + s.litLen = uint32(until - nextEmit) + } + if debug { + println("recent offsets:", blk.recentOffsets) + } + +encodeLoop: + for { + // t will contain the match offset when we find one. + // When existing the search loop, we have already checked 4 bytes. + var t int32 + + // We will not use repeat offsets across blocks. + // By not using them for the first 3 matches + + for { + nextHash := hash6(cv, hashLog) + nextHash2 := hash6(cv>>8, hashLog) + candidate := e.table[nextHash] + candidate2 := e.table[nextHash2] + repIndex := s - offset1 + 2 + + e.table[nextHash] = tableEntry{offset: s + e.cur, val: uint32(cv)} + e.table[nextHash2] = tableEntry{offset: s + e.cur + 1, val: uint32(cv >> 8)} + + if len(blk.sequences) > 2 && load3232(src, repIndex) == uint32(cv>>16) { + // Consider history as well. + var seq seq + // length := 4 + e.matchlen(s+6, repIndex+4, src) + // length := 4 + int32(matchLen(src[s+6:], src[repIndex+4:])) + var length int32 + { + a := src[s+6:] + b := src[repIndex+4:] + endI := len(a) & (math.MaxInt32 - 7) + length = int32(endI) + 4 + for i := 0; i < endI; i += 8 { + if diff := load64(a, i) ^ load64(b, i); diff != 0 { + length = int32(i+bits.TrailingZeros64(diff)>>3) + 4 + break + } + } + } + + seq.matchLen = uint32(length - zstdMinMatch) + + // We might be able to match backwards. + // Extend as long as we can. + start := s + 2 + // We end the search early, so we don't risk 0 literals + // and have to do special offset treatment. + startLimit := nextEmit + 1 + + sMin := s - e.maxMatchOff + if sMin < 0 { + sMin = 0 + } + for repIndex > sMin && start > startLimit && src[repIndex-1] == src[start-1] { + repIndex-- + start-- + seq.matchLen++ + } + addLiterals(&seq, start) + + // rep 0 + seq.offset = 1 + if debugSequences { + println("repeat sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + s += length + 2 + nextEmit = s + if s >= sLimit { + if debug { + println("repeat ended", s, length) + + } + break encodeLoop + } + cv = load6432(src, s) + continue + } + coffset0 := s - (candidate.offset - e.cur) + coffset1 := s - (candidate2.offset - e.cur) + 1 + if coffset0 < e.maxMatchOff && uint32(cv) == candidate.val { + // found a regular match + t = candidate.offset - e.cur + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + if debugAsserts && t < 0 { + panic(fmt.Sprintf("t (%d) < 0, candidate.offset: %d, e.cur: %d, coffset0: %d, e.maxMatchOff: %d", t, candidate.offset, e.cur, coffset0, e.maxMatchOff)) + } + break + } + + if coffset1 < e.maxMatchOff && uint32(cv>>8) == candidate2.val { + // found a regular match + t = candidate2.offset - e.cur + s++ + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + if debugAsserts && s-t > e.maxMatchOff { + panic("s - t >e.maxMatchOff") + } + if debugAsserts && t < 0 { + panic("t<0") + } + break + } + s += stepSize + ((s - nextEmit) >> (kSearchStrength - 1)) + if s >= sLimit { + break encodeLoop + } + cv = load6432(src, s) + } + // A 4-byte match has been found. We'll later see if more than 4 bytes. + offset2 = offset1 + offset1 = s - t + + if debugAsserts && s <= t { + panic(fmt.Sprintf("s (%d) <= t (%d)", s, t)) + } + + if debugAsserts && t < 0 { + panic(fmt.Sprintf("t (%d) < 0 ", t)) + } + // Extend the 4-byte match as long as possible. + //l := e.matchlenNoHist(s+4, t+4, src) + 4 + // l := int32(matchLen(src[s+4:], src[t+4:])) + 4 + var l int32 + { + a := src[s+4:] + b := src[t+4:] + endI := len(a) & (math.MaxInt32 - 7) + l = int32(endI) + 4 + for i := 0; i < endI; i += 8 { + if diff := load64(a, i) ^ load64(b, i); diff != 0 { + l = int32(i+bits.TrailingZeros64(diff)>>3) + 4 + break + } + } + } + + // Extend backwards + tMin := s - e.maxMatchOff + if tMin < 0 { + tMin = 0 + } + for t > tMin && s > nextEmit && src[t-1] == src[s-1] { + s-- + t-- + l++ + } + + // Write our sequence. + var seq seq + seq.litLen = uint32(s - nextEmit) + seq.matchLen = uint32(l - zstdMinMatch) + if seq.litLen > 0 { + blk.literals = append(blk.literals, src[nextEmit:s]...) + } + // Don't use repeat offsets + seq.offset = uint32(s-t) + 3 + s += l + if debugSequences { + println("sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + nextEmit = s + if s >= sLimit { + break encodeLoop + } + cv = load6432(src, s) + + // Check offset 2 + if o2 := s - offset2; len(blk.sequences) > 2 && load3232(src, o2) == uint32(cv) { + // We have at least 4 byte match. + // No need to check backwards. We come straight from a match + //l := 4 + e.matchlenNoHist(s+4, o2+4, src) + // l := 4 + int32(matchLen(src[s+4:], src[o2+4:])) + var l int32 + { + a := src[s+4:] + b := src[o2+4:] + endI := len(a) & (math.MaxInt32 - 7) + l = int32(endI) + 4 + for i := 0; i < endI; i += 8 { + if diff := load64(a, i) ^ load64(b, i); diff != 0 { + l = int32(i+bits.TrailingZeros64(diff)>>3) + 4 + break + } + } + } + + // Store this, since we have it. + nextHash := hash6(cv, hashLog) + e.table[nextHash] = tableEntry{offset: s + e.cur, val: uint32(cv)} + seq.matchLen = uint32(l) - zstdMinMatch + seq.litLen = 0 + // Since litlen is always 0, this is offset 1. + seq.offset = 1 + s += l + nextEmit = s + if debugSequences { + println("sequence", seq, "next s:", s) + } + blk.sequences = append(blk.sequences, seq) + + // Swap offset 1 and 2. + offset1, offset2 = offset2, offset1 + if s >= sLimit { + break encodeLoop + } + // Prepare next loop. + cv = load6432(src, s) + } + } + + if int(nextEmit) < len(src) { + blk.literals = append(blk.literals, src[nextEmit:]...) + blk.extraLits = len(src) - int(nextEmit) + } + if debug { + println("returning, recent offsets:", blk.recentOffsets, "extra literals:", blk.extraLits) + } + // We do not store history, so we must offset e.cur to avoid false matches for next user. + if e.cur < bufferReset { + e.cur += int32(len(src)) + } +} + +// ResetDict will reset and set a dictionary if not nil +func (e *fastEncoder) Reset(d *dict, singleBlock bool) { + e.resetBase(d, singleBlock) + if d == nil { + return + } + + // Init or copy dict table + if len(e.dictTable) != len(e.table) || d.id != e.lastDictID { + if len(e.dictTable) != len(e.table) { + e.dictTable = make([]tableEntry, len(e.table)) + } + if true { + end := e.maxMatchOff + int32(len(d.content)) - 8 + for i := e.maxMatchOff; i < end; i += 3 { + const hashLog = tableBits + + cv := load6432(d.content, i-e.maxMatchOff) + nextHash := hash6(cv, hashLog) // 0 -> 5 + nextHash1 := hash6(cv>>8, hashLog) // 1 -> 6 + nextHash2 := hash6(cv>>16, hashLog) // 2 -> 7 + e.dictTable[nextHash] = tableEntry{ + val: uint32(cv), + offset: i, + } + e.dictTable[nextHash1] = tableEntry{ + val: uint32(cv >> 8), + offset: i + 1, + } + e.dictTable[nextHash2] = tableEntry{ + val: uint32(cv >> 16), + offset: i + 2, + } + } + } + e.lastDictID = d.id + } + + e.cur = e.maxMatchOff + // Reset table to initial state + copy(e.table[:], e.dictTable) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/encoder.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/encoder.go new file mode 100644 index 000000000000..f5759211dac5 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/encoder.go @@ -0,0 +1,570 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "crypto/rand" + "fmt" + "io" + rdebug "runtime/debug" + "sync" + + "github.com/klauspost/compress/zstd/internal/xxhash" +) + +// Encoder provides encoding to Zstandard. +// An Encoder can be used for either compressing a stream via the +// io.WriteCloser interface supported by the Encoder or as multiple independent +// tasks via the EncodeAll function. +// Smaller encodes are encouraged to use the EncodeAll function. +// Use NewWriter to create a new instance. +type Encoder struct { + o encoderOptions + encoders chan encoder + state encoderState + init sync.Once +} + +type encoder interface { + Encode(blk *blockEnc, src []byte) + EncodeNoHist(blk *blockEnc, src []byte) + Block() *blockEnc + CRC() *xxhash.Digest + AppendCRC([]byte) []byte + WindowSize(size int) int32 + UseBlock(*blockEnc) + Reset(d *dict, singleBlock bool) +} + +type encoderState struct { + w io.Writer + filling []byte + current []byte + previous []byte + encoder encoder + writing *blockEnc + err error + writeErr error + nWritten int64 + headerWritten bool + eofWritten bool + fullFrameWritten bool + + // This waitgroup indicates an encode is running. + wg sync.WaitGroup + // This waitgroup indicates we have a block encoding/writing. + wWg sync.WaitGroup +} + +// NewWriter will create a new Zstandard encoder. +// If the encoder will be used for encoding blocks a nil writer can be used. +func NewWriter(w io.Writer, opts ...EOption) (*Encoder, error) { + initPredefined() + var e Encoder + e.o.setDefault() + for _, o := range opts { + err := o(&e.o) + if err != nil { + return nil, err + } + } + if w != nil { + e.Reset(w) + } + return &e, nil +} + +func (e *Encoder) initialize() { + if e.o.concurrent == 0 { + e.o.setDefault() + } + e.encoders = make(chan encoder, e.o.concurrent) + for i := 0; i < e.o.concurrent; i++ { + enc := e.o.encoder() + e.encoders <- enc + } +} + +// Reset will re-initialize the writer and new writes will encode to the supplied writer +// as a new, independent stream. +func (e *Encoder) Reset(w io.Writer) { + s := &e.state + s.wg.Wait() + s.wWg.Wait() + if cap(s.filling) == 0 { + s.filling = make([]byte, 0, e.o.blockSize) + } + if cap(s.current) == 0 { + s.current = make([]byte, 0, e.o.blockSize) + } + if cap(s.previous) == 0 { + s.previous = make([]byte, 0, e.o.blockSize) + } + if s.encoder == nil { + s.encoder = e.o.encoder() + } + if s.writing == nil { + s.writing = &blockEnc{} + s.writing.init() + } + s.writing.initNewEncode() + s.filling = s.filling[:0] + s.current = s.current[:0] + s.previous = s.previous[:0] + s.encoder.Reset(e.o.dict, false) + s.headerWritten = false + s.eofWritten = false + s.fullFrameWritten = false + s.w = w + s.err = nil + s.nWritten = 0 + s.writeErr = nil +} + +// Write data to the encoder. +// Input data will be buffered and as the buffer fills up +// content will be compressed and written to the output. +// When done writing, use Close to flush the remaining output +// and write CRC if requested. +func (e *Encoder) Write(p []byte) (n int, err error) { + s := &e.state + for len(p) > 0 { + if len(p)+len(s.filling) < e.o.blockSize { + if e.o.crc { + _, _ = s.encoder.CRC().Write(p) + } + s.filling = append(s.filling, p...) + return n + len(p), nil + } + add := p + if len(p)+len(s.filling) > e.o.blockSize { + add = add[:e.o.blockSize-len(s.filling)] + } + if e.o.crc { + _, _ = s.encoder.CRC().Write(add) + } + s.filling = append(s.filling, add...) + p = p[len(add):] + n += len(add) + if len(s.filling) < e.o.blockSize { + return n, nil + } + err := e.nextBlock(false) + if err != nil { + return n, err + } + if debugAsserts && len(s.filling) > 0 { + panic(len(s.filling)) + } + } + return n, nil +} + +// nextBlock will synchronize and start compressing input in e.state.filling. +// If an error has occurred during encoding it will be returned. +func (e *Encoder) nextBlock(final bool) error { + s := &e.state + // Wait for current block. + s.wg.Wait() + if s.err != nil { + return s.err + } + if len(s.filling) > e.o.blockSize { + return fmt.Errorf("block > maxStoreBlockSize") + } + if !s.headerWritten { + // If we have a single block encode, do a sync compression. + if final && len(s.filling) > 0 { + s.current = e.EncodeAll(s.filling, s.current[:0]) + var n2 int + n2, s.err = s.w.Write(s.current) + if s.err != nil { + return s.err + } + s.nWritten += int64(n2) + s.current = s.current[:0] + s.filling = s.filling[:0] + s.headerWritten = true + s.fullFrameWritten = true + s.eofWritten = true + return nil + } + + var tmp [maxHeaderSize]byte + fh := frameHeader{ + ContentSize: 0, + WindowSize: uint32(s.encoder.WindowSize(0)), + SingleSegment: false, + Checksum: e.o.crc, + DictID: e.o.dict.ID(), + } + + dst, err := fh.appendTo(tmp[:0]) + if err != nil { + return err + } + s.headerWritten = true + s.wWg.Wait() + var n2 int + n2, s.err = s.w.Write(dst) + if s.err != nil { + return s.err + } + s.nWritten += int64(n2) + } + if s.eofWritten { + // Ensure we only write it once. + final = false + } + + if len(s.filling) == 0 { + // Final block, but no data. + if final { + enc := s.encoder + blk := enc.Block() + blk.reset(nil) + blk.last = true + blk.encodeRaw(nil) + s.wWg.Wait() + _, s.err = s.w.Write(blk.output) + s.nWritten += int64(len(blk.output)) + s.eofWritten = true + } + return s.err + } + + // Move blocks forward. + s.filling, s.current, s.previous = s.previous[:0], s.filling, s.current + s.wg.Add(1) + go func(src []byte) { + if debug { + println("Adding block,", len(src), "bytes, final:", final) + } + defer func() { + if r := recover(); r != nil { + s.err = fmt.Errorf("panic while encoding: %v", r) + rdebug.PrintStack() + } + s.wg.Done() + }() + enc := s.encoder + blk := enc.Block() + enc.Encode(blk, src) + blk.last = final + if final { + s.eofWritten = true + } + // Wait for pending writes. + s.wWg.Wait() + if s.writeErr != nil { + s.err = s.writeErr + return + } + // Transfer encoders from previous write block. + blk.swapEncoders(s.writing) + // Transfer recent offsets to next. + enc.UseBlock(s.writing) + s.writing = blk + s.wWg.Add(1) + go func() { + defer func() { + if r := recover(); r != nil { + s.writeErr = fmt.Errorf("panic while encoding/writing: %v", r) + rdebug.PrintStack() + } + s.wWg.Done() + }() + err := errIncompressible + // If we got the exact same number of literals as input, + // assume the literals cannot be compressed. + if len(src) != len(blk.literals) || len(src) != e.o.blockSize { + err = blk.encode(src, e.o.noEntropy, !e.o.allLitEntropy) + } + switch err { + case errIncompressible: + if debug { + println("Storing incompressible block as raw") + } + blk.encodeRaw(src) + // In fast mode, we do not transfer offsets, so we don't have to deal with changing the. + case nil: + default: + s.writeErr = err + return + } + _, s.writeErr = s.w.Write(blk.output) + s.nWritten += int64(len(blk.output)) + }() + }(s.current) + return nil +} + +// ReadFrom reads data from r until EOF or error. +// The return value n is the number of bytes read. +// Any error except io.EOF encountered during the read is also returned. +// +// The Copy function uses ReaderFrom if available. +func (e *Encoder) ReadFrom(r io.Reader) (n int64, err error) { + if debug { + println("Using ReadFrom") + } + + // Flush any current writes. + if len(e.state.filling) > 0 { + if err := e.nextBlock(false); err != nil { + return 0, err + } + } + e.state.filling = e.state.filling[:e.o.blockSize] + src := e.state.filling + for { + n2, err := r.Read(src) + if e.o.crc { + _, _ = e.state.encoder.CRC().Write(src[:n2]) + } + // src is now the unfilled part... + src = src[n2:] + n += int64(n2) + switch err { + case io.EOF: + e.state.filling = e.state.filling[:len(e.state.filling)-len(src)] + if debug { + println("ReadFrom: got EOF final block:", len(e.state.filling)) + } + return n, nil + default: + if debug { + println("ReadFrom: got error:", err) + } + e.state.err = err + return n, err + case nil: + } + if len(src) > 0 { + if debug { + println("ReadFrom: got space left in source:", len(src)) + } + continue + } + err = e.nextBlock(false) + if err != nil { + return n, err + } + e.state.filling = e.state.filling[:e.o.blockSize] + src = e.state.filling + } +} + +// Flush will send the currently written data to output +// and block until everything has been written. +// This should only be used on rare occasions where pushing the currently queued data is critical. +func (e *Encoder) Flush() error { + s := &e.state + if len(s.filling) > 0 { + err := e.nextBlock(false) + if err != nil { + return err + } + } + s.wg.Wait() + s.wWg.Wait() + if s.err != nil { + return s.err + } + return s.writeErr +} + +// Close will flush the final output and close the stream. +// The function will block until everything has been written. +// The Encoder can still be re-used after calling this. +func (e *Encoder) Close() error { + s := &e.state + if s.encoder == nil { + return nil + } + err := e.nextBlock(true) + if err != nil { + return err + } + if e.state.fullFrameWritten { + return s.err + } + s.wg.Wait() + s.wWg.Wait() + + if s.err != nil { + return s.err + } + if s.writeErr != nil { + return s.writeErr + } + + // Write CRC + if e.o.crc && s.err == nil { + // heap alloc. + var tmp [4]byte + _, s.err = s.w.Write(s.encoder.AppendCRC(tmp[:0])) + s.nWritten += 4 + } + + // Add padding with content from crypto/rand.Reader + if s.err == nil && e.o.pad > 0 { + add := calcSkippableFrame(s.nWritten, int64(e.o.pad)) + frame, err := skippableFrame(s.filling[:0], add, rand.Reader) + if err != nil { + return err + } + _, s.err = s.w.Write(frame) + } + return s.err +} + +// EncodeAll will encode all input in src and append it to dst. +// This function can be called concurrently, but each call will only run on a single goroutine. +// If empty input is given, nothing is returned, unless WithZeroFrames is specified. +// Encoded blocks can be concatenated and the result will be the combined input stream. +// Data compressed with EncodeAll can be decoded with the Decoder, +// using either a stream or DecodeAll. +func (e *Encoder) EncodeAll(src, dst []byte) []byte { + if len(src) == 0 { + if e.o.fullZero { + // Add frame header. + fh := frameHeader{ + ContentSize: 0, + WindowSize: MinWindowSize, + SingleSegment: true, + // Adding a checksum would be a waste of space. + Checksum: false, + DictID: 0, + } + dst, _ = fh.appendTo(dst) + + // Write raw block as last one only. + var blk blockHeader + blk.setSize(0) + blk.setType(blockTypeRaw) + blk.setLast(true) + dst = blk.appendTo(dst) + } + return dst + } + e.init.Do(e.initialize) + enc := <-e.encoders + defer func() { + // Release encoder reference to last block. + // If a non-single block is needed the encoder will reset again. + e.encoders <- enc + }() + // Use single segments when above minimum window and below 1MB. + single := len(src) < 1<<20 && len(src) > MinWindowSize + if e.o.single != nil { + single = *e.o.single + } + fh := frameHeader{ + ContentSize: uint64(len(src)), + WindowSize: uint32(enc.WindowSize(len(src))), + SingleSegment: single, + Checksum: e.o.crc, + DictID: e.o.dict.ID(), + } + + // If less than 1MB, allocate a buffer up front. + if len(dst) == 0 && cap(dst) == 0 && len(src) < 1<<20 { + dst = make([]byte, 0, len(src)) + } + dst, err := fh.appendTo(dst) + if err != nil { + panic(err) + } + + // If we can do everything in one block, prefer that. + if len(src) <= maxCompressedBlockSize { + enc.Reset(e.o.dict, true) + // Slightly faster with no history and everything in one block. + if e.o.crc { + _, _ = enc.CRC().Write(src) + } + blk := enc.Block() + blk.last = true + if e.o.dict == nil { + enc.EncodeNoHist(blk, src) + } else { + enc.Encode(blk, src) + } + + // If we got the exact same number of literals as input, + // assume the literals cannot be compressed. + err := errIncompressible + oldout := blk.output + if len(blk.literals) != len(src) || len(src) != e.o.blockSize { + // Output directly to dst + blk.output = dst + err = blk.encode(src, e.o.noEntropy, !e.o.allLitEntropy) + } + + switch err { + case errIncompressible: + if debug { + println("Storing incompressible block as raw") + } + dst = blk.encodeRawTo(dst, src) + case nil: + dst = blk.output + default: + panic(err) + } + blk.output = oldout + } else { + enc.Reset(e.o.dict, false) + blk := enc.Block() + for len(src) > 0 { + todo := src + if len(todo) > e.o.blockSize { + todo = todo[:e.o.blockSize] + } + src = src[len(todo):] + if e.o.crc { + _, _ = enc.CRC().Write(todo) + } + blk.pushOffsets() + enc.Encode(blk, todo) + if len(src) == 0 { + blk.last = true + } + err := errIncompressible + // If we got the exact same number of literals as input, + // assume the literals cannot be compressed. + if len(blk.literals) != len(todo) || len(todo) != e.o.blockSize { + err = blk.encode(todo, e.o.noEntropy, !e.o.allLitEntropy) + } + + switch err { + case errIncompressible: + if debug { + println("Storing incompressible block as raw") + } + dst = blk.encodeRawTo(dst, todo) + blk.popOffsets() + case nil: + dst = append(dst, blk.output...) + default: + panic(err) + } + blk.reset(nil) + } + } + if e.o.crc { + dst = enc.AppendCRC(dst) + } + // Add padding with content from crypto/rand.Reader + if e.o.pad > 0 { + add := calcSkippableFrame(int64(len(dst)), int64(e.o.pad)) + dst, err = skippableFrame(dst, add, rand.Reader) + if err != nil { + panic(err) + } + } + return dst +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/encoder_options.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/encoder_options.go new file mode 100644 index 000000000000..1209915bcce7 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/encoder_options.go @@ -0,0 +1,282 @@ +package zstd + +import ( + "errors" + "fmt" + "runtime" + "strings" +) + +// EOption is an option for creating a encoder. +type EOption func(*encoderOptions) error + +// options retains accumulated state of multiple options. +type encoderOptions struct { + concurrent int + level EncoderLevel + single *bool + pad int + blockSize int + windowSize int + crc bool + fullZero bool + noEntropy bool + allLitEntropy bool + customWindow bool + customALEntropy bool + dict *dict +} + +func (o *encoderOptions) setDefault() { + *o = encoderOptions{ + // use less ram: true for now, but may change. + concurrent: runtime.GOMAXPROCS(0), + crc: true, + single: nil, + blockSize: 1 << 16, + windowSize: 8 << 20, + level: SpeedDefault, + allLitEntropy: true, + } +} + +// encoder returns an encoder with the selected options. +func (o encoderOptions) encoder() encoder { + switch o.level { + case SpeedDefault: + return &doubleFastEncoder{fastEncoder: fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize)}}} + case SpeedBetterCompression: + return &betterFastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize)}} + case SpeedFastest: + return &fastEncoder{fastBase: fastBase{maxMatchOff: int32(o.windowSize)}} + } + panic("unknown compression level") +} + +// WithEncoderCRC will add CRC value to output. +// Output will be 4 bytes larger. +func WithEncoderCRC(b bool) EOption { + return func(o *encoderOptions) error { o.crc = b; return nil } +} + +// WithEncoderConcurrency will set the concurrency, +// meaning the maximum number of decoders to run concurrently. +// The value supplied must be at least 1. +// By default this will be set to GOMAXPROCS. +func WithEncoderConcurrency(n int) EOption { + return func(o *encoderOptions) error { + if n <= 0 { + return fmt.Errorf("concurrency must be at least 1") + } + o.concurrent = n + return nil + } +} + +// WithWindowSize will set the maximum allowed back-reference distance. +// The value must be a power of two between MinWindowSize and MaxWindowSize. +// A larger value will enable better compression but allocate more memory and, +// for above-default values, take considerably longer. +// The default value is determined by the compression level. +func WithWindowSize(n int) EOption { + return func(o *encoderOptions) error { + switch { + case n < MinWindowSize: + return fmt.Errorf("window size must be at least %d", MinWindowSize) + case n > MaxWindowSize: + return fmt.Errorf("window size must be at most %d", MaxWindowSize) + case (n & (n - 1)) != 0: + return errors.New("window size must be a power of 2") + } + + o.windowSize = n + o.customWindow = true + if o.blockSize > o.windowSize { + o.blockSize = o.windowSize + } + return nil + } +} + +// WithEncoderPadding will add padding to all output so the size will be a multiple of n. +// This can be used to obfuscate the exact output size or make blocks of a certain size. +// The contents will be a skippable frame, so it will be invisible by the decoder. +// n must be > 0 and <= 1GB, 1<<30 bytes. +// The padded area will be filled with data from crypto/rand.Reader. +// If `EncodeAll` is used with data already in the destination, the total size will be multiple of this. +func WithEncoderPadding(n int) EOption { + return func(o *encoderOptions) error { + if n <= 0 { + return fmt.Errorf("padding must be at least 1") + } + // No need to waste our time. + if n == 1 { + o.pad = 0 + } + if n > 1<<30 { + return fmt.Errorf("padding must less than 1GB (1<<30 bytes) ") + } + o.pad = n + return nil + } +} + +// EncoderLevel predefines encoder compression levels. +// Only use the constants made available, since the actual mapping +// of these values are very likely to change and your compression could change +// unpredictably when upgrading the library. +type EncoderLevel int + +const ( + speedNotSet EncoderLevel = iota + + // SpeedFastest will choose the fastest reasonable compression. + // This is roughly equivalent to the fastest Zstandard mode. + SpeedFastest + + // SpeedDefault is the default "pretty fast" compression option. + // This is roughly equivalent to the default Zstandard mode (level 3). + SpeedDefault + + // SpeedBetterCompression will yield better compression than the default. + // Currently it is about zstd level 7-8 with ~ 2x-3x the default CPU usage. + // By using this, notice that CPU usage may go up in the future. + SpeedBetterCompression + + // speedLast should be kept as the last actual compression option. + // The is not for external usage, but is used to keep track of the valid options. + speedLast + + // SpeedBestCompression will choose the best available compression option. + // For now this is not implemented. + SpeedBestCompression = SpeedBetterCompression +) + +// EncoderLevelFromString will convert a string representation of an encoding level back +// to a compression level. The compare is not case sensitive. +// If the string wasn't recognized, (false, SpeedDefault) will be returned. +func EncoderLevelFromString(s string) (bool, EncoderLevel) { + for l := EncoderLevel(speedNotSet + 1); l < speedLast; l++ { + if strings.EqualFold(s, l.String()) { + return true, l + } + } + return false, SpeedDefault +} + +// EncoderLevelFromZstd will return an encoder level that closest matches the compression +// ratio of a specific zstd compression level. +// Many input values will provide the same compression level. +func EncoderLevelFromZstd(level int) EncoderLevel { + switch { + case level < 3: + return SpeedFastest + case level >= 3 && level < 6: + return SpeedDefault + case level > 5: + return SpeedBetterCompression + } + return SpeedDefault +} + +// String provides a string representation of the compression level. +func (e EncoderLevel) String() string { + switch e { + case SpeedFastest: + return "fastest" + case SpeedDefault: + return "default" + case SpeedBetterCompression: + return "better" + default: + return "invalid" + } +} + +// WithEncoderLevel specifies a predefined compression level. +func WithEncoderLevel(l EncoderLevel) EOption { + return func(o *encoderOptions) error { + switch { + case l <= speedNotSet || l >= speedLast: + return fmt.Errorf("unknown encoder level") + } + o.level = l + if !o.customWindow { + switch o.level { + case SpeedFastest: + o.windowSize = 4 << 20 + case SpeedDefault: + o.windowSize = 8 << 20 + case SpeedBetterCompression: + o.windowSize = 16 << 20 + } + } + if !o.customALEntropy { + o.allLitEntropy = l > SpeedFastest + } + + return nil + } +} + +// WithZeroFrames will encode 0 length input as full frames. +// This can be needed for compatibility with zstandard usage, +// but is not needed for this package. +func WithZeroFrames(b bool) EOption { + return func(o *encoderOptions) error { + o.fullZero = b + return nil + } +} + +// WithAllLitEntropyCompression will apply entropy compression if no matches are found. +// Disabling this will skip incompressible data faster, but in cases with no matches but +// skewed character distribution compression is lost. +// Default value depends on the compression level selected. +func WithAllLitEntropyCompression(b bool) EOption { + return func(o *encoderOptions) error { + o.customALEntropy = true + o.allLitEntropy = b + return nil + } +} + +// WithNoEntropyCompression will always skip entropy compression of literals. +// This can be useful if content has matches, but unlikely to benefit from entropy +// compression. Usually the slight speed improvement is not worth enabling this. +func WithNoEntropyCompression(b bool) EOption { + return func(o *encoderOptions) error { + o.noEntropy = b + return nil + } +} + +// WithSingleSegment will set the "single segment" flag when EncodeAll is used. +// If this flag is set, data must be regenerated within a single continuous memory segment. +// In this case, Window_Descriptor byte is skipped, but Frame_Content_Size is necessarily present. +// As a consequence, the decoder must allocate a memory segment of size equal or larger than size of your content. +// In order to preserve the decoder from unreasonable memory requirements, +// a decoder is allowed to reject a compressed frame which requests a memory size beyond decoder's authorized range. +// For broader compatibility, decoders are recommended to support memory sizes of at least 8 MB. +// This is only a recommendation, each decoder is free to support higher or lower limits, depending on local limitations. +// If this is not specified, block encodes will automatically choose this based on the input size. +// This setting has no effect on streamed encodes. +func WithSingleSegment(b bool) EOption { + return func(o *encoderOptions) error { + o.single = &b + return nil + } +} + +// WithEncoderDict allows to register a dictionary that will be used for the encode. +// The encoder *may* choose to use no dictionary instead for certain payloads. +func WithEncoderDict(dict []byte) EOption { + return func(o *encoderOptions) error { + d, err := loadDict(dict) + if err != nil { + return err + } + o.dict = d + return nil + } +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/framedec.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/framedec.go new file mode 100644 index 000000000000..fc4a566d39aa --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/framedec.go @@ -0,0 +1,494 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "bytes" + "encoding/hex" + "errors" + "hash" + "io" + "sync" + + "github.com/klauspost/compress/zstd/internal/xxhash" +) + +type frameDec struct { + o decoderOptions + crc hash.Hash64 + offset int64 + + WindowSize uint64 + + // maxWindowSize is the maximum windows size to support. + // should never be bigger than max-int. + maxWindowSize uint64 + + // In order queue of blocks being decoded. + decoding chan *blockDec + + // Frame history passed between blocks + history history + + rawInput byteBuffer + + // Byte buffer that can be reused for small input blocks. + bBuf byteBuf + + FrameContentSize uint64 + frameDone sync.WaitGroup + + DictionaryID *uint32 + HasCheckSum bool + SingleSegment bool + + // asyncRunning indicates whether the async routine processes input on 'decoding'. + asyncRunningMu sync.Mutex + asyncRunning bool +} + +const ( + // The minimum Window_Size is 1 KB. + MinWindowSize = 1 << 10 + MaxWindowSize = 1 << 29 +) + +var ( + frameMagic = []byte{0x28, 0xb5, 0x2f, 0xfd} + skippableFrameMagic = []byte{0x2a, 0x4d, 0x18} +) + +func newFrameDec(o decoderOptions) *frameDec { + d := frameDec{ + o: o, + maxWindowSize: MaxWindowSize, + } + if d.maxWindowSize > o.maxDecodedSize { + d.maxWindowSize = o.maxDecodedSize + } + return &d +} + +// reset will read the frame header and prepare for block decoding. +// If nothing can be read from the input, io.EOF will be returned. +// Any other error indicated that the stream contained data, but +// there was a problem. +func (d *frameDec) reset(br byteBuffer) error { + d.HasCheckSum = false + d.WindowSize = 0 + var b []byte + for { + b = br.readSmall(4) + if b == nil { + return io.EOF + } + if !bytes.Equal(b[1:4], skippableFrameMagic) || b[0]&0xf0 != 0x50 { + if debug { + println("Not skippable", hex.EncodeToString(b), hex.EncodeToString(skippableFrameMagic)) + } + // Break if not skippable frame. + break + } + // Read size to skip + b = br.readSmall(4) + if b == nil { + println("Reading Frame Size EOF") + return io.ErrUnexpectedEOF + } + n := uint32(b[0]) | (uint32(b[1]) << 8) | (uint32(b[2]) << 16) | (uint32(b[3]) << 24) + println("Skipping frame with", n, "bytes.") + err := br.skipN(int(n)) + if err != nil { + if debug { + println("Reading discarded frame", err) + } + return err + } + } + if !bytes.Equal(b, frameMagic) { + println("Got magic numbers: ", b, "want:", frameMagic) + return ErrMagicMismatch + } + + // Read Frame_Header_Descriptor + fhd, err := br.readByte() + if err != nil { + println("Reading Frame_Header_Descriptor", err) + return err + } + d.SingleSegment = fhd&(1<<5) != 0 + + if fhd&(1<<3) != 0 { + return errors.New("Reserved bit set on frame header") + } + + // Read Window_Descriptor + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#window_descriptor + d.WindowSize = 0 + if !d.SingleSegment { + wd, err := br.readByte() + if err != nil { + println("Reading Window_Descriptor", err) + return err + } + printf("raw: %x, mantissa: %d, exponent: %d\n", wd, wd&7, wd>>3) + windowLog := 10 + (wd >> 3) + windowBase := uint64(1) << windowLog + windowAdd := (windowBase / 8) * uint64(wd&0x7) + d.WindowSize = windowBase + windowAdd + } + + // Read Dictionary_ID + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#dictionary_id + d.DictionaryID = nil + if size := fhd & 3; size != 0 { + if size == 3 { + size = 4 + } + b = br.readSmall(int(size)) + if b == nil { + if debug { + println("Reading Dictionary_ID", io.ErrUnexpectedEOF) + } + return io.ErrUnexpectedEOF + } + var id uint32 + switch size { + case 1: + id = uint32(b[0]) + case 2: + id = uint32(b[0]) | (uint32(b[1]) << 8) + case 4: + id = uint32(b[0]) | (uint32(b[1]) << 8) | (uint32(b[2]) << 16) | (uint32(b[3]) << 24) + } + if debug { + println("Dict size", size, "ID:", id) + } + if id > 0 { + // ID 0 means "sorry, no dictionary anyway". + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#dictionary-format + d.DictionaryID = &id + } + } + + // Read Frame_Content_Size + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#frame_content_size + var fcsSize int + v := fhd >> 6 + switch v { + case 0: + if d.SingleSegment { + fcsSize = 1 + } + default: + fcsSize = 1 << v + } + d.FrameContentSize = 0 + if fcsSize > 0 { + b := br.readSmall(fcsSize) + if b == nil { + println("Reading Frame content", io.ErrUnexpectedEOF) + return io.ErrUnexpectedEOF + } + switch fcsSize { + case 1: + d.FrameContentSize = uint64(b[0]) + case 2: + // When FCS_Field_Size is 2, the offset of 256 is added. + d.FrameContentSize = uint64(b[0]) | (uint64(b[1]) << 8) + 256 + case 4: + d.FrameContentSize = uint64(b[0]) | (uint64(b[1]) << 8) | (uint64(b[2]) << 16) | (uint64(b[3]) << 24) + case 8: + d1 := uint32(b[0]) | (uint32(b[1]) << 8) | (uint32(b[2]) << 16) | (uint32(b[3]) << 24) + d2 := uint32(b[4]) | (uint32(b[5]) << 8) | (uint32(b[6]) << 16) | (uint32(b[7]) << 24) + d.FrameContentSize = uint64(d1) | (uint64(d2) << 32) + } + if debug { + println("field size bits:", v, "fcsSize:", fcsSize, "FrameContentSize:", d.FrameContentSize, hex.EncodeToString(b[:fcsSize]), "singleseg:", d.SingleSegment, "window:", d.WindowSize) + } + } + // Move this to shared. + d.HasCheckSum = fhd&(1<<2) != 0 + if d.HasCheckSum { + if d.crc == nil { + d.crc = xxhash.New() + } + d.crc.Reset() + } + + if d.WindowSize == 0 && d.SingleSegment { + // We may not need window in this case. + d.WindowSize = d.FrameContentSize + if d.WindowSize < MinWindowSize { + d.WindowSize = MinWindowSize + } + } + + if d.WindowSize > d.maxWindowSize { + printf("window size %d > max %d\n", d.WindowSize, d.maxWindowSize) + return ErrWindowSizeExceeded + } + // The minimum Window_Size is 1 KB. + if d.WindowSize < MinWindowSize { + println("got window size: ", d.WindowSize) + return ErrWindowSizeTooSmall + } + d.history.windowSize = int(d.WindowSize) + if d.o.lowMem && d.history.windowSize < maxBlockSize { + d.history.maxSize = d.history.windowSize * 2 + } else { + d.history.maxSize = d.history.windowSize + maxBlockSize + } + // history contains input - maybe we do something + d.rawInput = br + return nil +} + +// next will start decoding the next block from stream. +func (d *frameDec) next(block *blockDec) error { + if debug { + printf("decoding new block %p:%p", block, block.data) + } + err := block.reset(d.rawInput, d.WindowSize) + if err != nil { + println("block error:", err) + // Signal the frame decoder we have a problem. + d.sendErr(block, err) + return err + } + block.input <- struct{}{} + if debug { + println("next block:", block) + } + d.asyncRunningMu.Lock() + defer d.asyncRunningMu.Unlock() + if !d.asyncRunning { + return nil + } + if block.Last { + // We indicate the frame is done by sending io.EOF + d.decoding <- block + return io.EOF + } + d.decoding <- block + return nil +} + +// sendEOF will queue an error block on the frame. +// This will cause the frame decoder to return when it encounters the block. +// Returns true if the decoder was added. +func (d *frameDec) sendErr(block *blockDec, err error) bool { + d.asyncRunningMu.Lock() + defer d.asyncRunningMu.Unlock() + if !d.asyncRunning { + return false + } + + println("sending error", err.Error()) + block.sendErr(err) + d.decoding <- block + return true +} + +// checkCRC will check the checksum if the frame has one. +// Will return ErrCRCMismatch if crc check failed, otherwise nil. +func (d *frameDec) checkCRC() error { + if !d.HasCheckSum { + return nil + } + var tmp [4]byte + got := d.crc.Sum64() + // Flip to match file order. + tmp[0] = byte(got >> 0) + tmp[1] = byte(got >> 8) + tmp[2] = byte(got >> 16) + tmp[3] = byte(got >> 24) + + // We can overwrite upper tmp now + want := d.rawInput.readSmall(4) + if want == nil { + println("CRC missing?") + return io.ErrUnexpectedEOF + } + + if !bytes.Equal(tmp[:], want) { + if debug { + println("CRC Check Failed:", tmp[:], "!=", want) + } + return ErrCRCMismatch + } + if debug { + println("CRC ok", tmp[:]) + } + return nil +} + +func (d *frameDec) initAsync() { + if !d.o.lowMem && !d.SingleSegment { + // set max extra size history to 10MB. + d.history.maxSize = d.history.windowSize + maxBlockSize*5 + } + // re-alloc if more than one extra block size. + if d.o.lowMem && cap(d.history.b) > d.history.maxSize+maxBlockSize { + d.history.b = make([]byte, 0, d.history.maxSize) + } + if cap(d.history.b) < d.history.maxSize { + d.history.b = make([]byte, 0, d.history.maxSize) + } + if cap(d.decoding) < d.o.concurrent { + d.decoding = make(chan *blockDec, d.o.concurrent) + } + if debug { + h := d.history + printf("history init. len: %d, cap: %d", len(h.b), cap(h.b)) + } + d.asyncRunningMu.Lock() + d.asyncRunning = true + d.asyncRunningMu.Unlock() +} + +// startDecoder will start decoding blocks and write them to the writer. +// The decoder will stop as soon as an error occurs or at end of frame. +// When the frame has finished decoding the *bufio.Reader +// containing the remaining input will be sent on frameDec.frameDone. +func (d *frameDec) startDecoder(output chan decodeOutput) { + written := int64(0) + + defer func() { + d.asyncRunningMu.Lock() + d.asyncRunning = false + d.asyncRunningMu.Unlock() + + // Drain the currently decoding. + d.history.error = true + flushdone: + for { + select { + case b := <-d.decoding: + b.history <- &d.history + output <- <-b.result + default: + break flushdone + } + } + println("frame decoder done, signalling done") + d.frameDone.Done() + }() + // Get decoder for first block. + block := <-d.decoding + block.history <- &d.history + for { + var next *blockDec + // Get result + r := <-block.result + if r.err != nil { + println("Result contained error", r.err) + output <- r + return + } + if debug { + println("got result, from ", d.offset, "to", d.offset+int64(len(r.b))) + d.offset += int64(len(r.b)) + } + if !block.Last { + // Send history to next block + select { + case next = <-d.decoding: + if debug { + println("Sending ", len(d.history.b), "bytes as history") + } + next.history <- &d.history + default: + // Wait until we have sent the block, so + // other decoders can potentially get the decoder. + next = nil + } + } + + // Add checksum, async to decoding. + if d.HasCheckSum { + n, err := d.crc.Write(r.b) + if err != nil { + r.err = err + if n != len(r.b) { + r.err = io.ErrShortWrite + } + output <- r + return + } + } + written += int64(len(r.b)) + if d.SingleSegment && uint64(written) > d.FrameContentSize { + println("runDecoder: single segment and", uint64(written), ">", d.FrameContentSize) + r.err = ErrFrameSizeExceeded + output <- r + return + } + if block.Last { + r.err = d.checkCRC() + output <- r + return + } + output <- r + if next == nil { + // There was no decoder available, we wait for one now that we have sent to the writer. + if debug { + println("Sending ", len(d.history.b), " bytes as history") + } + next = <-d.decoding + next.history <- &d.history + } + block = next + } +} + +// runDecoder will create a sync decoder that will decode a block of data. +func (d *frameDec) runDecoder(dst []byte, dec *blockDec) ([]byte, error) { + saved := d.history.b + + // We use the history for output to avoid copying it. + d.history.b = dst + // Store input length, so we only check new data. + crcStart := len(dst) + var err error + for { + err = dec.reset(d.rawInput, d.WindowSize) + if err != nil { + break + } + if debug { + println("next block:", dec) + } + err = dec.decodeBuf(&d.history) + if err != nil || dec.Last { + break + } + if uint64(len(d.history.b)) > d.o.maxDecodedSize { + err = ErrDecoderSizeExceeded + break + } + if d.SingleSegment && uint64(len(d.history.b)) > d.o.maxDecodedSize { + println("runDecoder: single segment and", uint64(len(d.history.b)), ">", d.o.maxDecodedSize) + err = ErrFrameSizeExceeded + break + } + } + dst = d.history.b + if err == nil { + if d.HasCheckSum { + var n int + n, err = d.crc.Write(dst[crcStart:]) + if err == nil { + if n != len(dst)-crcStart { + err = io.ErrShortWrite + } else { + err = d.checkCRC() + } + } + } + } + d.history.b = saved + return dst, err +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/frameenc.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/frameenc.go new file mode 100644 index 000000000000..4ef7f5a3e3d5 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/frameenc.go @@ -0,0 +1,137 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "encoding/binary" + "fmt" + "io" + "math" + "math/bits" +) + +type frameHeader struct { + ContentSize uint64 + WindowSize uint32 + SingleSegment bool + Checksum bool + DictID uint32 +} + +const maxHeaderSize = 14 + +func (f frameHeader) appendTo(dst []byte) ([]byte, error) { + dst = append(dst, frameMagic...) + var fhd uint8 + if f.Checksum { + fhd |= 1 << 2 + } + if f.SingleSegment { + fhd |= 1 << 5 + } + + var dictIDContent []byte + if f.DictID > 0 { + var tmp [4]byte + if f.DictID < 256 { + fhd |= 1 + tmp[0] = uint8(f.DictID) + dictIDContent = tmp[:1] + } else if f.DictID < 1<<16 { + fhd |= 2 + binary.LittleEndian.PutUint16(tmp[:2], uint16(f.DictID)) + dictIDContent = tmp[:2] + } else { + fhd |= 3 + binary.LittleEndian.PutUint32(tmp[:4], f.DictID) + dictIDContent = tmp[:4] + } + } + var fcs uint8 + if f.ContentSize >= 256 { + fcs++ + } + if f.ContentSize >= 65536+256 { + fcs++ + } + if f.ContentSize >= 0xffffffff { + fcs++ + } + + fhd |= fcs << 6 + + dst = append(dst, fhd) + if !f.SingleSegment { + const winLogMin = 10 + windowLog := (bits.Len32(f.WindowSize-1) - winLogMin) << 3 + dst = append(dst, uint8(windowLog)) + } + if f.DictID > 0 { + dst = append(dst, dictIDContent...) + } + switch fcs { + case 0: + if f.SingleSegment { + dst = append(dst, uint8(f.ContentSize)) + } + // Unless SingleSegment is set, framessizes < 256 are nto stored. + case 1: + f.ContentSize -= 256 + dst = append(dst, uint8(f.ContentSize), uint8(f.ContentSize>>8)) + case 2: + dst = append(dst, uint8(f.ContentSize), uint8(f.ContentSize>>8), uint8(f.ContentSize>>16), uint8(f.ContentSize>>24)) + case 3: + dst = append(dst, uint8(f.ContentSize), uint8(f.ContentSize>>8), uint8(f.ContentSize>>16), uint8(f.ContentSize>>24), + uint8(f.ContentSize>>32), uint8(f.ContentSize>>40), uint8(f.ContentSize>>48), uint8(f.ContentSize>>56)) + default: + panic("invalid fcs") + } + return dst, nil +} + +const skippableFrameHeader = 4 + 4 + +// calcSkippableFrame will return a total size to be added for written +// to be divisible by multiple. +// The value will always be > skippableFrameHeader. +// The function will panic if written < 0 or wantMultiple <= 0. +func calcSkippableFrame(written, wantMultiple int64) int { + if wantMultiple <= 0 { + panic("wantMultiple <= 0") + } + if written < 0 { + panic("written < 0") + } + leftOver := written % wantMultiple + if leftOver == 0 { + return 0 + } + toAdd := wantMultiple - leftOver + for toAdd < skippableFrameHeader { + toAdd += wantMultiple + } + return int(toAdd) +} + +// skippableFrame will add a skippable frame with a total size of bytes. +// total should be >= skippableFrameHeader and < math.MaxUint32. +func skippableFrame(dst []byte, total int, r io.Reader) ([]byte, error) { + if total == 0 { + return dst, nil + } + if total < skippableFrameHeader { + return dst, fmt.Errorf("requested skippable frame (%d) < 8", total) + } + if int64(total) > math.MaxUint32 { + return dst, fmt.Errorf("requested skippable frame (%d) > max uint32", total) + } + dst = append(dst, 0x50, 0x2a, 0x4d, 0x18) + f := uint32(total - skippableFrameHeader) + dst = append(dst, uint8(f), uint8(f>>8), uint8(f>>16), uint8(f>>24)) + start := len(dst) + dst = append(dst, make([]byte, f)...) + _, err := io.ReadFull(r, dst[start:]) + return dst, err +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_decoder.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_decoder.go new file mode 100644 index 000000000000..e6d3d49b39c0 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_decoder.go @@ -0,0 +1,385 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "errors" + "fmt" +) + +const ( + tablelogAbsoluteMax = 9 +) + +const ( + /*!MEMORY_USAGE : + * Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.) + * Increasing memory usage improves compression ratio + * Reduced memory usage can improve speed, due to cache effect + * Recommended max value is 14, for 16KB, which nicely fits into Intel x86 L1 cache */ + maxMemoryUsage = tablelogAbsoluteMax + 2 + + maxTableLog = maxMemoryUsage - 2 + maxTablesize = 1 << maxTableLog + maxTableMask = (1 << maxTableLog) - 1 + minTablelog = 5 + maxSymbolValue = 255 +) + +// fseDecoder provides temporary storage for compression and decompression. +type fseDecoder struct { + dt [maxTablesize]decSymbol // Decompression table. + symbolLen uint16 // Length of active part of the symbol table. + actualTableLog uint8 // Selected tablelog. + maxBits uint8 // Maximum number of additional bits + + // used for table creation to avoid allocations. + stateTable [256]uint16 + norm [maxSymbolValue + 1]int16 + preDefined bool +} + +// tableStep returns the next table index. +func tableStep(tableSize uint32) uint32 { + return (tableSize >> 1) + (tableSize >> 3) + 3 +} + +// readNCount will read the symbol distribution so decoding tables can be constructed. +func (s *fseDecoder) readNCount(b *byteReader, maxSymbol uint16) error { + var ( + charnum uint16 + previous0 bool + ) + if b.remain() < 4 { + return errors.New("input too small") + } + bitStream := b.Uint32NC() + nbBits := uint((bitStream & 0xF) + minTablelog) // extract tableLog + if nbBits > tablelogAbsoluteMax { + println("Invalid tablelog:", nbBits) + return errors.New("tableLog too large") + } + bitStream >>= 4 + bitCount := uint(4) + + s.actualTableLog = uint8(nbBits) + remaining := int32((1 << nbBits) + 1) + threshold := int32(1 << nbBits) + gotTotal := int32(0) + nbBits++ + + for remaining > 1 && charnum <= maxSymbol { + if previous0 { + //println("prev0") + n0 := charnum + for (bitStream & 0xFFFF) == 0xFFFF { + //println("24 x 0") + n0 += 24 + if r := b.remain(); r > 5 { + b.advance(2) + // The check above should make sure we can read 32 bits + bitStream = b.Uint32NC() >> bitCount + } else { + // end of bit stream + bitStream >>= 16 + bitCount += 16 + } + } + //printf("bitstream: %d, 0b%b", bitStream&3, bitStream) + for (bitStream & 3) == 3 { + n0 += 3 + bitStream >>= 2 + bitCount += 2 + } + n0 += uint16(bitStream & 3) + bitCount += 2 + + if n0 > maxSymbolValue { + return errors.New("maxSymbolValue too small") + } + //println("inserting ", n0-charnum, "zeroes from idx", charnum, "ending before", n0) + for charnum < n0 { + s.norm[uint8(charnum)] = 0 + charnum++ + } + + if r := b.remain(); r >= 7 || r-int(bitCount>>3) >= 4 { + b.advance(bitCount >> 3) + bitCount &= 7 + // The check above should make sure we can read 32 bits + bitStream = b.Uint32NC() >> bitCount + } else { + bitStream >>= 2 + } + } + + max := (2*threshold - 1) - remaining + var count int32 + + if int32(bitStream)&(threshold-1) < max { + count = int32(bitStream) & (threshold - 1) + if debugAsserts && nbBits < 1 { + panic("nbBits underflow") + } + bitCount += nbBits - 1 + } else { + count = int32(bitStream) & (2*threshold - 1) + if count >= threshold { + count -= max + } + bitCount += nbBits + } + + // extra accuracy + count-- + if count < 0 { + // -1 means +1 + remaining += count + gotTotal -= count + } else { + remaining -= count + gotTotal += count + } + s.norm[charnum&0xff] = int16(count) + charnum++ + previous0 = count == 0 + for remaining < threshold { + nbBits-- + threshold >>= 1 + } + + if r := b.remain(); r >= 7 || r-int(bitCount>>3) >= 4 { + b.advance(bitCount >> 3) + bitCount &= 7 + // The check above should make sure we can read 32 bits + bitStream = b.Uint32NC() >> (bitCount & 31) + } else { + bitCount -= (uint)(8 * (len(b.b) - 4 - b.off)) + b.off = len(b.b) - 4 + bitStream = b.Uint32() >> (bitCount & 31) + } + } + s.symbolLen = charnum + if s.symbolLen <= 1 { + return fmt.Errorf("symbolLen (%d) too small", s.symbolLen) + } + if s.symbolLen > maxSymbolValue+1 { + return fmt.Errorf("symbolLen (%d) too big", s.symbolLen) + } + if remaining != 1 { + return fmt.Errorf("corruption detected (remaining %d != 1)", remaining) + } + if bitCount > 32 { + return fmt.Errorf("corruption detected (bitCount %d > 32)", bitCount) + } + if gotTotal != 1<> 3) + // println(s.norm[:s.symbolLen], s.symbolLen) + return s.buildDtable() +} + +// decSymbol contains information about a state entry, +// Including the state offset base, the output symbol and +// the number of bits to read for the low part of the destination state. +// Using a composite uint64 is faster than a struct with separate members. +type decSymbol uint64 + +func newDecSymbol(nbits, addBits uint8, newState uint16, baseline uint32) decSymbol { + return decSymbol(nbits) | (decSymbol(addBits) << 8) | (decSymbol(newState) << 16) | (decSymbol(baseline) << 32) +} + +func (d decSymbol) nbBits() uint8 { + return uint8(d) +} + +func (d decSymbol) addBits() uint8 { + return uint8(d >> 8) +} + +func (d decSymbol) newState() uint16 { + return uint16(d >> 16) +} + +func (d decSymbol) baseline() uint32 { + return uint32(d >> 32) +} + +func (d decSymbol) baselineInt() int { + return int(d >> 32) +} + +func (d *decSymbol) set(nbits, addBits uint8, newState uint16, baseline uint32) { + *d = decSymbol(nbits) | (decSymbol(addBits) << 8) | (decSymbol(newState) << 16) | (decSymbol(baseline) << 32) +} + +func (d *decSymbol) setNBits(nBits uint8) { + const mask = 0xffffffffffffff00 + *d = (*d & mask) | decSymbol(nBits) +} + +func (d *decSymbol) setAddBits(addBits uint8) { + const mask = 0xffffffffffff00ff + *d = (*d & mask) | (decSymbol(addBits) << 8) +} + +func (d *decSymbol) setNewState(state uint16) { + const mask = 0xffffffff0000ffff + *d = (*d & mask) | decSymbol(state)<<16 +} + +func (d *decSymbol) setBaseline(baseline uint32) { + const mask = 0xffffffff + *d = (*d & mask) | decSymbol(baseline)<<32 +} + +func (d *decSymbol) setExt(addBits uint8, baseline uint32) { + const mask = 0xffff00ff + *d = (*d & mask) | (decSymbol(addBits) << 8) | (decSymbol(baseline) << 32) +} + +// decSymbolValue returns the transformed decSymbol for the given symbol. +func decSymbolValue(symb uint8, t []baseOffset) (decSymbol, error) { + if int(symb) >= len(t) { + return 0, fmt.Errorf("rle symbol %d >= max %d", symb, len(t)) + } + lu := t[symb] + return newDecSymbol(0, lu.addBits, 0, lu.baseLine), nil +} + +// setRLE will set the decoder til RLE mode. +func (s *fseDecoder) setRLE(symbol decSymbol) { + s.actualTableLog = 0 + s.maxBits = symbol.addBits() + s.dt[0] = symbol +} + +// buildDtable will build the decoding table. +func (s *fseDecoder) buildDtable() error { + tableSize := uint32(1 << s.actualTableLog) + highThreshold := tableSize - 1 + symbolNext := s.stateTable[:256] + + // Init, lay down lowprob symbols + { + for i, v := range s.norm[:s.symbolLen] { + if v == -1 { + s.dt[highThreshold].setAddBits(uint8(i)) + highThreshold-- + symbolNext[i] = 1 + } else { + symbolNext[i] = uint16(v) + } + } + } + // Spread symbols + { + tableMask := tableSize - 1 + step := tableStep(tableSize) + position := uint32(0) + for ss, v := range s.norm[:s.symbolLen] { + for i := 0; i < int(v); i++ { + s.dt[position].setAddBits(uint8(ss)) + position = (position + step) & tableMask + for position > highThreshold { + // lowprob area + position = (position + step) & tableMask + } + } + } + if position != 0 { + // position must reach all cells once, otherwise normalizedCounter is incorrect + return errors.New("corrupted input (position != 0)") + } + } + + // Build Decoding table + { + tableSize := uint16(1 << s.actualTableLog) + for u, v := range s.dt[:tableSize] { + symbol := v.addBits() + nextState := symbolNext[symbol] + symbolNext[symbol] = nextState + 1 + nBits := s.actualTableLog - byte(highBits(uint32(nextState))) + s.dt[u&maxTableMask].setNBits(nBits) + newState := (nextState << nBits) - tableSize + if newState > tableSize { + return fmt.Errorf("newState (%d) outside table size (%d)", newState, tableSize) + } + if newState == uint16(u) && nBits == 0 { + // Seems weird that this is possible with nbits > 0. + return fmt.Errorf("newState (%d) == oldState (%d) and no bits", newState, u) + } + s.dt[u&maxTableMask].setNewState(newState) + } + } + return nil +} + +// transform will transform the decoder table into a table usable for +// decoding without having to apply the transformation while decoding. +// The state will contain the base value and the number of bits to read. +func (s *fseDecoder) transform(t []baseOffset) error { + tableSize := uint16(1 << s.actualTableLog) + s.maxBits = 0 + for i, v := range s.dt[:tableSize] { + add := v.addBits() + if int(add) >= len(t) { + return fmt.Errorf("invalid decoding table entry %d, symbol %d >= max (%d)", i, v.addBits(), len(t)) + } + lu := t[add] + if lu.addBits > s.maxBits { + s.maxBits = lu.addBits + } + v.setExt(lu.addBits, lu.baseLine) + s.dt[i] = v + } + return nil +} + +type fseState struct { + dt []decSymbol + state decSymbol +} + +// Initialize and decodeAsync first state and symbol. +func (s *fseState) init(br *bitReader, tableLog uint8, dt []decSymbol) { + s.dt = dt + br.fill() + s.state = dt[br.getBits(tableLog)] +} + +// next returns the current symbol and sets the next state. +// At least tablelog bits must be available in the bit reader. +func (s *fseState) next(br *bitReader) { + lowBits := uint16(br.getBits(s.state.nbBits())) + s.state = s.dt[s.state.newState()+lowBits] +} + +// finished returns true if all bits have been read from the bitstream +// and the next state would require reading bits from the input. +func (s *fseState) finished(br *bitReader) bool { + return br.finished() && s.state.nbBits() > 0 +} + +// final returns the current state symbol without decoding the next. +func (s *fseState) final() (int, uint8) { + return s.state.baselineInt(), s.state.addBits() +} + +// final returns the current state symbol without decoding the next. +func (s decSymbol) final() (int, uint8) { + return s.baselineInt(), s.addBits() +} + +// nextFast returns the next symbol and sets the next state. +// This can only be used if no symbols are 0 bits. +// At least tablelog bits must be available in the bit reader. +func (s *fseState) nextFast(br *bitReader) (uint32, uint8) { + lowBits := uint16(br.getBitsFast(s.state.nbBits())) + s.state = s.dt[s.state.newState()+lowBits] + return s.state.baseline(), s.state.addBits() +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_encoder.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_encoder.go new file mode 100644 index 000000000000..aa9eba88b805 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_encoder.go @@ -0,0 +1,726 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "errors" + "fmt" + "math" +) + +const ( + // For encoding we only support up to + maxEncTableLog = 8 + maxEncTablesize = 1 << maxTableLog + maxEncTableMask = (1 << maxTableLog) - 1 + minEncTablelog = 5 + maxEncSymbolValue = maxMatchLengthSymbol +) + +// Scratch provides temporary storage for compression and decompression. +type fseEncoder struct { + symbolLen uint16 // Length of active part of the symbol table. + actualTableLog uint8 // Selected tablelog. + ct cTable // Compression tables. + maxCount int // count of the most probable symbol + zeroBits bool // no bits has prob > 50%. + clearCount bool // clear count + useRLE bool // This encoder is for RLE + preDefined bool // This encoder is predefined. + reUsed bool // Set to know when the encoder has been reused. + rleVal uint8 // RLE Symbol + maxBits uint8 // Maximum output bits after transform. + + // TODO: Technically zstd should be fine with 64 bytes. + count [256]uint32 + norm [256]int16 +} + +// cTable contains tables used for compression. +type cTable struct { + tableSymbol []byte + stateTable []uint16 + symbolTT []symbolTransform +} + +// symbolTransform contains the state transform for a symbol. +type symbolTransform struct { + deltaNbBits uint32 + deltaFindState int16 + outBits uint8 +} + +// String prints values as a human readable string. +func (s symbolTransform) String() string { + return fmt.Sprintf("{deltabits: %08x, findstate:%d outbits:%d}", s.deltaNbBits, s.deltaFindState, s.outBits) +} + +// Histogram allows to populate the histogram and skip that step in the compression, +// It otherwise allows to inspect the histogram when compression is done. +// To indicate that you have populated the histogram call HistogramFinished +// with the value of the highest populated symbol, as well as the number of entries +// in the most populated entry. These are accepted at face value. +// The returned slice will always be length 256. +func (s *fseEncoder) Histogram() []uint32 { + return s.count[:] +} + +// HistogramFinished can be called to indicate that the histogram has been populated. +// maxSymbol is the index of the highest set symbol of the next data segment. +// maxCount is the number of entries in the most populated entry. +// These are accepted at face value. +func (s *fseEncoder) HistogramFinished(maxSymbol uint8, maxCount int) { + s.maxCount = maxCount + s.symbolLen = uint16(maxSymbol) + 1 + s.clearCount = maxCount != 0 +} + +// prepare will prepare and allocate scratch tables used for both compression and decompression. +func (s *fseEncoder) prepare() (*fseEncoder, error) { + if s == nil { + s = &fseEncoder{} + } + s.useRLE = false + if s.clearCount && s.maxCount == 0 { + for i := range s.count { + s.count[i] = 0 + } + s.clearCount = false + } + return s, nil +} + +// allocCtable will allocate tables needed for compression. +// If existing tables a re big enough, they are simply re-used. +func (s *fseEncoder) allocCtable() { + tableSize := 1 << s.actualTableLog + // get tableSymbol that is big enough. + if cap(s.ct.tableSymbol) < int(tableSize) { + s.ct.tableSymbol = make([]byte, tableSize) + } + s.ct.tableSymbol = s.ct.tableSymbol[:tableSize] + + ctSize := tableSize + if cap(s.ct.stateTable) < ctSize { + s.ct.stateTable = make([]uint16, ctSize) + } + s.ct.stateTable = s.ct.stateTable[:ctSize] + + if cap(s.ct.symbolTT) < 256 { + s.ct.symbolTT = make([]symbolTransform, 256) + } + s.ct.symbolTT = s.ct.symbolTT[:256] +} + +// buildCTable will populate the compression table so it is ready to be used. +func (s *fseEncoder) buildCTable() error { + tableSize := uint32(1 << s.actualTableLog) + highThreshold := tableSize - 1 + var cumul [256]int16 + + s.allocCtable() + tableSymbol := s.ct.tableSymbol[:tableSize] + // symbol start positions + { + cumul[0] = 0 + for ui, v := range s.norm[:s.symbolLen-1] { + u := byte(ui) // one less than reference + if v == -1 { + // Low proba symbol + cumul[u+1] = cumul[u] + 1 + tableSymbol[highThreshold] = u + highThreshold-- + } else { + cumul[u+1] = cumul[u] + v + } + } + // Encode last symbol separately to avoid overflowing u + u := int(s.symbolLen - 1) + v := s.norm[s.symbolLen-1] + if v == -1 { + // Low proba symbol + cumul[u+1] = cumul[u] + 1 + tableSymbol[highThreshold] = byte(u) + highThreshold-- + } else { + cumul[u+1] = cumul[u] + v + } + if uint32(cumul[s.symbolLen]) != tableSize { + return fmt.Errorf("internal error: expected cumul[s.symbolLen] (%d) == tableSize (%d)", cumul[s.symbolLen], tableSize) + } + cumul[s.symbolLen] = int16(tableSize) + 1 + } + // Spread symbols + s.zeroBits = false + { + step := tableStep(tableSize) + tableMask := tableSize - 1 + var position uint32 + // if any symbol > largeLimit, we may have 0 bits output. + largeLimit := int16(1 << (s.actualTableLog - 1)) + for ui, v := range s.norm[:s.symbolLen] { + symbol := byte(ui) + if v > largeLimit { + s.zeroBits = true + } + for nbOccurrences := int16(0); nbOccurrences < v; nbOccurrences++ { + tableSymbol[position] = symbol + position = (position + step) & tableMask + for position > highThreshold { + position = (position + step) & tableMask + } /* Low proba area */ + } + } + + // Check if we have gone through all positions + if position != 0 { + return errors.New("position!=0") + } + } + + // Build table + table := s.ct.stateTable + { + tsi := int(tableSize) + for u, v := range tableSymbol { + // TableU16 : sorted by symbol order; gives next state value + table[cumul[v]] = uint16(tsi + u) + cumul[v]++ + } + } + + // Build Symbol Transformation Table + { + total := int16(0) + symbolTT := s.ct.symbolTT[:s.symbolLen] + tableLog := s.actualTableLog + tl := (uint32(tableLog) << 16) - (1 << tableLog) + for i, v := range s.norm[:s.symbolLen] { + switch v { + case 0: + case -1, 1: + symbolTT[i].deltaNbBits = tl + symbolTT[i].deltaFindState = int16(total - 1) + total++ + default: + maxBitsOut := uint32(tableLog) - highBit(uint32(v-1)) + minStatePlus := uint32(v) << maxBitsOut + symbolTT[i].deltaNbBits = (maxBitsOut << 16) - minStatePlus + symbolTT[i].deltaFindState = int16(total - v) + total += v + } + } + if total != int16(tableSize) { + return fmt.Errorf("total mismatch %d (got) != %d (want)", total, tableSize) + } + } + return nil +} + +var rtbTable = [...]uint32{0, 473195, 504333, 520860, 550000, 700000, 750000, 830000} + +func (s *fseEncoder) setRLE(val byte) { + s.allocCtable() + s.actualTableLog = 0 + s.ct.stateTable = s.ct.stateTable[:1] + s.ct.symbolTT[val] = symbolTransform{ + deltaFindState: 0, + deltaNbBits: 0, + } + if debug { + println("setRLE: val", val, "symbolTT", s.ct.symbolTT[val]) + } + s.rleVal = val + s.useRLE = true +} + +// setBits will set output bits for the transform. +// if nil is provided, the number of bits is equal to the index. +func (s *fseEncoder) setBits(transform []byte) { + if s.reUsed || s.preDefined { + return + } + if s.useRLE { + if transform == nil { + s.ct.symbolTT[s.rleVal].outBits = s.rleVal + s.maxBits = s.rleVal + return + } + s.maxBits = transform[s.rleVal] + s.ct.symbolTT[s.rleVal].outBits = s.maxBits + return + } + if transform == nil { + for i := range s.ct.symbolTT[:s.symbolLen] { + s.ct.symbolTT[i].outBits = uint8(i) + } + s.maxBits = uint8(s.symbolLen - 1) + return + } + s.maxBits = 0 + for i, v := range transform[:s.symbolLen] { + s.ct.symbolTT[i].outBits = v + if v > s.maxBits { + // We could assume bits always going up, but we play safe. + s.maxBits = v + } + } +} + +// normalizeCount will normalize the count of the symbols so +// the total is equal to the table size. +// If successful, compression tables will also be made ready. +func (s *fseEncoder) normalizeCount(length int) error { + if s.reUsed { + return nil + } + s.optimalTableLog(length) + var ( + tableLog = s.actualTableLog + scale = 62 - uint64(tableLog) + step = (1 << 62) / uint64(length) + vStep = uint64(1) << (scale - 20) + stillToDistribute = int16(1 << tableLog) + largest int + largestP int16 + lowThreshold = (uint32)(length >> tableLog) + ) + if s.maxCount == length { + s.useRLE = true + return nil + } + s.useRLE = false + for i, cnt := range s.count[:s.symbolLen] { + // already handled + // if (count[s] == s.length) return 0; /* rle special case */ + + if cnt == 0 { + s.norm[i] = 0 + continue + } + if cnt <= lowThreshold { + s.norm[i] = -1 + stillToDistribute-- + } else { + proba := (int16)((uint64(cnt) * step) >> scale) + if proba < 8 { + restToBeat := vStep * uint64(rtbTable[proba]) + v := uint64(cnt)*step - (uint64(proba) << scale) + if v > restToBeat { + proba++ + } + } + if proba > largestP { + largestP = proba + largest = i + } + s.norm[i] = proba + stillToDistribute -= proba + } + } + + if -stillToDistribute >= (s.norm[largest] >> 1) { + // corner case, need another normalization method + err := s.normalizeCount2(length) + if err != nil { + return err + } + if debugAsserts { + err = s.validateNorm() + if err != nil { + return err + } + } + return s.buildCTable() + } + s.norm[largest] += stillToDistribute + if debugAsserts { + err := s.validateNorm() + if err != nil { + return err + } + } + return s.buildCTable() +} + +// Secondary normalization method. +// To be used when primary method fails. +func (s *fseEncoder) normalizeCount2(length int) error { + const notYetAssigned = -2 + var ( + distributed uint32 + total = uint32(length) + tableLog = s.actualTableLog + lowThreshold = uint32(total >> tableLog) + lowOne = uint32((total * 3) >> (tableLog + 1)) + ) + for i, cnt := range s.count[:s.symbolLen] { + if cnt == 0 { + s.norm[i] = 0 + continue + } + if cnt <= lowThreshold { + s.norm[i] = -1 + distributed++ + total -= cnt + continue + } + if cnt <= lowOne { + s.norm[i] = 1 + distributed++ + total -= cnt + continue + } + s.norm[i] = notYetAssigned + } + toDistribute := (1 << tableLog) - distributed + + if (total / toDistribute) > lowOne { + // risk of rounding to zero + lowOne = uint32((total * 3) / (toDistribute * 2)) + for i, cnt := range s.count[:s.symbolLen] { + if (s.norm[i] == notYetAssigned) && (cnt <= lowOne) { + s.norm[i] = 1 + distributed++ + total -= cnt + continue + } + } + toDistribute = (1 << tableLog) - distributed + } + if distributed == uint32(s.symbolLen)+1 { + // all values are pretty poor; + // probably incompressible data (should have already been detected); + // find max, then give all remaining points to max + var maxV int + var maxC uint32 + for i, cnt := range s.count[:s.symbolLen] { + if cnt > maxC { + maxV = i + maxC = cnt + } + } + s.norm[maxV] += int16(toDistribute) + return nil + } + + if total == 0 { + // all of the symbols were low enough for the lowOne or lowThreshold + for i := uint32(0); toDistribute > 0; i = (i + 1) % (uint32(s.symbolLen)) { + if s.norm[i] > 0 { + toDistribute-- + s.norm[i]++ + } + } + return nil + } + + var ( + vStepLog = 62 - uint64(tableLog) + mid = uint64((1 << (vStepLog - 1)) - 1) + rStep = (((1 << vStepLog) * uint64(toDistribute)) + mid) / uint64(total) // scale on remaining + tmpTotal = mid + ) + for i, cnt := range s.count[:s.symbolLen] { + if s.norm[i] == notYetAssigned { + var ( + end = tmpTotal + uint64(cnt)*rStep + sStart = uint32(tmpTotal >> vStepLog) + sEnd = uint32(end >> vStepLog) + weight = sEnd - sStart + ) + if weight < 1 { + return errors.New("weight < 1") + } + s.norm[i] = int16(weight) + tmpTotal = end + } + } + return nil +} + +// optimalTableLog calculates and sets the optimal tableLog in s.actualTableLog +func (s *fseEncoder) optimalTableLog(length int) { + tableLog := uint8(maxEncTableLog) + minBitsSrc := highBit(uint32(length)) + 1 + minBitsSymbols := highBit(uint32(s.symbolLen-1)) + 2 + minBits := uint8(minBitsSymbols) + if minBitsSrc < minBitsSymbols { + minBits = uint8(minBitsSrc) + } + + maxBitsSrc := uint8(highBit(uint32(length-1))) - 2 + if maxBitsSrc < tableLog { + // Accuracy can be reduced + tableLog = maxBitsSrc + } + if minBits > tableLog { + tableLog = minBits + } + // Need a minimum to safely represent all symbol values + if tableLog < minEncTablelog { + tableLog = minEncTablelog + } + if tableLog > maxEncTableLog { + tableLog = maxEncTableLog + } + s.actualTableLog = tableLog +} + +// validateNorm validates the normalized histogram table. +func (s *fseEncoder) validateNorm() (err error) { + var total int + for _, v := range s.norm[:s.symbolLen] { + if v >= 0 { + total += int(v) + } else { + total -= int(v) + } + } + defer func() { + if err == nil { + return + } + fmt.Printf("selected TableLog: %d, Symbol length: %d\n", s.actualTableLog, s.symbolLen) + for i, v := range s.norm[:s.symbolLen] { + fmt.Printf("%3d: %5d -> %4d \n", i, s.count[i], v) + } + }() + if total != (1 << s.actualTableLog) { + return fmt.Errorf("warning: Total == %d != %d", total, 1<> 3) + 3 + 2 + + // Write Table Size + bitStream = uint32(tableLog - minEncTablelog) + bitCount = uint(4) + remaining = int16(tableSize + 1) /* +1 for extra accuracy */ + threshold = int16(tableSize) + nbBits = uint(tableLog + 1) + outP = len(out) + ) + if cap(out) < outP+maxHeaderSize { + out = append(out, make([]byte, maxHeaderSize*3)...) + out = out[:len(out)-maxHeaderSize*3] + } + out = out[:outP+maxHeaderSize] + + // stops at 1 + for remaining > 1 { + if previous0 { + start := charnum + for s.norm[charnum] == 0 { + charnum++ + } + for charnum >= start+24 { + start += 24 + bitStream += uint32(0xFFFF) << bitCount + out[outP] = byte(bitStream) + out[outP+1] = byte(bitStream >> 8) + outP += 2 + bitStream >>= 16 + } + for charnum >= start+3 { + start += 3 + bitStream += 3 << bitCount + bitCount += 2 + } + bitStream += uint32(charnum-start) << bitCount + bitCount += 2 + if bitCount > 16 { + out[outP] = byte(bitStream) + out[outP+1] = byte(bitStream >> 8) + outP += 2 + bitStream >>= 16 + bitCount -= 16 + } + } + + count := s.norm[charnum] + charnum++ + max := (2*threshold - 1) - remaining + if count < 0 { + remaining += count + } else { + remaining -= count + } + count++ // +1 for extra accuracy + if count >= threshold { + count += max // [0..max[ [max..threshold[ (...) [threshold+max 2*threshold[ + } + bitStream += uint32(count) << bitCount + bitCount += nbBits + if count < max { + bitCount-- + } + + previous0 = count == 1 + if remaining < 1 { + return nil, errors.New("internal error: remaining < 1") + } + for remaining < threshold { + nbBits-- + threshold >>= 1 + } + + if bitCount > 16 { + out[outP] = byte(bitStream) + out[outP+1] = byte(bitStream >> 8) + outP += 2 + bitStream >>= 16 + bitCount -= 16 + } + } + + if outP+2 > len(out) { + return nil, fmt.Errorf("internal error: %d > %d, maxheader: %d, sl: %d, tl: %d, normcount: %v", outP+2, len(out), maxHeaderSize, s.symbolLen, int(tableLog), s.norm[:s.symbolLen]) + } + out[outP] = byte(bitStream) + out[outP+1] = byte(bitStream >> 8) + outP += int((bitCount + 7) / 8) + + if charnum > s.symbolLen { + return nil, errors.New("internal error: charnum > s.symbolLen") + } + return out[:outP], nil +} + +// Approximate symbol cost, as fractional value, using fixed-point format (accuracyLog fractional bits) +// note 1 : assume symbolValue is valid (<= maxSymbolValue) +// note 2 : if freq[symbolValue]==0, @return a fake cost of tableLog+1 bits * +func (s *fseEncoder) bitCost(symbolValue uint8, accuracyLog uint32) uint32 { + minNbBits := s.ct.symbolTT[symbolValue].deltaNbBits >> 16 + threshold := (minNbBits + 1) << 16 + if debugAsserts { + if !(s.actualTableLog < 16) { + panic("!s.actualTableLog < 16") + } + // ensure enough room for renormalization double shift + if !(uint8(accuracyLog) < 31-s.actualTableLog) { + panic("!uint8(accuracyLog) < 31-s.actualTableLog") + } + } + tableSize := uint32(1) << s.actualTableLog + deltaFromThreshold := threshold - (s.ct.symbolTT[symbolValue].deltaNbBits + tableSize) + // linear interpolation (very approximate) + normalizedDeltaFromThreshold := (deltaFromThreshold << accuracyLog) >> s.actualTableLog + bitMultiplier := uint32(1) << accuracyLog + if debugAsserts { + if s.ct.symbolTT[symbolValue].deltaNbBits+tableSize > threshold { + panic("s.ct.symbolTT[symbolValue].deltaNbBits+tableSize > threshold") + } + if normalizedDeltaFromThreshold > bitMultiplier { + panic("normalizedDeltaFromThreshold > bitMultiplier") + } + } + return (minNbBits+1)*bitMultiplier - normalizedDeltaFromThreshold +} + +// Returns the cost in bits of encoding the distribution in count using ctable. +// Histogram should only be up to the last non-zero symbol. +// Returns an -1 if ctable cannot represent all the symbols in count. +func (s *fseEncoder) approxSize(hist []uint32) uint32 { + if int(s.symbolLen) < len(hist) { + // More symbols than we have. + return math.MaxUint32 + } + if s.useRLE { + // We will never reuse RLE encoders. + return math.MaxUint32 + } + const kAccuracyLog = 8 + badCost := (uint32(s.actualTableLog) + 1) << kAccuracyLog + var cost uint32 + for i, v := range hist { + if v == 0 { + continue + } + if s.norm[i] == 0 { + return math.MaxUint32 + } + bitCost := s.bitCost(uint8(i), kAccuracyLog) + if bitCost > badCost { + return math.MaxUint32 + } + cost += v * bitCost + } + return cost >> kAccuracyLog +} + +// maxHeaderSize returns the maximum header size in bits. +// This is not exact size, but we want a penalty for new tables anyway. +func (s *fseEncoder) maxHeaderSize() uint32 { + if s.preDefined { + return 0 + } + if s.useRLE { + return 8 + } + return (((uint32(s.symbolLen) * uint32(s.actualTableLog)) >> 3) + 3) * 8 +} + +// cState contains the compression state of a stream. +type cState struct { + bw *bitWriter + stateTable []uint16 + state uint16 +} + +// init will initialize the compression state to the first symbol of the stream. +func (c *cState) init(bw *bitWriter, ct *cTable, first symbolTransform) { + c.bw = bw + c.stateTable = ct.stateTable + if len(c.stateTable) == 1 { + // RLE + c.stateTable[0] = uint16(0) + c.state = 0 + return + } + nbBitsOut := (first.deltaNbBits + (1 << 15)) >> 16 + im := int32((nbBitsOut << 16) - first.deltaNbBits) + lu := (im >> nbBitsOut) + int32(first.deltaFindState) + c.state = c.stateTable[lu] + return +} + +// encode the output symbol provided and write it to the bitstream. +func (c *cState) encode(symbolTT symbolTransform) { + nbBitsOut := (uint32(c.state) + symbolTT.deltaNbBits) >> 16 + dstState := int32(c.state>>(nbBitsOut&15)) + int32(symbolTT.deltaFindState) + c.bw.addBits16NC(c.state, uint8(nbBitsOut)) + c.state = c.stateTable[dstState] +} + +// flush will write the tablelog to the output and flush the remaining full bytes. +func (c *cState) flush(tableLog uint8) { + c.bw.flush32() + c.bw.addBits16NC(c.state, tableLog) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_predefined.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_predefined.go new file mode 100644 index 000000000000..6c17dc17f4fd --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/fse_predefined.go @@ -0,0 +1,158 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "fmt" + "math" + "sync" +) + +var ( + // fsePredef are the predefined fse tables as defined here: + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#default-distributions + // These values are already transformed. + fsePredef [3]fseDecoder + + // fsePredefEnc are the predefined encoder based on fse tables as defined here: + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#default-distributions + // These values are already transformed. + fsePredefEnc [3]fseEncoder + + // symbolTableX contain the transformations needed for each type as defined in + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#the-codes-for-literals-lengths-match-lengths-and-offsets + symbolTableX [3][]baseOffset + + // maxTableSymbol is the biggest supported symbol for each table type + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#the-codes-for-literals-lengths-match-lengths-and-offsets + maxTableSymbol = [3]uint8{tableLiteralLengths: maxLiteralLengthSymbol, tableOffsets: maxOffsetLengthSymbol, tableMatchLengths: maxMatchLengthSymbol} + + // bitTables is the bits table for each table. + bitTables = [3][]byte{tableLiteralLengths: llBitsTable[:], tableOffsets: nil, tableMatchLengths: mlBitsTable[:]} +) + +type tableIndex uint8 + +const ( + // indexes for fsePredef and symbolTableX + tableLiteralLengths tableIndex = 0 + tableOffsets tableIndex = 1 + tableMatchLengths tableIndex = 2 + + maxLiteralLengthSymbol = 35 + maxOffsetLengthSymbol = 30 + maxMatchLengthSymbol = 52 +) + +// baseOffset is used for calculating transformations. +type baseOffset struct { + baseLine uint32 + addBits uint8 +} + +// fillBase will precalculate base offsets with the given bit distributions. +func fillBase(dst []baseOffset, base uint32, bits ...uint8) { + if len(bits) != len(dst) { + panic(fmt.Sprintf("len(dst) (%d) != len(bits) (%d)", len(dst), len(bits))) + } + for i, bit := range bits { + if base > math.MaxInt32 { + panic(fmt.Sprintf("invalid decoding table, base overflows int32")) + } + + dst[i] = baseOffset{ + baseLine: base, + addBits: bit, + } + base += 1 << bit + } +} + +var predef sync.Once + +func initPredefined() { + predef.Do(func() { + // Literals length codes + tmp := make([]baseOffset, 36) + for i := range tmp[:16] { + tmp[i] = baseOffset{ + baseLine: uint32(i), + addBits: 0, + } + } + fillBase(tmp[16:], 16, 1, 1, 1, 1, 2, 2, 3, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) + symbolTableX[tableLiteralLengths] = tmp + + // Match length codes + tmp = make([]baseOffset, 53) + for i := range tmp[:32] { + tmp[i] = baseOffset{ + // The transformation adds the 3 length. + baseLine: uint32(i) + 3, + addBits: 0, + } + } + fillBase(tmp[32:], 35, 1, 1, 1, 1, 2, 2, 3, 3, 4, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) + symbolTableX[tableMatchLengths] = tmp + + // Offset codes + tmp = make([]baseOffset, maxOffsetBits+1) + tmp[1] = baseOffset{ + baseLine: 1, + addBits: 1, + } + fillBase(tmp[2:], 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30) + symbolTableX[tableOffsets] = tmp + + // Fill predefined tables and transform them. + // https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#default-distributions + for i := range fsePredef[:] { + f := &fsePredef[i] + switch tableIndex(i) { + case tableLiteralLengths: + // https://github.com/facebook/zstd/blob/ededcfca57366461021c922720878c81a5854a0a/lib/decompress/zstd_decompress_block.c#L243 + f.actualTableLog = 6 + copy(f.norm[:], []int16{4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 1, 1, 1, 1, 1, + -1, -1, -1, -1}) + f.symbolLen = 36 + case tableOffsets: + // https://github.com/facebook/zstd/blob/ededcfca57366461021c922720878c81a5854a0a/lib/decompress/zstd_decompress_block.c#L281 + f.actualTableLog = 5 + copy(f.norm[:], []int16{ + 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, -1}) + f.symbolLen = 29 + case tableMatchLengths: + //https://github.com/facebook/zstd/blob/ededcfca57366461021c922720878c81a5854a0a/lib/decompress/zstd_decompress_block.c#L304 + f.actualTableLog = 6 + copy(f.norm[:], []int16{ + 1, 4, 3, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -1, -1, + -1, -1, -1, -1, -1}) + f.symbolLen = 53 + } + if err := f.buildDtable(); err != nil { + panic(fmt.Errorf("building table %v: %v", tableIndex(i), err)) + } + if err := f.transform(symbolTableX[i]); err != nil { + panic(fmt.Errorf("building table %v: %v", tableIndex(i), err)) + } + f.preDefined = true + + // Create encoder as well + enc := &fsePredefEnc[i] + copy(enc.norm[:], f.norm[:]) + enc.symbolLen = f.symbolLen + enc.actualTableLog = f.actualTableLog + if err := enc.buildCTable(); err != nil { + panic(fmt.Errorf("building encoding table %v: %v", tableIndex(i), err)) + } + enc.setBits(bitTables[i]) + enc.preDefined = true + } + }) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/hash.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/hash.go new file mode 100644 index 000000000000..4a752067fc90 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/hash.go @@ -0,0 +1,77 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +const ( + prime3bytes = 506832829 + prime4bytes = 2654435761 + prime5bytes = 889523592379 + prime6bytes = 227718039650203 + prime7bytes = 58295818150454627 + prime8bytes = 0xcf1bbcdcb7a56463 +) + +// hashLen returns a hash of the lowest l bytes of u for a size size of h bytes. +// l must be >=4 and <=8. Any other value will return hash for 4 bytes. +// h should always be <32. +// Preferably h and l should be a constant. +// FIXME: This does NOT get resolved, if 'mls' is constant, +// so this cannot be used. +func hashLen(u uint64, hashLog, mls uint8) uint32 { + switch mls { + case 5: + return hash5(u, hashLog) + case 6: + return hash6(u, hashLog) + case 7: + return hash7(u, hashLog) + case 8: + return hash8(u, hashLog) + default: + return hash4x64(u, hashLog) + } +} + +// hash3 returns the hash of the lower 3 bytes of u to fit in a hash table with h bits. +// Preferably h should be a constant and should always be <32. +func hash3(u uint32, h uint8) uint32 { + return ((u << (32 - 24)) * prime3bytes) >> ((32 - h) & 31) +} + +// hash4 returns the hash of u to fit in a hash table with h bits. +// Preferably h should be a constant and should always be <32. +func hash4(u uint32, h uint8) uint32 { + return (u * prime4bytes) >> ((32 - h) & 31) +} + +// hash4x64 returns the hash of the lowest 4 bytes of u to fit in a hash table with h bits. +// Preferably h should be a constant and should always be <32. +func hash4x64(u uint64, h uint8) uint32 { + return (uint32(u) * prime4bytes) >> ((32 - h) & 31) +} + +// hash5 returns the hash of the lowest 5 bytes of u to fit in a hash table with h bits. +// Preferably h should be a constant and should always be <64. +func hash5(u uint64, h uint8) uint32 { + return uint32(((u << (64 - 40)) * prime5bytes) >> ((64 - h) & 63)) +} + +// hash6 returns the hash of the lowest 6 bytes of u to fit in a hash table with h bits. +// Preferably h should be a constant and should always be <64. +func hash6(u uint64, h uint8) uint32 { + return uint32(((u << (64 - 48)) * prime6bytes) >> ((64 - h) & 63)) +} + +// hash7 returns the hash of the lowest 7 bytes of u to fit in a hash table with h bits. +// Preferably h should be a constant and should always be <64. +func hash7(u uint64, h uint8) uint32 { + return uint32(((u << (64 - 56)) * prime7bytes) >> ((64 - h) & 63)) +} + +// hash8 returns the hash of u to fit in a hash table with h bits. +// Preferably h should be a constant and should always be <64. +func hash8(u uint64, h uint8) uint32 { + return uint32((u * prime8bytes) >> ((64 - h) & 63)) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/history.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/history.go new file mode 100644 index 000000000000..f783e32d251b --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/history.go @@ -0,0 +1,89 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "github.com/klauspost/compress/huff0" +) + +// history contains the information transferred between blocks. +type history struct { + b []byte + huffTree *huff0.Scratch + recentOffsets [3]int + decoders sequenceDecs + windowSize int + maxSize int + error bool + dict *dict +} + +// reset will reset the history to initial state of a frame. +// The history must already have been initialized to the desired size. +func (h *history) reset() { + h.b = h.b[:0] + h.error = false + h.recentOffsets = [3]int{1, 4, 8} + if f := h.decoders.litLengths.fse; f != nil && !f.preDefined { + fseDecoderPool.Put(f) + } + if f := h.decoders.offsets.fse; f != nil && !f.preDefined { + fseDecoderPool.Put(f) + } + if f := h.decoders.matchLengths.fse; f != nil && !f.preDefined { + fseDecoderPool.Put(f) + } + h.decoders = sequenceDecs{} + if h.huffTree != nil { + if h.dict == nil || h.dict.litEnc != h.huffTree { + huffDecoderPool.Put(h.huffTree) + } + } + h.huffTree = nil + h.dict = nil + //printf("history created: %+v (l: %d, c: %d)", *h, len(h.b), cap(h.b)) +} + +func (h *history) setDict(dict *dict) { + if dict == nil { + return + } + h.dict = dict + h.decoders.litLengths = dict.llDec + h.decoders.offsets = dict.ofDec + h.decoders.matchLengths = dict.mlDec + h.recentOffsets = dict.offsets + h.huffTree = dict.litEnc +} + +// append bytes to history. +// This function will make sure there is space for it, +// if the buffer has been allocated with enough extra space. +func (h *history) append(b []byte) { + if len(b) >= h.windowSize { + // Discard all history by simply overwriting + h.b = h.b[:h.windowSize] + copy(h.b, b[len(b)-h.windowSize:]) + return + } + + // If there is space, append it. + if len(b) < cap(h.b)-len(h.b) { + h.b = append(h.b, b...) + return + } + + // Move data down so we only have window size left. + // We know we have less than window size in b at this point. + discard := len(b) + len(h.b) - h.windowSize + copy(h.b, h.b[discard:]) + h.b = h.b[:h.windowSize] + copy(h.b[h.windowSize-len(b):], b) +} + +// append bytes to history without ever discarding anything. +func (h *history) appendKeep(b []byte) { + h.b = append(h.b, b...) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/LICENSE.txt b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/LICENSE.txt new file mode 100644 index 000000000000..24b53065f40b --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2016 Caleb Spare + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/README.md b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/README.md new file mode 100644 index 000000000000..69aa3bb587c8 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/README.md @@ -0,0 +1,58 @@ +# xxhash + +VENDORED: Go to [github.com/cespare/xxhash](https://github.com/cespare/xxhash) for original package. + + +[![GoDoc](https://godoc.org/github.com/cespare/xxhash?status.svg)](https://godoc.org/github.com/cespare/xxhash) +[![Build Status](https://travis-ci.org/cespare/xxhash.svg?branch=master)](https://travis-ci.org/cespare/xxhash) + +xxhash is a Go implementation of the 64-bit +[xxHash](http://cyan4973.github.io/xxHash/) algorithm, XXH64. This is a +high-quality hashing algorithm that is much faster than anything in the Go +standard library. + +This package provides a straightforward API: + +``` +func Sum64(b []byte) uint64 +func Sum64String(s string) uint64 +type Digest struct{ ... } + func New() *Digest +``` + +The `Digest` type implements hash.Hash64. Its key methods are: + +``` +func (*Digest) Write([]byte) (int, error) +func (*Digest) WriteString(string) (int, error) +func (*Digest) Sum64() uint64 +``` + +This implementation provides a fast pure-Go implementation and an even faster +assembly implementation for amd64. + +## Benchmarks + +Here are some quick benchmarks comparing the pure-Go and assembly +implementations of Sum64. + +| input size | purego | asm | +| --- | --- | --- | +| 5 B | 979.66 MB/s | 1291.17 MB/s | +| 100 B | 7475.26 MB/s | 7973.40 MB/s | +| 4 KB | 17573.46 MB/s | 17602.65 MB/s | +| 10 MB | 17131.46 MB/s | 17142.16 MB/s | + +These numbers were generated on Ubuntu 18.04 with an Intel i7-8700K CPU using +the following commands under Go 1.11.2: + +``` +$ go test -tags purego -benchtime 10s -bench '/xxhash,direct,bytes' +$ go test -benchtime 10s -bench '/xxhash,direct,bytes' +``` + +## Projects using this package + +- [InfluxDB](https://github.com/influxdata/influxdb) +- [Prometheus](https://github.com/prometheus/prometheus) +- [FreeCache](https://github.com/coocood/freecache) diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash.go new file mode 100644 index 000000000000..426b9cac7869 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash.go @@ -0,0 +1,238 @@ +// Package xxhash implements the 64-bit variant of xxHash (XXH64) as described +// at http://cyan4973.github.io/xxHash/. +// THIS IS VENDORED: Go to github.com/cespare/xxhash for original package. + +package xxhash + +import ( + "encoding/binary" + "errors" + "math/bits" +) + +const ( + prime1 uint64 = 11400714785074694791 + prime2 uint64 = 14029467366897019727 + prime3 uint64 = 1609587929392839161 + prime4 uint64 = 9650029242287828579 + prime5 uint64 = 2870177450012600261 +) + +// NOTE(caleb): I'm using both consts and vars of the primes. Using consts where +// possible in the Go code is worth a small (but measurable) performance boost +// by avoiding some MOVQs. Vars are needed for the asm and also are useful for +// convenience in the Go code in a few places where we need to intentionally +// avoid constant arithmetic (e.g., v1 := prime1 + prime2 fails because the +// result overflows a uint64). +var ( + prime1v = prime1 + prime2v = prime2 + prime3v = prime3 + prime4v = prime4 + prime5v = prime5 +) + +// Digest implements hash.Hash64. +type Digest struct { + v1 uint64 + v2 uint64 + v3 uint64 + v4 uint64 + total uint64 + mem [32]byte + n int // how much of mem is used +} + +// New creates a new Digest that computes the 64-bit xxHash algorithm. +func New() *Digest { + var d Digest + d.Reset() + return &d +} + +// Reset clears the Digest's state so that it can be reused. +func (d *Digest) Reset() { + d.v1 = prime1v + prime2 + d.v2 = prime2 + d.v3 = 0 + d.v4 = -prime1v + d.total = 0 + d.n = 0 +} + +// Size always returns 8 bytes. +func (d *Digest) Size() int { return 8 } + +// BlockSize always returns 32 bytes. +func (d *Digest) BlockSize() int { return 32 } + +// Write adds more data to d. It always returns len(b), nil. +func (d *Digest) Write(b []byte) (n int, err error) { + n = len(b) + d.total += uint64(n) + + if d.n+n < 32 { + // This new data doesn't even fill the current block. + copy(d.mem[d.n:], b) + d.n += n + return + } + + if d.n > 0 { + // Finish off the partial block. + copy(d.mem[d.n:], b) + d.v1 = round(d.v1, u64(d.mem[0:8])) + d.v2 = round(d.v2, u64(d.mem[8:16])) + d.v3 = round(d.v3, u64(d.mem[16:24])) + d.v4 = round(d.v4, u64(d.mem[24:32])) + b = b[32-d.n:] + d.n = 0 + } + + if len(b) >= 32 { + // One or more full blocks left. + nw := writeBlocks(d, b) + b = b[nw:] + } + + // Store any remaining partial block. + copy(d.mem[:], b) + d.n = len(b) + + return +} + +// Sum appends the current hash to b and returns the resulting slice. +func (d *Digest) Sum(b []byte) []byte { + s := d.Sum64() + return append( + b, + byte(s>>56), + byte(s>>48), + byte(s>>40), + byte(s>>32), + byte(s>>24), + byte(s>>16), + byte(s>>8), + byte(s), + ) +} + +// Sum64 returns the current hash. +func (d *Digest) Sum64() uint64 { + var h uint64 + + if d.total >= 32 { + v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 + h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) + h = mergeRound(h, v1) + h = mergeRound(h, v2) + h = mergeRound(h, v3) + h = mergeRound(h, v4) + } else { + h = d.v3 + prime5 + } + + h += d.total + + i, end := 0, d.n + for ; i+8 <= end; i += 8 { + k1 := round(0, u64(d.mem[i:i+8])) + h ^= k1 + h = rol27(h)*prime1 + prime4 + } + if i+4 <= end { + h ^= uint64(u32(d.mem[i:i+4])) * prime1 + h = rol23(h)*prime2 + prime3 + i += 4 + } + for i < end { + h ^= uint64(d.mem[i]) * prime5 + h = rol11(h) * prime1 + i++ + } + + h ^= h >> 33 + h *= prime2 + h ^= h >> 29 + h *= prime3 + h ^= h >> 32 + + return h +} + +const ( + magic = "xxh\x06" + marshaledSize = len(magic) + 8*5 + 32 +) + +// MarshalBinary implements the encoding.BinaryMarshaler interface. +func (d *Digest) MarshalBinary() ([]byte, error) { + b := make([]byte, 0, marshaledSize) + b = append(b, magic...) + b = appendUint64(b, d.v1) + b = appendUint64(b, d.v2) + b = appendUint64(b, d.v3) + b = appendUint64(b, d.v4) + b = appendUint64(b, d.total) + b = append(b, d.mem[:d.n]...) + b = b[:len(b)+len(d.mem)-d.n] + return b, nil +} + +// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. +func (d *Digest) UnmarshalBinary(b []byte) error { + if len(b) < len(magic) || string(b[:len(magic)]) != magic { + return errors.New("xxhash: invalid hash state identifier") + } + if len(b) != marshaledSize { + return errors.New("xxhash: invalid hash state size") + } + b = b[len(magic):] + b, d.v1 = consumeUint64(b) + b, d.v2 = consumeUint64(b) + b, d.v3 = consumeUint64(b) + b, d.v4 = consumeUint64(b) + b, d.total = consumeUint64(b) + copy(d.mem[:], b) + b = b[len(d.mem):] + d.n = int(d.total % uint64(len(d.mem))) + return nil +} + +func appendUint64(b []byte, x uint64) []byte { + var a [8]byte + binary.LittleEndian.PutUint64(a[:], x) + return append(b, a[:]...) +} + +func consumeUint64(b []byte) ([]byte, uint64) { + x := u64(b) + return b[8:], x +} + +func u64(b []byte) uint64 { return binary.LittleEndian.Uint64(b) } +func u32(b []byte) uint32 { return binary.LittleEndian.Uint32(b) } + +func round(acc, input uint64) uint64 { + acc += input * prime2 + acc = rol31(acc) + acc *= prime1 + return acc +} + +func mergeRound(acc, val uint64) uint64 { + val = round(0, val) + acc ^= val + acc = acc*prime1 + prime4 + return acc +} + +func rol1(x uint64) uint64 { return bits.RotateLeft64(x, 1) } +func rol7(x uint64) uint64 { return bits.RotateLeft64(x, 7) } +func rol11(x uint64) uint64 { return bits.RotateLeft64(x, 11) } +func rol12(x uint64) uint64 { return bits.RotateLeft64(x, 12) } +func rol18(x uint64) uint64 { return bits.RotateLeft64(x, 18) } +func rol23(x uint64) uint64 { return bits.RotateLeft64(x, 23) } +func rol27(x uint64) uint64 { return bits.RotateLeft64(x, 27) } +func rol31(x uint64) uint64 { return bits.RotateLeft64(x, 31) } diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go new file mode 100644 index 000000000000..35318d7c46cb --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.go @@ -0,0 +1,13 @@ +// +build !appengine +// +build gc +// +build !purego + +package xxhash + +// Sum64 computes the 64-bit xxHash digest of b. +// +//go:noescape +func Sum64(b []byte) uint64 + +//go:noescape +func writeBlocks(*Digest, []byte) int diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s new file mode 100644 index 000000000000..2c9c5357a14b --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_amd64.s @@ -0,0 +1,215 @@ +// +build !appengine +// +build gc +// +build !purego + +#include "textflag.h" + +// Register allocation: +// AX h +// CX pointer to advance through b +// DX n +// BX loop end +// R8 v1, k1 +// R9 v2 +// R10 v3 +// R11 v4 +// R12 tmp +// R13 prime1v +// R14 prime2v +// R15 prime4v + +// round reads from and advances the buffer pointer in CX. +// It assumes that R13 has prime1v and R14 has prime2v. +#define round(r) \ + MOVQ (CX), R12 \ + ADDQ $8, CX \ + IMULQ R14, R12 \ + ADDQ R12, r \ + ROLQ $31, r \ + IMULQ R13, r + +// mergeRound applies a merge round on the two registers acc and val. +// It assumes that R13 has prime1v, R14 has prime2v, and R15 has prime4v. +#define mergeRound(acc, val) \ + IMULQ R14, val \ + ROLQ $31, val \ + IMULQ R13, val \ + XORQ val, acc \ + IMULQ R13, acc \ + ADDQ R15, acc + +// func Sum64(b []byte) uint64 +TEXT ·Sum64(SB), NOSPLIT, $0-32 + // Load fixed primes. + MOVQ ·prime1v(SB), R13 + MOVQ ·prime2v(SB), R14 + MOVQ ·prime4v(SB), R15 + + // Load slice. + MOVQ b_base+0(FP), CX + MOVQ b_len+8(FP), DX + LEAQ (CX)(DX*1), BX + + // The first loop limit will be len(b)-32. + SUBQ $32, BX + + // Check whether we have at least one block. + CMPQ DX, $32 + JLT noBlocks + + // Set up initial state (v1, v2, v3, v4). + MOVQ R13, R8 + ADDQ R14, R8 + MOVQ R14, R9 + XORQ R10, R10 + XORQ R11, R11 + SUBQ R13, R11 + + // Loop until CX > BX. +blockLoop: + round(R8) + round(R9) + round(R10) + round(R11) + + CMPQ CX, BX + JLE blockLoop + + MOVQ R8, AX + ROLQ $1, AX + MOVQ R9, R12 + ROLQ $7, R12 + ADDQ R12, AX + MOVQ R10, R12 + ROLQ $12, R12 + ADDQ R12, AX + MOVQ R11, R12 + ROLQ $18, R12 + ADDQ R12, AX + + mergeRound(AX, R8) + mergeRound(AX, R9) + mergeRound(AX, R10) + mergeRound(AX, R11) + + JMP afterBlocks + +noBlocks: + MOVQ ·prime5v(SB), AX + +afterBlocks: + ADDQ DX, AX + + // Right now BX has len(b)-32, and we want to loop until CX > len(b)-8. + ADDQ $24, BX + + CMPQ CX, BX + JG fourByte + +wordLoop: + // Calculate k1. + MOVQ (CX), R8 + ADDQ $8, CX + IMULQ R14, R8 + ROLQ $31, R8 + IMULQ R13, R8 + + XORQ R8, AX + ROLQ $27, AX + IMULQ R13, AX + ADDQ R15, AX + + CMPQ CX, BX + JLE wordLoop + +fourByte: + ADDQ $4, BX + CMPQ CX, BX + JG singles + + MOVL (CX), R8 + ADDQ $4, CX + IMULQ R13, R8 + XORQ R8, AX + + ROLQ $23, AX + IMULQ R14, AX + ADDQ ·prime3v(SB), AX + +singles: + ADDQ $4, BX + CMPQ CX, BX + JGE finalize + +singlesLoop: + MOVBQZX (CX), R12 + ADDQ $1, CX + IMULQ ·prime5v(SB), R12 + XORQ R12, AX + + ROLQ $11, AX + IMULQ R13, AX + + CMPQ CX, BX + JL singlesLoop + +finalize: + MOVQ AX, R12 + SHRQ $33, R12 + XORQ R12, AX + IMULQ R14, AX + MOVQ AX, R12 + SHRQ $29, R12 + XORQ R12, AX + IMULQ ·prime3v(SB), AX + MOVQ AX, R12 + SHRQ $32, R12 + XORQ R12, AX + + MOVQ AX, ret+24(FP) + RET + +// writeBlocks uses the same registers as above except that it uses AX to store +// the d pointer. + +// func writeBlocks(d *Digest, b []byte) int +TEXT ·writeBlocks(SB), NOSPLIT, $0-40 + // Load fixed primes needed for round. + MOVQ ·prime1v(SB), R13 + MOVQ ·prime2v(SB), R14 + + // Load slice. + MOVQ arg1_base+8(FP), CX + MOVQ arg1_len+16(FP), DX + LEAQ (CX)(DX*1), BX + SUBQ $32, BX + + // Load vN from d. + MOVQ arg+0(FP), AX + MOVQ 0(AX), R8 // v1 + MOVQ 8(AX), R9 // v2 + MOVQ 16(AX), R10 // v3 + MOVQ 24(AX), R11 // v4 + + // We don't need to check the loop condition here; this function is + // always called with at least one block of data to process. +blockLoop: + round(R8) + round(R9) + round(R10) + round(R11) + + CMPQ CX, BX + JLE blockLoop + + // Copy vN back to d. + MOVQ R8, 0(AX) + MOVQ R9, 8(AX) + MOVQ R10, 16(AX) + MOVQ R11, 24(AX) + + // The number of bytes written is CX minus the old base pointer. + SUBQ arg1_base+8(FP), CX + MOVQ CX, ret+32(FP) + + RET diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go new file mode 100644 index 000000000000..4a5a821603e5 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_other.go @@ -0,0 +1,76 @@ +// +build !amd64 appengine !gc purego + +package xxhash + +// Sum64 computes the 64-bit xxHash digest of b. +func Sum64(b []byte) uint64 { + // A simpler version would be + // d := New() + // d.Write(b) + // return d.Sum64() + // but this is faster, particularly for small inputs. + + n := len(b) + var h uint64 + + if n >= 32 { + v1 := prime1v + prime2 + v2 := prime2 + v3 := uint64(0) + v4 := -prime1v + for len(b) >= 32 { + v1 = round(v1, u64(b[0:8:len(b)])) + v2 = round(v2, u64(b[8:16:len(b)])) + v3 = round(v3, u64(b[16:24:len(b)])) + v4 = round(v4, u64(b[24:32:len(b)])) + b = b[32:len(b):len(b)] + } + h = rol1(v1) + rol7(v2) + rol12(v3) + rol18(v4) + h = mergeRound(h, v1) + h = mergeRound(h, v2) + h = mergeRound(h, v3) + h = mergeRound(h, v4) + } else { + h = prime5 + } + + h += uint64(n) + + i, end := 0, len(b) + for ; i+8 <= end; i += 8 { + k1 := round(0, u64(b[i:i+8:len(b)])) + h ^= k1 + h = rol27(h)*prime1 + prime4 + } + if i+4 <= end { + h ^= uint64(u32(b[i:i+4:len(b)])) * prime1 + h = rol23(h)*prime2 + prime3 + i += 4 + } + for ; i < end; i++ { + h ^= uint64(b[i]) * prime5 + h = rol11(h) * prime1 + } + + h ^= h >> 33 + h *= prime2 + h ^= h >> 29 + h *= prime3 + h ^= h >> 32 + + return h +} + +func writeBlocks(d *Digest, b []byte) int { + v1, v2, v3, v4 := d.v1, d.v2, d.v3, d.v4 + n := len(b) + for len(b) >= 32 { + v1 = round(v1, u64(b[0:8:len(b)])) + v2 = round(v2, u64(b[8:16:len(b)])) + v3 = round(v3, u64(b[16:24:len(b)])) + v4 = round(v4, u64(b[24:32:len(b)])) + b = b[32:len(b):len(b)] + } + d.v1, d.v2, d.v3, d.v4 = v1, v2, v3, v4 + return n - len(b) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_safe.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_safe.go new file mode 100644 index 000000000000..6f3b0cb10264 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/internal/xxhash/xxhash_safe.go @@ -0,0 +1,11 @@ +package xxhash + +// Sum64String computes the 64-bit xxHash digest of s. +func Sum64String(s string) uint64 { + return Sum64([]byte(s)) +} + +// WriteString adds more data to d. It always returns len(s), nil. +func (d *Digest) WriteString(s string) (n int, err error) { + return d.Write([]byte(s)) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/seqdec.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/seqdec.go new file mode 100644 index 000000000000..b5c8ef133296 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/seqdec.go @@ -0,0 +1,485 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "errors" + "fmt" + "io" +) + +type seq struct { + litLen uint32 + matchLen uint32 + offset uint32 + + // Codes are stored here for the encoder + // so they only have to be looked up once. + llCode, mlCode, ofCode uint8 +} + +func (s seq) String() string { + if s.offset <= 3 { + if s.offset == 0 { + return fmt.Sprint("litLen:", s.litLen, ", matchLen:", s.matchLen+zstdMinMatch, ", offset: INVALID (0)") + } + return fmt.Sprint("litLen:", s.litLen, ", matchLen:", s.matchLen+zstdMinMatch, ", offset:", s.offset, " (repeat)") + } + return fmt.Sprint("litLen:", s.litLen, ", matchLen:", s.matchLen+zstdMinMatch, ", offset:", s.offset-3, " (new)") +} + +type seqCompMode uint8 + +const ( + compModePredefined seqCompMode = iota + compModeRLE + compModeFSE + compModeRepeat +) + +type sequenceDec struct { + // decoder keeps track of the current state and updates it from the bitstream. + fse *fseDecoder + state fseState + repeat bool +} + +// init the state of the decoder with input from stream. +func (s *sequenceDec) init(br *bitReader) error { + if s.fse == nil { + return errors.New("sequence decoder not defined") + } + s.state.init(br, s.fse.actualTableLog, s.fse.dt[:1<= 0; i-- { + if br.overread() { + printf("reading sequence %d, exceeded available data\n", seqs-i) + return io.ErrUnexpectedEOF + } + var ll, mo, ml int + if br.off > 4+((maxOffsetBits+16+16)>>3) { + // inlined function: + // ll, mo, ml = s.nextFast(br, llState, mlState, ofState) + + // Final will not read from stream. + var llB, mlB, moB uint8 + ll, llB = llState.final() + ml, mlB = mlState.final() + mo, moB = ofState.final() + + // extra bits are stored in reverse order. + br.fillFast() + mo += br.getBits(moB) + if s.maxBits > 32 { + br.fillFast() + } + ml += br.getBits(mlB) + ll += br.getBits(llB) + + if moB > 1 { + s.prevOffset[2] = s.prevOffset[1] + s.prevOffset[1] = s.prevOffset[0] + s.prevOffset[0] = mo + } else { + // mo = s.adjustOffset(mo, ll, moB) + // Inlined for rather big speedup + if ll == 0 { + // There is an exception though, when current sequence's literals_length = 0. + // In this case, repeated offsets are shifted by one, so an offset_value of 1 means Repeated_Offset2, + // an offset_value of 2 means Repeated_Offset3, and an offset_value of 3 means Repeated_Offset1 - 1_byte. + mo++ + } + + if mo == 0 { + mo = s.prevOffset[0] + } else { + var temp int + if mo == 3 { + temp = s.prevOffset[0] - 1 + } else { + temp = s.prevOffset[mo] + } + + if temp == 0 { + // 0 is not valid; input is corrupted; force offset to 1 + println("temp was 0") + temp = 1 + } + + if mo != 1 { + s.prevOffset[2] = s.prevOffset[1] + } + s.prevOffset[1] = s.prevOffset[0] + s.prevOffset[0] = temp + mo = temp + } + } + br.fillFast() + } else { + ll, mo, ml = s.next(br, llState, mlState, ofState) + br.fill() + } + + if debugSequences { + println("Seq", seqs-i-1, "Litlen:", ll, "mo:", mo, "(abs) ml:", ml) + } + + if ll > len(s.literals) { + return fmt.Errorf("unexpected literal count, want %d bytes, but only %d is available", ll, len(s.literals)) + } + size := ll + ml + len(s.out) + if size-startSize > maxBlockSize { + return fmt.Errorf("output (%d) bigger than max block size", size) + } + if size > cap(s.out) { + // Not enough size, will be extremely rarely triggered, + // but could be if destination slice is too small for sync operations. + // We add maxBlockSize to the capacity. + s.out = append(s.out, make([]byte, maxBlockSize)...) + s.out = s.out[:len(s.out)-maxBlockSize] + } + if ml > maxMatchLen { + return fmt.Errorf("match len (%d) bigger than max allowed length", ml) + } + + // Add literals + s.out = append(s.out, s.literals[:ll]...) + s.literals = s.literals[ll:] + out := s.out + + if mo == 0 && ml > 0 { + return fmt.Errorf("zero matchoff and matchlen (%d) > 0", ml) + } + + if mo > len(s.out)+len(hist) || mo > s.windowSize { + if len(s.dict) == 0 { + return fmt.Errorf("match offset (%d) bigger than current history (%d)", mo, len(s.out)+len(hist)) + } + + // we may be in dictionary. + dictO := len(s.dict) - (mo - (len(s.out) + len(hist))) + if dictO < 0 || dictO >= len(s.dict) { + return fmt.Errorf("match offset (%d) bigger than current history (%d)", mo, len(s.out)+len(hist)) + } + end := dictO + ml + if end > len(s.dict) { + out = append(out, s.dict[dictO:]...) + mo -= len(s.dict) - dictO + ml -= len(s.dict) - dictO + } else { + out = append(out, s.dict[dictO:end]...) + mo = 0 + ml = 0 + } + } + + // Copy from history. + // TODO: Blocks without history could be made to ignore this completely. + if v := mo - len(s.out); v > 0 { + // v is the start position in history from end. + start := len(s.hist) - v + if ml > v { + // Some goes into current block. + // Copy remainder of history + out = append(out, s.hist[start:]...) + mo -= v + ml -= v + } else { + out = append(out, s.hist[start:start+ml]...) + ml = 0 + } + } + // We must be in current buffer now + if ml > 0 { + start := len(s.out) - mo + if ml <= len(s.out)-start { + // No overlap + out = append(out, s.out[start:start+ml]...) + } else { + // Overlapping copy + // Extend destination slice and copy one byte at the time. + out = out[:len(out)+ml] + src := out[start : start+ml] + // Destination is the space we just added. + dst := out[len(out)-ml:] + dst = dst[:len(src)] + for i := range src { + dst[i] = src[i] + } + } + } + s.out = out + if i == 0 { + // This is the last sequence, so we shouldn't update state. + break + } + + // Manually inlined, ~ 5-20% faster + // Update all 3 states at once. Approx 20% faster. + nBits := llState.nbBits() + mlState.nbBits() + ofState.nbBits() + if nBits == 0 { + llState = llTable[llState.newState()&maxTableMask] + mlState = mlTable[mlState.newState()&maxTableMask] + ofState = ofTable[ofState.newState()&maxTableMask] + } else { + bits := br.getBitsFast(nBits) + lowBits := uint16(bits >> ((ofState.nbBits() + mlState.nbBits()) & 31)) + llState = llTable[(llState.newState()+lowBits)&maxTableMask] + + lowBits = uint16(bits >> (ofState.nbBits() & 31)) + lowBits &= bitMask[mlState.nbBits()&15] + mlState = mlTable[(mlState.newState()+lowBits)&maxTableMask] + + lowBits = uint16(bits) & bitMask[ofState.nbBits()&15] + ofState = ofTable[(ofState.newState()+lowBits)&maxTableMask] + } + } + + // Add final literals + s.out = append(s.out, s.literals...) + return nil +} + +// update states, at least 27 bits must be available. +func (s *sequenceDecs) update(br *bitReader) { + // Max 8 bits + s.litLengths.state.next(br) + // Max 9 bits + s.matchLengths.state.next(br) + // Max 8 bits + s.offsets.state.next(br) +} + +var bitMask [16]uint16 + +func init() { + for i := range bitMask[:] { + bitMask[i] = uint16((1 << uint(i)) - 1) + } +} + +// update states, at least 27 bits must be available. +func (s *sequenceDecs) updateAlt(br *bitReader) { + // Update all 3 states at once. Approx 20% faster. + a, b, c := s.litLengths.state.state, s.matchLengths.state.state, s.offsets.state.state + + nBits := a.nbBits() + b.nbBits() + c.nbBits() + if nBits == 0 { + s.litLengths.state.state = s.litLengths.state.dt[a.newState()] + s.matchLengths.state.state = s.matchLengths.state.dt[b.newState()] + s.offsets.state.state = s.offsets.state.dt[c.newState()] + return + } + bits := br.getBitsFast(nBits) + lowBits := uint16(bits >> ((c.nbBits() + b.nbBits()) & 31)) + s.litLengths.state.state = s.litLengths.state.dt[a.newState()+lowBits] + + lowBits = uint16(bits >> (c.nbBits() & 31)) + lowBits &= bitMask[b.nbBits()&15] + s.matchLengths.state.state = s.matchLengths.state.dt[b.newState()+lowBits] + + lowBits = uint16(bits) & bitMask[c.nbBits()&15] + s.offsets.state.state = s.offsets.state.dt[c.newState()+lowBits] +} + +// nextFast will return new states when there are at least 4 unused bytes left on the stream when done. +func (s *sequenceDecs) nextFast(br *bitReader, llState, mlState, ofState decSymbol) (ll, mo, ml int) { + // Final will not read from stream. + ll, llB := llState.final() + ml, mlB := mlState.final() + mo, moB := ofState.final() + + // extra bits are stored in reverse order. + br.fillFast() + mo += br.getBits(moB) + if s.maxBits > 32 { + br.fillFast() + } + ml += br.getBits(mlB) + ll += br.getBits(llB) + + if moB > 1 { + s.prevOffset[2] = s.prevOffset[1] + s.prevOffset[1] = s.prevOffset[0] + s.prevOffset[0] = mo + return + } + // mo = s.adjustOffset(mo, ll, moB) + // Inlined for rather big speedup + if ll == 0 { + // There is an exception though, when current sequence's literals_length = 0. + // In this case, repeated offsets are shifted by one, so an offset_value of 1 means Repeated_Offset2, + // an offset_value of 2 means Repeated_Offset3, and an offset_value of 3 means Repeated_Offset1 - 1_byte. + mo++ + } + + if mo == 0 { + mo = s.prevOffset[0] + return + } + var temp int + if mo == 3 { + temp = s.prevOffset[0] - 1 + } else { + temp = s.prevOffset[mo] + } + + if temp == 0 { + // 0 is not valid; input is corrupted; force offset to 1 + println("temp was 0") + temp = 1 + } + + if mo != 1 { + s.prevOffset[2] = s.prevOffset[1] + } + s.prevOffset[1] = s.prevOffset[0] + s.prevOffset[0] = temp + mo = temp + return +} + +func (s *sequenceDecs) next(br *bitReader, llState, mlState, ofState decSymbol) (ll, mo, ml int) { + // Final will not read from stream. + ll, llB := llState.final() + ml, mlB := mlState.final() + mo, moB := ofState.final() + + // extra bits are stored in reverse order. + br.fill() + if s.maxBits <= 32 { + mo += br.getBits(moB) + ml += br.getBits(mlB) + ll += br.getBits(llB) + } else { + mo += br.getBits(moB) + br.fill() + // matchlength+literal length, max 32 bits + ml += br.getBits(mlB) + ll += br.getBits(llB) + + } + mo = s.adjustOffset(mo, ll, moB) + return +} + +func (s *sequenceDecs) adjustOffset(offset, litLen int, offsetB uint8) int { + if offsetB > 1 { + s.prevOffset[2] = s.prevOffset[1] + s.prevOffset[1] = s.prevOffset[0] + s.prevOffset[0] = offset + return offset + } + + if litLen == 0 { + // There is an exception though, when current sequence's literals_length = 0. + // In this case, repeated offsets are shifted by one, so an offset_value of 1 means Repeated_Offset2, + // an offset_value of 2 means Repeated_Offset3, and an offset_value of 3 means Repeated_Offset1 - 1_byte. + offset++ + } + + if offset == 0 { + return s.prevOffset[0] + } + var temp int + if offset == 3 { + temp = s.prevOffset[0] - 1 + } else { + temp = s.prevOffset[offset] + } + + if temp == 0 { + // 0 is not valid; input is corrupted; force offset to 1 + println("temp was 0") + temp = 1 + } + + if offset != 1 { + s.prevOffset[2] = s.prevOffset[1] + } + s.prevOffset[1] = s.prevOffset[0] + s.prevOffset[0] = temp + return temp +} + +// mergeHistory will merge history. +func (s *sequenceDecs) mergeHistory(hist *sequenceDecs) (*sequenceDecs, error) { + for i := uint(0); i < 3; i++ { + var sNew, sHist *sequenceDec + switch i { + default: + // same as "case 0": + sNew = &s.litLengths + sHist = &hist.litLengths + case 1: + sNew = &s.offsets + sHist = &hist.offsets + case 2: + sNew = &s.matchLengths + sHist = &hist.matchLengths + } + if sNew.repeat { + if sHist.fse == nil { + return nil, fmt.Errorf("sequence stream %d, repeat requested, but no history", i) + } + continue + } + if sNew.fse == nil { + return nil, fmt.Errorf("sequence stream %d, no fse found", i) + } + if sHist.fse != nil && !sHist.fse.preDefined { + fseDecoderPool.Put(sHist.fse) + } + sHist.fse = sNew.fse + } + return hist, nil +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/seqenc.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/seqenc.go new file mode 100644 index 000000000000..36bcc3cc02eb --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/seqenc.go @@ -0,0 +1,115 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import "math/bits" + +type seqCoders struct { + llEnc, ofEnc, mlEnc *fseEncoder + llPrev, ofPrev, mlPrev *fseEncoder +} + +// swap coders with another (block). +func (s *seqCoders) swap(other *seqCoders) { + *s, *other = *other, *s +} + +// setPrev will update the previous encoders to the actually used ones +// and make sure a fresh one is in the main slot. +func (s *seqCoders) setPrev(ll, ml, of *fseEncoder) { + compareSwap := func(used *fseEncoder, current, prev **fseEncoder) { + // We used the new one, more current to history and reuse the previous history + if *current == used { + *prev, *current = *current, *prev + c := *current + p := *prev + c.reUsed = false + p.reUsed = true + return + } + if used == *prev { + return + } + // Ensure we cannot reuse by accident + prevEnc := *prev + prevEnc.symbolLen = 0 + return + } + compareSwap(ll, &s.llEnc, &s.llPrev) + compareSwap(ml, &s.mlEnc, &s.mlPrev) + compareSwap(of, &s.ofEnc, &s.ofPrev) +} + +func highBit(val uint32) (n uint32) { + return uint32(bits.Len32(val) - 1) +} + +var llCodeTable = [64]byte{0, 1, 2, 3, 4, 5, 6, 7, + 8, 9, 10, 11, 12, 13, 14, 15, + 16, 16, 17, 17, 18, 18, 19, 19, + 20, 20, 20, 20, 21, 21, 21, 21, + 22, 22, 22, 22, 22, 22, 22, 22, + 23, 23, 23, 23, 23, 23, 23, 23, + 24, 24, 24, 24, 24, 24, 24, 24, + 24, 24, 24, 24, 24, 24, 24, 24} + +// Up to 6 bits +const maxLLCode = 35 + +// llBitsTable translates from ll code to number of bits. +var llBitsTable = [maxLLCode + 1]byte{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 2, 2, 3, 3, + 4, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16} + +// llCode returns the code that represents the literal length requested. +func llCode(litLength uint32) uint8 { + const llDeltaCode = 19 + if litLength <= 63 { + // Compiler insists on bounds check (Go 1.12) + return llCodeTable[litLength&63] + } + return uint8(highBit(litLength)) + llDeltaCode +} + +var mlCodeTable = [128]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 36, 36, 37, 37, 37, 37, + 38, 38, 38, 38, 38, 38, 38, 38, 39, 39, 39, 39, 39, 39, 39, 39, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, + 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42} + +// Up to 6 bits +const maxMLCode = 52 + +// mlBitsTable translates from ml code to number of bits. +var mlBitsTable = [maxMLCode + 1]byte{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 1, 1, 1, 1, 2, 2, 3, 3, + 4, 4, 5, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16} + +// note : mlBase = matchLength - MINMATCH; +// because it's the format it's stored in seqStore->sequences +func mlCode(mlBase uint32) uint8 { + const mlDeltaCode = 36 + if mlBase <= 127 { + // Compiler insists on bounds check (Go 1.12) + return mlCodeTable[mlBase&127] + } + return uint8(highBit(mlBase)) + mlDeltaCode +} + +func ofCode(offset uint32) uint8 { + // A valid offset will always be > 0. + return uint8(bits.Len32(offset) - 1) +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/snappy.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/snappy.go new file mode 100644 index 000000000000..841fd95acce9 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/snappy.go @@ -0,0 +1,436 @@ +// Copyright 2019+ Klaus Post. All rights reserved. +// License information can be found in the LICENSE file. +// Based on work by Yann Collet, released under BSD License. + +package zstd + +import ( + "encoding/binary" + "errors" + "hash/crc32" + "io" + + "github.com/klauspost/compress/huff0" + "github.com/klauspost/compress/snappy" +) + +const ( + snappyTagLiteral = 0x00 + snappyTagCopy1 = 0x01 + snappyTagCopy2 = 0x02 + snappyTagCopy4 = 0x03 +) + +const ( + snappyChecksumSize = 4 + snappyMagicBody = "sNaPpY" + + // snappyMaxBlockSize is the maximum size of the input to encodeBlock. It is not + // part of the wire format per se, but some parts of the encoder assume + // that an offset fits into a uint16. + // + // Also, for the framing format (Writer type instead of Encode function), + // https://github.com/google/snappy/blob/master/framing_format.txt says + // that "the uncompressed data in a chunk must be no longer than 65536 + // bytes". + snappyMaxBlockSize = 65536 + + // snappyMaxEncodedLenOfMaxBlockSize equals MaxEncodedLen(snappyMaxBlockSize), but is + // hard coded to be a const instead of a variable, so that obufLen can also + // be a const. Their equivalence is confirmed by + // TestMaxEncodedLenOfMaxBlockSize. + snappyMaxEncodedLenOfMaxBlockSize = 76490 +) + +const ( + chunkTypeCompressedData = 0x00 + chunkTypeUncompressedData = 0x01 + chunkTypePadding = 0xfe + chunkTypeStreamIdentifier = 0xff +) + +var ( + // ErrSnappyCorrupt reports that the input is invalid. + ErrSnappyCorrupt = errors.New("snappy: corrupt input") + // ErrSnappyTooLarge reports that the uncompressed length is too large. + ErrSnappyTooLarge = errors.New("snappy: decoded block is too large") + // ErrSnappyUnsupported reports that the input isn't supported. + ErrSnappyUnsupported = errors.New("snappy: unsupported input") + + errUnsupportedLiteralLength = errors.New("snappy: unsupported literal length") +) + +// SnappyConverter can read SnappyConverter-compressed streams and convert them to zstd. +// Conversion is done by converting the stream directly from Snappy without intermediate +// full decoding. +// Therefore the compression ratio is much less than what can be done by a full decompression +// and compression, and a faulty Snappy stream may lead to a faulty Zstandard stream without +// any errors being generated. +// No CRC value is being generated and not all CRC values of the Snappy stream are checked. +// However, it provides really fast recompression of Snappy streams. +// The converter can be reused to avoid allocations, even after errors. +type SnappyConverter struct { + r io.Reader + err error + buf []byte + block *blockEnc +} + +// Convert the Snappy stream supplied in 'in' and write the zStandard stream to 'w'. +// If any error is detected on the Snappy stream it is returned. +// The number of bytes written is returned. +func (r *SnappyConverter) Convert(in io.Reader, w io.Writer) (int64, error) { + initPredefined() + r.err = nil + r.r = in + if r.block == nil { + r.block = &blockEnc{} + r.block.init() + } + r.block.initNewEncode() + if len(r.buf) != snappyMaxEncodedLenOfMaxBlockSize+snappyChecksumSize { + r.buf = make([]byte, snappyMaxEncodedLenOfMaxBlockSize+snappyChecksumSize) + } + r.block.litEnc.Reuse = huff0.ReusePolicyNone + var written int64 + var readHeader bool + { + var header []byte + var n int + header, r.err = frameHeader{WindowSize: snappyMaxBlockSize}.appendTo(r.buf[:0]) + + n, r.err = w.Write(header) + if r.err != nil { + return written, r.err + } + written += int64(n) + } + + for { + if !r.readFull(r.buf[:4], true) { + // Add empty last block + r.block.reset(nil) + r.block.last = true + err := r.block.encodeLits(r.block.literals, false) + if err != nil { + return written, err + } + n, err := w.Write(r.block.output) + if err != nil { + return written, err + } + written += int64(n) + + return written, r.err + } + chunkType := r.buf[0] + if !readHeader { + if chunkType != chunkTypeStreamIdentifier { + println("chunkType != chunkTypeStreamIdentifier", chunkType) + r.err = ErrSnappyCorrupt + return written, r.err + } + readHeader = true + } + chunkLen := int(r.buf[1]) | int(r.buf[2])<<8 | int(r.buf[3])<<16 + if chunkLen > len(r.buf) { + println("chunkLen > len(r.buf)", chunkType) + r.err = ErrSnappyUnsupported + return written, r.err + } + + // The chunk types are specified at + // https://github.com/google/snappy/blob/master/framing_format.txt + switch chunkType { + case chunkTypeCompressedData: + // Section 4.2. Compressed data (chunk type 0x00). + if chunkLen < snappyChecksumSize { + println("chunkLen < snappyChecksumSize", chunkLen, snappyChecksumSize) + r.err = ErrSnappyCorrupt + return written, r.err + } + buf := r.buf[:chunkLen] + if !r.readFull(buf, false) { + return written, r.err + } + //checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + buf = buf[snappyChecksumSize:] + + n, hdr, err := snappyDecodedLen(buf) + if err != nil { + r.err = err + return written, r.err + } + buf = buf[hdr:] + if n > snappyMaxBlockSize { + println("n > snappyMaxBlockSize", n, snappyMaxBlockSize) + r.err = ErrSnappyCorrupt + return written, r.err + } + r.block.reset(nil) + r.block.pushOffsets() + if err := decodeSnappy(r.block, buf); err != nil { + r.err = err + return written, r.err + } + if r.block.size+r.block.extraLits != n { + printf("invalid size, want %d, got %d\n", n, r.block.size+r.block.extraLits) + r.err = ErrSnappyCorrupt + return written, r.err + } + err = r.block.encode(nil, false, false) + switch err { + case errIncompressible: + r.block.popOffsets() + r.block.reset(nil) + r.block.literals, err = snappy.Decode(r.block.literals[:n], r.buf[snappyChecksumSize:chunkLen]) + if err != nil { + println("snappy.Decode:", err) + return written, err + } + err = r.block.encodeLits(r.block.literals, false) + if err != nil { + return written, err + } + case nil: + default: + return written, err + } + + n, r.err = w.Write(r.block.output) + if r.err != nil { + return written, err + } + written += int64(n) + continue + case chunkTypeUncompressedData: + if debug { + println("Uncompressed, chunklen", chunkLen) + } + // Section 4.3. Uncompressed data (chunk type 0x01). + if chunkLen < snappyChecksumSize { + println("chunkLen < snappyChecksumSize", chunkLen, snappyChecksumSize) + r.err = ErrSnappyCorrupt + return written, r.err + } + r.block.reset(nil) + buf := r.buf[:snappyChecksumSize] + if !r.readFull(buf, false) { + return written, r.err + } + checksum := uint32(buf[0]) | uint32(buf[1])<<8 | uint32(buf[2])<<16 | uint32(buf[3])<<24 + // Read directly into r.decoded instead of via r.buf. + n := chunkLen - snappyChecksumSize + if n > snappyMaxBlockSize { + println("n > snappyMaxBlockSize", n, snappyMaxBlockSize) + r.err = ErrSnappyCorrupt + return written, r.err + } + r.block.literals = r.block.literals[:n] + if !r.readFull(r.block.literals, false) { + return written, r.err + } + if snappyCRC(r.block.literals) != checksum { + println("literals crc mismatch") + r.err = ErrSnappyCorrupt + return written, r.err + } + err := r.block.encodeLits(r.block.literals, false) + if err != nil { + return written, err + } + n, r.err = w.Write(r.block.output) + if r.err != nil { + return written, err + } + written += int64(n) + continue + + case chunkTypeStreamIdentifier: + if debug { + println("stream id", chunkLen, len(snappyMagicBody)) + } + // Section 4.1. Stream identifier (chunk type 0xff). + if chunkLen != len(snappyMagicBody) { + println("chunkLen != len(snappyMagicBody)", chunkLen, len(snappyMagicBody)) + r.err = ErrSnappyCorrupt + return written, r.err + } + if !r.readFull(r.buf[:len(snappyMagicBody)], false) { + return written, r.err + } + for i := 0; i < len(snappyMagicBody); i++ { + if r.buf[i] != snappyMagicBody[i] { + println("r.buf[i] != snappyMagicBody[i]", r.buf[i], snappyMagicBody[i], i) + r.err = ErrSnappyCorrupt + return written, r.err + } + } + continue + } + + if chunkType <= 0x7f { + // Section 4.5. Reserved unskippable chunks (chunk types 0x02-0x7f). + println("chunkType <= 0x7f") + r.err = ErrSnappyUnsupported + return written, r.err + } + // Section 4.4 Padding (chunk type 0xfe). + // Section 4.6. Reserved skippable chunks (chunk types 0x80-0xfd). + if !r.readFull(r.buf[:chunkLen], false) { + return written, r.err + } + } +} + +// decodeSnappy writes the decoding of src to dst. It assumes that the varint-encoded +// length of the decompressed bytes has already been read. +func decodeSnappy(blk *blockEnc, src []byte) error { + //decodeRef(make([]byte, snappyMaxBlockSize), src) + var s, length int + lits := blk.extraLits + var offset uint32 + for s < len(src) { + switch src[s] & 0x03 { + case snappyTagLiteral: + x := uint32(src[s] >> 2) + switch { + case x < 60: + s++ + case x == 60: + s += 2 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + println("uint(s) > uint(len(src)", s, src) + return ErrSnappyCorrupt + } + x = uint32(src[s-1]) + case x == 61: + s += 3 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + println("uint(s) > uint(len(src)", s, src) + return ErrSnappyCorrupt + } + x = uint32(src[s-2]) | uint32(src[s-1])<<8 + case x == 62: + s += 4 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + println("uint(s) > uint(len(src)", s, src) + return ErrSnappyCorrupt + } + x = uint32(src[s-3]) | uint32(src[s-2])<<8 | uint32(src[s-1])<<16 + case x == 63: + s += 5 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + println("uint(s) > uint(len(src)", s, src) + return ErrSnappyCorrupt + } + x = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24 + } + if x > snappyMaxBlockSize { + println("x > snappyMaxBlockSize", x, snappyMaxBlockSize) + return ErrSnappyCorrupt + } + length = int(x) + 1 + if length <= 0 { + println("length <= 0 ", length) + + return errUnsupportedLiteralLength + } + //if length > snappyMaxBlockSize-d || uint32(length) > len(src)-s { + // return ErrSnappyCorrupt + //} + + blk.literals = append(blk.literals, src[s:s+length]...) + //println(length, "litLen") + lits += length + s += length + continue + + case snappyTagCopy1: + s += 2 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + println("uint(s) > uint(len(src)", s, len(src)) + return ErrSnappyCorrupt + } + length = 4 + int(src[s-2])>>2&0x7 + offset = uint32(src[s-2])&0xe0<<3 | uint32(src[s-1]) + + case snappyTagCopy2: + s += 3 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + println("uint(s) > uint(len(src)", s, len(src)) + return ErrSnappyCorrupt + } + length = 1 + int(src[s-3])>>2 + offset = uint32(src[s-2]) | uint32(src[s-1])<<8 + + case snappyTagCopy4: + s += 5 + if uint(s) > uint(len(src)) { // The uint conversions catch overflow from the previous line. + println("uint(s) > uint(len(src)", s, len(src)) + return ErrSnappyCorrupt + } + length = 1 + int(src[s-5])>>2 + offset = uint32(src[s-4]) | uint32(src[s-3])<<8 | uint32(src[s-2])<<16 | uint32(src[s-1])<<24 + } + + if offset <= 0 || blk.size+lits < int(offset) /*|| length > len(blk)-d */ { + println("offset <= 0 || blk.size+lits < int(offset)", offset, blk.size+lits, int(offset), blk.size, lits) + + return ErrSnappyCorrupt + } + + // Check if offset is one of the recent offsets. + // Adjusts the output offset accordingly. + // Gives a tiny bit of compression, typically around 1%. + if false { + offset = blk.matchOffset(offset, uint32(lits)) + } else { + offset += 3 + } + + blk.sequences = append(blk.sequences, seq{ + litLen: uint32(lits), + offset: offset, + matchLen: uint32(length) - zstdMinMatch, + }) + blk.size += length + lits + lits = 0 + } + blk.extraLits = lits + return nil +} + +func (r *SnappyConverter) readFull(p []byte, allowEOF bool) (ok bool) { + if _, r.err = io.ReadFull(r.r, p); r.err != nil { + if r.err == io.ErrUnexpectedEOF || (r.err == io.EOF && !allowEOF) { + r.err = ErrSnappyCorrupt + } + return false + } + return true +} + +var crcTable = crc32.MakeTable(crc32.Castagnoli) + +// crc implements the checksum specified in section 3 of +// https://github.com/google/snappy/blob/master/framing_format.txt +func snappyCRC(b []byte) uint32 { + c := crc32.Update(0, crcTable, b) + return uint32(c>>15|c<<17) + 0xa282ead8 +} + +// snappyDecodedLen returns the length of the decoded block and the number of bytes +// that the length header occupied. +func snappyDecodedLen(src []byte) (blockLen, headerLen int, err error) { + v, n := binary.Uvarint(src) + if n <= 0 || v > 0xffffffff { + return 0, 0, ErrSnappyCorrupt + } + + const wordSize = 32 << (^uint(0) >> 32 & 1) + if wordSize == 32 && v > 0x7fffffff { + return 0, 0, ErrSnappyTooLarge + } + return int(v), n, nil +} diff --git a/awsproviderlint/vendor/github.com/klauspost/compress/zstd/zstd.go b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/zstd.go new file mode 100644 index 000000000000..0807719c8b90 --- /dev/null +++ b/awsproviderlint/vendor/github.com/klauspost/compress/zstd/zstd.go @@ -0,0 +1,144 @@ +// Package zstd provides decompression of zstandard files. +// +// For advanced usage and examples, go to the README: https://github.com/klauspost/compress/tree/master/zstd#zstd +package zstd + +import ( + "errors" + "log" + "math" + "math/bits" +) + +// enable debug printing +const debug = false + +// Enable extra assertions. +const debugAsserts = debug || false + +// print sequence details +const debugSequences = false + +// print detailed matching information +const debugMatches = false + +// force encoder to use predefined tables. +const forcePreDef = false + +// zstdMinMatch is the minimum zstd match length. +const zstdMinMatch = 3 + +// Reset the buffer offset when reaching this. +const bufferReset = math.MaxInt32 - MaxWindowSize + +var ( + // ErrReservedBlockType is returned when a reserved block type is found. + // Typically this indicates wrong or corrupted input. + ErrReservedBlockType = errors.New("invalid input: reserved block type encountered") + + // ErrCompressedSizeTooBig is returned when a block is bigger than allowed. + // Typically this indicates wrong or corrupted input. + ErrCompressedSizeTooBig = errors.New("invalid input: compressed size too big") + + // ErrBlockTooSmall is returned when a block is too small to be decoded. + // Typically returned on invalid input. + ErrBlockTooSmall = errors.New("block too small") + + // ErrMagicMismatch is returned when a "magic" number isn't what is expected. + // Typically this indicates wrong or corrupted input. + ErrMagicMismatch = errors.New("invalid input: magic number mismatch") + + // ErrWindowSizeExceeded is returned when a reference exceeds the valid window size. + // Typically this indicates wrong or corrupted input. + ErrWindowSizeExceeded = errors.New("window size exceeded") + + // ErrWindowSizeTooSmall is returned when no window size is specified. + // Typically this indicates wrong or corrupted input. + ErrWindowSizeTooSmall = errors.New("invalid input: window size was too small") + + // ErrDecoderSizeExceeded is returned if decompressed size exceeds the configured limit. + ErrDecoderSizeExceeded = errors.New("decompressed size exceeds configured limit") + + // ErrUnknownDictionary is returned if the dictionary ID is unknown. + // For the time being dictionaries are not supported. + ErrUnknownDictionary = errors.New("unknown dictionary") + + // ErrFrameSizeExceeded is returned if the stated frame size is exceeded. + // This is only returned if SingleSegment is specified on the frame. + ErrFrameSizeExceeded = errors.New("frame size exceeded") + + // ErrCRCMismatch is returned if CRC mismatches. + ErrCRCMismatch = errors.New("CRC check failed") + + // ErrDecoderClosed will be returned if the Decoder was used after + // Close has been called. + ErrDecoderClosed = errors.New("decoder used after Close") +) + +func println(a ...interface{}) { + if debug { + log.Println(a...) + } +} + +func printf(format string, a ...interface{}) { + if debug { + log.Printf(format, a...) + } +} + +// matchLenFast does matching, but will not match the last up to 7 bytes. +func matchLenFast(a, b []byte) int { + endI := len(a) & (math.MaxInt32 - 7) + for i := 0; i < endI; i += 8 { + if diff := load64(a, i) ^ load64(b, i); diff != 0 { + return i + bits.TrailingZeros64(diff)>>3 + } + } + return endI +} + +// matchLen returns the maximum length. +// a must be the shortest of the two. +// The function also returns whether all bytes matched. +func matchLen(a, b []byte) int { + b = b[:len(a)] + for i := 0; i < len(a)-7; i += 8 { + if diff := load64(a, i) ^ load64(b, i); diff != 0 { + return i + (bits.TrailingZeros64(diff) >> 3) + } + } + + checked := (len(a) >> 3) << 3 + a = a[checked:] + b = b[checked:] + for i := range a { + if a[i] != b[i] { + return i + checked + } + } + return len(a) + checked +} + +func load3232(b []byte, i int32) uint32 { + // Help the compiler eliminate bounds checks on the read so it can be done in a single read. + b = b[i:] + b = b[:4] + return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 +} + +func load6432(b []byte, i int32) uint64 { + // Help the compiler eliminate bounds checks on the read so it can be done in a single read. + b = b[i:] + b = b[:8] + return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | + uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 +} + +func load64(b []byte, i int) uint64 { + // Help the compiler eliminate bounds checks on the read so it can be done in a single read. + b = b[i:] + b = b[:8] + return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | + uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 +} diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion.go index ee35e9de7cbc..8d177f151c42 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion.go @@ -138,6 +138,15 @@ func getConversionKnown(in cty.Type, out cty.Type, unsafe bool) conversion { outEty := out.ElementType() return conversionObjectToMap(in, outEty, unsafe) + case out.IsObjectType() && in.IsMapType(): + if !unsafe { + // Converting a map to an object is an "unsafe" conversion, + // because we don't know if all the map keys will correspond to + // object attributes. + return nil + } + return conversionMapToObject(in, out, unsafe) + case in.IsCapsuleType() || out.IsCapsuleType(): if !unsafe { // Capsule types can only participate in "unsafe" conversions, diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion_collection.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion_collection.go index 3039ba22e545..2207df9e46c0 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion_collection.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion_collection.go @@ -13,20 +13,28 @@ import ( // if we're converting from a set into a list of the same element type.) func conversionCollectionToList(ety cty.Type, conv conversion) conversion { return func(val cty.Value, path cty.Path) (cty.Value, error) { + if !val.Length().IsKnown() { + // If the input collection has an unknown length (which is true + // for a set containing unknown values) then our result must be + // an unknown list, because we can't predict how many elements + // the resulting list should have. + return cty.UnknownVal(cty.List(val.Type().ElementType())), nil + } + elems := make([]cty.Value, 0, val.LengthInt()) i := int64(0) - path = append(path, nil) + elemPath := append(path.Copy(), nil) it := val.ElementIterator() for it.Next() { _, val := it.Element() var err error - path[len(path)-1] = cty.IndexStep{ + elemPath[len(elemPath)-1] = cty.IndexStep{ Key: cty.NumberIntVal(i), } if conv != nil { - val, err = conv(val, path) + val, err = conv(val, elemPath) if err != nil { return cty.NilVal, err } @@ -37,6 +45,9 @@ func conversionCollectionToList(ety cty.Type, conv conversion) conversion { } if len(elems) == 0 { + if ety == cty.DynamicPseudoType { + ety = val.Type().ElementType() + } return cty.ListValEmpty(ety), nil } @@ -55,18 +66,18 @@ func conversionCollectionToSet(ety cty.Type, conv conversion) conversion { return func(val cty.Value, path cty.Path) (cty.Value, error) { elems := make([]cty.Value, 0, val.LengthInt()) i := int64(0) - path = append(path, nil) + elemPath := append(path.Copy(), nil) it := val.ElementIterator() for it.Next() { _, val := it.Element() var err error - path[len(path)-1] = cty.IndexStep{ + elemPath[len(elemPath)-1] = cty.IndexStep{ Key: cty.NumberIntVal(i), } if conv != nil { - val, err = conv(val, path) + val, err = conv(val, elemPath) if err != nil { return cty.NilVal, err } @@ -77,6 +88,11 @@ func conversionCollectionToSet(ety cty.Type, conv conversion) conversion { } if len(elems) == 0 { + // Prefer a concrete type over a dynamic type when returning an + // empty set + if ety == cty.DynamicPseudoType { + ety = val.Type().ElementType() + } return cty.SetValEmpty(ety), nil } @@ -93,13 +109,13 @@ func conversionCollectionToSet(ety cty.Type, conv conversion) conversion { func conversionCollectionToMap(ety cty.Type, conv conversion) conversion { return func(val cty.Value, path cty.Path) (cty.Value, error) { elems := make(map[string]cty.Value, 0) - path = append(path, nil) + elemPath := append(path.Copy(), nil) it := val.ElementIterator() for it.Next() { key, val := it.Element() var err error - path[len(path)-1] = cty.IndexStep{ + elemPath[len(elemPath)-1] = cty.IndexStep{ Key: key, } @@ -107,11 +123,11 @@ func conversionCollectionToMap(ety cty.Type, conv conversion) conversion { if err != nil { // Should never happen, because keys can only be numbers or // strings and both can convert to string. - return cty.DynamicVal, path.NewErrorf("cannot convert key type %s to string for map", key.Type().FriendlyName()) + return cty.DynamicVal, elemPath.NewErrorf("cannot convert key type %s to string for map", key.Type().FriendlyName()) } if conv != nil { - val, err = conv(val, path) + val, err = conv(val, elemPath) if err != nil { return cty.NilVal, err } @@ -121,9 +137,25 @@ func conversionCollectionToMap(ety cty.Type, conv conversion) conversion { } if len(elems) == 0 { + // Prefer a concrete type over a dynamic type when returning an + // empty map + if ety == cty.DynamicPseudoType { + ety = val.Type().ElementType() + } return cty.MapValEmpty(ety), nil } + if ety.IsCollectionType() || ety.IsObjectType() { + var err error + if elems, err = conversionUnifyCollectionElements(elems, path, false); err != nil { + return cty.NilVal, err + } + } + + if err := conversionCheckMapElementTypes(elems, path); err != nil { + return cty.NilVal, err + } + return cty.MapVal(elems), nil } } @@ -132,34 +164,45 @@ func conversionCollectionToMap(ety cty.Type, conv conversion) conversion { // given tuple type and return a set of the given element type. // // Will panic if the given tupleType isn't actually a tuple type. -func conversionTupleToSet(tupleType cty.Type, listEty cty.Type, unsafe bool) conversion { +func conversionTupleToSet(tupleType cty.Type, setEty cty.Type, unsafe bool) conversion { tupleEtys := tupleType.TupleElementTypes() if len(tupleEtys) == 0 { // Empty tuple short-circuit return func(val cty.Value, path cty.Path) (cty.Value, error) { - return cty.SetValEmpty(listEty), nil + return cty.SetValEmpty(setEty), nil } } - if listEty == cty.DynamicPseudoType { + if setEty == cty.DynamicPseudoType { // This is a special case where the caller wants us to find // a suitable single type that all elements can convert to, if // possible. - listEty, _ = unify(tupleEtys, unsafe) - if listEty == cty.NilType { + setEty, _ = unify(tupleEtys, unsafe) + if setEty == cty.NilType { return nil } + + // If the set element type after unification is still the dynamic + // type, the only way this can result in a valid set is if all values + // are of dynamic type + if setEty == cty.DynamicPseudoType { + for _, tupleEty := range tupleEtys { + if !tupleEty.Equals(cty.DynamicPseudoType) { + return nil + } + } + } } elemConvs := make([]conversion, len(tupleEtys)) for i, tupleEty := range tupleEtys { - if tupleEty.Equals(listEty) { + if tupleEty.Equals(setEty) { // no conversion required continue } - elemConvs[i] = getConversion(tupleEty, listEty, unsafe) + elemConvs[i] = getConversion(tupleEty, setEty, unsafe) if elemConvs[i] == nil { // If any of our element conversions are impossible, then the our // whole conversion is impossible. @@ -171,20 +214,20 @@ func conversionTupleToSet(tupleType cty.Type, listEty cty.Type, unsafe bool) con // element conversions in elemConvs return func(val cty.Value, path cty.Path) (cty.Value, error) { elems := make([]cty.Value, 0, len(elemConvs)) - path = append(path, nil) + elemPath := append(path.Copy(), nil) i := int64(0) it := val.ElementIterator() for it.Next() { _, val := it.Element() var err error - path[len(path)-1] = cty.IndexStep{ + elemPath[len(elemPath)-1] = cty.IndexStep{ Key: cty.NumberIntVal(i), } conv := elemConvs[i] if conv != nil { - val, err = conv(val, path) + val, err = conv(val, elemPath) if err != nil { return cty.NilVal, err } @@ -220,6 +263,17 @@ func conversionTupleToList(tupleType cty.Type, listEty cty.Type, unsafe bool) co if listEty == cty.NilType { return nil } + + // If the list element type after unification is still the dynamic + // type, the only way this can result in a valid list is if all values + // are of dynamic type + if listEty == cty.DynamicPseudoType { + for _, tupleEty := range tupleEtys { + if !tupleEty.Equals(cty.DynamicPseudoType) { + return nil + } + } + } } elemConvs := make([]conversion, len(tupleEtys)) @@ -241,29 +295,35 @@ func conversionTupleToList(tupleType cty.Type, listEty cty.Type, unsafe bool) co // element conversions in elemConvs return func(val cty.Value, path cty.Path) (cty.Value, error) { elems := make([]cty.Value, 0, len(elemConvs)) - path = append(path, nil) + elemTys := make([]cty.Type, 0, len(elems)) + elemPath := append(path.Copy(), nil) i := int64(0) it := val.ElementIterator() for it.Next() { _, val := it.Element() var err error - path[len(path)-1] = cty.IndexStep{ + elemPath[len(elemPath)-1] = cty.IndexStep{ Key: cty.NumberIntVal(i), } conv := elemConvs[i] if conv != nil { - val, err = conv(val, path) + val, err = conv(val, elemPath) if err != nil { return cty.NilVal, err } } elems = append(elems, val) + elemTys = append(elemTys, val.Type()) i++ } + elems, err := conversionUnifyListElements(elems, elemPath, unsafe) + if err != nil { + return cty.NilVal, err + } return cty.ListVal(elems), nil } } @@ -315,19 +375,19 @@ func conversionObjectToMap(objectType cty.Type, mapEty cty.Type, unsafe bool) co // element conversions in elemConvs return func(val cty.Value, path cty.Path) (cty.Value, error) { elems := make(map[string]cty.Value, len(elemConvs)) - path = append(path, nil) + elemPath := append(path.Copy(), nil) it := val.ElementIterator() for it.Next() { name, val := it.Element() var err error - path[len(path)-1] = cty.IndexStep{ + elemPath[len(elemPath)-1] = cty.IndexStep{ Key: name, } conv := elemConvs[name.AsString()] if conv != nil { - val, err = conv(val, path) + val, err = conv(val, elemPath) if err != nil { return cty.NilVal, err } @@ -335,6 +395,175 @@ func conversionObjectToMap(objectType cty.Type, mapEty cty.Type, unsafe bool) co elems[name.AsString()] = val } + if mapEty.IsCollectionType() || mapEty.IsObjectType() { + var err error + if elems, err = conversionUnifyCollectionElements(elems, path, unsafe); err != nil { + return cty.NilVal, err + } + } + + if err := conversionCheckMapElementTypes(elems, path); err != nil { + return cty.NilVal, err + } + return cty.MapVal(elems), nil } } + +// conversionMapToObject returns a conversion that will take a value of the +// given map type and return an object of the given type. The object attribute +// types must all be compatible with the map element type. +// +// Will panic if the given mapType and objType are not maps and objects +// respectively. +func conversionMapToObject(mapType cty.Type, objType cty.Type, unsafe bool) conversion { + objectAtys := objType.AttributeTypes() + mapEty := mapType.ElementType() + + elemConvs := make(map[string]conversion, len(objectAtys)) + for name, objectAty := range objectAtys { + if objectAty.Equals(mapEty) { + // no conversion required + continue + } + + elemConvs[name] = getConversion(mapEty, objectAty, unsafe) + if elemConvs[name] == nil { + // If any of our element conversions are impossible, then the our + // whole conversion is impossible. + return nil + } + } + + // If we fall out here then a conversion is possible, using the + // element conversions in elemConvs + return func(val cty.Value, path cty.Path) (cty.Value, error) { + elems := make(map[string]cty.Value, len(elemConvs)) + elemPath := append(path.Copy(), nil) + it := val.ElementIterator() + for it.Next() { + name, val := it.Element() + + // if there is no corresponding attribute, we skip this key + if _, ok := objectAtys[name.AsString()]; !ok { + continue + } + + var err error + + elemPath[len(elemPath)-1] = cty.IndexStep{ + Key: name, + } + + conv := elemConvs[name.AsString()] + if conv != nil { + val, err = conv(val, elemPath) + if err != nil { + return cty.NilVal, err + } + } + + elems[name.AsString()] = val + } + + for name, aty := range objectAtys { + if _, exists := elems[name]; !exists { + if optional := objType.AttributeOptional(name); optional { + elems[name] = cty.NullVal(aty) + } else { + return cty.NilVal, path.NewErrorf("map has no element for required attribute %q", name) + } + } + } + + return cty.ObjectVal(elems), nil + } +} + +func conversionUnifyCollectionElements(elems map[string]cty.Value, path cty.Path, unsafe bool) (map[string]cty.Value, error) { + elemTypes := make([]cty.Type, 0, len(elems)) + for _, elem := range elems { + elemTypes = append(elemTypes, elem.Type()) + } + unifiedType, _ := unify(elemTypes, unsafe) + if unifiedType == cty.NilType { + return nil, path.NewErrorf("collection elements cannot be unified") + } + + unifiedElems := make(map[string]cty.Value) + elemPath := append(path.Copy(), nil) + + for name, elem := range elems { + if elem.Type().Equals(unifiedType) { + unifiedElems[name] = elem + continue + } + conv := getConversion(elem.Type(), unifiedType, unsafe) + if conv == nil { + } + elemPath[len(elemPath)-1] = cty.IndexStep{ + Key: cty.StringVal(name), + } + val, err := conv(elem, elemPath) + if err != nil { + return nil, err + } + unifiedElems[name] = val + } + + return unifiedElems, nil +} + +func conversionCheckMapElementTypes(elems map[string]cty.Value, path cty.Path) error { + elementType := cty.NilType + elemPath := append(path.Copy(), nil) + + for name, elem := range elems { + if elementType == cty.NilType { + elementType = elem.Type() + continue + } + if !elementType.Equals(elem.Type()) { + elemPath[len(elemPath)-1] = cty.IndexStep{ + Key: cty.StringVal(name), + } + return elemPath.NewErrorf("%s is required", elementType.FriendlyName()) + } + } + + return nil +} + +func conversionUnifyListElements(elems []cty.Value, path cty.Path, unsafe bool) ([]cty.Value, error) { + elemTypes := make([]cty.Type, len(elems)) + for i, elem := range elems { + elemTypes[i] = elem.Type() + } + unifiedType, _ := unify(elemTypes, unsafe) + if unifiedType == cty.NilType { + return nil, path.NewErrorf("collection elements cannot be unified") + } + + ret := make([]cty.Value, len(elems)) + elemPath := append(path.Copy(), nil) + + for i, elem := range elems { + if elem.Type().Equals(unifiedType) { + ret[i] = elem + continue + } + conv := getConversion(elem.Type(), unifiedType, unsafe) + if conv == nil { + } + elemPath[len(elemPath)-1] = cty.IndexStep{ + Key: cty.NumberIntVal(int64(i)), + } + val, err := conv(elem, elemPath) + if err != nil { + return nil, err + } + ret[i] = val + } + + return ret, nil +} diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion_object.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion_object.go index 62dabb8d1bba..098c109bdbaa 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion_object.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/conversion_object.go @@ -11,17 +11,29 @@ import ( // type, meaning that each attribute of the output type has a corresponding // attribute in the input type where a recursive conversion is available. // +// If the "out" type has any optional attributes, those attributes may be +// absent in the "in" type, in which case null values will be used in their +// place in the result. +// // Shallow object conversions work the same for both safe and unsafe modes, // but the safety flag is passed on to recursive conversions and may thus // limit the above definition of "subset". func conversionObjectToObject(in, out cty.Type, unsafe bool) conversion { inAtys := in.AttributeTypes() outAtys := out.AttributeTypes() + outOptionals := out.OptionalAttributes() attrConvs := make(map[string]conversion) for name, outAty := range outAtys { inAty, exists := inAtys[name] if !exists { + if _, optional := outOptionals[name]; optional { + // If it's optional then we'll skip inserting an + // attribute conversion and then deal with inserting + // the default value in our overall conversion logic + // later. + continue + } // No conversion is available, then. return nil } @@ -71,6 +83,13 @@ func conversionObjectToObject(in, out cty.Type, unsafe bool) conversion { attrVals[name] = val } + for name := range outOptionals { + if _, exists := attrVals[name]; !exists { + wantTy := outAtys[name] + attrVals[name] = cty.NullVal(wantTy) + } + } + return cty.ObjectVal(attrVals), nil } } diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/mismatch_msg.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/mismatch_msg.go index 581304ecd5b0..5c1e114d9f55 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/mismatch_msg.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/mismatch_msg.go @@ -78,10 +78,16 @@ func mismatchMessageObjects(got, want cty.Type) string { for name, wantAty := range wantAtys { gotAty, exists := gotAtys[name] if !exists { - missingAttrs = append(missingAttrs, name) + if !want.AttributeOptional(name) { + missingAttrs = append(missingAttrs, name) + } continue } + if gotAty.Equals(wantAty) { + continue // exact match, so no problem + } + // We'll now try to convert these attributes in isolation and // see if we have a nested conversion error to report. // We'll try an unsafe conversion first, and then fall back on diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/unify.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/unify.go index 53ebbfe08a15..ee171d1ed4ba 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/unify.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/convert/unify.go @@ -28,11 +28,14 @@ func unify(types []cty.Type, unsafe bool) (cty.Type, []Conversion) { // a subset of that type, which would be a much less useful conversion for // unification purposes. { + mapCt := 0 objectCt := 0 tupleCt := 0 dynamicCt := 0 for _, ty := range types { switch { + case ty.IsMapType(): + mapCt++ case ty.IsObjectType(): objectCt++ case ty.IsTupleType(): @@ -44,6 +47,8 @@ func unify(types []cty.Type, unsafe bool) (cty.Type, []Conversion) { } } switch { + case mapCt > 0 && (mapCt+dynamicCt) == len(types): + return unifyMapTypes(types, unsafe, dynamicCt > 0) case objectCt > 0 && (objectCt+dynamicCt) == len(types): return unifyObjectTypes(types, unsafe, dynamicCt > 0) case tupleCt > 0 && (tupleCt+dynamicCt) == len(types): @@ -95,6 +100,44 @@ Preferences: return cty.NilType, nil } +func unifyMapTypes(types []cty.Type, unsafe bool, hasDynamic bool) (cty.Type, []Conversion) { + // If we had any dynamic types in the input here then we can't predict + // what path we'll take through here once these become known types, so + // we'll conservatively produce DynamicVal for these. + if hasDynamic { + return unifyAllAsDynamic(types) + } + + elemTypes := make([]cty.Type, 0, len(types)) + for _, ty := range types { + elemTypes = append(elemTypes, ty.ElementType()) + } + retElemType, _ := unify(elemTypes, unsafe) + if retElemType == cty.NilType { + return cty.NilType, nil + } + + retTy := cty.Map(retElemType) + + conversions := make([]Conversion, len(types)) + for i, ty := range types { + if ty.Equals(retTy) { + continue + } + if unsafe { + conversions[i] = GetConversionUnsafe(ty, retTy) + } else { + conversions[i] = GetConversion(ty, retTy) + } + if conversions[i] == nil { + // Shouldn't be reachable, since we were able to unify + return cty.NilType, nil + } + } + + return retTy, conversions +} + func unifyObjectTypes(types []cty.Type, unsafe bool, hasDynamic bool) (cty.Type, []Conversion) { // If we had any dynamic types in the input here then we can't predict // what path we'll take through here once these become known types, so diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/function.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/function.go index efd882725fd3..efc83ad7699e 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/function.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/function.go @@ -244,19 +244,21 @@ func (f Function) Call(args []cty.Value) (val cty.Value, err error) { return cty.UnknownVal(expectedType), nil } - if val.IsMarked() && !spec.AllowMarked { - unwrappedVal, marks := val.Unmark() - // In order to avoid additional overhead on applications that - // are not using marked values, we copy the given args only - // if we encounter a marked value we need to unmark. However, - // as a consequence we end up doing redundant copying if multiple - // marked values need to be unwrapped. That seems okay because - // argument lists are generally small. - newArgs := make([]cty.Value, len(args)) - copy(newArgs, args) - newArgs[i] = unwrappedVal - resultMarks = append(resultMarks, marks) - args = newArgs + if !spec.AllowMarked { + unwrappedVal, marks := val.UnmarkDeep() + if len(marks) > 0 { + // In order to avoid additional overhead on applications that + // are not using marked values, we copy the given args only + // if we encounter a marked value we need to unmark. However, + // as a consequence we end up doing redundant copying if multiple + // marked values need to be unwrapped. That seems okay because + // argument lists are generally small. + newArgs := make([]cty.Value, len(args)) + copy(newArgs, args) + newArgs[i] = unwrappedVal + resultMarks = append(resultMarks, marks) + args = newArgs + } } } @@ -266,13 +268,15 @@ func (f Function) Call(args []cty.Value) (val cty.Value, err error) { if !val.IsKnown() && !spec.AllowUnknown { return cty.UnknownVal(expectedType), nil } - if val.IsMarked() && !spec.AllowMarked { - unwrappedVal, marks := val.Unmark() - newArgs := make([]cty.Value, len(args)) - copy(newArgs, args) - newArgs[len(posArgs)+i] = unwrappedVal - resultMarks = append(resultMarks, marks) - args = newArgs + if !spec.AllowMarked { + unwrappedVal, marks := val.UnmarkDeep() + if len(marks) > 0 { + newArgs := make([]cty.Value, len(args)) + copy(newArgs, args) + newArgs[len(posArgs)+i] = unwrappedVal + resultMarks = append(resultMarks, marks) + args = newArgs + } } } } diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/collection.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/collection.go index 967ba03c8b2f..230b03af5fad 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/collection.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/collection.go @@ -1,9 +1,12 @@ package stdlib import ( + "errors" "fmt" + "sort" "github.com/zclconf/go-cty/cty" + "github.com/zclconf/go-cty/cty/convert" "github.com/zclconf/go-cty/cty/function" "github.com/zclconf/go-cty/cty/gocty" ) @@ -122,6 +125,1114 @@ var LengthFunc = function.New(&function.Spec{ }, }) +var ElementFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "list", + Type: cty.DynamicPseudoType, + }, + { + Name: "index", + Type: cty.Number, + }, + }, + Type: func(args []cty.Value) (cty.Type, error) { + list := args[0] + index := args[1] + if index.IsKnown() { + if index.LessThan(cty.NumberIntVal(0)).True() { + return cty.DynamicPseudoType, fmt.Errorf("cannot use element function with a negative index") + } + } + + listTy := list.Type() + switch { + case listTy.IsListType(): + return listTy.ElementType(), nil + case listTy.IsTupleType(): + if !args[1].IsKnown() { + // If the index isn't known yet then we can't predict the + // result type since each tuple element can have its own type. + return cty.DynamicPseudoType, nil + } + + etys := listTy.TupleElementTypes() + var index int + err := gocty.FromCtyValue(args[1], &index) + if err != nil { + // e.g. fractional number where whole number is required + return cty.DynamicPseudoType, fmt.Errorf("invalid index: %s", err) + } + if len(etys) == 0 { + return cty.DynamicPseudoType, errors.New("cannot use element function with an empty list") + } + index = index % len(etys) + return etys[index], nil + default: + return cty.DynamicPseudoType, fmt.Errorf("cannot read elements from %s", listTy.FriendlyName()) + } + }, + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + var index int + err := gocty.FromCtyValue(args[1], &index) + if err != nil { + // can't happen because we checked this in the Type function above + return cty.DynamicVal, fmt.Errorf("invalid index: %s", err) + } + + if args[1].LessThan(cty.NumberIntVal(0)).True() { + return cty.DynamicVal, fmt.Errorf("cannot use element function with a negative index") + } + + if !args[0].IsKnown() { + return cty.UnknownVal(retType), nil + } + + l := args[0].LengthInt() + if l == 0 { + return cty.DynamicVal, errors.New("cannot use element function with an empty list") + } + index = index % l + + // We did all the necessary type checks in the type function above, + // so this is guaranteed not to fail. + return args[0].Index(cty.NumberIntVal(int64(index))), nil + }, +}) + +// CoalesceListFunc is a function that takes any number of list arguments +// and returns the first one that isn't empty. +var CoalesceListFunc = function.New(&function.Spec{ + Params: []function.Parameter{}, + VarParam: &function.Parameter{ + Name: "vals", + Type: cty.DynamicPseudoType, + AllowUnknown: true, + AllowDynamicType: true, + AllowNull: true, + }, + Type: func(args []cty.Value) (ret cty.Type, err error) { + if len(args) == 0 { + return cty.NilType, errors.New("at least one argument is required") + } + + argTypes := make([]cty.Type, len(args)) + + for i, arg := range args { + // if any argument is unknown, we can't be certain know which type we will return + if !arg.IsKnown() { + return cty.DynamicPseudoType, nil + } + ty := arg.Type() + + if !ty.IsListType() && !ty.IsTupleType() { + return cty.NilType, errors.New("coalescelist arguments must be lists or tuples") + } + + argTypes[i] = arg.Type() + } + + last := argTypes[0] + // If there are mixed types, we have to return a dynamic type. + for _, next := range argTypes[1:] { + if !next.Equals(last) { + return cty.DynamicPseudoType, nil + } + } + + return last, nil + }, + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + for _, arg := range args { + if !arg.IsKnown() { + // If we run into an unknown list at some point, we can't + // predict the final result yet. (If there's a known, non-empty + // arg before this then we won't get here.) + return cty.UnknownVal(retType), nil + } + + if arg.IsNull() { + continue + } + + if arg.LengthInt() > 0 { + return arg, nil + } + } + + return cty.NilVal, errors.New("no non-null arguments") + }, +}) + +// CompactFunc is a function that takes a list of strings and returns a new list +// with any empty string elements removed. +var CompactFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "list", + Type: cty.List(cty.String), + }, + }, + Type: function.StaticReturnType(cty.List(cty.String)), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + listVal := args[0] + if !listVal.IsWhollyKnown() { + // If some of the element values aren't known yet then we + // can't yet return a compacted list + return cty.UnknownVal(retType), nil + } + + var outputList []cty.Value + + for it := listVal.ElementIterator(); it.Next(); { + _, v := it.Element() + if v.IsNull() || v.AsString() == "" { + continue + } + outputList = append(outputList, v) + } + + if len(outputList) == 0 { + return cty.ListValEmpty(cty.String), nil + } + + return cty.ListVal(outputList), nil + }, +}) + +// ContainsFunc is a function that determines whether a given list or +// set contains a given single value as one of its elements. +var ContainsFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "list", + Type: cty.DynamicPseudoType, + }, + { + Name: "value", + Type: cty.DynamicPseudoType, + }, + }, + Type: function.StaticReturnType(cty.Bool), + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + arg := args[0] + ty := arg.Type() + + if !ty.IsListType() && !ty.IsTupleType() && !ty.IsSetType() { + return cty.NilVal, errors.New("argument must be list, tuple, or set") + } + + if args[0].IsNull() { + return cty.NilVal, errors.New("cannot search a nil list or set") + } + + if args[0].LengthInt() == 0 { + return cty.False, nil + } + + if !args[0].IsKnown() || !args[1].IsKnown() { + return cty.UnknownVal(cty.Bool), nil + } + + containsUnknown := false + for it := args[0].ElementIterator(); it.Next(); { + _, v := it.Element() + eq := args[1].Equals(v) + if !eq.IsKnown() { + // We may have an unknown value which could match later, but we + // first need to continue checking all values for an exact + // match. + containsUnknown = true + continue + } + if eq.True() { + return cty.True, nil + } + } + + if containsUnknown { + return cty.UnknownVal(cty.Bool), nil + } + + return cty.False, nil + }, +}) + +// DistinctFunc is a function that takes a list and returns a new list +// with any duplicate elements removed. +var DistinctFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "list", + Type: cty.List(cty.DynamicPseudoType), + }, + }, + Type: func(args []cty.Value) (cty.Type, error) { + return args[0].Type(), nil + }, + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + listVal := args[0] + + if !listVal.IsWhollyKnown() { + return cty.UnknownVal(retType), nil + } + var list []cty.Value + + for it := listVal.ElementIterator(); it.Next(); { + _, v := it.Element() + list, err = appendIfMissing(list, v) + if err != nil { + return cty.NilVal, err + } + } + + if len(list) == 0 { + return cty.ListValEmpty(retType.ElementType()), nil + } + return cty.ListVal(list), nil + }, +}) + +// ChunklistFunc is a function that splits a single list into fixed-size chunks, +// returning a list of lists. +var ChunklistFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "list", + Type: cty.List(cty.DynamicPseudoType), + }, + { + Name: "size", + Type: cty.Number, + }, + }, + Type: func(args []cty.Value) (cty.Type, error) { + return cty.List(args[0].Type()), nil + }, + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + listVal := args[0] + if !listVal.IsKnown() { + return cty.UnknownVal(retType), nil + } + + if listVal.LengthInt() == 0 { + return cty.ListValEmpty(listVal.Type()), nil + } + + var size int + err = gocty.FromCtyValue(args[1], &size) + if err != nil { + return cty.NilVal, fmt.Errorf("invalid index: %s", err) + } + + if size < 0 { + return cty.NilVal, errors.New("the size argument must be positive") + } + + output := make([]cty.Value, 0) + + // if size is 0, returns a list made of the initial list + if size == 0 { + output = append(output, listVal) + return cty.ListVal(output), nil + } + + chunk := make([]cty.Value, 0) + + l := args[0].LengthInt() + i := 0 + + for it := listVal.ElementIterator(); it.Next(); { + _, v := it.Element() + chunk = append(chunk, v) + + // Chunk when index isn't 0, or when reaching the values's length + if (i+1)%size == 0 || (i+1) == l { + output = append(output, cty.ListVal(chunk)) + chunk = make([]cty.Value, 0) + } + i++ + } + + return cty.ListVal(output), nil + }, +}) + +// FlattenFunc is a function that takes a list and replaces any elements +// that are lists with a flattened sequence of the list contents. +var FlattenFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "list", + Type: cty.DynamicPseudoType, + }, + }, + Type: func(args []cty.Value) (cty.Type, error) { + if !args[0].IsWhollyKnown() { + return cty.DynamicPseudoType, nil + } + + argTy := args[0].Type() + if !argTy.IsListType() && !argTy.IsSetType() && !argTy.IsTupleType() { + return cty.NilType, errors.New("can only flatten lists, sets and tuples") + } + + retVal, known := flattener(args[0]) + if !known { + return cty.DynamicPseudoType, nil + } + + tys := make([]cty.Type, len(retVal)) + for i, ty := range retVal { + tys[i] = ty.Type() + } + return cty.Tuple(tys), nil + }, + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + inputList := args[0] + if inputList.LengthInt() == 0 { + return cty.EmptyTupleVal, nil + } + + out, known := flattener(inputList) + if !known { + return cty.UnknownVal(retType), nil + } + + return cty.TupleVal(out), nil + }, +}) + +// Flatten until it's not a cty.List, and return whether the value is known. +// We can flatten lists with unknown values, as long as they are not +// lists themselves. +func flattener(flattenList cty.Value) ([]cty.Value, bool) { + if !flattenList.Length().IsKnown() { + // If we don't know the length of what we're flattening then we can't + // predict the length of our result yet either. + return nil, false + } + out := make([]cty.Value, 0) + for it := flattenList.ElementIterator(); it.Next(); { + _, val := it.Element() + if val.Type().IsListType() || val.Type().IsSetType() || val.Type().IsTupleType() { + if !val.IsKnown() { + return out, false + } + + res, known := flattener(val) + if !known { + return res, known + } + out = append(out, res...) + } else { + out = append(out, val) + } + } + return out, true +} + +// KeysFunc is a function that takes a map and returns a sorted list of the map keys. +var KeysFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "inputMap", + Type: cty.DynamicPseudoType, + AllowUnknown: true, + }, + }, + Type: func(args []cty.Value) (cty.Type, error) { + ty := args[0].Type() + switch { + case ty.IsMapType(): + return cty.List(cty.String), nil + case ty.IsObjectType(): + atys := ty.AttributeTypes() + if len(atys) == 0 { + return cty.EmptyTuple, nil + } + // All of our result elements will be strings, and atys just + // decides how many there are. + etys := make([]cty.Type, len(atys)) + for i := range etys { + etys[i] = cty.String + } + return cty.Tuple(etys), nil + default: + return cty.DynamicPseudoType, function.NewArgErrorf(0, "must have map or object type") + } + }, + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + m := args[0] + var keys []cty.Value + + switch { + case m.Type().IsObjectType(): + // In this case we allow unknown values so we must work only with + // the attribute _types_, not with the value itself. + var names []string + for name := range m.Type().AttributeTypes() { + names = append(names, name) + } + sort.Strings(names) // same ordering guaranteed by cty's ElementIterator + if len(names) == 0 { + return cty.EmptyTupleVal, nil + } + keys = make([]cty.Value, len(names)) + for i, name := range names { + keys[i] = cty.StringVal(name) + } + return cty.TupleVal(keys), nil + default: + if !m.IsKnown() { + return cty.UnknownVal(retType), nil + } + + // cty guarantees that ElementIterator will iterate in lexicographical + // order by key. + for it := args[0].ElementIterator(); it.Next(); { + k, _ := it.Element() + keys = append(keys, k) + } + if len(keys) == 0 { + return cty.ListValEmpty(cty.String), nil + } + return cty.ListVal(keys), nil + } + }, +}) + +// LookupFunc is a function that performs dynamic lookups of map types. +var LookupFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "inputMap", + Type: cty.DynamicPseudoType, + }, + { + Name: "key", + Type: cty.String, + }, + { + Name: "default", + Type: cty.DynamicPseudoType, + }, + }, + Type: func(args []cty.Value) (ret cty.Type, err error) { + ty := args[0].Type() + + switch { + case ty.IsObjectType(): + if !args[1].IsKnown() { + return cty.DynamicPseudoType, nil + } + + key := args[1].AsString() + if ty.HasAttribute(key) { + return args[0].GetAttr(key).Type(), nil + } else if len(args) == 3 { + // if the key isn't found but a default is provided, + // return the default type + return args[2].Type(), nil + } + return cty.DynamicPseudoType, function.NewArgErrorf(0, "the given object has no attribute %q", key) + case ty.IsMapType(): + if len(args) == 3 { + _, err = convert.Convert(args[2], ty.ElementType()) + if err != nil { + return cty.NilType, function.NewArgErrorf(2, "the default value must have the same type as the map elements") + } + } + return ty.ElementType(), nil + default: + return cty.NilType, function.NewArgErrorf(0, "lookup() requires a map as the first argument") + } + }, + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + defaultVal := args[2] + + mapVar := args[0] + lookupKey := args[1].AsString() + + if !mapVar.IsWhollyKnown() { + return cty.UnknownVal(retType), nil + } + + if mapVar.Type().IsObjectType() { + if mapVar.Type().HasAttribute(lookupKey) { + return mapVar.GetAttr(lookupKey), nil + } + } else if mapVar.HasIndex(cty.StringVal(lookupKey)) == cty.True { + return mapVar.Index(cty.StringVal(lookupKey)), nil + } + + defaultVal, err = convert.Convert(defaultVal, retType) + if err != nil { + return cty.NilVal, err + } + return defaultVal, nil + }, +}) + +// MergeFunc constructs a function that takes an arbitrary number of maps or +// objects, and returns a single value that contains a merged set of keys and +// values from all of the inputs. +// +// If more than one given map or object defines the same key then the one that +// is later in the argument sequence takes precedence. +var MergeFunc = function.New(&function.Spec{ + Params: []function.Parameter{}, + VarParam: &function.Parameter{ + Name: "maps", + Type: cty.DynamicPseudoType, + AllowDynamicType: true, + AllowNull: true, + }, + Type: func(args []cty.Value) (cty.Type, error) { + // empty args is accepted, so assume an empty object since we have no + // key-value types. + if len(args) == 0 { + return cty.EmptyObject, nil + } + + // collect the possible object attrs + attrs := map[string]cty.Type{} + + first := cty.NilType + matching := true + attrsKnown := true + for i, arg := range args { + ty := arg.Type() + // any dynamic args mean we can't compute a type + if ty.Equals(cty.DynamicPseudoType) { + return cty.DynamicPseudoType, nil + } + + // check for invalid arguments + if !ty.IsMapType() && !ty.IsObjectType() { + return cty.NilType, fmt.Errorf("arguments must be maps or objects, got %#v", ty.FriendlyName()) + } + + switch { + case ty.IsObjectType() && !arg.IsNull(): + for attr, aty := range ty.AttributeTypes() { + attrs[attr] = aty + } + case ty.IsMapType(): + switch { + case arg.IsNull(): + // pass, nothing to add + case arg.IsKnown(): + ety := arg.Type().ElementType() + for it := arg.ElementIterator(); it.Next(); { + attr, _ := it.Element() + attrs[attr.AsString()] = ety + } + default: + // any unknown maps means we don't know all possible attrs + // for the return type + attrsKnown = false + } + } + + // record the first argument type for comparison + if i == 0 { + first = arg.Type() + continue + } + + if !ty.Equals(first) && matching { + matching = false + } + } + + // the types all match, so use the first argument type + if matching { + return first, nil + } + + // We had a mix of unknown maps and objects, so we can't predict the + // attributes + if !attrsKnown { + return cty.DynamicPseudoType, nil + } + + return cty.Object(attrs), nil + }, + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + outputMap := make(map[string]cty.Value) + + for _, arg := range args { + if arg.IsNull() { + continue + } + for it := arg.ElementIterator(); it.Next(); { + k, v := it.Element() + outputMap[k.AsString()] = v + } + } + + switch { + case retType.IsMapType(): + if len(outputMap) == 0 { + return cty.MapValEmpty(retType.ElementType()), nil + } + return cty.MapVal(outputMap), nil + case retType.IsObjectType(), retType.Equals(cty.DynamicPseudoType): + return cty.ObjectVal(outputMap), nil + default: + panic(fmt.Sprintf("unexpected return type: %#v", retType)) + } + }, +}) + +// ReverseListFunc takes a sequence and produces a new sequence of the same length +// with all of the same elements as the given sequence but in reverse order. +var ReverseListFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "list", + Type: cty.DynamicPseudoType, + }, + }, + Type: func(args []cty.Value) (cty.Type, error) { + argTy := args[0].Type() + switch { + case argTy.IsTupleType(): + argTys := argTy.TupleElementTypes() + retTys := make([]cty.Type, len(argTys)) + for i, ty := range argTys { + retTys[len(retTys)-i-1] = ty + } + return cty.Tuple(retTys), nil + case argTy.IsListType(), argTy.IsSetType(): // We accept sets here to mimic the usual behavior of auto-converting to list + return cty.List(argTy.ElementType()), nil + default: + return cty.NilType, function.NewArgErrorf(0, "can only reverse list or tuple values, not %s", argTy.FriendlyName()) + } + }, + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + in := args[0].AsValueSlice() + outVals := make([]cty.Value, len(in)) + for i, v := range in { + outVals[len(outVals)-i-1] = v + } + switch { + case retType.IsTupleType(): + return cty.TupleVal(outVals), nil + default: + if len(outVals) == 0 { + return cty.ListValEmpty(retType.ElementType()), nil + } + return cty.ListVal(outVals), nil + } + }, +}) + +// SetProductFunc calculates the Cartesian product of two or more sets or +// sequences. If the arguments are all lists then the result is a list of tuples, +// preserving the ordering of all of the input lists. Otherwise the result is a +// set of tuples. +var SetProductFunc = function.New(&function.Spec{ + Params: []function.Parameter{}, + VarParam: &function.Parameter{ + Name: "sets", + Type: cty.DynamicPseudoType, + }, + Type: func(args []cty.Value) (retType cty.Type, err error) { + if len(args) < 2 { + return cty.NilType, errors.New("at least two arguments are required") + } + + listCount := 0 + elemTys := make([]cty.Type, len(args)) + for i, arg := range args { + aty := arg.Type() + switch { + case aty.IsSetType(): + elemTys[i] = aty.ElementType() + case aty.IsListType(): + elemTys[i] = aty.ElementType() + listCount++ + case aty.IsTupleType(): + // We can accept a tuple type only if there's some common type + // that all of its elements can be converted to. + allEtys := aty.TupleElementTypes() + if len(allEtys) == 0 { + elemTys[i] = cty.DynamicPseudoType + listCount++ + break + } + ety, _ := convert.UnifyUnsafe(allEtys) + if ety == cty.NilType { + return cty.NilType, function.NewArgErrorf(i, "all elements must be of the same type") + } + elemTys[i] = ety + listCount++ + default: + return cty.NilType, function.NewArgErrorf(i, "a set or a list is required") + } + } + + if listCount == len(args) { + return cty.List(cty.Tuple(elemTys)), nil + } + return cty.Set(cty.Tuple(elemTys)), nil + }, + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + ety := retType.ElementType() + + total := 1 + for _, arg := range args { + if !arg.Length().IsKnown() { + return cty.UnknownVal(retType), nil + } + + // Because of our type checking function, we are guaranteed that + // all of the arguments are known, non-null values of types that + // support LengthInt. + total *= arg.LengthInt() + } + + if total == 0 { + // If any of the arguments was an empty collection then our result + // is also an empty collection, which we'll short-circuit here. + if retType.IsListType() { + return cty.ListValEmpty(ety), nil + } + return cty.SetValEmpty(ety), nil + } + + subEtys := ety.TupleElementTypes() + product := make([][]cty.Value, total) + + b := make([]cty.Value, total*len(args)) + n := make([]int, len(args)) + s := 0 + argVals := make([][]cty.Value, len(args)) + for i, arg := range args { + argVals[i] = arg.AsValueSlice() + } + + for i := range product { + e := s + len(args) + pi := b[s:e] + product[i] = pi + s = e + + for j, n := range n { + val := argVals[j][n] + ty := subEtys[j] + if !val.Type().Equals(ty) { + var err error + val, err = convert.Convert(val, ty) + if err != nil { + // Should never happen since we checked this in our + // type-checking function. + return cty.NilVal, fmt.Errorf("failed to convert argVals[%d][%d] to %s; this is a bug in cty", j, n, ty.FriendlyName()) + } + } + pi[j] = val + } + + for j := len(n) - 1; j >= 0; j-- { + n[j]++ + if n[j] < len(argVals[j]) { + break + } + n[j] = 0 + } + } + + productVals := make([]cty.Value, total) + for i, vals := range product { + productVals[i] = cty.TupleVal(vals) + } + + if retType.IsListType() { + return cty.ListVal(productVals), nil + } + return cty.SetVal(productVals), nil + }, +}) + +// SliceFunc is a function that extracts some consecutive elements +// from within a list. +var SliceFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "list", + Type: cty.DynamicPseudoType, + }, + { + Name: "start_index", + Type: cty.Number, + }, + { + Name: "end_index", + Type: cty.Number, + }, + }, + Type: func(args []cty.Value) (cty.Type, error) { + arg := args[0] + argTy := arg.Type() + + if argTy.IsSetType() { + return cty.NilType, function.NewArgErrorf(0, "cannot slice a set, because its elements do not have indices; explicitly convert to a list if the ordering of the result is not important") + } + if !argTy.IsListType() && !argTy.IsTupleType() { + return cty.NilType, function.NewArgErrorf(0, "must be a list or tuple value") + } + + startIndex, endIndex, idxsKnown, err := sliceIndexes(args) + if err != nil { + return cty.NilType, err + } + + if argTy.IsListType() { + return argTy, nil + } + + if !idxsKnown { + // If we don't know our start/end indices then we can't predict + // the result type if we're planning to return a tuple. + return cty.DynamicPseudoType, nil + } + return cty.Tuple(argTy.TupleElementTypes()[startIndex:endIndex]), nil + }, + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + inputList := args[0] + + if retType == cty.DynamicPseudoType { + return cty.DynamicVal, nil + } + + // we ignore idxsKnown return value here because the indices are always + // known here, or else the call would've short-circuited. + startIndex, endIndex, _, err := sliceIndexes(args) + if err != nil { + return cty.NilVal, err + } + + if endIndex-startIndex == 0 { + if retType.IsTupleType() { + return cty.EmptyTupleVal, nil + } + return cty.ListValEmpty(retType.ElementType()), nil + } + + outputList := inputList.AsValueSlice()[startIndex:endIndex] + + if retType.IsTupleType() { + return cty.TupleVal(outputList), nil + } + + return cty.ListVal(outputList), nil + }, +}) + +func sliceIndexes(args []cty.Value) (int, int, bool, error) { + var startIndex, endIndex, length int + var startKnown, endKnown, lengthKnown bool + + // If it's a tuple then we always know the length by the type, but collections might be unknown or have unknown length + if args[0].Type().IsTupleType() || args[0].Length().IsKnown() { + length = args[0].LengthInt() + lengthKnown = true + } + + if args[1].IsKnown() { + if err := gocty.FromCtyValue(args[1], &startIndex); err != nil { + return 0, 0, false, function.NewArgErrorf(1, "invalid start index: %s", err) + } + if startIndex < 0 { + return 0, 0, false, function.NewArgErrorf(1, "start index must not be less than zero") + } + if lengthKnown && startIndex > length { + return 0, 0, false, function.NewArgErrorf(1, "start index must not be greater than the length of the list") + } + startKnown = true + } + if args[2].IsKnown() { + if err := gocty.FromCtyValue(args[2], &endIndex); err != nil { + return 0, 0, false, function.NewArgErrorf(2, "invalid end index: %s", err) + } + if endIndex < 0 { + return 0, 0, false, function.NewArgErrorf(2, "end index must not be less than zero") + } + if lengthKnown && endIndex > length { + return 0, 0, false, function.NewArgErrorf(2, "end index must not be greater than the length of the list") + } + endKnown = true + } + if startKnown && endKnown { + if startIndex > endIndex { + return 0, 0, false, function.NewArgErrorf(1, "start index must not be greater than end index") + } + } + return startIndex, endIndex, startKnown && endKnown, nil +} + +// ValuesFunc is a function that returns a list of the map values, +// in the order of the sorted keys. +var ValuesFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "values", + Type: cty.DynamicPseudoType, + }, + }, + Type: func(args []cty.Value) (ret cty.Type, err error) { + ty := args[0].Type() + if ty.IsMapType() { + return cty.List(ty.ElementType()), nil + } else if ty.IsObjectType() { + // The result is a tuple type with all of the same types as our + // object type's attributes, sorted in lexicographical order by the + // keys. (This matches the sort order guaranteed by ElementIterator + // on a cty object value.) + atys := ty.AttributeTypes() + if len(atys) == 0 { + return cty.EmptyTuple, nil + } + attrNames := make([]string, 0, len(atys)) + for name := range atys { + attrNames = append(attrNames, name) + } + sort.Strings(attrNames) + + tys := make([]cty.Type, len(attrNames)) + for i, name := range attrNames { + tys[i] = atys[name] + } + return cty.Tuple(tys), nil + } + return cty.NilType, errors.New("values() requires a map as the first argument") + }, + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + mapVar := args[0] + + // We can just iterate the map/object value here because cty guarantees + // that these types always iterate in key lexicographical order. + var values []cty.Value + for it := mapVar.ElementIterator(); it.Next(); { + _, val := it.Element() + values = append(values, val) + } + + if retType.IsTupleType() { + return cty.TupleVal(values), nil + } + if len(values) == 0 { + return cty.ListValEmpty(retType.ElementType()), nil + } + return cty.ListVal(values), nil + }, +}) + +// ZipmapFunc is a function that constructs a map from a list of keys +// and a corresponding list of values. +var ZipmapFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "keys", + Type: cty.List(cty.String), + }, + { + Name: "values", + Type: cty.DynamicPseudoType, + }, + }, + Type: func(args []cty.Value) (ret cty.Type, err error) { + keys := args[0] + values := args[1] + valuesTy := values.Type() + + switch { + case valuesTy.IsListType(): + return cty.Map(values.Type().ElementType()), nil + case valuesTy.IsTupleType(): + if !keys.IsWhollyKnown() { + // Since zipmap with a tuple produces an object, we need to know + // all of the key names before we can predict our result type. + return cty.DynamicPseudoType, nil + } + + keysRaw := keys.AsValueSlice() + valueTypesRaw := valuesTy.TupleElementTypes() + if len(keysRaw) != len(valueTypesRaw) { + return cty.NilType, fmt.Errorf("number of keys (%d) does not match number of values (%d)", len(keysRaw), len(valueTypesRaw)) + } + atys := make(map[string]cty.Type, len(valueTypesRaw)) + for i, keyVal := range keysRaw { + if keyVal.IsNull() { + return cty.NilType, fmt.Errorf("keys list has null value at index %d", i) + } + key := keyVal.AsString() + atys[key] = valueTypesRaw[i] + } + return cty.Object(atys), nil + + default: + return cty.NilType, errors.New("values argument must be a list or tuple value") + } + }, + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + keys := args[0] + values := args[1] + + if !keys.IsWhollyKnown() { + // Unknown map keys and object attributes are not supported, so + // our entire result must be unknown in this case. + return cty.UnknownVal(retType), nil + } + + // both keys and values are guaranteed to be shallowly-known here, + // because our declared params above don't allow unknown or null values. + if keys.LengthInt() != values.LengthInt() { + return cty.NilVal, fmt.Errorf("number of keys (%d) does not match number of values (%d)", keys.LengthInt(), values.LengthInt()) + } + + output := make(map[string]cty.Value) + + i := 0 + for it := keys.ElementIterator(); it.Next(); { + _, v := it.Element() + val := values.Index(cty.NumberIntVal(int64(i))) + output[v.AsString()] = val + i++ + } + + switch { + case retType.IsMapType(): + if len(output) == 0 { + return cty.MapValEmpty(retType.ElementType()), nil + } + return cty.MapVal(output), nil + case retType.IsObjectType(): + return cty.ObjectVal(output), nil + default: + // Should never happen because the type-check function should've + // caught any other case. + return cty.NilVal, fmt.Errorf("internally selected incorrect result type %s (this is a bug)", retType.FriendlyName()) + } + }, +}) + +// helper function to add an element to a list, if it does not already exist +func appendIfMissing(slice []cty.Value, element cty.Value) ([]cty.Value, error) { + for _, ele := range slice { + eq, err := Equal(ele, element) + if err != nil { + return slice, err + } + if eq.True() { + return slice, nil + } + } + return append(slice, element), nil +} + // HasIndex determines whether the given collection can be indexed with the // given key. func HasIndex(collection cty.Value, key cty.Value) (cty.Value, error) { @@ -138,3 +1249,91 @@ func Index(collection cty.Value, key cty.Value) (cty.Value, error) { func Length(collection cty.Value) (cty.Value, error) { return LengthFunc.Call([]cty.Value{collection}) } + +// Element returns a single element from a given list at the given index. If +// index is greater than the length of the list then it is wrapped modulo +// the list length. +func Element(list, index cty.Value) (cty.Value, error) { + return ElementFunc.Call([]cty.Value{list, index}) +} + +// CoalesceList takes any number of list arguments and returns the first one that isn't empty. +func CoalesceList(args ...cty.Value) (cty.Value, error) { + return CoalesceListFunc.Call(args) +} + +// Compact takes a list of strings and returns a new list +// with any empty string elements removed. +func Compact(list cty.Value) (cty.Value, error) { + return CompactFunc.Call([]cty.Value{list}) +} + +// Contains determines whether a given list contains a given single value +// as one of its elements. +func Contains(list, value cty.Value) (cty.Value, error) { + return ContainsFunc.Call([]cty.Value{list, value}) +} + +// Distinct takes a list and returns a new list with any duplicate elements removed. +func Distinct(list cty.Value) (cty.Value, error) { + return DistinctFunc.Call([]cty.Value{list}) +} + +// Chunklist splits a single list into fixed-size chunks, returning a list of lists. +func Chunklist(list, size cty.Value) (cty.Value, error) { + return ChunklistFunc.Call([]cty.Value{list, size}) +} + +// Flatten takes a list and replaces any elements that are lists with a flattened +// sequence of the list contents. +func Flatten(list cty.Value) (cty.Value, error) { + return FlattenFunc.Call([]cty.Value{list}) +} + +// Keys takes a map and returns a sorted list of the map keys. +func Keys(inputMap cty.Value) (cty.Value, error) { + return KeysFunc.Call([]cty.Value{inputMap}) +} + +// Lookup performs a dynamic lookup into a map. +// There are two required arguments, map and key, plus an optional default, +// which is a value to return if no key is found in map. +func Lookup(inputMap, key, defaultValue cty.Value) (cty.Value, error) { + return LookupFunc.Call([]cty.Value{inputMap, key, defaultValue}) +} + +// Merge takes an arbitrary number of maps and returns a single map that contains +// a merged set of elements from all of the maps. +// +// If more than one given map defines the same key then the one that is later in +// the argument sequence takes precedence. +func Merge(maps ...cty.Value) (cty.Value, error) { + return MergeFunc.Call(maps) +} + +// ReverseList takes a sequence and produces a new sequence of the same length +// with all of the same elements as the given sequence but in reverse order. +func ReverseList(list cty.Value) (cty.Value, error) { + return ReverseListFunc.Call([]cty.Value{list}) +} + +// SetProduct computes the Cartesian product of sets or sequences. +func SetProduct(sets ...cty.Value) (cty.Value, error) { + return SetProductFunc.Call(sets) +} + +// Slice extracts some consecutive elements from within a list. +func Slice(list, start, end cty.Value) (cty.Value, error) { + return SliceFunc.Call([]cty.Value{list, start, end}) +} + +// Values returns a list of the map values, in the order of the sorted keys. +// This function only works on flat maps. +func Values(values cty.Value) (cty.Value, error) { + return ValuesFunc.Call([]cty.Value{values}) +} + +// Zipmap constructs a map from a list of keys and a corresponding list of values. +func Zipmap(keys, values cty.Value) (cty.Value, error) { + return ZipmapFunc.Call([]cty.Value{keys, values}) +} diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/conversion.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/conversion.go new file mode 100644 index 000000000000..66eb97e2512f --- /dev/null +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/conversion.go @@ -0,0 +1,87 @@ +package stdlib + +import ( + "strconv" + + "github.com/zclconf/go-cty/cty" + "github.com/zclconf/go-cty/cty/convert" + "github.com/zclconf/go-cty/cty/function" +) + +// MakeToFunc constructs a "to..." function, like "tostring", which converts +// its argument to a specific type or type kind. +// +// The given type wantTy can be any type constraint that cty's "convert" package +// would accept. In particular, this means that you can pass +// cty.List(cty.DynamicPseudoType) to mean "list of any single type", which +// will then cause cty to attempt to unify all of the element types when given +// a tuple. +func MakeToFunc(wantTy cty.Type) function.Function { + return function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "v", + // We use DynamicPseudoType rather than wantTy here so that + // all values will pass through the function API verbatim and + // we can handle the conversion logic within the Type and + // Impl functions. This allows us to customize the error + // messages to be more appropriate for an explicit type + // conversion, whereas the cty function system produces + // messages aimed at _implicit_ type conversions. + Type: cty.DynamicPseudoType, + AllowNull: true, + }, + }, + Type: func(args []cty.Value) (cty.Type, error) { + gotTy := args[0].Type() + if gotTy.Equals(wantTy) { + return wantTy, nil + } + conv := convert.GetConversionUnsafe(args[0].Type(), wantTy) + if conv == nil { + // We'll use some specialized errors for some trickier cases, + // but most we can handle in a simple way. + switch { + case gotTy.IsTupleType() && wantTy.IsTupleType(): + return cty.NilType, function.NewArgErrorf(0, "incompatible tuple type for conversion: %s", convert.MismatchMessage(gotTy, wantTy)) + case gotTy.IsObjectType() && wantTy.IsObjectType(): + return cty.NilType, function.NewArgErrorf(0, "incompatible object type for conversion: %s", convert.MismatchMessage(gotTy, wantTy)) + default: + return cty.NilType, function.NewArgErrorf(0, "cannot convert %s to %s", gotTy.FriendlyName(), wantTy.FriendlyNameForConstraint()) + } + } + // If a conversion is available then everything is fine. + return wantTy, nil + }, + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + // We didn't set "AllowUnknown" on our argument, so it is guaranteed + // to be known here but may still be null. + ret, err := convert.Convert(args[0], retType) + if err != nil { + // Because we used GetConversionUnsafe above, conversion can + // still potentially fail in here. For example, if the user + // asks to convert the string "a" to bool then we'll + // optimistically permit it during type checking but fail here + // once we note that the value isn't either "true" or "false". + gotTy := args[0].Type() + switch { + case gotTy == cty.String && wantTy == cty.Bool: + what := "string" + if !args[0].IsNull() { + what = strconv.Quote(args[0].AsString()) + } + return cty.NilVal, function.NewArgErrorf(0, `cannot convert %s to bool; only the strings "true" or "false" are allowed`, what) + case gotTy == cty.String && wantTy == cty.Number: + what := "string" + if !args[0].IsNull() { + what = strconv.Quote(args[0].AsString()) + } + return cty.NilVal, function.NewArgErrorf(0, `cannot convert %s to number; given string must be a decimal representation of a number`, what) + default: + return cty.NilVal, function.NewArgErrorf(0, "cannot convert %s to %s", gotTy.FriendlyName(), wantTy.FriendlyNameForConstraint()) + } + } + return ret, nil + }, + }) +} diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/datetime.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/datetime.go index aa15b7bde96d..1ceffcf63cfe 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/datetime.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/datetime.go @@ -203,6 +203,33 @@ var FormatDateFunc = function.New(&function.Spec{ }, }) +// TimeAddFunc is a function that adds a duration to a timestamp, returning a new timestamp. +var TimeAddFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "timestamp", + Type: cty.String, + }, + { + Name: "duration", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + ts, err := parseTimestamp(args[0].AsString()) + if err != nil { + return cty.UnknownVal(cty.String), err + } + duration, err := time.ParseDuration(args[1].AsString()) + if err != nil { + return cty.UnknownVal(cty.String), err + } + + return cty.StringVal(ts.Add(duration).Format(time.RFC3339)), nil + }, +}) + // FormatDate reformats a timestamp given in RFC3339 syntax into another time // syntax defined by a given format string. // @@ -335,9 +362,14 @@ func splitDateFormat(data []byte, atEOF bool) (advance int, token []byte, err er for i := 1; i < len(data); i++ { if data[i] == esc { if (i + 1) == len(data) { - // We need at least one more byte to decide if this is an - // escape or a terminator. - return 0, nil, nil + if atEOF { + // We have a closing quote and are at the end of our input + return len(data), data, nil + } else { + // We need at least one more byte to decide if this is an + // escape or a terminator. + return 0, nil, nil + } } if data[i+1] == esc { i++ // doubled-up quotes are an escape sequence @@ -383,3 +415,20 @@ func splitDateFormat(data []byte, atEOF bool) (advance int, token []byte, err er func startsDateFormatVerb(b byte) bool { return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') } + +// TimeAdd adds a duration to a timestamp, returning a new timestamp. +// +// In the HCL language, timestamps are conventionally represented as +// strings using RFC 3339 "Date and Time format" syntax. Timeadd requires +// the timestamp argument to be a string conforming to this syntax. +// +// `duration` is a string representation of a time difference, consisting of +// sequences of number and unit pairs, like `"1.5h"` or `1h30m`. The accepted +// units are `ns`, `us` (or `µs`), `"ms"`, `"s"`, `"m"`, and `"h"`. The first +// number may be negative to indicate a negative duration, like `"-2h5m"`. +// +// The result is a string, also in RFC 3339 format, representing the result +// of adding the given direction to the given timestamp. +func TimeAdd(timestamp cty.Value, duration cty.Value) (cty.Value, error) { + return TimeAddFunc.Call([]cty.Value{timestamp, duration}) +} diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/format.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/format.go index 834e9b6fcc13..b95c347f5758 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/format.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/format.go @@ -6,7 +6,7 @@ import ( "math/big" "strings" - "github.com/apparentlymart/go-textseg/textseg" + "github.com/apparentlymart/go-textseg/v12/textseg" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/convert" @@ -85,7 +85,7 @@ var FormatListFunc = function.New(&function.Spec{ argTy := arg.Type() switch { case (argTy.IsListType() || argTy.IsSetType() || argTy.IsTupleType()) && !arg.IsNull(): - if !argTy.IsTupleType() && !arg.IsKnown() { + if !argTy.IsTupleType() && !(arg.IsKnown() && arg.Length().IsKnown()) { // We can't iterate this one at all yet then, so we can't // yet produce a result. unknowns[i] = true diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/json.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/json.go index 07901c65d377..02770a652870 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/json.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/json.go @@ -12,6 +12,7 @@ var JSONEncodeFunc = function.New(&function.Spec{ Name: "val", Type: cty.DynamicPseudoType, AllowDynamicType: true, + AllowNull: true, }, }, Type: function.StaticReturnType(cty.String), @@ -24,6 +25,10 @@ var JSONEncodeFunc = function.New(&function.Spec{ return cty.UnknownVal(retType), nil } + if val.IsNull() { + return cty.StringVal("null"), nil + } + buf, err := json.Marshal(val, val.Type()) if err != nil { return cty.NilVal, err diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/number.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/number.go index 480305e831d0..7bbe584b0a12 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/number.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/number.go @@ -2,10 +2,12 @@ package stdlib import ( "fmt" + "math" "math/big" "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/function" + "github.com/zclconf/go-cty/cty/gocty" ) var AbsoluteFunc = function.New(&function.Spec{ @@ -358,6 +360,188 @@ var IntFunc = function.New(&function.Spec{ }, }) +// CeilFunc is a function that returns the closest whole number greater +// than or equal to the given value. +var CeilFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "num", + Type: cty.Number, + }, + }, + Type: function.StaticReturnType(cty.Number), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + var val float64 + if err := gocty.FromCtyValue(args[0], &val); err != nil { + return cty.UnknownVal(cty.String), err + } + if math.IsInf(val, 0) { + return cty.NumberFloatVal(val), nil + } + return cty.NumberIntVal(int64(math.Ceil(val))), nil + }, +}) + +// FloorFunc is a function that returns the closest whole number lesser +// than or equal to the given value. +var FloorFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "num", + Type: cty.Number, + }, + }, + Type: function.StaticReturnType(cty.Number), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + var val float64 + if err := gocty.FromCtyValue(args[0], &val); err != nil { + return cty.UnknownVal(cty.String), err + } + if math.IsInf(val, 0) { + return cty.NumberFloatVal(val), nil + } + return cty.NumberIntVal(int64(math.Floor(val))), nil + }, +}) + +// LogFunc is a function that returns the logarithm of a given number in a given base. +var LogFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "num", + Type: cty.Number, + }, + { + Name: "base", + Type: cty.Number, + }, + }, + Type: function.StaticReturnType(cty.Number), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + var num float64 + if err := gocty.FromCtyValue(args[0], &num); err != nil { + return cty.UnknownVal(cty.String), err + } + + var base float64 + if err := gocty.FromCtyValue(args[1], &base); err != nil { + return cty.UnknownVal(cty.String), err + } + + return cty.NumberFloatVal(math.Log(num) / math.Log(base)), nil + }, +}) + +// PowFunc is a function that returns the logarithm of a given number in a given base. +var PowFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "num", + Type: cty.Number, + }, + { + Name: "power", + Type: cty.Number, + }, + }, + Type: function.StaticReturnType(cty.Number), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + var num float64 + if err := gocty.FromCtyValue(args[0], &num); err != nil { + return cty.UnknownVal(cty.String), err + } + + var power float64 + if err := gocty.FromCtyValue(args[1], &power); err != nil { + return cty.UnknownVal(cty.String), err + } + + return cty.NumberFloatVal(math.Pow(num, power)), nil + }, +}) + +// SignumFunc is a function that determines the sign of a number, returning a +// number between -1 and 1 to represent the sign.. +var SignumFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "num", + Type: cty.Number, + }, + }, + Type: function.StaticReturnType(cty.Number), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + var num int + if err := gocty.FromCtyValue(args[0], &num); err != nil { + return cty.UnknownVal(cty.String), err + } + switch { + case num < 0: + return cty.NumberIntVal(-1), nil + case num > 0: + return cty.NumberIntVal(+1), nil + default: + return cty.NumberIntVal(0), nil + } + }, +}) + +// ParseIntFunc is a function that parses a string argument and returns an integer of the specified base. +var ParseIntFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "number", + Type: cty.DynamicPseudoType, + }, + { + Name: "base", + Type: cty.Number, + }, + }, + + Type: func(args []cty.Value) (cty.Type, error) { + if !args[0].Type().Equals(cty.String) { + return cty.Number, function.NewArgErrorf(0, "first argument must be a string, not %s", args[0].Type().FriendlyName()) + } + return cty.Number, nil + }, + + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + var numstr string + var base int + var err error + + if err = gocty.FromCtyValue(args[0], &numstr); err != nil { + return cty.UnknownVal(cty.String), function.NewArgError(0, err) + } + + if err = gocty.FromCtyValue(args[1], &base); err != nil { + return cty.UnknownVal(cty.Number), function.NewArgError(1, err) + } + + if base < 2 || base > 62 { + return cty.UnknownVal(cty.Number), function.NewArgErrorf( + 1, + "base must be a whole number between 2 and 62 inclusive", + ) + } + + num, ok := (&big.Int{}).SetString(numstr, base) + if !ok { + return cty.UnknownVal(cty.Number), function.NewArgErrorf( + 0, + "cannot parse %q as a base %d integer", + numstr, + base, + ) + } + + parsedNum := cty.NumberVal((&big.Float{}).SetInt(num)) + + return parsedNum, nil + }, +}) + // Absolute returns the magnitude of the given number, without its sign. // That is, it turns negative values into positive values. func Absolute(num cty.Value) (cty.Value, error) { @@ -436,3 +620,34 @@ func Int(num cty.Value) (cty.Value, error) { } return IntFunc.Call([]cty.Value{num}) } + +// Ceil returns the closest whole number greater than or equal to the given value. +func Ceil(num cty.Value) (cty.Value, error) { + return CeilFunc.Call([]cty.Value{num}) +} + +// Floor returns the closest whole number lesser than or equal to the given value. +func Floor(num cty.Value) (cty.Value, error) { + return FloorFunc.Call([]cty.Value{num}) +} + +// Log returns returns the logarithm of a given number in a given base. +func Log(num, base cty.Value) (cty.Value, error) { + return LogFunc.Call([]cty.Value{num, base}) +} + +// Pow returns the logarithm of a given number in a given base. +func Pow(num, power cty.Value) (cty.Value, error) { + return PowFunc.Call([]cty.Value{num, power}) +} + +// Signum determines the sign of a number, returning a number between -1 and +// 1 to represent the sign. +func Signum(num cty.Value) (cty.Value, error) { + return SignumFunc.Call([]cty.Value{num}) +} + +// ParseInt parses a string argument and returns an integer of the specified base. +func ParseInt(num cty.Value, base cty.Value) (cty.Value, error) { + return ParseIntFunc.Call([]cty.Value{num, base}) +} diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/set.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/set.go index 100078fdc430..29c425eaf29c 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/set.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/set.go @@ -44,7 +44,7 @@ var SetUnionFunc = function.New(&function.Spec{ Type: setOperationReturnType, Impl: setOperationImpl(func(s1, s2 cty.ValueSet) cty.ValueSet { return s1.Union(s2) - }), + }, true), }) var SetIntersectionFunc = function.New(&function.Spec{ @@ -63,7 +63,7 @@ var SetIntersectionFunc = function.New(&function.Spec{ Type: setOperationReturnType, Impl: setOperationImpl(func(s1, s2 cty.ValueSet) cty.ValueSet { return s1.Intersection(s2) - }), + }, false), }) var SetSubtractFunc = function.New(&function.Spec{ @@ -82,7 +82,7 @@ var SetSubtractFunc = function.New(&function.Spec{ Type: setOperationReturnType, Impl: setOperationImpl(func(s1, s2 cty.ValueSet) cty.ValueSet { return s1.Subtract(s2) - }), + }, false), }) var SetSymmetricDifferenceFunc = function.New(&function.Spec{ @@ -100,8 +100,8 @@ var SetSymmetricDifferenceFunc = function.New(&function.Spec{ }, Type: setOperationReturnType, Impl: setOperationImpl(func(s1, s2 cty.ValueSet) cty.ValueSet { - return s1.Subtract(s2) - }), + return s1.SymmetricDifference(s2) + }, false), }) // SetHasElement determines whether the given set contains the given value as an @@ -163,8 +163,23 @@ func SetSymmetricDifference(sets ...cty.Value) (cty.Value, error) { func setOperationReturnType(args []cty.Value) (ret cty.Type, err error) { var etys []cty.Type for _, arg := range args { - etys = append(etys, arg.Type().ElementType()) + ty := arg.Type().ElementType() + + // Do not unify types for empty dynamic pseudo typed collections. These + // will always convert to any other concrete type. + if arg.IsKnown() && arg.LengthInt() == 0 && ty.Equals(cty.DynamicPseudoType) { + continue + } + + etys = append(etys, ty) } + + // If all element types were skipped (due to being empty dynamic collections), + // the return type should also be a set of dynamic pseudo type. + if len(etys) == 0 { + return cty.Set(cty.DynamicPseudoType), nil + } + newEty, _ := convert.UnifyUnsafe(etys) if newEty == cty.NilType { return cty.NilType, fmt.Errorf("given sets must all have compatible element types") @@ -172,13 +187,21 @@ func setOperationReturnType(args []cty.Value) (ret cty.Type, err error) { return cty.Set(newEty), nil } -func setOperationImpl(f func(s1, s2 cty.ValueSet) cty.ValueSet) function.ImplFunc { +func setOperationImpl(f func(s1, s2 cty.ValueSet) cty.ValueSet, allowUnknowns bool) function.ImplFunc { return func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { first := args[0] first, err = convert.Convert(first, retType) if err != nil { return cty.NilVal, function.NewArgError(0, err) } + if !allowUnknowns && !first.IsWhollyKnown() { + // This set function can produce a correct result only when all + // elements are known, because eventually knowing the unknown + // values may cause the result to have fewer known elements, or + // might cause a result with no unknown elements at all to become + // one with a different length. + return cty.UnknownVal(retType), nil + } set := first.AsValueSet() for i, arg := range args[1:] { @@ -186,6 +209,10 @@ func setOperationImpl(f func(s1, s2 cty.ValueSet) cty.ValueSet) function.ImplFun if err != nil { return cty.NilVal, function.NewArgError(i+1, err) } + if !allowUnknowns && !arg.IsWhollyKnown() { + // (For the same reason as we did this check for "first" above.) + return cty.UnknownVal(retType), nil + } argSet := arg.AsValueSet() set = f(set, argSet) diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/string.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/string.go index 12e9dbc3ddf1..01ebc47fd5dc 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/string.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/string.go @@ -1,9 +1,13 @@ package stdlib import ( + "fmt" + "regexp" + "sort" "strings" - "github.com/apparentlymart/go-textseg/textseg" + "github.com/apparentlymart/go-textseg/v12/textseg" + "github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty/function" "github.com/zclconf/go-cty/cty/gocty" @@ -140,8 +144,14 @@ var SubstrFunc = function.New(&function.Spec{ } offset += totalLen + } else if length == 0 { + // Short circuit here, after error checks, because if a + // string of length 0 has been requested it will always + // be the empty string + return cty.StringVal(""), nil } + sub := in pos := 0 var i int @@ -187,6 +197,252 @@ var SubstrFunc = function.New(&function.Spec{ }, }) +var JoinFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "separator", + Type: cty.String, + }, + }, + VarParam: &function.Parameter{ + Name: "lists", + Type: cty.List(cty.String), + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + sep := args[0].AsString() + listVals := args[1:] + if len(listVals) < 1 { + return cty.UnknownVal(cty.String), fmt.Errorf("at least one list is required") + } + + l := 0 + for _, list := range listVals { + if !list.IsWhollyKnown() { + return cty.UnknownVal(cty.String), nil + } + l += list.LengthInt() + } + + items := make([]string, 0, l) + for ai, list := range listVals { + ei := 0 + for it := list.ElementIterator(); it.Next(); { + _, val := it.Element() + if val.IsNull() { + if len(listVals) > 1 { + return cty.UnknownVal(cty.String), function.NewArgErrorf(ai+1, "element %d of list %d is null; cannot concatenate null values", ei, ai+1) + } + return cty.UnknownVal(cty.String), function.NewArgErrorf(ai+1, "element %d is null; cannot concatenate null values", ei) + } + items = append(items, val.AsString()) + ei++ + } + } + + return cty.StringVal(strings.Join(items, sep)), nil + }, +}) + +var SortFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "list", + Type: cty.List(cty.String), + }, + }, + Type: function.StaticReturnType(cty.List(cty.String)), + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + listVal := args[0] + + if !listVal.IsWhollyKnown() { + // If some of the element values aren't known yet then we + // can't yet predict the order of the result. + return cty.UnknownVal(retType), nil + } + if listVal.LengthInt() == 0 { // Easy path + return listVal, nil + } + + list := make([]string, 0, listVal.LengthInt()) + for it := listVal.ElementIterator(); it.Next(); { + iv, v := it.Element() + if v.IsNull() { + return cty.UnknownVal(retType), fmt.Errorf("given list element %s is null; a null string cannot be sorted", iv.AsBigFloat().String()) + } + list = append(list, v.AsString()) + } + + sort.Strings(list) + retVals := make([]cty.Value, len(list)) + for i, s := range list { + retVals[i] = cty.StringVal(s) + } + return cty.ListVal(retVals), nil + }, +}) + +var SplitFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "separator", + Type: cty.String, + }, + { + Name: "str", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.List(cty.String)), + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + sep := args[0].AsString() + str := args[1].AsString() + elems := strings.Split(str, sep) + elemVals := make([]cty.Value, len(elems)) + for i, s := range elems { + elemVals[i] = cty.StringVal(s) + } + if len(elemVals) == 0 { + return cty.ListValEmpty(cty.String), nil + } + return cty.ListVal(elemVals), nil + }, +}) + +// ChompFunc is a function that removes newline characters at the end of a +// string. +var ChompFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "str", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + newlines := regexp.MustCompile(`(?:\r\n?|\n)*\z`) + return cty.StringVal(newlines.ReplaceAllString(args[0].AsString(), "")), nil + }, +}) + +// IndentFunc is a function that adds a given number of spaces to the +// beginnings of all but the first line in a given multi-line string. +var IndentFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "spaces", + Type: cty.Number, + }, + { + Name: "str", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + var spaces int + if err := gocty.FromCtyValue(args[0], &spaces); err != nil { + return cty.UnknownVal(cty.String), err + } + data := args[1].AsString() + pad := strings.Repeat(" ", spaces) + return cty.StringVal(strings.Replace(data, "\n", "\n"+pad, -1)), nil + }, +}) + +// TitleFunc is a function that converts the first letter of each word in the +// given string to uppercase. +var TitleFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "str", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + return cty.StringVal(strings.Title(args[0].AsString())), nil + }, +}) + +// TrimSpaceFunc is a function that removes any space characters from the start +// and end of the given string. +var TrimSpaceFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "str", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + return cty.StringVal(strings.TrimSpace(args[0].AsString())), nil + }, +}) + +// TrimFunc is a function that removes the specified characters from the start +// and end of the given string. +var TrimFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "str", + Type: cty.String, + }, + { + Name: "cutset", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + str := args[0].AsString() + cutset := args[1].AsString() + return cty.StringVal(strings.Trim(str, cutset)), nil + }, +}) + +// TrimPrefixFunc is a function that removes the specified characters from the +// start the given string. +var TrimPrefixFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "str", + Type: cty.String, + }, + { + Name: "prefix", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + str := args[0].AsString() + prefix := args[1].AsString() + return cty.StringVal(strings.TrimPrefix(str, prefix)), nil + }, +}) + +// TrimSuffixFunc is a function that removes the specified characters from the +// end of the given string. +var TrimSuffixFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "str", + Type: cty.String, + }, + { + Name: "suffix", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + str := args[0].AsString() + cutset := args[1].AsString() + return cty.StringVal(strings.TrimSuffix(str, cutset)), nil + }, +}) + // Upper is a Function that converts a given string to uppercase. func Upper(str cty.Value) (cty.Value, error) { return UpperFunc.Call([]cty.Value{str}) @@ -232,3 +488,60 @@ func Strlen(str cty.Value) (cty.Value, error) { func Substr(str cty.Value, offset cty.Value, length cty.Value) (cty.Value, error) { return SubstrFunc.Call([]cty.Value{str, offset, length}) } + +// Join concatenates together the string elements of one or more lists with a +// given separator. +func Join(sep cty.Value, lists ...cty.Value) (cty.Value, error) { + args := make([]cty.Value, len(lists)+1) + args[0] = sep + copy(args[1:], lists) + return JoinFunc.Call(args) +} + +// Sort re-orders the elements of a given list of strings so that they are +// in ascending lexicographical order. +func Sort(list cty.Value) (cty.Value, error) { + return SortFunc.Call([]cty.Value{list}) +} + +// Split divides a given string by a given separator, returning a list of +// strings containing the characters between the separator sequences. +func Split(sep, str cty.Value) (cty.Value, error) { + return SplitFunc.Call([]cty.Value{sep, str}) +} + +// Chomp removes newline characters at the end of a string. +func Chomp(str cty.Value) (cty.Value, error) { + return ChompFunc.Call([]cty.Value{str}) +} + +// Indent adds a given number of spaces to the beginnings of all but the first +// line in a given multi-line string. +func Indent(spaces, str cty.Value) (cty.Value, error) { + return IndentFunc.Call([]cty.Value{spaces, str}) +} + +// Title converts the first letter of each word in the given string to uppercase. +func Title(str cty.Value) (cty.Value, error) { + return TitleFunc.Call([]cty.Value{str}) +} + +// TrimSpace removes any space characters from the start and end of the given string. +func TrimSpace(str cty.Value) (cty.Value, error) { + return TrimSpaceFunc.Call([]cty.Value{str}) +} + +// Trim removes the specified characters from the start and end of the given string. +func Trim(str, cutset cty.Value) (cty.Value, error) { + return TrimFunc.Call([]cty.Value{str, cutset}) +} + +// TrimPrefix removes the specified prefix from the start of the given string. +func TrimPrefix(str, prefix cty.Value) (cty.Value, error) { + return TrimPrefixFunc.Call([]cty.Value{str, prefix}) +} + +// TrimSuffix removes the specified suffix from the end of the given string. +func TrimSuffix(str, suffix cty.Value) (cty.Value, error) { + return TrimSuffixFunc.Call([]cty.Value{str, suffix}) +} diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/string_replace.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/string_replace.go new file mode 100644 index 000000000000..f777ce5c3e96 --- /dev/null +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/function/stdlib/string_replace.go @@ -0,0 +1,80 @@ +package stdlib + +import ( + "regexp" + "strings" + + "github.com/zclconf/go-cty/cty" + "github.com/zclconf/go-cty/cty/function" +) + +// ReplaceFunc is a function that searches a given string for another given +// substring, and replaces each occurence with a given replacement string. +// The substr argument is a simple string. +var ReplaceFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "str", + Type: cty.String, + }, + { + Name: "substr", + Type: cty.String, + }, + { + Name: "replace", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (cty.Value, error) { + str := args[0].AsString() + substr := args[1].AsString() + replace := args[2].AsString() + + return cty.StringVal(strings.Replace(str, substr, replace, -1)), nil + }, +}) + +// RegexReplaceFunc is a function that searches a given string for another +// given substring, and replaces each occurence with a given replacement +// string. The substr argument must be a valid regular expression. +var RegexReplaceFunc = function.New(&function.Spec{ + Params: []function.Parameter{ + { + Name: "str", + Type: cty.String, + }, + { + Name: "substr", + Type: cty.String, + }, + { + Name: "replace", + Type: cty.String, + }, + }, + Type: function.StaticReturnType(cty.String), + Impl: func(args []cty.Value, retType cty.Type) (ret cty.Value, err error) { + str := args[0].AsString() + substr := args[1].AsString() + replace := args[2].AsString() + + re, err := regexp.Compile(substr) + if err != nil { + return cty.UnknownVal(cty.String), err + } + + return cty.StringVal(re.ReplaceAllString(str, replace)), nil + }, +}) + +// Replace searches a given string for another given substring, +// and replaces all occurrences with a given replacement string. +func Replace(str, substr, replace cty.Value) (cty.Value, error) { + return ReplaceFunc.Call([]cty.Value{str, substr, replace}) +} + +func RegexReplace(str, substr, replace cty.Value) (cty.Value, error) { + return RegexReplaceFunc.Call([]cty.Value{str, substr, replace}) +} diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/json.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/json.go index c421a62ed949..2222e0f80bb6 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/json.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/json.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/json" "fmt" + "sort" ) // MarshalJSON is an implementation of json.Marshaler that allows Type @@ -52,6 +53,19 @@ func (t Type) MarshalJSON() ([]byte, error) { } buf.WriteString(`["object",`) buf.Write(atysJSON) + if optionals := t.OptionalAttributes(); len(optionals) > 0 { + buf.WriteByte(',') + optionalNames := make([]string, 0, len(optionals)) + for k := range optionals { + optionalNames = append(optionalNames, k) + } + sort.Strings(optionalNames) + optionalsJSON, err := json.Marshal(optionalNames) + if err != nil { + return nil, err + } + buf.Write(optionalsJSON) + } buf.WriteRune(']') return buf.Bytes(), nil case typeTuple: @@ -148,7 +162,16 @@ func (t *Type) UnmarshalJSON(buf []byte) error { if err != nil { return err } - *t = Object(atys) + if dec.More() { + var optionals []string + err = dec.Decode(&optionals) + if err != nil { + return err + } + *t = ObjectWithOptionalAttrs(atys, optionals) + } else { + *t = Object(atys) + } case "tuple": var etys []Type err = dec.Decode(&etys) diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/json/marshal.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/json/marshal.go index 75e02577b1ef..7a14ce81a42b 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/json/marshal.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/json/marshal.go @@ -10,7 +10,7 @@ import ( func marshal(val cty.Value, t cty.Type, path cty.Path, b *bytes.Buffer) error { if val.IsMarked() { - return path.NewErrorf("value has marks, so it cannot be seralized") + return path.NewErrorf("value has marks, so it cannot be serialized as JSON") } // If we're going to decode as DynamicPseudoType then we need to save diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/marks.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/marks.go index 3898e4553355..4e1d3b129f38 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/marks.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/marks.go @@ -67,6 +67,23 @@ func (m ValueMarks) GoString() string { return s.String() } +// PathValueMarks is a structure that enables tracking marks +// and the paths where they are located in one type +type PathValueMarks struct { + Path Path + Marks ValueMarks +} + +func (p PathValueMarks) Equal(o PathValueMarks) bool { + if !p.Path.Equals(o.Path) { + return false + } + if !p.Marks.Equal(o.Marks) { + return false + } + return true +} + // IsMarked returns true if and only if the receiving value carries at least // one mark. A marked value cannot be used directly with integration methods // without explicitly unmarking it (and retrieving the markings) first. @@ -174,6 +191,31 @@ func (val Value) Mark(mark interface{}) Value { } } +type applyPathValueMarksTransformer struct { + pvm []PathValueMarks +} + +func (t *applyPathValueMarksTransformer) Enter(p Path, v Value) (Value, error) { + return v, nil +} + +func (t *applyPathValueMarksTransformer) Exit(p Path, v Value) (Value, error) { + for _, path := range t.pvm { + if p.Equals(path.Path) { + return v.WithMarks(path.Marks), nil + } + } + return v, nil +} + +// MarkWithPaths accepts a slice of PathValueMarks to apply +// markers to particular paths and returns the marked +// Value. +func (val Value) MarkWithPaths(pvm []PathValueMarks) Value { + ret, _ := TransformWithTransformer(val, &applyPathValueMarksTransformer{pvm}) + return ret +} + // Unmark separates the marks of the receiving value from the value itself, // removing a new unmarked value and a map (representing a set) of the marks. // @@ -191,6 +233,24 @@ func (val Value) Unmark() (Value, ValueMarks) { }, marks } +type unmarkTransformer struct { + pvm []PathValueMarks +} + +func (t *unmarkTransformer) Enter(p Path, v Value) (Value, error) { + unmarkedVal, marks := v.Unmark() + if len(marks) > 0 { + path := make(Path, len(p), len(p)+1) + copy(path, p) + t.pvm = append(t.pvm, PathValueMarks{path, marks}) + } + return unmarkedVal, nil +} + +func (t *unmarkTransformer) Exit(p Path, v Value) (Value, error) { + return v, nil +} + // UnmarkDeep is similar to Unmark, but it works with an entire nested structure // rather than just the given value directly. // @@ -198,17 +258,29 @@ func (val Value) Unmark() (Value, ValueMarks) { // the returned marks set includes the superset of all of the marks encountered // during the operation. func (val Value) UnmarkDeep() (Value, ValueMarks) { + t := unmarkTransformer{} + ret, _ := TransformWithTransformer(val, &t) + marks := make(ValueMarks) - ret, _ := Transform(val, func(_ Path, v Value) (Value, error) { - unmarkedV, valueMarks := v.Unmark() - for m, s := range valueMarks { + for _, pvm := range t.pvm { + for m, s := range pvm.Marks { marks[m] = s } - return unmarkedV, nil - }) + } + return ret, marks } +// UnmarkDeepWithPaths is like UnmarkDeep, except it returns a slice +// of PathValueMarks rather than a superset of all marks. This allows +// a caller to know which marks are associated with which paths +// in the Value. +func (val Value) UnmarkDeepWithPaths() (Value, []PathValueMarks) { + t := unmarkTransformer{} + ret, _ := TransformWithTransformer(val, &t) + return ret, t.pvm +} + func (val Value) unmarkForce() Value { unw, _ := val.Unmark() return unw diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/object_type.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/object_type.go index 187d38751b8c..0c67d4ecd412 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/object_type.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/object_type.go @@ -2,11 +2,13 @@ package cty import ( "fmt" + "sort" ) type typeObject struct { typeImplSigil - AttrTypes map[string]Type + AttrTypes map[string]Type + AttrOptional map[string]struct{} } // Object creates an object type with the given attribute types. @@ -14,14 +16,52 @@ type typeObject struct { // After a map is passed to this function the caller must no longer access it, // since ownership is transferred to this library. func Object(attrTypes map[string]Type) Type { + return ObjectWithOptionalAttrs(attrTypes, nil) +} + +// ObjectWithOptionalAttrs creates an object type where some of its attributes +// are optional. +// +// This function is EXPERIMENTAL. The behavior of the function or of any other +// functions working either directly or indirectly with a type created by +// this function is not currently considered as a compatibility constraint, and +// is subject to change even in minor-version releases of this module. Other +// modules that work with cty types and values may or may not support object +// types with optional attributes; if they do not, their behavior when +// receiving one may be non-ideal. +// +// Optional attributes are significant only when an object type is being used +// as a target type for conversion in the "convert" package. A value of an +// object type always has a value for each of the attributes in the attribute +// types table, with optional values replaced with null during conversion. +// +// All keys in the optional slice must also exist in the attrTypes map. If not, +// this function will panic. +// +// After a map or array is passed to this function the caller must no longer +// access it, since ownership is transferred to this library. +func ObjectWithOptionalAttrs(attrTypes map[string]Type, optional []string) Type { attrTypesNorm := make(map[string]Type, len(attrTypes)) for k, v := range attrTypes { attrTypesNorm[NormalizeString(k)] = v } + var optionalSet map[string]struct{} + if len(optional) > 0 { + optionalSet = make(map[string]struct{}, len(optional)) + for _, k := range optional { + k = NormalizeString(k) + if _, exists := attrTypesNorm[k]; !exists { + panic(fmt.Sprintf("optional contains undeclared attribute %q", k)) + } + optionalSet[k] = struct{}{} + } + } + return Type{ typeObject{ - AttrTypes: attrTypesNorm, + AttrTypes: attrTypesNorm, + AttrOptional: optionalSet, }, } } @@ -44,6 +84,11 @@ func (t typeObject) Equals(other Type) bool { if !oty.Equals(ty) { return false } + _, opt := t.AttrOptional[attr] + _, oopt := ot.AttrOptional[attr] + if opt != oopt { + return false + } } return true @@ -66,6 +111,14 @@ func (t typeObject) GoString() string { if len(t.AttrTypes) == 0 { return "cty.EmptyObject" } + if len(t.AttrOptional) > 0 { + opt := make([]string, len(t.AttrOptional)) + for k := range t.AttrOptional { + opt = append(opt, k) + } + sort.Strings(opt) + return fmt.Sprintf("cty.ObjectWithOptionalAttrs(%#v, %#v)", t.AttrTypes, opt) + } return fmt.Sprintf("cty.Object(%#v)", t.AttrTypes) } @@ -133,3 +186,35 @@ func (t Type) AttributeTypes() map[string]Type { } panic("AttributeTypes on non-object Type") } + +// OptionalAttributes returns a map representing the set of attributes +// that are optional. Will panic if the receiver is not an object type +// (use IsObjectType to confirm). +// +// The returned map is part of the internal state of the type, and is provided +// for read access only. It is forbidden for any caller to modify the returned +// map. +func (t Type) OptionalAttributes() map[string]struct{} { + if ot, ok := t.typeImpl.(typeObject); ok { + return ot.AttrOptional + } + panic("OptionalAttributes on non-object Type") +} + +// AttributeOptional returns true if the attribute of the given name is +// optional. +// +// Will panic if the receiver is not an object type (use IsObjectType to +// confirm) or if the object type has no such attribute (use HasAttribute to +// confirm). +func (t Type) AttributeOptional(name string) bool { + name = NormalizeString(name) + if ot, ok := t.typeImpl.(typeObject); ok { + if _, hasAttr := ot.AttrTypes[name]; !hasAttr { + panic("no such attribute") + } + _, exists := ot.AttrOptional[name] + return exists + } + panic("AttributeDefaultValue on non-object Type") +} diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/path.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/path.go index b31444954d3a..636e68c63dd1 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/path.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/path.go @@ -51,11 +51,31 @@ func (p Path) Index(v Value) Path { return ret } +// IndexInt is a typed convenience method for Index. +func (p Path) IndexInt(v int) Path { + return p.Index(NumberIntVal(int64(v))) +} + +// IndexString is a typed convenience method for Index. +func (p Path) IndexString(v string) Path { + return p.Index(StringVal(v)) +} + // IndexPath is a convenience method to start a new Path with an IndexStep. func IndexPath(v Value) Path { return Path{}.Index(v) } +// IndexIntPath is a typed convenience method for IndexPath. +func IndexIntPath(v int) Path { + return IndexPath(NumberIntVal(int64(v))) +} + +// IndexStringPath is a typed convenience method for IndexPath. +func IndexStringPath(v string) Path { + return IndexPath(StringVal(v)) +} + // GetAttr returns a new Path that is the reciever with a GetAttrStep appended // to the end. // diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/path_set.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/path_set.go index f1c892b9d9d4..1960c01e9749 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/path_set.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/path_set.go @@ -196,3 +196,9 @@ func (r pathSetRules) Equivalent(a, b interface{}) bool { return true } + +// SameRules is true if both Rules instances are pathSetRules structs. +func (r pathSetRules) SameRules(other set.Rules) bool { + _, ok := other.(pathSetRules) + return ok +} diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set/rules.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set/rules.go index 51f744b5e9ab..03ecd25b97c6 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set/rules.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set/rules.go @@ -22,6 +22,10 @@ type Rules interface { // though it is *not* required that two values with the same hash value // be equivalent. Equivalent(interface{}, interface{}) bool + + // SameRules returns true if the instance is equivalent to another Rules + // instance. + SameRules(Rules) bool } // OrderedRules is an extension of Rules that can apply a partial order to diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set/set.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set/set.go index b4fb316f1ccd..15a76638f568 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set/set.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set/set.go @@ -41,7 +41,7 @@ func NewSetFromSlice(rules Rules, vals []interface{}) Set { } func sameRules(s1 Set, s2 Set) bool { - return s1.rules == s2.rules + return s1.rules.SameRules(s2.rules) } func mustHaveSameRules(s1 Set, s2 Set) { @@ -53,7 +53,7 @@ func mustHaveSameRules(s1 Set, s2 Set) { // HasRules returns true if and only if the receiving set has the given rules // instance as its rules. func (s Set) HasRules(rules Rules) bool { - return s.rules == rules + return s.rules.SameRules(rules) } // Rules returns the receiving set's rules instance. diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set_internals.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set_internals.go index e7e1d3337e32..2b8af1e21708 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set_internals.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/set_internals.go @@ -65,6 +65,17 @@ func (r setRules) Equivalent(v1 interface{}, v2 interface{}) bool { return eqv.v == true } +// SameRules is only true if the other Rules instance is also a setRules struct, +// and the types are considered equal. +func (r setRules) SameRules(other set.Rules) bool { + rules, ok := other.(setRules) + if !ok { + return false + } + + return r.Type.Equals(rules.Type) +} + // Less is an implementation of set.OrderedRules so that we can iterate over // set elements in a consistent order, where such an order is possible. func (r setRules) Less(v1, v2 interface{}) bool { diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/type.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/type.go index 730cb9862efb..5c44575338c7 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/type.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/type.go @@ -36,6 +36,9 @@ func (t typeImplSigil) isTypeImpl() typeImplSigil { // Equals returns true if the other given Type exactly equals the receiver // type. func (t Type) Equals(other Type) bool { + if t == NilType || other == NilType { + return t == other + } return t.typeImpl.Equals(other) } @@ -87,7 +90,7 @@ func (t Type) HasDynamicTypes() bool { case t.IsPrimitiveType(): return false case t.IsCollectionType(): - return false + return t.ElementType().HasDynamicTypes() case t.IsObjectType(): attrTypes := t.AttributeTypes() for _, at := range attrTypes { diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/unknown.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/unknown.go index e54179eb144d..83893c0237de 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/unknown.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/unknown.go @@ -5,7 +5,8 @@ package cty type unknownType struct { } -// Unknown is a special value that can be +// unknown is a special value that can be used as the internal value of a +// Value to create a placeholder for a value that isn't yet known. var unknown interface{} = &unknownType{} // UnknownVal returns an Value that represents an unknown value of the given diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value.go index 1025ba82eba3..f6a25ddef9f6 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value.go @@ -106,3 +106,37 @@ func (val Value) IsWhollyKnown() bool { return true } } + +// HasWhollyKnownType checks if the value is dynamic, or contains any nested +// DynamicVal. This implies that both the value is not known, and the final +// type may change. +func (val Value) HasWhollyKnownType() bool { + // a null dynamic type is known + if val.IsNull() { + return true + } + + // an unknown DynamicPseudoType is a DynamicVal, but we don't want to + // check that value for equality here, since this method is used within the + // equality check. + if !val.IsKnown() && val.ty == DynamicPseudoType { + return false + } + + if val.CanIterateElements() { + // if the value is not known, then we can look directly at the internal + // types + if !val.IsKnown() { + return !val.ty.HasDynamicTypes() + } + + for it := val.ElementIterator(); it.Next(); { + _, ev := it.Element() + if !ev.HasWhollyKnownType() { + return false + } + } + } + + return true +} diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value_init.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value_init.go index 2dafe17ae343..fc2d7b6fb392 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value_init.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value_init.go @@ -247,11 +247,6 @@ func SetVal(vals []Value) Value { val = unmarkedVal markSets = append(markSets, marks) } - if val.ContainsMarked() { - // FIXME: Allow this, but unmark the values and apply the - // marking to the set itself instead. - panic("set cannot contain marked values") - } if elementType == DynamicPseudoType { elementType = val.ty } else if val.ty != DynamicPseudoType && !elementType.Equals(val.ty) { diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value_ops.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value_ops.go index 35a644be45ff..b33cc4f4711c 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value_ops.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/value_ops.go @@ -3,7 +3,6 @@ package cty import ( "fmt" "math/big" - "reflect" "github.com/zclconf/go-cty/cty/set" ) @@ -133,9 +132,9 @@ func (val Value) Equals(other Value) Value { case val.IsKnown() && !other.IsKnown(): switch { case val.IsNull(), other.ty.HasDynamicTypes(): - // If known is Null, we need to wait for the unkown value since + // If known is Null, we need to wait for the unknown value since // nulls of any type are equal. - // An unkown with a dynamic type compares as unknown, which we need + // An unknown with a dynamic type compares as unknown, which we need // to check before the type comparison below. return UnknownVal(Bool) case !val.ty.Equals(other.ty): @@ -148,9 +147,9 @@ func (val Value) Equals(other Value) Value { case other.IsKnown() && !val.IsKnown(): switch { case other.IsNull(), val.ty.HasDynamicTypes(): - // If known is Null, we need to wait for the unkown value since + // If known is Null, we need to wait for the unknown value since // nulls of any type are equal. - // An unkown with a dynamic type compares as unknown, which we need + // An unknown with a dynamic type compares as unknown, which we need // to check before the type comparison below. return UnknownVal(Bool) case !other.ty.Equals(val.ty): @@ -171,7 +170,15 @@ func (val Value) Equals(other Value) Value { return BoolVal(false) } - if val.ty.HasDynamicTypes() || other.ty.HasDynamicTypes() { + // Check if there are any nested dynamic values making this comparison + // unknown. + if !val.HasWhollyKnownType() || !other.HasWhollyKnownType() { + // Even if we have dynamic values, we can still determine inequality if + // there is no way the types could later conform. + if val.ty.TestConformance(other.ty) != nil && other.ty.TestConformance(val.ty) != nil { + return BoolVal(false) + } + return UnknownVal(Bool) } @@ -262,24 +269,26 @@ func (val Value) Equals(other Value) Value { s2 := other.v.(set.Set) equal := true - // Note that by our definition of sets it's never possible for two - // sets that contain unknown values (directly or indicrectly) to - // ever be equal, even if they are otherwise identical. - - // FIXME: iterating both lists and checking each item is not the - // ideal implementation here, but it works with the primitives we - // have in the set implementation. Perhaps the set implementation - // can provide its own equality test later. - s1.EachValue(func(v interface{}) { - if !s2.Has(v) { + // Two sets are equal if all of their values are known and all values + // in one are also in the other. + for it := s1.Iterator(); it.Next(); { + rv := it.Value() + if rv == unknown { // "unknown" is the internal representation of unknown-ness + return UnknownVal(Bool) + } + if !s2.Has(rv) { equal = false } - }) - s2.EachValue(func(v interface{}) { - if !s1.Has(v) { + } + for it := s2.Iterator(); it.Next(); { + rv := it.Value() + if rv == unknown { // "unknown" is the internal representation of unknown-ness + return UnknownVal(Bool) + } + if !s1.Has(rv) { equal = false } - }) + } result = equal case ty.IsMapType(): @@ -454,17 +463,32 @@ func (val Value) RawEquals(other Value) bool { return true } return false + case ty.IsSetType(): - s1 := val.v.(set.Set) - s2 := other.v.(set.Set) + // Convert the set values into a slice so that we can compare each + // value. This is safe because the underlying sets are ordered (see + // setRules in set_internals.go), and so the results are guaranteed to + // be in a consistent order for two equal sets + setList1 := val.AsValueSlice() + setList2 := other.AsValueSlice() + + // If both physical sets have the same length and they have all of their + // _known_ values in common, we know that both sets also have the same + // number of unknown values. + if len(setList1) != len(setList2) { + return false + } + + for i := range setList1 { + eq := setList1[i].RawEquals(setList2[i]) + if !eq { + return false + } + } - // Since we're intentionally ignoring our rule that two unknowns - // are never equal, we can cheat here. - // (This isn't 100% right since e.g. it will fail if the set contains - // numbers that are infinite, which DeepEqual can't compare properly. - // We're accepting that limitation for simplicity here, since this - // function is here primarily for testing.) - return reflect.DeepEqual(s1, s2) + // If we got here without returning false already then our sets are + // equal enough for RawEquals purposes. + return true case ty.IsMapType(): ety := ty.typeImpl.(typeMap).ElementTypeT @@ -572,8 +596,25 @@ func (val Value) Multiply(other Value) Value { return *shortCircuit } - ret := new(big.Float) + // find the larger precision of the arguments + resPrec := val.v.(*big.Float).Prec() + otherPrec := other.v.(*big.Float).Prec() + if otherPrec > resPrec { + resPrec = otherPrec + } + + // make sure we have enough precision for the product + ret := new(big.Float).SetPrec(512) ret.Mul(val.v.(*big.Float), other.v.(*big.Float)) + + // now reduce the precision back to the greater argument, or the minimum + // required by the product. + minPrec := ret.MinPrec() + if minPrec > resPrec { + resPrec = minPrec + } + ret.SetPrec(resPrec) + return NumberVal(ret) } @@ -645,11 +686,14 @@ func (val Value) Modulo(other Value) Value { // FIXME: This is a bit clumsy. Should come back later and see if there's a // more straightforward way to do this. rat := val.Divide(other) - ratFloorInt := &big.Int{} - rat.v.(*big.Float).Int(ratFloorInt) - work := (&big.Float{}).SetInt(ratFloorInt) + ratFloorInt, _ := rat.v.(*big.Float).Int(nil) + + // start with a copy of the original larger value so that we do not lose + // precision. + v := val.v.(*big.Float) + work := new(big.Float).Copy(v).SetInt(ratFloorInt) work.Mul(other.v.(*big.Float), work) - work.Sub(val.v.(*big.Float), work) + work.Sub(v, work) return NumberVal(work) } @@ -947,8 +991,7 @@ func (val Value) HasElement(elem Value) Value { // If the receiver is null then this function will panic. // // Note that Length is not supported for strings. To determine the length -// of a string, call AsString and take the length of the native Go string -// that is returned. +// of a string, use the Length function in funcs/stdlib. func (val Value) Length() Value { if val.IsMarked() { val, valMarks := val.Unmark() @@ -963,6 +1006,25 @@ func (val Value) Length() Value { if !val.IsKnown() { return UnknownVal(Number) } + if val.Type().IsSetType() { + // The Length rules are a little different for sets because if any + // unknown values are present then the values they are standing in for + // may or may not be equal to other elements in the set, and thus they + // may or may not coalesce with other elements and produce fewer + // items in the resulting set. + storeLength := int64(val.v.(set.Set).Length()) + if storeLength == 1 || val.IsWhollyKnown() { + // If our set is wholly known then we know its length. + // + // We also know the length if the physical store has only one + // element, even if that element is unknown, because there's + // nothing else in the set for it to coalesce with and a single + // unknown value cannot represent more than one known value. + return NumberIntVal(storeLength) + } + // Otherwise, we cannot predict the length. + return UnknownVal(Number) + } return NumberIntVal(int64(val.LengthInt())) } @@ -972,6 +1034,13 @@ func (val Value) Length() Value { // // This is an integration method provided for the convenience of code bridging // into Go's type system. +// +// For backward compatibility with an earlier implementation error, LengthInt's +// result can disagree with Length's result for any set containing unknown +// values. Length can potentially indicate the set's length is unknown in that +// case, whereas LengthInt will return the maximum possible length as if the +// unknown values were each a placeholder for a value not equal to any other +// value in the set. func (val Value) LengthInt() int { val.assertUnmarked() if val.Type().IsTupleType() { @@ -995,6 +1064,15 @@ func (val Value) LengthInt() int { return len(val.v.([]interface{})) case val.ty.IsSetType(): + // NOTE: This is technically not correct in cases where the set + // contains unknown values, because in that case we can't know how + // many known values those unknown values are standing in for -- they + // might coalesce with other values once known. + // + // However, this incorrect behavior is preserved for backward + // compatibility with callers that were relying on LengthInt rather + // than calling Length. Instead of panicking when a set contains an + // unknown value, LengthInt returns the largest possible length. return val.v.(set.Set).Length() case val.ty.IsMapType(): diff --git a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/walk.go b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/walk.go index a6943babef84..d17f48ccd1e4 100644 --- a/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/walk.go +++ b/awsproviderlint/vendor/github.com/zclconf/go-cty/cty/walk.go @@ -61,6 +61,34 @@ func walk(path Path, val Value, cb func(Path, Value) (bool, error)) error { return nil } +// Transformer is the interface used to optionally transform values in a +// possibly-complex structure. The Enter method is called before traversing +// through a given path, and the Exit method is called when traversal of a +// path is complete. +// +// Use Enter when you want to transform a complex value before traversal +// (preorder), and Exit when you want to transform a value after traversal +// (postorder). +// +// The path passed to the given function may not be used after that function +// returns, since its backing array is re-used for other calls. +type Transformer interface { + Enter(Path, Value) (Value, error) + Exit(Path, Value) (Value, error) +} + +type postorderTransformer struct { + callback func(Path, Value) (Value, error) +} + +func (t *postorderTransformer) Enter(p Path, v Value) (Value, error) { + return v, nil +} + +func (t *postorderTransformer) Exit(p Path, v Value) (Value, error) { + return t.callback(p, v) +} + // Transform visits all of the values in a possibly-complex structure, // calling a given function for each value which has an opportunity to // replace that value. @@ -77,7 +105,7 @@ func walk(path Path, val Value, cb func(Path, Value) (bool, error)) error { // value constructor functions. An easy way to preserve invariants is to // ensure that the transform function never changes the value type. // -// The callback function my halt the walk altogether by +// The callback function may halt the walk altogether by // returning a non-nil error. If the returned error is about the element // currently being visited, it is recommended to use the provided path // value to produce a PathError describing that context. @@ -86,10 +114,23 @@ func walk(path Path, val Value, cb func(Path, Value) (bool, error)) error { // returns, since its backing array is re-used for other calls. func Transform(val Value, cb func(Path, Value) (Value, error)) (Value, error) { var path Path - return transform(path, val, cb) + return transform(path, val, &postorderTransformer{cb}) +} + +// TransformWithTransformer allows the caller to more closely control the +// traversal used for transformation. See the documentation for Transformer for +// more details. +func TransformWithTransformer(val Value, t Transformer) (Value, error) { + var path Path + return transform(path, val, t) } -func transform(path Path, val Value, cb func(Path, Value) (Value, error)) (Value, error) { +func transform(path Path, val Value, t Transformer) (Value, error) { + val, err := t.Enter(path, val) + if err != nil { + return DynamicVal, err + } + ty := val.Type() var newVal Value @@ -112,7 +153,7 @@ func transform(path Path, val Value, cb func(Path, Value) (Value, error)) (Value path := append(path, IndexStep{ Key: kv, }) - newEv, err := transform(path, ev, cb) + newEv, err := transform(path, ev, t) if err != nil { return DynamicVal, err } @@ -143,7 +184,7 @@ func transform(path Path, val Value, cb func(Path, Value) (Value, error)) (Value path := append(path, IndexStep{ Key: kv, }) - newEv, err := transform(path, ev, cb) + newEv, err := transform(path, ev, t) if err != nil { return DynamicVal, err } @@ -165,7 +206,7 @@ func transform(path Path, val Value, cb func(Path, Value) (Value, error)) (Value path := append(path, GetAttrStep{ Name: name, }) - newAV, err := transform(path, av, cb) + newAV, err := transform(path, av, t) if err != nil { return DynamicVal, err } @@ -178,5 +219,9 @@ func transform(path Path, val Value, cb func(Path, Value) (Value, error)) (Value newVal = val } - return cb(path, newVal) + newVal, err = t.Exit(path, newVal) + if err != nil { + return DynamicVal, err + } + return newVal, err } diff --git a/awsproviderlint/vendor/golang.org/x/oauth2/go.mod b/awsproviderlint/vendor/golang.org/x/oauth2/go.mod index b3457815528f..2b13f0b34cb7 100644 --- a/awsproviderlint/vendor/golang.org/x/oauth2/go.mod +++ b/awsproviderlint/vendor/golang.org/x/oauth2/go.mod @@ -3,8 +3,7 @@ module golang.org/x/oauth2 go 1.11 require ( - cloud.google.com/go v0.34.0 - golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e - golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 // indirect - google.golang.org/appengine v1.4.0 + cloud.google.com/go v0.65.0 + golang.org/x/net v0.0.0-20200822124328-c89045814202 + google.golang.org/appengine v1.6.6 ) diff --git a/awsproviderlint/vendor/golang.org/x/oauth2/go.sum b/awsproviderlint/vendor/golang.org/x/oauth2/go.sum index 6f0079b0d7f9..eab5833c4210 100644 --- a/awsproviderlint/vendor/golang.org/x/oauth2/go.sum +++ b/awsproviderlint/vendor/golang.org/x/oauth2/go.sum @@ -1,12 +1,361 @@ -cloud.google.com/go v0.34.0 h1:eOI3/cP2VTU6uZLDYAoic+eyzzB9YyGmJ7eIjl8rOPg= +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM= +cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= +cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= +cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= +cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= +cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= +cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= +cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= +cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= +cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.56.0/go.mod h1:jr7tqZxxKOVYizybht9+26Z/gUq7tiRzu+ACVAMbKVk= +cloud.google.com/go v0.57.0/go.mod h1:oXiQ6Rzq3RAkkY7N6t3TcE6jE+CIBBbA36lwQ1JyzZs= +cloud.google.com/go v0.62.0/go.mod h1:jmCYTdRCQuc1PHIIJ/maLInMho30T/Y0M4hTdTShOYc= +cloud.google.com/go v0.65.0 h1:Dg9iHVQfrhq82rUNu9ZxUDrJLaxFUe/HlCVaLyRruq8= +cloud.google.com/go v0.65.0/go.mod h1:O5N8zS7uWy9vkA9vayVHs65eM1ubvY4h553ofrNHObY= +cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= +cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= +cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= +cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= +cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= +cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= +cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= +cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= +cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= +cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= +cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= +cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= +cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.0/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.1/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.3/go.mod h1:UOMv5ysSaYNkG+OFQykRIcU/QvvxJf3p21QfJ2Bt3cw= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= +github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= +github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= +github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= +github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= +github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= +github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= +github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= +go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190409202823-959b441ac422/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= +golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200212091648-12a6c2dcc1e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200331124033-c3d80250170d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200501052902-10377860bb8e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= +golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200312045724-11d5b4c81c7d/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= +golang.org/x/tools v0.0.0-20200331025713-a30bf2db82d4/go.mod h1:Sl4aGygMT6LrqrWclx+PTx3U+LnKx/seiNR+3G19Ar8= +golang.org/x/tools v0.0.0-20200501065659-ab2804fb9c9d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200512131952-2bc93b1c0c88/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200515010526-7d3b6ebf133d/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= +google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= +google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= +google.golang.org/api v0.13.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.14.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.15.0/go.mod h1:iLdEw5Ide6rF15KTC1Kkl0iskquN2gFfn9o9XIsbkAI= +google.golang.org/api v0.17.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.18.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.19.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.20.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.22.0/go.mod h1:BwFmGc8tA3vsd7r/7kR8DY7iEEGSU04BFxCo5jP/sfE= +google.golang.org/api v0.24.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.28.0/go.mod h1:lIXQywCXRcnZPGlsd8NbLnOjtAoL6em04bJ9+z0MncE= +google.golang.org/api v0.29.0/go.mod h1:Lcubydp8VUV7KeIHD9z2Bys/sm/vGKnG1UHuDBSrHWM= +google.golang.org/api v0.30.0/go.mod h1:QGmEvQ87FHZNiUVJkT14jQNYJ4ZJjdRF23ZXz5138Fc= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= +google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc= +google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= +google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= +google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= +google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= +google.golang.org/genproto v0.0.0-20200515170657-fc4c6c6a6587/go.mod h1:YsZOwe1myG/8QRHRsmBRE1LrgQY60beZKjly0O1fX9U= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20200618031413-b414f8b61790/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA= +google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= +google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= +google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= +google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c= +google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= +honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= +rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= +rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff --git a/awsproviderlint/vendor/golang.org/x/tools/go/analysis/analysis.go b/awsproviderlint/vendor/golang.org/x/tools/go/analysis/analysis.go index 8c9977355c9d..8c3c2e7ab950 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/go/analysis/analysis.go +++ b/awsproviderlint/vendor/golang.org/x/tools/go/analysis/analysis.go @@ -95,12 +95,13 @@ type Pass struct { Analyzer *Analyzer // the identity of the current analyzer // syntax and type information - Fset *token.FileSet // file position information - Files []*ast.File // the abstract syntax tree of each file - OtherFiles []string // names of non-Go files of this package - Pkg *types.Package // type information about the package - TypesInfo *types.Info // type information about the syntax trees - TypesSizes types.Sizes // function for computing sizes of types + Fset *token.FileSet // file position information + Files []*ast.File // the abstract syntax tree of each file + OtherFiles []string // names of non-Go files of this package + IgnoredFiles []string // names of ignored source files in this package + Pkg *types.Package // type information about the package + TypesInfo *types.Info // type information about the syntax trees + TypesSizes types.Sizes // function for computing sizes of types // Report reports a Diagnostic, a finding about a specific location // in the analyzed source code such as a potential mistake. diff --git a/awsproviderlint/vendor/golang.org/x/tools/go/analysis/analysistest/analysistest.go b/awsproviderlint/vendor/golang.org/x/tools/go/analysis/analysistest/analysistest.go index 5b22053d00da..ae5630239cb8 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/go/analysis/analysistest/analysistest.go +++ b/awsproviderlint/vendor/golang.org/x/tools/go/analysis/analysistest/analysistest.go @@ -97,12 +97,22 @@ type Testing interface { func RunWithSuggestedFixes(t Testing, dir string, a *analysis.Analyzer, patterns ...string) []*Result { r := Run(t, dir, a, patterns...) - // file -> message -> edits - fileEdits := make(map[*token.File]map[string][]diff.TextEdit) - fileContents := make(map[*token.File][]byte) - - // Validate edits, prepare the fileEdits map and read the file contents. + // Process each result (package) separately, matching up the suggested + // fixes into a diff, which we will compare to the .golden file. We have + // to do this per-result in case a file appears in two packages, such as in + // packages with tests, where mypkg/a.go will appear in both mypkg and + // mypkg.test. In that case, the analyzer may suggest the same set of + // changes to a.go for each package. If we merge all the results, those + // changes get doubly applied, which will cause conflicts or mismatches. + // Validating the results separately means as long as the two analyses + // don't produce conflicting suggestions for a single file, everything + // should match up. for _, act := range r { + // file -> message -> edits + fileEdits := make(map[*token.File]map[string][]diff.TextEdit) + fileContents := make(map[*token.File][]byte) + + // Validate edits, prepare the fileEdits map and read the file contents. for _, diag := range act.Diagnostics { for _, sf := range diag.SuggestedFixes { for _, edit := range sf.TextEdits { @@ -142,78 +152,78 @@ func RunWithSuggestedFixes(t Testing, dir string, a *analysis.Analyzer, patterns } } } - } - for file, fixes := range fileEdits { - // Get the original file contents. - orig, ok := fileContents[file] - if !ok { - t.Errorf("could not find file contents for %s", file.Name()) - continue - } - - // Get the golden file and read the contents. - ar, err := txtar.ParseFile(file.Name() + ".golden") - if err != nil { - t.Errorf("error reading %s.golden: %v", file.Name(), err) - continue - } - - if len(ar.Files) > 0 { - // one virtual file per kind of suggested fix + for file, fixes := range fileEdits { + // Get the original file contents. + orig, ok := fileContents[file] + if !ok { + t.Errorf("could not find file contents for %s", file.Name()) + continue + } - if len(ar.Comment) != 0 { - // we allow either just the comment, or just virtual - // files, not both. it is not clear how "both" should - // behave. - t.Errorf("%s.golden has leading comment; we don't know what to do with it", file.Name()) + // Get the golden file and read the contents. + ar, err := txtar.ParseFile(file.Name() + ".golden") + if err != nil { + t.Errorf("error reading %s.golden: %v", file.Name(), err) continue } - for sf, edits := range fixes { - found := false - for _, vf := range ar.Files { - if vf.Name == sf { - found = true - out := diff.ApplyEdits(string(orig), edits) - // the file may contain multiple trailing - // newlines if the user places empty lines - // between files in the archive. normalize - // this to a single newline. - want := string(bytes.TrimRight(vf.Data, "\n")) + "\n" - formatted, err := format.Source([]byte(out)) - if err != nil { - continue - } - if want != string(formatted) { - d := myers.ComputeEdits("", want, string(formatted)) - t.Errorf("suggested fixes failed for %s:\n%s", file.Name(), diff.ToUnified(fmt.Sprintf("%s.golden [%s]", file.Name(), sf), "actual", want, d)) + if len(ar.Files) > 0 { + // one virtual file per kind of suggested fix + + if len(ar.Comment) != 0 { + // we allow either just the comment, or just virtual + // files, not both. it is not clear how "both" should + // behave. + t.Errorf("%s.golden has leading comment; we don't know what to do with it", file.Name()) + continue + } + + for sf, edits := range fixes { + found := false + for _, vf := range ar.Files { + if vf.Name == sf { + found = true + out := diff.ApplyEdits(string(orig), edits) + // the file may contain multiple trailing + // newlines if the user places empty lines + // between files in the archive. normalize + // this to a single newline. + want := string(bytes.TrimRight(vf.Data, "\n")) + "\n" + formatted, err := format.Source([]byte(out)) + if err != nil { + continue + } + if want != string(formatted) { + d := myers.ComputeEdits("", want, string(formatted)) + t.Errorf("suggested fixes failed for %s:\n%s", file.Name(), diff.ToUnified(fmt.Sprintf("%s.golden [%s]", file.Name(), sf), "actual", want, d)) + } + break } - break + } + if !found { + t.Errorf("no section for suggested fix %q in %s.golden", sf, file.Name()) } } - if !found { - t.Errorf("no section for suggested fix %q in %s.golden", sf, file.Name()) - } - } - } else { - // all suggested fixes are represented by a single file + } else { + // all suggested fixes are represented by a single file - var catchallEdits []diff.TextEdit - for _, edits := range fixes { - catchallEdits = append(catchallEdits, edits...) - } + var catchallEdits []diff.TextEdit + for _, edits := range fixes { + catchallEdits = append(catchallEdits, edits...) + } - out := diff.ApplyEdits(string(orig), catchallEdits) - want := string(ar.Comment) + out := diff.ApplyEdits(string(orig), catchallEdits) + want := string(ar.Comment) - formatted, err := format.Source([]byte(out)) - if err != nil { - continue - } - if want != string(formatted) { - d := myers.ComputeEdits("", want, string(formatted)) - t.Errorf("suggested fixes failed for %s:\n%s", file.Name(), diff.ToUnified(file.Name()+".golden", "actual", want, d)) + formatted, err := format.Source([]byte(out)) + if err != nil { + continue + } + if want != string(formatted) { + d := myers.ComputeEdits("", want, string(formatted)) + t.Errorf("suggested fixes failed for %s:\n%s", file.Name(), diff.ToUnified(file.Name()+".golden", "actual", want, d)) + } } } } @@ -320,7 +330,6 @@ func loadPackages(dir string, patterns ...string) ([]*packages.Package, error) { // specified by the contents of "// want ..." comments in the package's // source files, which must have been parsed with comments enabled. func check(t Testing, gopath string, pass *analysis.Pass, diagnostics []analysis.Diagnostic, facts map[types.Object][]analysis.Fact) { - type key struct { file string line int @@ -346,7 +355,7 @@ func check(t Testing, gopath string, pass *analysis.Pass, diagnostics []analysis } } - // Extract 'want' comments from Go files. + // Extract 'want' comments from parsed Go files. for _, f := range pass.Files { for _, cgroup := range f.Comments { for _, c := range cgroup.List { @@ -389,6 +398,16 @@ func check(t Testing, gopath string, pass *analysis.Pass, diagnostics []analysis linenum := 0 for _, line := range strings.Split(string(data), "\n") { linenum++ + + // Hack: treat a comment of the form "//...// want..." + // or "/*...// want... */ + // as if it starts at 'want'. + // This allows us to add comments on comments, + // as required when testing the buildtag analyzer. + if i := strings.Index(line, "// want"); i >= 0 { + line = line[i:] + } + if i := strings.Index(line, "//"); i >= 0 { line = line[i+len("//"):] processComment(filename, linenum, line) diff --git a/awsproviderlint/vendor/golang.org/x/tools/go/analysis/doc.go b/awsproviderlint/vendor/golang.org/x/tools/go/analysis/doc.go index fb17a0e4154c..9fa3302dfbe9 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/go/analysis/doc.go +++ b/awsproviderlint/vendor/golang.org/x/tools/go/analysis/doc.go @@ -121,13 +121,14 @@ package being analyzed, and provides operations to the Run function for reporting diagnostics and other information back to the driver. type Pass struct { - Fset *token.FileSet - Files []*ast.File - OtherFiles []string - Pkg *types.Package - TypesInfo *types.Info - ResultOf map[*Analyzer]interface{} - Report func(Diagnostic) + Fset *token.FileSet + Files []*ast.File + OtherFiles []string + IgnoredFiles []string + Pkg *types.Package + TypesInfo *types.Info + ResultOf map[*Analyzer]interface{} + Report func(Diagnostic) ... } @@ -139,6 +140,12 @@ files such as assembly that are part of this package. See the "asmdecl" or "buildtags" analyzers for examples of loading non-Go files and reporting diagnostics against them. +The IgnoredFiles field provides the names, but not the contents, +of ignored Go and non-Go source files that are not part of this package +with the current build configuration but may be part of other build +configurations. See the "buildtags" analyzer for an example of loading +and checking IgnoredFiles. + The ResultOf field provides the results computed by the analyzers required by this one, as expressed in its Analyzer.Requires field. The driver runs the required analyzers first and makes their results diff --git a/awsproviderlint/vendor/golang.org/x/tools/go/analysis/internal/checker/checker.go b/awsproviderlint/vendor/golang.org/x/tools/go/analysis/internal/checker/checker.go index 5ccfb1637487..34f5b47d4cb3 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/go/analysis/internal/checker/checker.go +++ b/awsproviderlint/vendor/golang.org/x/tools/go/analysis/internal/checker/checker.go @@ -639,6 +639,7 @@ func (act *action) execOnce() { Fset: act.pkg.Fset, Files: act.pkg.Syntax, OtherFiles: act.pkg.OtherFiles, + IgnoredFiles: act.pkg.IgnoredFiles, Pkg: act.pkg.Types, TypesInfo: act.pkg.TypesInfo, TypesSizes: act.pkg.TypesSizes, diff --git a/awsproviderlint/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go b/awsproviderlint/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go index 2ed274949bda..713e1380ef10 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go +++ b/awsproviderlint/vendor/golang.org/x/tools/go/analysis/unitchecker/unitchecker.go @@ -63,6 +63,7 @@ type Config struct { ImportPath string GoFiles []string NonGoFiles []string + IgnoredFiles []string ImportMap map[string]string PackageFile map[string]string Standard map[string]bool @@ -333,6 +334,7 @@ func run(fset *token.FileSet, cfg *Config, analyzers []*analysis.Analyzer) ([]re Fset: fset, Files: files, OtherFiles: cfg.NonGoFiles, + IgnoredFiles: cfg.IgnoredFiles, Pkg: pkg, TypesInfo: info, TypesSizes: tc.Sizes, diff --git a/awsproviderlint/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go b/awsproviderlint/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go index dc6177c122d9..35bc6a4127ac 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go +++ b/awsproviderlint/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go @@ -39,7 +39,12 @@ func GetSizes(ctx context.Context, buildFlags, env []string, gocmdRunner *gocomm } if tool == "off" { - return GetSizesGolist(ctx, buildFlags, env, gocmdRunner, dir) + inv := gocommand.Invocation{ + BuildFlags: buildFlags, + Env: env, + WorkingDir: dir, + } + return GetSizesGolist(ctx, inv, gocmdRunner) } req, err := json.Marshal(struct { @@ -75,26 +80,17 @@ func GetSizes(ctx context.Context, buildFlags, env []string, gocmdRunner *gocomm return response.Sizes, nil } -func GetSizesGolist(ctx context.Context, buildFlags, env []string, gocmdRunner *gocommand.Runner, dir string) (types.Sizes, error) { - inv := gocommand.Invocation{ - Verb: "list", - Args: []string{"-f", "{{context.GOARCH}} {{context.Compiler}}", "--", "unsafe"}, - Env: env, - BuildFlags: buildFlags, - WorkingDir: dir, - } +func GetSizesGolist(ctx context.Context, inv gocommand.Invocation, gocmdRunner *gocommand.Runner) (types.Sizes, error) { + inv.Verb = "list" + inv.Args = []string{"-f", "{{context.GOARCH}} {{context.Compiler}}", "--", "unsafe"} stdout, stderr, friendlyErr, rawErr := gocmdRunner.RunRaw(ctx, inv) var goarch, compiler string if rawErr != nil { if strings.Contains(rawErr.Error(), "cannot find main module") { // User's running outside of a module. All bets are off. Get GOARCH and guess compiler is gc. // TODO(matloob): Is this a problem in practice? - inv := gocommand.Invocation{ - Verb: "env", - Args: []string{"GOARCH"}, - Env: env, - WorkingDir: dir, - } + inv.Verb = "env" + inv.Args = []string{"GOARCH"} envout, enverr := gocmdRunner.Run(ctx, inv) if enverr != nil { return nil, enverr diff --git a/awsproviderlint/vendor/golang.org/x/tools/go/packages/golist.go b/awsproviderlint/vendor/golang.org/x/tools/go/packages/golist.go index bc04503c10ab..81381fa1cce3 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/go/packages/golist.go +++ b/awsproviderlint/vendor/golang.org/x/tools/go/packages/golist.go @@ -10,6 +10,7 @@ import ( "encoding/json" "fmt" "go/types" + "io/ioutil" "log" "os" "os/exec" @@ -91,7 +92,7 @@ type golistState struct { goVersionOnce sync.Once goVersionError error - goVersion string // third field of 'go version' + goVersion int // The X in Go 1.X. // vendorDirs caches the (non)existence of vendor directories. vendorDirs map[string]bool @@ -139,6 +140,12 @@ func goListDriver(cfg *Config, patterns ...string) (*driverResponse, error) { response := newDeduper() + state := &golistState{ + cfg: cfg, + ctx: ctx, + vendorDirs: map[string]bool{}, + } + // Fill in response.Sizes asynchronously if necessary. var sizeserr error var sizeswg sync.WaitGroup @@ -146,19 +153,13 @@ func goListDriver(cfg *Config, patterns ...string) (*driverResponse, error) { sizeswg.Add(1) go func() { var sizes types.Sizes - sizes, sizeserr = packagesdriver.GetSizesGolist(ctx, cfg.BuildFlags, cfg.Env, cfg.gocmdRunner, cfg.Dir) + sizes, sizeserr = packagesdriver.GetSizesGolist(ctx, state.cfgInvocation(), cfg.gocmdRunner) // types.SizesFor always returns nil or a *types.StdSizes. response.dr.Sizes, _ = sizes.(*types.StdSizes) sizeswg.Done() }() } - state := &golistState{ - cfg: cfg, - ctx: ctx, - vendorDirs: map[string]bool{}, - } - // Determine files requested in contains patterns var containFiles []string restPatterns := make([]string, 0, len(patterns)) @@ -208,56 +209,58 @@ extractQueries: } } - modifiedPkgs, needPkgs, err := state.processGolistOverlay(response) - if err != nil { - return nil, err - } + // Only use go/packages' overlay processing if we're using a Go version + // below 1.16. Otherwise, go list handles it. + if goVersion, err := state.getGoVersion(); err == nil && goVersion < 16 { + modifiedPkgs, needPkgs, err := state.processGolistOverlay(response) + if err != nil { + return nil, err + } - var containsCandidates []string - if len(containFiles) > 0 { - containsCandidates = append(containsCandidates, modifiedPkgs...) - containsCandidates = append(containsCandidates, needPkgs...) - } - if err := state.addNeededOverlayPackages(response, needPkgs); err != nil { - return nil, err - } - // Check candidate packages for containFiles. - if len(containFiles) > 0 { - for _, id := range containsCandidates { - pkg, ok := response.seenPackages[id] - if !ok { - response.addPackage(&Package{ - ID: id, - Errors: []Error{ - { + var containsCandidates []string + if len(containFiles) > 0 { + containsCandidates = append(containsCandidates, modifiedPkgs...) + containsCandidates = append(containsCandidates, needPkgs...) + } + if err := state.addNeededOverlayPackages(response, needPkgs); err != nil { + return nil, err + } + // Check candidate packages for containFiles. + if len(containFiles) > 0 { + for _, id := range containsCandidates { + pkg, ok := response.seenPackages[id] + if !ok { + response.addPackage(&Package{ + ID: id, + Errors: []Error{{ Kind: ListError, Msg: fmt.Sprintf("package %s expected but not seen", id), - }, - }, - }) - continue - } - for _, f := range containFiles { - for _, g := range pkg.GoFiles { - if sameFile(f, g) { - response.addRoot(id) + }}, + }) + continue + } + for _, f := range containFiles { + for _, g := range pkg.GoFiles { + if sameFile(f, g) { + response.addRoot(id) + } } } } } - } - // Add root for any package that matches a pattern. This applies only to - // packages that are modified by overlays, since they are not added as - // roots automatically. - for _, pattern := range restPatterns { - match := matchPattern(pattern) - for _, pkgID := range modifiedPkgs { - pkg, ok := response.seenPackages[pkgID] - if !ok { - continue - } - if match(pkg.PkgPath) { - response.addRoot(pkg.ID) + // Add root for any package that matches a pattern. This applies only to + // packages that are modified by overlays, since they are not added as + // roots automatically. + for _, pattern := range restPatterns { + match := matchPattern(pattern) + for _, pkgID := range modifiedPkgs { + pkg, ok := response.seenPackages[pkgID] + if !ok { + continue + } + if match(pkg.PkgPath) { + response.addRoot(pkg.ID) + } } } } @@ -381,32 +384,34 @@ func (state *golistState) adhocPackage(pattern, query string) (*driverResponse, // Fields must match go list; // see $GOROOT/src/cmd/go/internal/load/pkg.go. type jsonPackage struct { - ImportPath string - Dir string - Name string - Export string - GoFiles []string - CompiledGoFiles []string - CFiles []string - CgoFiles []string - CXXFiles []string - MFiles []string - HFiles []string - FFiles []string - SFiles []string - SwigFiles []string - SwigCXXFiles []string - SysoFiles []string - Imports []string - ImportMap map[string]string - Deps []string - Module *Module - TestGoFiles []string - TestImports []string - XTestGoFiles []string - XTestImports []string - ForTest string // q in a "p [q.test]" package, else "" - DepOnly bool + ImportPath string + Dir string + Name string + Export string + GoFiles []string + CompiledGoFiles []string + IgnoredGoFiles []string + IgnoredOtherFiles []string + CFiles []string + CgoFiles []string + CXXFiles []string + MFiles []string + HFiles []string + FFiles []string + SFiles []string + SwigFiles []string + SwigCXXFiles []string + SysoFiles []string + Imports []string + ImportMap map[string]string + Deps []string + Module *Module + TestGoFiles []string + TestImports []string + XTestGoFiles []string + XTestImports []string + ForTest string // q in a "p [q.test]" package, else "" + DepOnly bool Error *jsonPackageError } @@ -558,6 +563,7 @@ func (state *golistState) createDriverResponse(words ...string) (*driverResponse GoFiles: absJoin(p.Dir, p.GoFiles, p.CgoFiles), CompiledGoFiles: absJoin(p.Dir, p.CompiledGoFiles), OtherFiles: absJoin(p.Dir, otherFiles(p)...), + IgnoredFiles: absJoin(p.Dir, p.IgnoredGoFiles, p.IgnoredOtherFiles), forTest: p.ForTest, Module: p.Module, } @@ -728,7 +734,7 @@ func (state *golistState) shouldAddFilenameFromError(p *jsonPackage) bool { // On Go 1.14 and earlier, only add filenames from errors if the import stack is empty. // The import stack behaves differently for these versions than newer Go versions. - if strings.HasPrefix(goV, "go1.13") || strings.HasPrefix(goV, "go1.14") { + if goV < 15 { return len(p.Error.ImportStack) == 0 } @@ -739,31 +745,9 @@ func (state *golistState) shouldAddFilenameFromError(p *jsonPackage) bool { return len(p.Error.ImportStack) == 0 || p.Error.ImportStack[len(p.Error.ImportStack)-1] == p.ImportPath } -func (state *golistState) getGoVersion() (string, error) { +func (state *golistState) getGoVersion() (int, error) { state.goVersionOnce.Do(func() { - var b *bytes.Buffer - // Invoke go version. Don't use invokeGo because it will supply build flags, and - // go version doesn't expect build flags. - inv := gocommand.Invocation{ - Verb: "version", - Env: state.cfg.Env, - Logf: state.cfg.Logf, - } - gocmdRunner := state.cfg.gocmdRunner - if gocmdRunner == nil { - gocmdRunner = &gocommand.Runner{} - } - b, _, _, state.goVersionError = gocmdRunner.RunRaw(state.cfg.Context, inv) - if state.goVersionError != nil { - return - } - - sp := strings.Split(b.String(), " ") - if len(sp) < 3 { - state.goVersionError = fmt.Errorf("go version output: expected 'go version ', got '%s'", b.String()) - return - } - state.goVersion = sp[2] + state.goVersion, state.goVersionError = gocommand.GoVersion(state.ctx, state.cfgInvocation(), state.cfg.gocmdRunner) }) return state.goVersion, state.goVersionError } @@ -836,18 +820,46 @@ func golistargs(cfg *Config, words []string) []string { return fullargs } -// invokeGo returns the stdout of a go command invocation. -func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer, error) { +// cfgInvocation returns an Invocation that reflects cfg's settings. +func (state *golistState) cfgInvocation() gocommand.Invocation { cfg := state.cfg - - inv := gocommand.Invocation{ - Verb: verb, - Args: args, + return gocommand.Invocation{ BuildFlags: cfg.BuildFlags, + ModFile: cfg.modFile, + ModFlag: cfg.modFlag, Env: cfg.Env, Logf: cfg.Logf, WorkingDir: cfg.Dir, } +} + +// invokeGo returns the stdout of a go command invocation. +func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer, error) { + cfg := state.cfg + + inv := state.cfgInvocation() + + // For Go versions 1.16 and above, `go list` accepts overlays directly via + // the -overlay flag. Set it, if it's available. + // + // The check for "list" is not necessarily required, but we should avoid + // getting the go version if possible. + if verb == "list" { + goVersion, err := state.getGoVersion() + if err != nil { + return nil, err + } + if goVersion >= 16 { + filename, cleanup, err := state.writeOverlays() + if err != nil { + return nil, err + } + defer cleanup() + inv.Overlay = filename + } + } + inv.Verb = verb + inv.Args = args gocmdRunner := cfg.gocmdRunner if gocmdRunner == nil { gocmdRunner = &gocommand.Runner{} @@ -987,6 +999,67 @@ func (state *golistState) invokeGo(verb string, args ...string) (*bytes.Buffer, return stdout, nil } +// OverlayJSON is the format overlay files are expected to be in. +// The Replace map maps from overlaid paths to replacement paths: +// the Go command will forward all reads trying to open +// each overlaid path to its replacement path, or consider the overlaid +// path not to exist if the replacement path is empty. +// +// From golang/go#39958. +type OverlayJSON struct { + Replace map[string]string `json:"replace,omitempty"` +} + +// writeOverlays writes out files for go list's -overlay flag, as described +// above. +func (state *golistState) writeOverlays() (filename string, cleanup func(), err error) { + // Do nothing if there are no overlays in the config. + if len(state.cfg.Overlay) == 0 { + return "", func() {}, nil + } + dir, err := ioutil.TempDir("", "gopackages-*") + if err != nil { + return "", nil, err + } + // The caller must clean up this directory, unless this function returns an + // error. + cleanup = func() { + os.RemoveAll(dir) + } + defer func() { + if err != nil { + cleanup() + } + }() + overlays := map[string]string{} + for k, v := range state.cfg.Overlay { + // Create a unique filename for the overlaid files, to avoid + // creating nested directories. + noSeparator := strings.Join(strings.Split(filepath.ToSlash(k), "/"), "") + f, err := ioutil.TempFile(dir, fmt.Sprintf("*-%s", noSeparator)) + if err != nil { + return "", func() {}, err + } + if _, err := f.Write(v); err != nil { + return "", func() {}, err + } + if err := f.Close(); err != nil { + return "", func() {}, err + } + overlays[k] = f.Name() + } + b, err := json.Marshal(OverlayJSON{Replace: overlays}) + if err != nil { + return "", func() {}, err + } + // Write out the overlay file that contains the filepath mappings. + filename = filepath.Join(dir, "overlay.json") + if err := ioutil.WriteFile(filename, b, 0665); err != nil { + return "", func() {}, err + } + return filename, cleanup, nil +} + func containsGoFile(s []string) bool { for _, f := range s { if strings.HasSuffix(f, ".go") { diff --git a/awsproviderlint/vendor/golang.org/x/tools/go/packages/golist_overlay.go b/awsproviderlint/vendor/golang.org/x/tools/go/packages/golist_overlay.go index 885aec3ec317..de2c1dc57932 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/go/packages/golist_overlay.go +++ b/awsproviderlint/vendor/golang.org/x/tools/go/packages/golist_overlay.go @@ -1,3 +1,7 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + package packages import ( diff --git a/awsproviderlint/vendor/golang.org/x/tools/go/packages/packages.go b/awsproviderlint/vendor/golang.org/x/tools/go/packages/packages.go index 04053f1e7d4c..38475e8712a9 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/go/packages/packages.go +++ b/awsproviderlint/vendor/golang.org/x/tools/go/packages/packages.go @@ -144,6 +144,12 @@ type Config struct { // the build system's query tool. BuildFlags []string + // modFile will be used for -modfile in go command invocations. + modFile string + + // modFlag will be used for -modfile in go command invocations. + modFlag string + // Fset provides source position information for syntax trees and types. // If Fset is nil, Load will use a new fileset, but preserve Fset's value. Fset *token.FileSet @@ -289,6 +295,11 @@ type Package struct { // including assembly, C, C++, Fortran, Objective-C, SWIG, and so on. OtherFiles []string + // IgnoredFiles lists source files that are not part of the package + // using the current build configuration but that might be part of + // the package using other build configurations. + IgnoredFiles []string + // ExportFile is the absolute path to a file containing type // information for the package as provided by the build system. ExportFile string @@ -361,6 +372,12 @@ func init() { packagesinternal.SetGoCmdRunner = func(config interface{}, runner *gocommand.Runner) { config.(*Config).gocmdRunner = runner } + packagesinternal.SetModFile = func(config interface{}, value string) { + config.(*Config).modFile = value + } + packagesinternal.SetModFlag = func(config interface{}, value string) { + config.(*Config).modFlag = value + } packagesinternal.TypecheckCgo = int(typecheckCgo) } @@ -404,6 +421,7 @@ type flatPackage struct { GoFiles []string `json:",omitempty"` CompiledGoFiles []string `json:",omitempty"` OtherFiles []string `json:",omitempty"` + IgnoredFiles []string `json:",omitempty"` ExportFile string `json:",omitempty"` Imports map[string]string `json:",omitempty"` } @@ -426,6 +444,7 @@ func (p *Package) MarshalJSON() ([]byte, error) { GoFiles: p.GoFiles, CompiledGoFiles: p.CompiledGoFiles, OtherFiles: p.OtherFiles, + IgnoredFiles: p.IgnoredFiles, ExportFile: p.ExportFile, } if len(p.Imports) > 0 { @@ -712,7 +731,8 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { result[i] = lpkg.Package } for i := range ld.pkgs { - // Clear all unrequested fields, for extra de-Hyrum-ization. + // Clear all unrequested fields, + // to catch programs that use more than they request. if ld.requestedMode&NeedName == 0 { ld.pkgs[i].Name = "" ld.pkgs[i].PkgPath = "" @@ -720,6 +740,7 @@ func (ld *loader) refine(roots []string, list ...*Package) ([]*Package, error) { if ld.requestedMode&NeedFiles == 0 { ld.pkgs[i].GoFiles = nil ld.pkgs[i].OtherFiles = nil + ld.pkgs[i].IgnoredFiles = nil } if ld.requestedMode&NeedCompiledGoFiles == 0 { ld.pkgs[i].CompiledGoFiles = nil diff --git a/awsproviderlint/vendor/golang.org/x/tools/internal/gocommand/invoke.go b/awsproviderlint/vendor/golang.org/x/tools/internal/gocommand/invoke.go index f516e17623d6..8ba2253838c0 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/internal/gocommand/invoke.go +++ b/awsproviderlint/vendor/golang.org/x/tools/internal/gocommand/invoke.go @@ -130,6 +130,9 @@ type Invocation struct { Verb string Args []string BuildFlags []string + ModFlag string + ModFile string + Overlay string Env []string WorkingDir string Logf func(format string, args ...interface{}) @@ -158,17 +161,41 @@ func (i *Invocation) run(ctx context.Context, stdout, stderr io.Writer) error { } goArgs := []string{i.Verb} + + appendModFile := func() { + if i.ModFile != "" { + goArgs = append(goArgs, "-modfile="+i.ModFile) + } + } + appendModFlag := func() { + if i.ModFlag != "" { + goArgs = append(goArgs, "-mod="+i.ModFlag) + } + } + appendOverlayFlag := func() { + if i.Overlay != "" { + goArgs = append(goArgs, "-overlay="+i.Overlay) + } + } + switch i.Verb { + case "env", "version": + goArgs = append(goArgs, i.Args...) case "mod": - // mod needs the sub-verb before build flags. + // mod needs the sub-verb before flags. goArgs = append(goArgs, i.Args[0]) - goArgs = append(goArgs, i.BuildFlags...) + appendModFile() goArgs = append(goArgs, i.Args[1:]...) - case "env": - // env doesn't take build flags. + case "get": + goArgs = append(goArgs, i.BuildFlags...) + appendModFile() goArgs = append(goArgs, i.Args...) - default: + + default: // notably list and build. goArgs = append(goArgs, i.BuildFlags...) + appendModFile() + appendModFlag() + appendOverlayFlag() goArgs = append(goArgs, i.Args...) } cmd := exec.Command("go", goArgs...) diff --git a/awsproviderlint/vendor/golang.org/x/tools/internal/gocommand/version.go b/awsproviderlint/vendor/golang.org/x/tools/internal/gocommand/version.go new file mode 100644 index 000000000000..60d45ac0e64d --- /dev/null +++ b/awsproviderlint/vendor/golang.org/x/tools/internal/gocommand/version.go @@ -0,0 +1,40 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package gocommand + +import ( + "context" + "fmt" + "strings" +) + +// GoVersion checks the go version by running "go list" with modules off. +// It returns the X in Go 1.X. +func GoVersion(ctx context.Context, inv Invocation, r *Runner) (int, error) { + inv.Verb = "list" + inv.Args = []string{"-e", "-f", `{{context.ReleaseTags}}`} + inv.Env = append(append([]string{}, inv.Env...), "GO111MODULE=off") + // Unset any unneeded flags. + inv.ModFile = "" + inv.ModFlag = "" + stdoutBytes, err := r.Run(ctx, inv) + if err != nil { + return 0, err + } + stdout := stdoutBytes.String() + if len(stdout) < 3 { + return 0, fmt.Errorf("bad ReleaseTags output: %q", stdout) + } + // Split up "[go1.1 go1.15]" + tags := strings.Fields(stdout[1 : len(stdout)-2]) + for i := len(tags) - 1; i >= 0; i-- { + var version int + if _, err := fmt.Sscanf(tags[i], "go1.%d", &version); err != nil { + continue + } + return version, nil + } + return 0, fmt.Errorf("no parseable ReleaseTags in %v", tags) +} diff --git a/awsproviderlint/vendor/golang.org/x/tools/internal/imports/fix.go b/awsproviderlint/vendor/golang.org/x/tools/internal/imports/fix.go index 675d16c873b4..d859617b7745 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/internal/imports/fix.go +++ b/awsproviderlint/vendor/golang.org/x/tools/internal/imports/fix.go @@ -83,7 +83,7 @@ type ImportFix struct { IdentName string // FixType is the type of fix this is (AddImport, DeleteImport, SetImportName). FixType ImportFixType - Relevance int // see pkg + Relevance float64 // see pkg } // An ImportInfo represents a single import statement. @@ -592,9 +592,9 @@ func getFixes(fset *token.FileSet, f *ast.File, filename string, env *ProcessEnv return fixes, nil } -// Highest relevance, used for the standard library. Chosen arbitrarily to -// match pre-existing gopls code. -const MaxRelevance = 7 +// MaxRelevance is the highest relevance, used for the standard library. +// Chosen arbitrarily to match pre-existing gopls code. +const MaxRelevance = 7.0 // getCandidatePkgs works with the passed callback to find all acceptable packages. // It deduplicates by import path, and uses a cached stdlib rather than reading @@ -607,6 +607,10 @@ func getCandidatePkgs(ctx context.Context, wrappedCallback *scanCallback, filena if err != nil { return err } + + var mu sync.Mutex // to guard asynchronous access to dupCheck + dupCheck := map[string]struct{}{} + // Start off with the standard library. for importPath, exports := range stdlib { p := &pkg{ @@ -615,14 +619,12 @@ func getCandidatePkgs(ctx context.Context, wrappedCallback *scanCallback, filena packageName: path.Base(importPath), relevance: MaxRelevance, } + dupCheck[importPath] = struct{}{} if notSelf(p) && wrappedCallback.dirFound(p) && wrappedCallback.packageNameLoaded(p) { wrappedCallback.exportsLoaded(p, exports) } } - var mu sync.Mutex - dupCheck := map[string]struct{}{} - scanFilter := &scanCallback{ rootFound: func(root gopathwalk.Root) bool { // Exclude goroot results -- getting them is relatively expensive, not cached, @@ -658,8 +660,8 @@ func getCandidatePkgs(ctx context.Context, wrappedCallback *scanCallback, filena return resolver.scan(ctx, scanFilter) } -func ScoreImportPaths(ctx context.Context, env *ProcessEnv, paths []string) (map[string]int, error) { - result := make(map[string]int) +func ScoreImportPaths(ctx context.Context, env *ProcessEnv, paths []string) (map[string]float64, error) { + result := make(map[string]float64) resolver, err := env.GetResolver() if err != nil { return nil, err @@ -802,6 +804,8 @@ type ProcessEnv struct { GocmdRunner *gocommand.Runner BuildFlags []string + ModFlag string + ModFile string // Env overrides the OS environment, and can be used to specify // GOPROXY, GO111MODULE, etc. PATH cannot be set here, because @@ -995,7 +999,7 @@ type Resolver interface { // loadExports may be called concurrently. loadExports(ctx context.Context, pkg *pkg, includeTest bool) (string, []string, error) // scoreImportPath returns the relevance for an import path. - scoreImportPath(ctx context.Context, path string) int + scoreImportPath(ctx context.Context, path string) float64 ClearForNewScan() } @@ -1260,10 +1264,10 @@ func packageDirToName(dir string) (packageName string, err error) { } type pkg struct { - dir string // absolute file path to pkg directory ("/usr/lib/go/src/net/http") - importPathShort string // vendorless import path ("net/http", "a/b") - packageName string // package name loaded from source if requested - relevance int // a weakly-defined score of how relevant a package is. 0 is most relevant. + dir string // absolute file path to pkg directory ("/usr/lib/go/src/net/http") + importPathShort string // vendorless import path ("net/http", "a/b") + packageName string // package name loaded from source if requested + relevance float64 // a weakly-defined score of how relevant a package is. 0 is most relevant. } type pkgDistance struct { @@ -1389,7 +1393,7 @@ func (r *gopathResolver) scan(ctx context.Context, callback *scanCallback) error return nil } -func (r *gopathResolver) scoreImportPath(ctx context.Context, path string) int { +func (r *gopathResolver) scoreImportPath(ctx context.Context, path string) float64 { if _, ok := stdlib[path]; ok { return MaxRelevance } diff --git a/awsproviderlint/vendor/golang.org/x/tools/internal/imports/mod.go b/awsproviderlint/vendor/golang.org/x/tools/internal/imports/mod.go index 94880d616041..8a83613c5728 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/internal/imports/mod.go +++ b/awsproviderlint/vendor/golang.org/x/tools/internal/imports/mod.go @@ -59,6 +59,8 @@ func (r *ModuleResolver) init() error { } inv := gocommand.Invocation{ BuildFlags: r.env.BuildFlags, + ModFlag: r.env.ModFlag, + ModFile: r.env.ModFile, Env: r.env.env(), Logf: r.env.Logf, WorkingDir: r.env.WorkingDir, @@ -487,7 +489,7 @@ func (r *ModuleResolver) scan(ctx context.Context, callback *scanCallback) error return nil } -func (r *ModuleResolver) scoreImportPath(ctx context.Context, path string) int { +func (r *ModuleResolver) scoreImportPath(ctx context.Context, path string) float64 { if _, ok := stdlib[path]; ok { return MaxRelevance } @@ -495,17 +497,31 @@ func (r *ModuleResolver) scoreImportPath(ctx context.Context, path string) int { return modRelevance(mod) } -func modRelevance(mod *gocommand.ModuleJSON) int { +func modRelevance(mod *gocommand.ModuleJSON) float64 { + var relevance float64 switch { case mod == nil: // out of scope return MaxRelevance - 4 case mod.Indirect: - return MaxRelevance - 3 + relevance = MaxRelevance - 3 case !mod.Main: - return MaxRelevance - 2 + relevance = MaxRelevance - 2 default: - return MaxRelevance - 1 // main module ties with stdlib + relevance = MaxRelevance - 1 // main module ties with stdlib } + + _, versionString, ok := module.SplitPathVersion(mod.Path) + if ok { + index := strings.Index(versionString, "v") + if index == -1 { + return relevance + } + if versionNumber, err := strconv.ParseFloat(versionString[index+1:], 64); err == nil { + relevance += versionNumber / 1000 + } + } + + return relevance } // canonicalize gets the result of canonicalizing the packages using the results diff --git a/awsproviderlint/vendor/golang.org/x/tools/internal/packagesinternal/packages.go b/awsproviderlint/vendor/golang.org/x/tools/internal/packagesinternal/packages.go index 2c4527f2436a..1335a5eed8a9 100644 --- a/awsproviderlint/vendor/golang.org/x/tools/internal/packagesinternal/packages.go +++ b/awsproviderlint/vendor/golang.org/x/tools/internal/packagesinternal/packages.go @@ -12,3 +12,6 @@ var GetGoCmdRunner = func(config interface{}) *gocommand.Runner { return nil } var SetGoCmdRunner = func(config interface{}, runner *gocommand.Runner) {} var TypecheckCgo int + +var SetModFlag = func(config interface{}, value string) {} +var SetModFile = func(config interface{}, value string) {} diff --git a/awsproviderlint/vendor/google.golang.org/api/internal/creds.go b/awsproviderlint/vendor/google.golang.org/api/internal/creds.go index 75e9445e1b31..dc6d50e96aae 100644 --- a/awsproviderlint/vendor/google.golang.org/api/internal/creds.go +++ b/awsproviderlint/vendor/google.golang.org/api/internal/creds.go @@ -11,6 +11,7 @@ import ( "io/ioutil" "golang.org/x/oauth2" + "google.golang.org/api/internal/impersonate" "golang.org/x/oauth2/google" ) @@ -18,6 +19,17 @@ import ( // Creds returns credential information obtained from DialSettings, or if none, then // it returns default credential information. func Creds(ctx context.Context, ds *DialSettings) (*google.Credentials, error) { + creds, err := baseCreds(ctx, ds) + if err != nil { + return nil, err + } + if ds.ImpersonationConfig != nil { + return impersonateCredentials(ctx, creds, ds) + } + return creds, nil +} + +func baseCreds(ctx context.Context, ds *DialSettings) (*google.Credentials, error) { if ds.Credentials != nil { return ds.Credentials, nil } @@ -103,3 +115,17 @@ func QuotaProjectFromCreds(cred *google.Credentials) string { } return v.QuotaProject } + +func impersonateCredentials(ctx context.Context, creds *google.Credentials, ds *DialSettings) (*google.Credentials, error) { + if len(ds.ImpersonationConfig.Scopes) == 0 { + ds.ImpersonationConfig.Scopes = ds.Scopes + } + ts, err := impersonate.TokenSource(ctx, creds.TokenSource, ds.ImpersonationConfig) + if err != nil { + return nil, err + } + return &google.Credentials{ + TokenSource: ts, + ProjectID: creds.ProjectID, + }, nil +} diff --git a/awsproviderlint/vendor/google.golang.org/api/internal/gensupport/media.go b/awsproviderlint/vendor/google.golang.org/api/internal/gensupport/media.go index 0288cc304279..0460ab594069 100644 --- a/awsproviderlint/vendor/google.golang.org/api/internal/gensupport/media.go +++ b/awsproviderlint/vendor/google.golang.org/api/internal/gensupport/media.go @@ -55,7 +55,7 @@ func (cs *contentSniffer) Read(p []byte) (n int, err error) { return cs.r.Read(p) } -// ContentType returns the sniffed content type, and whether the content type was succesfully sniffed. +// ContentType returns the sniffed content type, and whether the content type was successfully sniffed. func (cs *contentSniffer) ContentType() (string, bool) { if cs.sniffed { return cs.ctype, cs.ctype != "" @@ -88,7 +88,7 @@ func DetermineContentType(media io.Reader, ctype string) (io.Reader, string) { return media, ctype } - // For backwards compatability, allow clients to set content + // For backwards compatibility, allow clients to set content // type by providing a ContentTyper for media. if typer, ok := media.(googleapi.ContentTyper); ok { return media, typer.ContentType() diff --git a/awsproviderlint/vendor/google.golang.org/api/internal/impersonate/impersonate.go b/awsproviderlint/vendor/google.golang.org/api/internal/impersonate/impersonate.go new file mode 100644 index 000000000000..b465bbcd12e3 --- /dev/null +++ b/awsproviderlint/vendor/google.golang.org/api/internal/impersonate/impersonate.go @@ -0,0 +1,128 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package impersonate is used to impersonate Google Credentials. +package impersonate + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "net/http" + "time" + + "golang.org/x/oauth2" +) + +// Config for generating impersonated credentials. +type Config struct { + // Target is the service account to impersonate. Required. + Target string + // Scopes the impersonated credential should have. Required. + Scopes []string + // Delegates are the service accounts in a delegation chain. Each service + // account must be granted roles/iam.serviceAccountTokenCreator on the next + // service account in the chain. Optional. + Delegates []string +} + +// TokenSource returns an impersonated TokenSource configured with the provided +// config using ts as the base credential provider for making requests. +func TokenSource(ctx context.Context, ts oauth2.TokenSource, config *Config) (oauth2.TokenSource, error) { + if len(config.Scopes) == 0 { + return nil, fmt.Errorf("impersonate: scopes must be provided") + } + its := impersonatedTokenSource{ + ctx: ctx, + ts: ts, + name: formatIAMServiceAccountName(config.Target), + // Default to the longest acceptable value of one hour as the token will + // be refreshed automatically. + lifetime: "3600s", + } + + its.delegates = make([]string, len(config.Delegates)) + for i, v := range config.Delegates { + its.delegates[i] = formatIAMServiceAccountName(v) + } + its.scopes = make([]string, len(config.Scopes)) + copy(its.scopes, config.Scopes) + + return oauth2.ReuseTokenSource(nil, its), nil +} + +func formatIAMServiceAccountName(name string) string { + return fmt.Sprintf("projects/-/serviceAccounts/%s", name) +} + +type generateAccessTokenReq struct { + Delegates []string `json:"delegates,omitempty"` + Lifetime string `json:"lifetime,omitempty"` + Scope []string `json:"scope,omitempty"` +} + +type generateAccessTokenResp struct { + AccessToken string `json:"accessToken"` + ExpireTime string `json:"expireTime"` +} + +type impersonatedTokenSource struct { + ctx context.Context + ts oauth2.TokenSource + + name string + lifetime string + scopes []string + delegates []string +} + +// Token returns an impersonated Token. +func (i impersonatedTokenSource) Token() (*oauth2.Token, error) { + hc := oauth2.NewClient(i.ctx, i.ts) + reqBody := generateAccessTokenReq{ + Delegates: i.delegates, + Lifetime: i.lifetime, + Scope: i.scopes, + } + b, err := json.Marshal(reqBody) + if err != nil { + return nil, fmt.Errorf("impersonate: unable to marshal request: %v", err) + } + url := fmt.Sprintf("https://iamcredentials.googleapis.com/v1/%s:generateAccessToken", i.name) + req, err := http.NewRequest("POST", url, bytes.NewReader(b)) + if err != nil { + return nil, fmt.Errorf("impersonate: unable to create request: %v", err) + } + req = req.WithContext(i.ctx) + req.Header.Set("Content-Type", "application/json") + + resp, err := hc.Do(req) + if err != nil { + return nil, fmt.Errorf("impersonate: unable to generate access token: %v", err) + } + defer resp.Body.Close() + body, err := ioutil.ReadAll(io.LimitReader(resp.Body, 1<<20)) + if err != nil { + return nil, fmt.Errorf("impersonate: unable to read body: %v", err) + } + if c := resp.StatusCode; c < 200 || c > 299 { + return nil, fmt.Errorf("impersonate: status code %d: %s", c, body) + } + + var accessTokenResp generateAccessTokenResp + if err := json.Unmarshal(body, &accessTokenResp); err != nil { + return nil, fmt.Errorf("impersonate: unable to parse response: %v", err) + } + expiry, err := time.Parse(time.RFC3339, accessTokenResp.ExpireTime) + if err != nil { + return nil, fmt.Errorf("impersonate: unable to parse expiry: %v", err) + } + return &oauth2.Token{ + AccessToken: accessTokenResp.AccessToken, + Expiry: expiry, + }, nil +} diff --git a/awsproviderlint/vendor/google.golang.org/api/internal/service-account.json b/awsproviderlint/vendor/google.golang.org/api/internal/service-account.json deleted file mode 100644 index 6b36a92961ea..000000000000 --- a/awsproviderlint/vendor/google.golang.org/api/internal/service-account.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "type": "service_account", - "project_id": "project_id", - "private_key_id": "private_key_id", - "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCzd9ZdbPLAR4/g\nj+Rodu15kEasMpxf/Mz+gKRb2fmgR2Y18Y/iRBYZ4SkmF2pBSfzvwE/aTCzSPBGl\njHhPzohXnSN029eWoItmxVONlqCbR29pD07aLzv08LGeIGdHIEdhVjhvRwTkYZIF\ndXmlHNDRUU/EbJN9D+3ahw22BNnC4PaDgfIWTs3xIlTCSf2rL39I4DSNLTS/LzxK\n/XrQfBMtfwMWwyQaemXbc7gRgzOy8L56wa1W1zyXx99th97j1bLnoAXBGplhB4Co\n25ohyDAuhxRm+XGMEaO0Mzo7u97kvhj48a569RH1QRhOf7EBf60jO4h5eOmfi5P5\nPV3l7041AgMBAAECggEAEZ0RTNoEeRqM5F067YW+iM/AH+ZXspP9Cn1VpC4gcbqQ\nLXsnw+0qvh97CmIB66Z3TJBzRdl0DK4YjUbcB/kdKHwjnrR01DOtesijCqJd4N+B\n762w73jzSXbV9872U+S3HLZ5k3JE6KUqz55X8fyCAgkY6w4862lEzs2yasrPFHEV\nRoQp3PM0Miif8R3hGDhOWcHxcobullthG6JHAQFfc1ctwEjZI4TK0iWqlzfWGyKN\nT9UgvjUDud5cGvS9el0AiLN6keAf77tcPn1zetUVhxN1KN4bVAm1Q+6O8esl63Rj\n7JXpHzxaRnit9S6/aH/twHsGGtLg5Puw6jey6xs4AQKBgQD2JNy1wzewCRkD+jug\n8CHbJ+LIJVRNIaWa/RK1QD8/UjmFPkIzRQSF3AKC5mRAWSa2FL3yVK3N/DD7hazW\n85XSBB7IDcnoJnA9SkUeWwqQGkDx3EntlU3gX8Kn/+ofF8O9jLXxAa901MAVXVuf\n5YDzrl4PNE3bFnPCdiNmSdRfhQKBgQC6p4DsCpwqbeTu9f5ak9VW/fQP47Fgt+Mf\nwGjBnKP5PbbNJpHCfamF7jqSRH83Xy0KNssH7jD/NZ2oT594sMmiQPUC5ni9VYY6\nsuYB0JbD5Mq+EjKIVhYtxaQJ76LzHreEI+G4z6k3H7/hRpr3/C48n9G/uVkT9DbJ\noplxxEx68QKBgQCdJ23vcwO0Firtmi/GEmtbVHz70rGfSXNFoHz4UlvPXv0wsE5u\nE4vOt2i3EMhDOWh46odYGG6bzH+tp2xyFTW70Dui+QLHgPs6dpfoyLHWzZxXj5F3\n6lK9hgZvYvqk/XRRKmzjwnK2wjsdqOyeC1covlR5mqh20D/6kZkKbur0TQKBgAwy\nCZBimRWEnKKoW/gbFKNccGfhXqONID/g2Hdd/rC4QYth68AjacIgcJ9B7nX1uAGk\n1tsryvPB0w0+NpMyKdp6GAgaeuUUA3MuYSzZLiCagEyu77JMvaI7+Z3UlHcCGMd/\neK4Uk1/QqT7U2Cc/yN2ZK6E1QQa2vCWshA4U31JhAoGAbtbSSSsul1c+PsJ13Cfk\n6qVnqYzPqt23QTyOZmGAvUHH/M4xRiQpOE0cDF4t/r5PwenAQPQzTvMmWRzj6uAY\n3eaU0eAK7ZfoweCoOIAPnpFbbRLrXfoY46H7MYh7euWGXOKEpxz5yzuEkd9ByNUE\n86vSEidqbMIiXVgEgnu/k08=\n-----END PRIVATE KEY-----\n", - "client_email": "xyz@developer.gserviceaccount.com", - "client_id": "123", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "token_uri": "https://accounts.google.com/o/oauth2/token", - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/xyz%40developer.gserviceaccount.com" -} diff --git a/awsproviderlint/vendor/google.golang.org/api/internal/settings.go b/awsproviderlint/vendor/google.golang.org/api/internal/settings.go index f435519decfb..26259b82abb6 100644 --- a/awsproviderlint/vendor/google.golang.org/api/internal/settings.go +++ b/awsproviderlint/vendor/google.golang.org/api/internal/settings.go @@ -12,6 +12,7 @@ import ( "golang.org/x/oauth2" "golang.org/x/oauth2/google" + "google.golang.org/api/internal/impersonate" "google.golang.org/grpc" ) @@ -38,6 +39,8 @@ type DialSettings struct { TelemetryDisabled bool ClientCertSource func(*tls.CertificateRequestInfo) (*tls.Certificate, error) CustomClaims map[string]interface{} + SkipValidation bool + ImpersonationConfig *impersonate.Config // Google API system parameters. For more information please read: // https://cloud.google.com/apis/docs/system-parameters @@ -47,6 +50,9 @@ type DialSettings struct { // Validate reports an error if ds is invalid. func (ds *DialSettings) Validate() error { + if ds.SkipValidation { + return nil + } hasCreds := ds.APIKey != "" || ds.TokenSource != nil || ds.CredentialsFile != "" || ds.Credentials != nil if ds.NoAuth && hasCreds { return errors.New("options.WithoutAuthentication is incompatible with any option that provides credentials") @@ -101,6 +107,8 @@ func (ds *DialSettings) Validate() error { if ds.ClientCertSource != nil && (ds.GRPCConn != nil || ds.GRPCConnPool != nil || ds.GRPCConnPoolSize != 0 || ds.GRPCDialOpts != nil) { return errors.New("WithClientCertSource is currently only supported for HTTP. gRPC settings are incompatible") } - + if ds.ImpersonationConfig != nil && len(ds.ImpersonationConfig.Scopes) == 0 && len(ds.Scopes) == 0 { + return errors.New("WithImpersonatedCredentials requires scopes being provided") + } return nil } diff --git a/awsproviderlint/vendor/google.golang.org/api/option/internaloption/internaloption.go b/awsproviderlint/vendor/google.golang.org/api/option/internaloption/internaloption.go index ff5b530cfe08..b4d78a830ae3 100644 --- a/awsproviderlint/vendor/google.golang.org/api/option/internaloption/internaloption.go +++ b/awsproviderlint/vendor/google.golang.org/api/option/internaloption/internaloption.go @@ -20,7 +20,7 @@ func (o defaultEndpointOption) Apply(settings *internal.DialSettings) { // // It should only be used internally by generated clients. // -// This is similar to WithEndpoint, but allows us to determine whether the user has overriden the default endpoint. +// This is similar to WithEndpoint, but allows us to determine whether the user has overridden the default endpoint. func WithDefaultEndpoint(url string) option.ClientOption { return defaultEndpointOption(url) } @@ -34,7 +34,19 @@ func (o defaultMTLSEndpointOption) Apply(settings *internal.DialSettings) { // WithDefaultMTLSEndpoint is an option that indicates the default mTLS endpoint. // // It should only be used internally by generated clients. -// func WithDefaultMTLSEndpoint(url string) option.ClientOption { return defaultMTLSEndpointOption(url) } + +// SkipDialSettingsValidation bypasses validation on ClientOptions. +// +// It should only be used internally. +func SkipDialSettingsValidation() option.ClientOption { + return skipDialSettingsValidation{} +} + +type skipDialSettingsValidation struct{} + +func (s skipDialSettingsValidation) Apply(settings *internal.DialSettings) { + settings.SkipValidation = true +} diff --git a/awsproviderlint/vendor/google.golang.org/api/option/option.go b/awsproviderlint/vendor/google.golang.org/api/option/option.go index b7c40d60a45f..686476f9cbbf 100644 --- a/awsproviderlint/vendor/google.golang.org/api/option/option.go +++ b/awsproviderlint/vendor/google.golang.org/api/option/option.go @@ -11,6 +11,7 @@ import ( "golang.org/x/oauth2" "google.golang.org/api/internal" + "google.golang.org/api/internal/impersonate" "google.golang.org/grpc" ) @@ -269,3 +270,57 @@ type withClientCertSource struct{ s ClientCertSource } func (w withClientCertSource) Apply(o *internal.DialSettings) { o.ClientCertSource = w.s } + +// ImpersonateCredentials returns a ClientOption that will impersonate the +// target service account. +// +// In order to impersonate the target service account +// the base service account must have the Service Account Token Creator role, +// roles/iam.serviceAccountTokenCreator, on the target service account. +// See https://cloud.google.com/iam/docs/understanding-service-accounts. +// +// Optionally, delegates can be used during impersonation if the base service +// account lacks the token creator role on the target. When using delegates, +// each service account must be granted roles/iam.serviceAccountTokenCreator +// on the next service account in the chain. +// +// For example, if a base service account of SA1 is trying to impersonate target +// service account SA2 while using delegate service accounts DSA1 and DSA2, +// the following must be true: +// +// 1. Base service account SA1 has roles/iam.serviceAccountTokenCreator on +// DSA1. +// 2. DSA1 has roles/iam.serviceAccountTokenCreator on DSA2. +// 3. DSA2 has roles/iam.serviceAccountTokenCreator on target SA2. +// +// The resulting impersonated credential will either have the default scopes of +// the client being instantiating or the scopes from WithScopes if provided. +// Scopes are required for creating impersonated credentials, so if this option +// is used while not using a NewClient/NewService function, WithScopes must also +// be explicitly passed in as well. +// +// If the base credential is an authorized user and not a service account, or if +// the option WithQuotaProject is set, the target service account must have a +// role that grants the serviceusage.services.use permission such as +// roles/serviceusage.serviceUsageConsumer. +// +// This is an EXPERIMENTAL API and may be changed or removed in the future. +func ImpersonateCredentials(target string, delegates ...string) ClientOption { + return impersonateServiceAccount{ + target: target, + delegates: delegates, + } +} + +type impersonateServiceAccount struct { + target string + delegates []string +} + +func (i impersonateServiceAccount) Apply(o *internal.DialSettings) { + o.ImpersonationConfig = &impersonate.Config{ + Target: i.target, + } + o.ImpersonationConfig.Delegates = make([]string, len(i.delegates)) + copy(o.ImpersonationConfig.Delegates, i.delegates) +} diff --git a/awsproviderlint/vendor/google.golang.org/api/storage/v1/storage-api.json b/awsproviderlint/vendor/google.golang.org/api/storage/v1/storage-api.json index e78776b2be88..1e076ab66d44 100644 --- a/awsproviderlint/vendor/google.golang.org/api/storage/v1/storage-api.json +++ b/awsproviderlint/vendor/google.golang.org/api/storage/v1/storage-api.json @@ -26,7 +26,7 @@ "description": "Stores and retrieves potentially large, immutable data objects.", "discoveryVersion": "v1", "documentationLink": "https://developers.google.com/storage/docs/json_api/", - "etag": "\"u9GIe6H63LSGq-9_t39K2Zx_EAc/5Ir-e9ddNPcr5skzvRsSnJlvTYg\"", + "etag": "\"3133373531323239383338313531333236393038\"", "icons": { "x16": "https://www.google.com/images/icons/product/cloud_storage-16.png", "x32": "https://www.google.com/images/icons/product/cloud_storage-32.png" @@ -1781,7 +1781,7 @@ "type": "string" }, "kmsKeyName": { - "description": "Not currently supported. Specifying the parameter causes the request to fail with status code 400 - Bad Request.", + "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.", "location": "query", "type": "string" }, @@ -3229,7 +3229,7 @@ } } }, - "revision": "20200611", + "revision": "20200927", "rootUrl": "https://storage.googleapis.com/", "schemas": { "Bucket": { @@ -3406,8 +3406,8 @@ "type": "string" }, "customTimeBefore": { - "description": "A timestamp in RFC 3339 format. This condition is satisfied when the custom time on an object is before this timestamp.", - "format": "date-time", + "description": "A date in RFC 3339 format with only the date part (for instance, \"2013-01-15\"). This condition is satisfied when the custom time on an object is before this date in UTC.", + "format": "date", "type": "string" }, "daysSinceCustomTime": { @@ -3436,8 +3436,8 @@ "type": "array" }, "noncurrentTimeBefore": { - "description": "A timestamp in RFC 3339 format. This condition is satisfied when the noncurrent time on an object is before this timestamp. This condition is relevant only for versioned objects.", - "format": "date-time", + "description": "A date in RFC 3339 format with only the date part (for instance, \"2013-01-15\"). This condition is satisfied when the noncurrent time on an object is before this date in UTC. This condition is relevant only for versioned objects.", + "format": "date", "type": "string" }, "numNewerVersions": { @@ -3579,10 +3579,6 @@ "type": "string" }, "type": "array" - }, - "zoneSeparation": { - "description": "If set, objects placed in this bucket are required to be separated by disaster domain.", - "type": "boolean" } }, "type": "object" @@ -4096,7 +4092,7 @@ "type": "string" }, "kmsKeyName": { - "description": "Cloud KMS Key used to encrypt this object, if the object is encrypted by such a key.", + "description": "Not currently supported. Specifying the parameter causes the request to fail with status code 400 - Bad Request.", "type": "string" }, "md5Hash": { diff --git a/awsproviderlint/vendor/google.golang.org/api/storage/v1/storage-gen.go b/awsproviderlint/vendor/google.golang.org/api/storage/v1/storage-gen.go index dc51a22ede62..6c80946b2170 100644 --- a/awsproviderlint/vendor/google.golang.org/api/storage/v1/storage-gen.go +++ b/awsproviderlint/vendor/google.golang.org/api/storage/v1/storage-gen.go @@ -400,10 +400,6 @@ type Bucket struct { // requests will fail with a 400 Bad Request response. ZoneAffinity []string `json:"zoneAffinity,omitempty"` - // ZoneSeparation: If set, objects placed in this bucket are required to - // be separated by disaster domain. - ZoneSeparation bool `json:"zoneSeparation,omitempty"` - // ServerResponse contains the HTTP response code and headers from the // server. googleapi.ServerResponse `json:"-"` @@ -756,8 +752,9 @@ type BucketLifecycleRuleCondition struct { // is created before midnight of the specified date in UTC. CreatedBefore string `json:"createdBefore,omitempty"` - // CustomTimeBefore: A timestamp in RFC 3339 format. This condition is - // satisfied when the custom time on an object is before this timestamp. + // CustomTimeBefore: A date in RFC 3339 format with only the date part + // (for instance, "2013-01-15"). This condition is satisfied when the + // custom time on an object is before this date in UTC. CustomTimeBefore string `json:"customTimeBefore,omitempty"` // DaysSinceCustomTime: Number of days elapsed since the user-specified @@ -793,9 +790,10 @@ type BucketLifecycleRuleCondition struct { // DURABLE_REDUCED_AVAILABILITY. MatchesStorageClass []string `json:"matchesStorageClass,omitempty"` - // NoncurrentTimeBefore: A timestamp in RFC 3339 format. This condition - // is satisfied when the noncurrent time on an object is before this - // timestamp. This condition is relevant only for versioned objects. + // NoncurrentTimeBefore: A date in RFC 3339 format with only the date + // part (for instance, "2013-01-15"). This condition is satisfied when + // the noncurrent time on an object is before this date in UTC. This + // condition is relevant only for versioned objects. NoncurrentTimeBefore string `json:"noncurrentTimeBefore,omitempty"` // NumNewerVersions: Relevant only for versioned objects. If the value @@ -1734,8 +1732,8 @@ type Object struct { // storage#object. Kind string `json:"kind,omitempty"` - // KmsKeyName: Cloud KMS Key used to encrypt this object, if the object - // is encrypted by such a key. + // KmsKeyName: Not currently supported. Specifying the parameter causes + // the request to fail with status code 400 - Bad Request. KmsKeyName string `json:"kmsKeyName,omitempty"` // Md5Hash: MD5 hash of the data; encoded using base64. For more @@ -2442,7 +2440,7 @@ func (c *BucketAccessControlsDeleteCall) Header() http.Header { func (c *BucketAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -2590,7 +2588,7 @@ func (c *BucketAccessControlsGetCall) Header() http.Header { func (c *BucketAccessControlsGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -2757,7 +2755,7 @@ func (c *BucketAccessControlsInsertCall) Header() http.Header { func (c *BucketAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -2930,7 +2928,7 @@ func (c *BucketAccessControlsListCall) Header() http.Header { func (c *BucketAccessControlsListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -3091,7 +3089,7 @@ func (c *BucketAccessControlsPatchCall) Header() http.Header { func (c *BucketAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -3265,7 +3263,7 @@ func (c *BucketAccessControlsUpdateCall) Header() http.Header { func (c *BucketAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -3451,7 +3449,7 @@ func (c *BucketsDeleteCall) Header() http.Header { func (c *BucketsDeleteCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -3630,7 +3628,7 @@ func (c *BucketsGetCall) Header() http.Header { func (c *BucketsGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -3836,7 +3834,7 @@ func (c *BucketsGetIamPolicyCall) Header() http.Header { func (c *BucketsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -4053,7 +4051,7 @@ func (c *BucketsInsertCall) Header() http.Header { func (c *BucketsInsertCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -4310,7 +4308,7 @@ func (c *BucketsListCall) Header() http.Header { func (c *BucketsListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -4520,7 +4518,7 @@ func (c *BucketsLockRetentionPolicyCall) Header() http.Header { func (c *BucketsLockRetentionPolicyCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -4755,7 +4753,7 @@ func (c *BucketsPatchCall) Header() http.Header { func (c *BucketsPatchCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -4984,7 +4982,7 @@ func (c *BucketsSetIamPolicyCall) Header() http.Header { func (c *BucketsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -5159,7 +5157,7 @@ func (c *BucketsTestIamPermissionsCall) Header() http.Header { func (c *BucketsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -5399,7 +5397,7 @@ func (c *BucketsUpdateCall) Header() http.Header { func (c *BucketsUpdateCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -5611,7 +5609,7 @@ func (c *ChannelsStopCall) Header() http.Header { func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -5728,7 +5726,7 @@ func (c *DefaultObjectAccessControlsDeleteCall) Header() http.Header { func (c *DefaultObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -5876,7 +5874,7 @@ func (c *DefaultObjectAccessControlsGetCall) Header() http.Header { func (c *DefaultObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -6044,7 +6042,7 @@ func (c *DefaultObjectAccessControlsInsertCall) Header() http.Header { func (c *DefaultObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -6234,7 +6232,7 @@ func (c *DefaultObjectAccessControlsListCall) Header() http.Header { func (c *DefaultObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -6407,7 +6405,7 @@ func (c *DefaultObjectAccessControlsPatchCall) Header() http.Header { func (c *DefaultObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -6581,7 +6579,7 @@ func (c *DefaultObjectAccessControlsUpdateCall) Header() http.Header { func (c *DefaultObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -6753,7 +6751,7 @@ func (c *NotificationsDeleteCall) Header() http.Header { func (c *NotificationsDeleteCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -6901,7 +6899,7 @@ func (c *NotificationsGetCall) Header() http.Header { func (c *NotificationsGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -7071,7 +7069,7 @@ func (c *NotificationsInsertCall) Header() http.Header { func (c *NotificationsInsertCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -7246,7 +7244,7 @@ func (c *NotificationsListCall) Header() http.Header { func (c *NotificationsListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -7419,7 +7417,7 @@ func (c *ObjectAccessControlsDeleteCall) Header() http.Header { func (c *ObjectAccessControlsDeleteCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -7591,7 +7589,7 @@ func (c *ObjectAccessControlsGetCall) Header() http.Header { func (c *ObjectAccessControlsGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -7782,7 +7780,7 @@ func (c *ObjectAccessControlsInsertCall) Header() http.Header { func (c *ObjectAccessControlsInsertCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -7979,7 +7977,7 @@ func (c *ObjectAccessControlsListCall) Header() http.Header { func (c *ObjectAccessControlsListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -8164,7 +8162,7 @@ func (c *ObjectAccessControlsPatchCall) Header() http.Header { func (c *ObjectAccessControlsPatchCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -8362,7 +8360,7 @@ func (c *ObjectAccessControlsUpdateCall) Header() http.Header { func (c *ObjectAccessControlsUpdateCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -8547,9 +8545,11 @@ func (c *ObjectsComposeCall) IfMetagenerationMatch(ifMetagenerationMatch int64) return c } -// KmsKeyName sets the optional parameter "kmsKeyName": Not currently -// supported. Specifying the parameter causes the request to fail with -// status code 400 - Bad Request. +// KmsKeyName sets the optional parameter "kmsKeyName": Resource name of +// the Cloud KMS key, of the form +// projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, +// that will be used to encrypt the object. Overrides the object +// metadata's kms_key_name value, if any. func (c *ObjectsComposeCall) KmsKeyName(kmsKeyName string) *ObjectsComposeCall { c.urlParams_.Set("kmsKeyName", kmsKeyName) return c @@ -8597,7 +8597,7 @@ func (c *ObjectsComposeCall) Header() http.Header { func (c *ObjectsComposeCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -8716,7 +8716,7 @@ func (c *ObjectsComposeCall) Do(opts ...googleapi.CallOption) (*Object, error) { // "type": "string" // }, // "kmsKeyName": { - // "description": "Not currently supported. Specifying the parameter causes the request to fail with status code 400 - Bad Request.", + // "description": "Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.", // "location": "query", // "type": "string" // }, @@ -8940,7 +8940,7 @@ func (c *ObjectsCopyCall) Header() http.Header { func (c *ObjectsCopyCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -9268,7 +9268,7 @@ func (c *ObjectsDeleteCall) Header() http.Header { func (c *ObjectsDeleteCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -9501,7 +9501,7 @@ func (c *ObjectsGetCall) Header() http.Header { func (c *ObjectsGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -9751,7 +9751,7 @@ func (c *ObjectsGetIamPolicyCall) Header() http.Header { func (c *ObjectsGetIamPolicyCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -10068,7 +10068,7 @@ func (c *ObjectsInsertCall) Header() http.Header { func (c *ObjectsInsertCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -10441,7 +10441,7 @@ func (c *ObjectsListCall) Header() http.Header { func (c *ObjectsListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -10758,7 +10758,7 @@ func (c *ObjectsPatchCall) Header() http.Header { func (c *ObjectsPatchCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -11150,7 +11150,7 @@ func (c *ObjectsRewriteCall) Header() http.Header { func (c *ObjectsRewriteCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -11453,7 +11453,7 @@ func (c *ObjectsSetIamPolicyCall) Header() http.Header { func (c *ObjectsSetIamPolicyCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -11653,7 +11653,7 @@ func (c *ObjectsTestIamPermissionsCall) Header() http.Header { func (c *ObjectsTestIamPermissionsCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -11914,7 +11914,7 @@ func (c *ObjectsUpdateCall) Header() http.Header { func (c *ObjectsUpdateCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -12232,7 +12232,7 @@ func (c *ObjectsWatchAllCall) Header() http.Header { func (c *ObjectsWatchAllCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -12448,7 +12448,7 @@ func (c *ProjectsHmacKeysCreateCall) Header() http.Header { func (c *ProjectsHmacKeysCreateCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -12598,7 +12598,7 @@ func (c *ProjectsHmacKeysDeleteCall) Header() http.Header { func (c *ProjectsHmacKeysDeleteCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -12733,7 +12733,7 @@ func (c *ProjectsHmacKeysGetCall) Header() http.Header { func (c *ProjectsHmacKeysGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -12933,7 +12933,7 @@ func (c *ProjectsHmacKeysListCall) Header() http.Header { func (c *ProjectsHmacKeysListCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -13128,7 +13128,7 @@ func (c *ProjectsHmacKeysUpdateCall) Header() http.Header { func (c *ProjectsHmacKeysUpdateCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } @@ -13305,7 +13305,7 @@ func (c *ProjectsServiceAccountGetCall) Header() http.Header { func (c *ProjectsServiceAccountGetCall) doRequest(alt string) (*http.Response, error) { reqHeaders := make(http.Header) - reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20200707") + reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201023") for k, v := range c.header_ { reqHeaders[k] = v } diff --git a/awsproviderlint/vendor/google.golang.org/api/transport/http/dial.go b/awsproviderlint/vendor/google.golang.org/api/transport/http/dial.go index 44503014172c..8578cac9ef21 100644 --- a/awsproviderlint/vendor/google.golang.org/api/transport/http/dial.go +++ b/awsproviderlint/vendor/google.golang.org/api/transport/http/dial.go @@ -13,9 +13,6 @@ import ( "errors" "net" "net/http" - "net/url" - "os" - "strings" "time" "go.opencensus.io/plugin/ochttp" @@ -25,12 +22,7 @@ import ( "google.golang.org/api/option" "google.golang.org/api/transport/cert" "google.golang.org/api/transport/http/internal/propagation" -) - -const ( - mTLSModeAlways = "always" - mTLSModeNever = "never" - mTLSModeAuto = "auto" + "google.golang.org/api/transport/internal/dca" ) // NewClient returns an HTTP client for use communicating with a Google cloud @@ -41,11 +33,7 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*http.Client, if err != nil { return nil, "", err } - clientCertSource, err := getClientCertificateSource(settings) - if err != nil { - return nil, "", err - } - endpoint, err := getEndpoint(settings, clientCertSource) + clientCertSource, endpoint, err := dca.GetClientCertificateSourceAndEndpoint(settings) if err != nil { return nil, "", err } @@ -218,87 +206,3 @@ func addOCTransport(trans http.RoundTripper, settings *internal.DialSettings) ht Propagation: &propagation.HTTPFormat{}, } } - -// getClientCertificateSource returns a default client certificate source, if -// not provided by the user. -// -// A nil default source can be returned if the source does not exist. Any exceptions -// encountered while initializing the default source will be reported as client -// error (ex. corrupt metadata file). -// -// The overall logic is as follows: -// 1. If both endpoint override and client certificate are specified, use them as is. -// 2. If user does not specify client certificate, we will attempt to use default -// client certificate. -// 3. If user does not specify endpoint override, we will use defaultMtlsEndpoint if -// client certificate is available and defaultEndpoint otherwise. -// -// Implications of the above logic: -// 1. If the user specifies a non-mTLS endpoint override but client certificate is -// available, we will pass along the cert anyway and let the server decide what to do. -// 2. If the user specifies an mTLS endpoint override but client certificate is not -// available, we will not fail-fast, but let backend throw error when connecting. -// -// We would like to avoid introducing client-side logic that parses whether the -// endpoint override is an mTLS url, since the url pattern may change at anytime. -func getClientCertificateSource(settings *internal.DialSettings) (cert.Source, error) { - if settings.HTTPClient != nil { - return nil, nil // HTTPClient is incompatible with ClientCertificateSource - } else if settings.ClientCertSource != nil { - return settings.ClientCertSource, nil - } else { - return cert.DefaultSource() - } - -} - -// getEndpoint returns the endpoint for the service, taking into account the -// user-provided endpoint override "settings.Endpoint" -// -// If no endpoint override is specified, we will either return the default endpoint or -// the default mTLS endpoint if a client certificate is available. -// -// You can override the default endpoint (mtls vs. regular) by setting the -// GOOGLE_API_USE_MTLS environment variable. -// -// If the endpoint override is an address (host:port) rather than full base -// URL (ex. https://...), then the user-provided address will be merged into -// the default endpoint. For example, WithEndpoint("myhost:8000") and -// WithDefaultEndpoint("https://foo.com/bar/baz") will return "https://myhost:8080/bar/baz" -func getEndpoint(settings *internal.DialSettings, clientCertSource cert.Source) (string, error) { - if settings.Endpoint == "" { - mtlsMode := getMTLSMode() - if mtlsMode == mTLSModeAlways || (clientCertSource != nil && mtlsMode == mTLSModeAuto) { - return settings.DefaultMTLSEndpoint, nil - } - return settings.DefaultEndpoint, nil - } - if strings.Contains(settings.Endpoint, "://") { - // User passed in a full URL path, use it verbatim. - return settings.Endpoint, nil - } - if settings.DefaultEndpoint == "" { - return "", errors.New("WithEndpoint requires a full URL path") - } - - // Assume user-provided endpoint is host[:port], merge it with the default endpoint. - return mergeEndpoints(settings.DefaultEndpoint, settings.Endpoint) -} - -func getMTLSMode() string { - mode := os.Getenv("GOOGLE_API_USE_MTLS") - if mode == "" { - // TODO(shinfan): Update this to "auto" when the mTLS feature is fully released. - return mTLSModeNever - } - return strings.ToLower(mode) -} - -func mergeEndpoints(base, newHost string) (string, error) { - u, err := url.Parse(base) - if err != nil { - return "", err - } - u.Host = newHost - return u.String(), nil -} diff --git a/awsproviderlint/vendor/google.golang.org/api/transport/internal/dca/dca.go b/awsproviderlint/vendor/google.golang.org/api/transport/internal/dca/dca.go new file mode 100644 index 000000000000..b3be7e4e3a7f --- /dev/null +++ b/awsproviderlint/vendor/google.golang.org/api/transport/internal/dca/dca.go @@ -0,0 +1,145 @@ +// Copyright 2020 Google LLC. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Package dca contains utils for implementing Device Certificate +// Authentication according to https://google.aip.dev/auth/4114 +// +// The overall logic for DCA is as follows: +// 1. If both endpoint override and client certificate are specified, use them as is. +// 2. If user does not specify client certificate, we will attempt to use default +// client certificate. +// 3. If user does not specify endpoint override, we will use defaultMtlsEndpoint if +// client certificate is available and defaultEndpoint otherwise. +// +// Implications of the above logic: +// 1. If the user specifies a non-mTLS endpoint override but client certificate is +// available, we will pass along the cert anyway and let the server decide what to do. +// 2. If the user specifies an mTLS endpoint override but client certificate is not +// available, we will not fail-fast, but let backend throw error when connecting. +// +// We would like to avoid introducing client-side logic that parses whether the +// endpoint override is an mTLS url, since the url pattern may change at anytime. +// +// This package is not intended for use by end developers. Use the +// google.golang.org/api/option package to configure API clients. +package dca + +import ( + "net/url" + "os" + "strings" + + "google.golang.org/api/internal" + "google.golang.org/api/transport/cert" +) + +const ( + mTLSModeAlways = "always" + mTLSModeNever = "never" + mTLSModeAuto = "auto" +) + +// GetClientCertificateSourceAndEndpoint is a convenience function that invokes +// getClientCertificateSource and getEndpoint sequentially and returns the client +// cert source and endpoint as a tuple. +func GetClientCertificateSourceAndEndpoint(settings *internal.DialSettings) (cert.Source, string, error) { + clientCertSource, err := getClientCertificateSource(settings) + if err != nil { + return nil, "", err + } + endpoint, err := getEndpoint(settings, clientCertSource) + if err != nil { + return nil, "", err + } + return clientCertSource, endpoint, nil +} + +// getClientCertificateSource returns a default client certificate source, if +// not provided by the user. +// +// A nil default source can be returned if the source does not exist. Any exceptions +// encountered while initializing the default source will be reported as client +// error (ex. corrupt metadata file). +// +// Important Note: For now, the environment variable GOOGLE_API_USE_CLIENT_CERTIFICATE +// must be set to "true" to allow certificate to be used (including user provided +// certificates). For details, see AIP-4114. +func getClientCertificateSource(settings *internal.DialSettings) (cert.Source, error) { + if !isClientCertificateEnabled() { + return nil, nil + } else if settings.HTTPClient != nil { + return nil, nil // HTTPClient is incompatible with ClientCertificateSource + } else if settings.ClientCertSource != nil { + return settings.ClientCertSource, nil + } else { + return cert.DefaultSource() + } +} + +func isClientCertificateEnabled() bool { + useClientCert := os.Getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE") + // TODO(andyrzhao): Update default to return "true" after DCA feature is fully released. + return strings.ToLower(useClientCert) == "true" +} + +// getEndpoint returns the endpoint for the service, taking into account the +// user-provided endpoint override "settings.Endpoint". +// +// If no endpoint override is specified, we will either return the default endpoint or +// the default mTLS endpoint if a client certificate is available. +// +// You can override the default endpoint choice (mtls vs. regular) by setting the +// GOOGLE_API_USE_MTLS_ENDPOINT environment variable. +// +// If the endpoint override is an address (host:port) rather than full base +// URL (ex. https://...), then the user-provided address will be merged into +// the default endpoint. For example, WithEndpoint("myhost:8000") and +// WithDefaultEndpoint("https://foo.com/bar/baz") will return "https://myhost:8080/bar/baz" +func getEndpoint(settings *internal.DialSettings, clientCertSource cert.Source) (string, error) { + if settings.Endpoint == "" { + mtlsMode := getMTLSMode() + if mtlsMode == mTLSModeAlways || (clientCertSource != nil && mtlsMode == mTLSModeAuto) { + return settings.DefaultMTLSEndpoint, nil + } + return settings.DefaultEndpoint, nil + } + if strings.Contains(settings.Endpoint, "://") { + // User passed in a full URL path, use it verbatim. + return settings.Endpoint, nil + } + if settings.DefaultEndpoint == "" { + // If DefaultEndpoint is not configured, use the user provided endpoint verbatim. + // This allows a naked "host[:port]" URL to be used with GRPC Direct Path. + return settings.Endpoint, nil + } + + // Assume user-provided endpoint is host[:port], merge it with the default endpoint. + return mergeEndpoints(settings.DefaultEndpoint, settings.Endpoint) +} + +func getMTLSMode() string { + mode := os.Getenv("GOOGLE_API_USE_MTLS_ENDPOINT") + if mode == "" { + mode = os.Getenv("GOOGLE_API_USE_MTLS") // Deprecated. + } + if mode == "" { + return mTLSModeAuto + } + return strings.ToLower(mode) +} + +func mergeEndpoints(baseURL, newHost string) (string, error) { + u, err := url.Parse(fixScheme(baseURL)) + if err != nil { + return "", err + } + return strings.Replace(baseURL, u.Host, newHost, 1), nil +} + +func fixScheme(baseURL string) string { + if !strings.Contains(baseURL, "://") { + return "https://" + baseURL + } + return baseURL +} diff --git a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go index 2ac4deb0c9cb..55111d110c7f 100644 --- a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go +++ b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/annotations.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.12.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: google/api/annotations.proto package annotations @@ -24,9 +24,9 @@ import ( reflect "reflect" proto "github.com/golang/protobuf/proto" - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" ) const ( @@ -42,7 +42,7 @@ const _ = proto.ProtoPackageIsVersion4 var file_google_api_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ { - ExtendedType: (*descriptor.MethodOptions)(nil), + ExtendedType: (*descriptorpb.MethodOptions)(nil), ExtensionType: (*HttpRule)(nil), Field: 72295728, Name: "google.api.http", @@ -51,7 +51,7 @@ var file_google_api_annotations_proto_extTypes = []protoimpl.ExtensionInfo{ }, } -// Extension fields to descriptor.MethodOptions. +// Extension fields to descriptorpb.MethodOptions. var ( // See `HttpRule`. // @@ -84,8 +84,8 @@ var file_google_api_annotations_proto_rawDesc = []byte{ } var file_google_api_annotations_proto_goTypes = []interface{}{ - (*descriptor.MethodOptions)(nil), // 0: google.protobuf.MethodOptions - (*HttpRule)(nil), // 1: google.api.HttpRule + (*descriptorpb.MethodOptions)(nil), // 0: google.protobuf.MethodOptions + (*HttpRule)(nil), // 1: google.api.HttpRule } var file_google_api_annotations_proto_depIdxs = []int32{ 0, // 0: google.api.http:extendee -> google.protobuf.MethodOptions diff --git a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go index 3832df0bd53b..e4324641d6c7 100644 --- a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go +++ b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/client.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.12.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: google/api/client.proto package annotations @@ -24,9 +24,9 @@ import ( reflect "reflect" proto "github.com/golang/protobuf/proto" - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" ) const ( @@ -42,7 +42,7 @@ const _ = proto.ProtoPackageIsVersion4 var file_google_api_client_proto_extTypes = []protoimpl.ExtensionInfo{ { - ExtendedType: (*descriptor.MethodOptions)(nil), + ExtendedType: (*descriptorpb.MethodOptions)(nil), ExtensionType: ([]string)(nil), Field: 1051, Name: "google.api.method_signature", @@ -50,7 +50,7 @@ var file_google_api_client_proto_extTypes = []protoimpl.ExtensionInfo{ Filename: "google/api/client.proto", }, { - ExtendedType: (*descriptor.ServiceOptions)(nil), + ExtendedType: (*descriptorpb.ServiceOptions)(nil), ExtensionType: (*string)(nil), Field: 1049, Name: "google.api.default_host", @@ -58,7 +58,7 @@ var file_google_api_client_proto_extTypes = []protoimpl.ExtensionInfo{ Filename: "google/api/client.proto", }, { - ExtendedType: (*descriptor.ServiceOptions)(nil), + ExtendedType: (*descriptorpb.ServiceOptions)(nil), ExtensionType: (*string)(nil), Field: 1050, Name: "google.api.oauth_scopes", @@ -67,7 +67,7 @@ var file_google_api_client_proto_extTypes = []protoimpl.ExtensionInfo{ }, } -// Extension fields to descriptor.MethodOptions. +// Extension fields to descriptorpb.MethodOptions. var ( // A definition of a client library method signature. // @@ -109,7 +109,7 @@ var ( E_MethodSignature = &file_google_api_client_proto_extTypes[0] ) -// Extension fields to descriptor.ServiceOptions. +// Extension fields to descriptorpb.ServiceOptions. var ( // The hostname for this service. // This should be specified with no prefix or protocol. @@ -179,8 +179,8 @@ var file_google_api_client_proto_rawDesc = []byte{ } var file_google_api_client_proto_goTypes = []interface{}{ - (*descriptor.MethodOptions)(nil), // 0: google.protobuf.MethodOptions - (*descriptor.ServiceOptions)(nil), // 1: google.protobuf.ServiceOptions + (*descriptorpb.MethodOptions)(nil), // 0: google.protobuf.MethodOptions + (*descriptorpb.ServiceOptions)(nil), // 1: google.protobuf.ServiceOptions } var file_google_api_client_proto_depIdxs = []int32{ 0, // 0: google.api.method_signature:extendee -> google.protobuf.MethodOptions diff --git a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go index 0038b20e4e4a..b6b9094c9a4e 100644 --- a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go +++ b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/field_behavior.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.12.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: google/api/field_behavior.proto package annotations @@ -25,9 +25,9 @@ import ( sync "sync" proto "github.com/golang/protobuf/proto" - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" ) const ( @@ -124,7 +124,7 @@ func (FieldBehavior) EnumDescriptor() ([]byte, []int) { var file_google_api_field_behavior_proto_extTypes = []protoimpl.ExtensionInfo{ { - ExtendedType: (*descriptor.FieldOptions)(nil), + ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: ([]FieldBehavior)(nil), Field: 1052, Name: "google.api.field_behavior", @@ -133,7 +133,7 @@ var file_google_api_field_behavior_proto_extTypes = []protoimpl.ExtensionInfo{ }, } -// Extension fields to descriptor.FieldOptions. +// Extension fields to descriptorpb.FieldOptions. var ( // A designation of a specific field behavior (required, output only, etc.) // in protobuf messages. @@ -198,8 +198,8 @@ func file_google_api_field_behavior_proto_rawDescGZIP() []byte { var file_google_api_field_behavior_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_google_api_field_behavior_proto_goTypes = []interface{}{ - (FieldBehavior)(0), // 0: google.api.FieldBehavior - (*descriptor.FieldOptions)(nil), // 1: google.protobuf.FieldOptions + (FieldBehavior)(0), // 0: google.api.FieldBehavior + (*descriptorpb.FieldOptions)(nil), // 1: google.protobuf.FieldOptions } var file_google_api_field_behavior_proto_depIdxs = []int32{ 1, // 0: google.api.field_behavior:extendee -> google.protobuf.FieldOptions diff --git a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go index 955bc56a394c..f36d981ced0c 100644 --- a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go +++ b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/http.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.12.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: google/api/http.proto package annotations diff --git a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go index ff6147fe2775..d3e36efee6d0 100644 --- a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go +++ b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/api/annotations/resource.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.12.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: google/api/resource.proto package annotations @@ -25,9 +25,9 @@ import ( sync "sync" proto "github.com/golang/protobuf/proto" - descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + descriptorpb "google.golang.org/protobuf/types/descriptorpb" ) const ( @@ -440,7 +440,7 @@ func (x *ResourceReference) GetChildType() string { var file_google_api_resource_proto_extTypes = []protoimpl.ExtensionInfo{ { - ExtendedType: (*descriptor.FieldOptions)(nil), + ExtendedType: (*descriptorpb.FieldOptions)(nil), ExtensionType: (*ResourceReference)(nil), Field: 1055, Name: "google.api.resource_reference", @@ -448,7 +448,7 @@ var file_google_api_resource_proto_extTypes = []protoimpl.ExtensionInfo{ Filename: "google/api/resource.proto", }, { - ExtendedType: (*descriptor.FileOptions)(nil), + ExtendedType: (*descriptorpb.FileOptions)(nil), ExtensionType: ([]*ResourceDescriptor)(nil), Field: 1053, Name: "google.api.resource_definition", @@ -456,7 +456,7 @@ var file_google_api_resource_proto_extTypes = []protoimpl.ExtensionInfo{ Filename: "google/api/resource.proto", }, { - ExtendedType: (*descriptor.MessageOptions)(nil), + ExtendedType: (*descriptorpb.MessageOptions)(nil), ExtensionType: (*ResourceDescriptor)(nil), Field: 1053, Name: "google.api.resource", @@ -465,7 +465,7 @@ var file_google_api_resource_proto_extTypes = []protoimpl.ExtensionInfo{ }, } -// Extension fields to descriptor.FieldOptions. +// Extension fields to descriptorpb.FieldOptions. var ( // An annotation that describes a resource reference, see // [ResourceReference][]. @@ -474,7 +474,7 @@ var ( E_ResourceReference = &file_google_api_resource_proto_extTypes[0] ) -// Extension fields to descriptor.FileOptions. +// Extension fields to descriptorpb.FileOptions. var ( // An annotation that describes a resource definition without a corresponding // message; see [ResourceDescriptor][]. @@ -483,7 +483,7 @@ var ( E_ResourceDefinition = &file_google_api_resource_proto_extTypes[1] ) -// Extension fields to descriptor.MessageOptions. +// Extension fields to descriptorpb.MessageOptions. var ( // An annotation that describes a resource definition, see // [ResourceDescriptor][]. @@ -568,12 +568,12 @@ func file_google_api_resource_proto_rawDescGZIP() []byte { var file_google_api_resource_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_google_api_resource_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_google_api_resource_proto_goTypes = []interface{}{ - (ResourceDescriptor_History)(0), // 0: google.api.ResourceDescriptor.History - (*ResourceDescriptor)(nil), // 1: google.api.ResourceDescriptor - (*ResourceReference)(nil), // 2: google.api.ResourceReference - (*descriptor.FieldOptions)(nil), // 3: google.protobuf.FieldOptions - (*descriptor.FileOptions)(nil), // 4: google.protobuf.FileOptions - (*descriptor.MessageOptions)(nil), // 5: google.protobuf.MessageOptions + (ResourceDescriptor_History)(0), // 0: google.api.ResourceDescriptor.History + (*ResourceDescriptor)(nil), // 1: google.api.ResourceDescriptor + (*ResourceReference)(nil), // 2: google.api.ResourceReference + (*descriptorpb.FieldOptions)(nil), // 3: google.protobuf.FieldOptions + (*descriptorpb.FileOptions)(nil), // 4: google.protobuf.FileOptions + (*descriptorpb.MessageOptions)(nil), // 5: google.protobuf.MessageOptions } var file_google_api_resource_proto_depIdxs = []int32{ 0, // 0: google.api.ResourceDescriptor.history:type_name -> google.api.ResourceDescriptor.History diff --git a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/iam_policy.pb.go b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/iam_policy.pb.go index 375d3876535c..8a0cca603e4d 100644 --- a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/iam_policy.pb.go +++ b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/iam_policy.pb.go @@ -15,8 +15,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.12.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: google/iam/v1/iam_policy.proto package iam diff --git a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/options.pb.go b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/options.pb.go index e6c2bfcba568..f8f9fb0e92f2 100644 --- a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/options.pb.go +++ b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/options.pb.go @@ -15,8 +15,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.12.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: google/iam/v1/options.proto package iam diff --git a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/policy.pb.go b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/policy.pb.go index ba64dcc4690f..78fa90086216 100644 --- a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/policy.pb.go +++ b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/iam/v1/policy.pb.go @@ -15,8 +15,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.12.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: google/iam/v1/policy.proto package iam diff --git a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go index 9034439ad9fc..386fd7b13c45 100644 --- a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go +++ b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/rpc/code/code.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.12.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: google/rpc/code.proto package code diff --git a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go index 5dfabd640ba7..e79a53884651 100644 --- a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go +++ b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/rpc/status/status.pb.go @@ -14,8 +14,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.12.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: google/rpc/status.proto package status @@ -25,9 +25,9 @@ import ( sync "sync" proto "github.com/golang/protobuf/proto" - any "github.com/golang/protobuf/ptypes/any" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" + anypb "google.golang.org/protobuf/types/known/anypb" ) const ( @@ -61,7 +61,7 @@ type Status struct { Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` // A list of messages that carry the error details. There is a common set of // message types for APIs to use. - Details []*any.Any `protobuf:"bytes,3,rep,name=details,proto3" json:"details,omitempty"` + Details []*anypb.Any `protobuf:"bytes,3,rep,name=details,proto3" json:"details,omitempty"` } func (x *Status) Reset() { @@ -110,7 +110,7 @@ func (x *Status) GetMessage() string { return "" } -func (x *Status) GetDetails() []*any.Any { +func (x *Status) GetDetails() []*anypb.Any { if x != nil { return x.Details } @@ -154,8 +154,8 @@ func file_google_rpc_status_proto_rawDescGZIP() []byte { var file_google_rpc_status_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_google_rpc_status_proto_goTypes = []interface{}{ - (*Status)(nil), // 0: google.rpc.Status - (*any.Any)(nil), // 1: google.protobuf.Any + (*Status)(nil), // 0: google.rpc.Status + (*anypb.Any)(nil), // 1: google.protobuf.Any } var file_google_rpc_status_proto_depIdxs = []int32{ 1, // 0: google.rpc.Status.details:type_name -> google.protobuf.Any diff --git a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go index 4d9a47dca940..1cc50df7366f 100644 --- a/awsproviderlint/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go +++ b/awsproviderlint/vendor/google.golang.org/genproto/googleapis/type/expr/expr.pb.go @@ -15,8 +15,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.22.0 -// protoc v3.12.3 +// protoc-gen-go v1.25.0 +// protoc v3.13.0 // source: google/type/expr.proto package expr diff --git a/awsproviderlint/vendor/modules.txt b/awsproviderlint/vendor/modules.txt index 4de63983b7eb..45dbbb839369 100644 --- a/awsproviderlint/vendor/modules.txt +++ b/awsproviderlint/vendor/modules.txt @@ -1,4 +1,4 @@ -# cloud.google.com/go v0.61.0 +# cloud.google.com/go v0.65.0 cloud.google.com/go cloud.google.com/go/compute/metadata cloud.google.com/go/iam @@ -10,9 +10,9 @@ cloud.google.com/go/internal/version cloud.google.com/go/storage # github.com/agext/levenshtein v1.2.2 github.com/agext/levenshtein -# github.com/apparentlymart/go-textseg v1.0.0 -github.com/apparentlymart/go-textseg/textseg -# github.com/aws/aws-sdk-go v1.37.4 +# github.com/apparentlymart/go-textseg/v12 v12.0.0 +github.com/apparentlymart/go-textseg/v12/textseg +# github.com/aws/aws-sdk-go v1.38.6 ## explicit github.com/aws/aws-sdk-go/aws github.com/aws/aws-sdk-go/aws/arn @@ -68,7 +68,7 @@ github.com/bflad/gopaniccheck/passes/logpaniccallexpr github.com/bflad/gopaniccheck/passes/logpanicfcallexpr github.com/bflad/gopaniccheck/passes/logpaniclncallexpr github.com/bflad/gopaniccheck/passes/paniccallexpr -# github.com/bflad/tfproviderlint v0.22.0 +# github.com/bflad/tfproviderlint v0.26.0 ## explicit github.com/bflad/tfproviderlint/helper/analysisutils github.com/bflad/tfproviderlint/helper/astutils @@ -88,6 +88,9 @@ github.com/bflad/tfproviderlint/passes/AT006 github.com/bflad/tfproviderlint/passes/AT007 github.com/bflad/tfproviderlint/passes/AT008 github.com/bflad/tfproviderlint/passes/AT009 +github.com/bflad/tfproviderlint/passes/AT010 +github.com/bflad/tfproviderlint/passes/AT011 +github.com/bflad/tfproviderlint/passes/AT012 github.com/bflad/tfproviderlint/passes/R001 github.com/bflad/tfproviderlint/passes/R002 github.com/bflad/tfproviderlint/passes/R003 @@ -154,6 +157,10 @@ github.com/bflad/tfproviderlint/passes/V007 github.com/bflad/tfproviderlint/passes/V008 github.com/bflad/tfproviderlint/passes/V009 github.com/bflad/tfproviderlint/passes/V010 +github.com/bflad/tfproviderlint/passes/V011 +github.com/bflad/tfproviderlint/passes/V012 +github.com/bflad/tfproviderlint/passes/V013 +github.com/bflad/tfproviderlint/passes/V014 github.com/bflad/tfproviderlint/passes/commentignore github.com/bflad/tfproviderlint/passes/helper/acctest/randstringfromcharsetcallexpr github.com/bflad/tfproviderlint/passes/helper/resource/retryfuncinfo @@ -191,16 +198,23 @@ github.com/bflad/tfproviderlint/passes/helper/validation/validatelistuniquestrin github.com/bflad/tfproviderlint/passes/helper/validation/validateregexpselectorexpr github.com/bflad/tfproviderlint/passes/helper/validation/validaterfc3339timestringselectorexpr github.com/bflad/tfproviderlint/passes/stdlib/fmtsprintfcallexpr +github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcallexpr +github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextcallexpr +github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandcontextselectorexpr +github.com/bflad/tfproviderlint/passes/stdlib/osexeccommandselectorexpr github.com/bflad/tfproviderlint/passes/stdlib/timesleepcallexpr github.com/bflad/tfproviderlint/passes/testaccfuncdecl github.com/bflad/tfproviderlint/passes/testfuncdecl github.com/bflad/tfproviderlint/xpasses +github.com/bflad/tfproviderlint/xpasses/XAT001 github.com/bflad/tfproviderlint/xpasses/XR001 github.com/bflad/tfproviderlint/xpasses/XR002 github.com/bflad/tfproviderlint/xpasses/XR003 github.com/bflad/tfproviderlint/xpasses/XR004 github.com/bflad/tfproviderlint/xpasses/XR005 github.com/bflad/tfproviderlint/xpasses/XR006 +github.com/bflad/tfproviderlint/xpasses/XR007 +github.com/bflad/tfproviderlint/xpasses/XR008 github.com/bflad/tfproviderlint/xpasses/XS001 github.com/bflad/tfproviderlint/xpasses/XS002 # github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d @@ -242,7 +256,7 @@ github.com/hashicorp/go-cty/cty/gocty github.com/hashicorp/go-cty/cty/json github.com/hashicorp/go-cty/cty/msgpack github.com/hashicorp/go-cty/cty/set -# github.com/hashicorp/go-getter v1.5.0 +# github.com/hashicorp/go-getter v1.5.2 github.com/hashicorp/go-getter github.com/hashicorp/go-getter/helper/url # github.com/hashicorp/go-hclog v0.15.0 @@ -258,7 +272,7 @@ github.com/hashicorp/go-safetemp github.com/hashicorp/go-uuid # github.com/hashicorp/go-version v1.2.1 github.com/hashicorp/go-version -# github.com/hashicorp/hcl/v2 v2.3.0 +# github.com/hashicorp/hcl/v2 v2.8.2 github.com/hashicorp/hcl/v2 github.com/hashicorp/hcl/v2/ext/customdecode github.com/hashicorp/hcl/v2/hclsyntax @@ -277,7 +291,7 @@ github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5 github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/toproto github.com/hashicorp/terraform-plugin-go/tfprotov5/server github.com/hashicorp/terraform-plugin-go/tfprotov5/tftypes -# github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.3 +# github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0 ## explicit github.com/hashicorp/terraform-plugin-sdk/v2/diag github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging @@ -304,6 +318,12 @@ github.com/jmespath/go-jmespath github.com/jstemmer/go-junit-report github.com/jstemmer/go-junit-report/formatter github.com/jstemmer/go-junit-report/parser +# github.com/klauspost/compress v1.11.2 +github.com/klauspost/compress/fse +github.com/klauspost/compress/huff0 +github.com/klauspost/compress/snappy +github.com/klauspost/compress/zstd +github.com/klauspost/compress/zstd/internal/xxhash # github.com/mattn/go-colorable v0.1.4 github.com/mattn/go-colorable # github.com/mattn/go-isatty v0.0.10 @@ -330,7 +350,7 @@ github.com/ulikunitz/xz/lzma # github.com/vmihailenco/msgpack v4.0.4+incompatible github.com/vmihailenco/msgpack github.com/vmihailenco/msgpack/codes -# github.com/zclconf/go-cty v1.2.1 +# github.com/zclconf/go-cty v1.7.1 github.com/zclconf/go-cty/cty github.com/zclconf/go-cty/cty/convert github.com/zclconf/go-cty/cty/function @@ -378,7 +398,7 @@ golang.org/x/net/http2/hpack golang.org/x/net/idna golang.org/x/net/internal/timeseries golang.org/x/net/trace -# golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d +# golang.org/x/oauth2 v0.0.0-20200902213428-5d25da1a8d43 golang.org/x/oauth2 golang.org/x/oauth2/google golang.org/x/oauth2/internal @@ -392,7 +412,7 @@ golang.org/x/text/secure/bidirule golang.org/x/text/transform golang.org/x/text/unicode/bidi golang.org/x/text/unicode/norm -# golang.org/x/tools v0.0.0-20200928201943-a0ef9b62deab +# golang.org/x/tools v0.0.0-20201028111035-eafbe7b904eb ## explicit golang.org/x/tools/cmd/goimports golang.org/x/tools/go/analysis @@ -430,11 +450,12 @@ golang.org/x/tools/txtar # golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 golang.org/x/xerrors golang.org/x/xerrors/internal -# google.golang.org/api v0.29.0 +# google.golang.org/api v0.34.0 google.golang.org/api/googleapi google.golang.org/api/googleapi/transport google.golang.org/api/internal google.golang.org/api/internal/gensupport +google.golang.org/api/internal/impersonate google.golang.org/api/internal/third_party/uritemplates google.golang.org/api/iterator google.golang.org/api/option @@ -443,6 +464,7 @@ google.golang.org/api/storage/v1 google.golang.org/api/transport/cert google.golang.org/api/transport/http google.golang.org/api/transport/http/internal/propagation +google.golang.org/api/transport/internal/dca # google.golang.org/appengine v1.6.6 google.golang.org/appengine google.golang.org/appengine/datastore @@ -457,7 +479,7 @@ google.golang.org/appengine/internal/modules google.golang.org/appengine/internal/remote_api google.golang.org/appengine/internal/urlfetch google.golang.org/appengine/urlfetch -# google.golang.org/genproto v0.0.0-20200711021454-869866162049 +# google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d google.golang.org/genproto/googleapis/api/annotations google.golang.org/genproto/googleapis/iam/v1 google.golang.org/genproto/googleapis/rpc/code diff --git a/docs/contributing/contribution-checklists.md b/docs/contributing/contribution-checklists.md index b45bcabe38cd..8d1c2db29803 100644 --- a/docs/contributing/contribution-checklists.md +++ b/docs/contributing/contribution-checklists.md @@ -136,6 +136,7 @@ func TestAccAWSServiceThing_Name_Generated(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, service.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSServiceThingDestroy, Steps: []resource.TestStep{ @@ -163,6 +164,7 @@ func TestAccAWSServiceThing_NamePrefix(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, service.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSServiceThingDestroy, Steps: []resource.TestStep{ @@ -353,6 +355,7 @@ More details about this code generation, including fixes for potential error mes resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t); testAccPreCheckAWSEks(t) }, + ErrorCheck: testAccErrorCheck(t, eks.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSEksClusterDestroy, Steps: []resource.TestStep{ diff --git a/docs/contributing/running-and-writing-acceptance-tests.md b/docs/contributing/running-and-writing-acceptance-tests.md index 208a1cc309a0..fb54e6144495 100644 --- a/docs/contributing/running-and-writing-acceptance-tests.md +++ b/docs/contributing/running-and-writing-acceptance-tests.md @@ -17,6 +17,9 @@ - [PreChecks](#prechecks) - [Standard Provider PreChecks](#standard-provider-prechecks) - [Custom PreChecks](#custom-prechecks) + - [ErrorChecks](#errorchecks) + - [Common ErrorCheck](#common-errorcheck) + - [Service-Specific ErrorChecks](#service-specific-errorchecks) - [Disappears Acceptance Tests](#disappears-acceptance-tests) - [Per Attribute Acceptance Tests](#per-attribute-acceptance-tests) - [Cross-Account Acceptance Tests](#cross-account-acceptance-tests) @@ -192,6 +195,7 @@ func TestAccAWSCloudWatchDashboard_basic(t *testing.T) { rInt := acctest.RandInt() resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, cloudwatch.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAWSCloudWatchDashboardDestroy, Steps: []resource.TestStep{ @@ -488,6 +492,7 @@ func TestAccAwsExampleThing_basic(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, service.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsExampleThingDestroy, Steps: []resource.TestStep{ @@ -595,6 +600,59 @@ func testAccPreCheckAwsExample(t *testing.T) { } ``` +#### ErrorChecks + +Acceptance test cases have an ErrorCheck. The ErrorCheck provides a chance to take a look at errors before the test fails. While most errors should result in test failure, some should not. For example, an error that indicates an API operation is not supported in a particular region should cause the test to skip instead of fail. Since errors should flow through the ErrorCheck, do not handle the vast majority of failing conditions. Instead, in ErrorCheck, focus on the rare errors that should cause a test to skip, or in other words, be ignored. + +##### Common ErrorCheck + +In many situations, the common ErrorCheck is sufficient. It will skip tests for several normal occurrences such as when AWS reports a feature is not supported in the current region. + +Here is an example of the common ErrorCheck: + +```go +func TestAccAwsExampleThing_basic(t *testing.T) { + rName := acctest.RandomWithPrefix("tf-acc-test") + resourceName := "aws_example_thing.test" + + resource.ParallelTest(t, resource.TestCase{ + // PreCheck + ErrorCheck: testAccErrorCheck(t, service.EndpointsID), + // ... additional checks follow ... + }) +} +``` + +##### Service-Specific ErrorChecks + +However, some services have special conditions that aren't caught by the common ErrorCheck. In these cases, you can create a service-specific ErrorCheck. + +To add a service-specific ErrorCheck, follow these steps: + +1. Make sure there is not already an ErrorCheck for the service you have in mind. For example, search the codebase for `RegisterServiceErrorCheckFunc(service.EndpointsID` replacing "service" with the package name of the service you're working on (e.g., `ec2`). If there is already an ErrorCheck for the service, add to the existing service-specific ErrorCheck. +2. Create the service-specific ErrorCheck in an `_test.go` file for the service. See the example below. +3. Register the new service-specific ErrorCheck in the `init()` at the top of the `_test.go` file. See the example below. + +An example of adding a service-specific ErrorCheck: + +```go +// just after the imports, create or add to the init() function +func init() { + RegisterServiceErrorCheck(service.EndpointsID, testAccErrorCheckSkipService) +} + +// ... additional code and tests ... + +// this is the service-specific ErrorCheck +func testAccErrorCheckSkipService(t *testing.T) resource.ErrorCheckFunc { + return testAccErrorCheckSkipMessagesContaining(t, + "Error message specific to the service that indicates unsupported features", + "You can include from one to many portions of error messages", + "Be careful to not inadvertently capture errors that should not be skipped", + ) +} +``` + #### Disappears Acceptance Tests This test is generally implemented second. It is straightforward to setup once the basic test is passing since it can reuse that test configuration. It prevents a common bug report with Terraform resources that error when they can not be found (e.g. deleted outside Terraform). @@ -610,6 +668,7 @@ func TestAccAwsExampleThing_disappears(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, service.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsExampleThingDestroy, Steps: []resource.TestStep{ @@ -652,6 +711,7 @@ func TestAccAwsExampleChildThing_disappears_ParentThing(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, service.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsExampleChildThingDestroy, Steps: []resource.TestStep{ @@ -681,6 +741,7 @@ func TestAccAwsExampleThing_Description(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, service.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsExampleThingDestroy, Steps: []resource.TestStep{ @@ -741,6 +802,7 @@ func TestAccAwsExample_basic(t *testing.T) { testAccPreCheck(t) testAccAlternateAccountPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, service.EndpointsID), ProviderFactories: testAccProviderFactoriesAlternate(&providers), CheckDestroy: testAccCheckAwsExampleDestroy, Steps: []resource.TestStep{ @@ -804,6 +866,7 @@ func TestAccAwsExample_basic(t *testing.T) { testAccPreCheck(t) testAccMultipleRegionPreCheck(t, 2) }, + ErrorCheck: testAccErrorCheck(t, service.EndpointsID), ProviderFactories: testAccProviderFactoriesMultipleRegion(&providers, 2), CheckDestroy: testAccCheckAwsExampleDestroy, Steps: []resource.TestStep{ @@ -1018,6 +1081,7 @@ func TestAccAwsExampleThingDataSource_Name(t *testing.T) { resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { testAccPreCheck(t) }, + ErrorCheck: testAccErrorCheck(t, service.EndpointsID), Providers: testAccProviders, CheckDestroy: testAccCheckAwsExampleThingDestroy, Steps: []resource.TestStep{ @@ -1212,9 +1276,11 @@ The below are required items that will be noted during submission review and pre - [ ] __Implements Exists Check Function__: Resource testing should include a `TestCheckFunc` function (typically named `testAccCheckAws{SERVICE}{RESOURCE}Exists`) that calls the API to verify that the Terraform resource has been created or associated as appropriate. Preferably, this function will also accept a pointer to an API object representing the Terraform resource from the API response that can be set for potential usage in later `TestCheckFunc`. More information about these functions can be found in the [Extending Terraform Custom Check Functions documentation](https://www.terraform.io/docs/extend/testing/acceptance-tests/testcase.html#checkdestroy). - [ ] __Excludes Provider Declarations__: Test configurations should not include `provider "aws" {...}` declarations. If necessary, only the provider declarations in `provider_test.go` should be used for multiple account/region or otherwise specialized testing. - [ ] __Passes in us-west-2 Region__: Tests default to running in `us-west-2` and at a minimum should pass in that region or include necessary `PreCheck` functions to skip the test when ran outside an expected environment. +- [ ] __Includes ErrorCheck__: All acceptance tests should include a call to the common ErrorCheck (`ErrorCheck: testAccErrorCheck(t, service.EndpointsID),`). - [ ] __Uses resource.ParallelTest__: Tests should utilize [`resource.ParallelTest()`](https://godoc.org/github.com/hashicorp/terraform/helper/resource#ParallelTest) instead of [`resource.Test()`](https://godoc.org/github.com/hashicorp/terraform/helper/resource#Test) except where serialized testing is absolutely required. - [ ] __Uses fmt.Sprintf()__: Test configurations preferably should to be separated into their own functions (typically named `testAccAws{SERVICE}{RESOURCE}Config{PURPOSE}`) that call [`fmt.Sprintf()`](https://golang.org/pkg/fmt/#Sprintf) for variable injection or a string `const` for completely static configurations. Test configurations should avoid `var` or other variable injection functionality such as [`text/template`](https://golang.org/pkg/text/template/). - [ ] __Uses Randomized Infrastructure Naming__: Test configurations that utilize resources where a unique name is required should generate a random name. Typically this is created via `rName := acctest.RandomWithPrefix("tf-acc-test")` in the acceptance test function before generating the configuration. +- [ ] __Prevents S3 Bucket Deletion Errors__: Test configurations that utilize `aws_s3_bucket` resources as a logging destination should include the `force_destroy = true` configuration. This is to prevent race conditions where logging objects may be written during the testing duration which will cause `BucketNotEmpty` errors during deletion. For resources that support import, the additional item below is required that will be noted during submission review and prevent immediate merging: diff --git a/go.mod b/go.mod index 9244f1937441..f871edf996c8 100644 --- a/go.mod +++ b/go.mod @@ -3,21 +3,21 @@ module github.com/terraform-providers/terraform-provider-aws go 1.16 require ( - github.com/aws/aws-sdk-go v1.37.24 + github.com/aws/aws-sdk-go v1.38.6 github.com/beevik/etree v1.1.0 github.com/fatih/color v1.9.0 // indirect github.com/hashicorp/aws-sdk-go-base v0.7.0 github.com/hashicorp/go-cleanhttp v0.5.2 github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 - github.com/hashicorp/go-multierror v1.1.0 + github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/go-version v1.2.1 - github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.4 + github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0 github.com/jen20/awspolicyequivalence v1.1.0 github.com/keybase/go-crypto v0.0.0-20161004153544-93f5b35093ba github.com/mattn/go-colorable v0.1.7 // indirect - github.com/mitchellh/copystructure v1.0.0 + github.com/mitchellh/copystructure v1.1.1 github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/go-testing-interface v1.14.1 github.com/pquerna/otp v1.3.0 - gopkg.in/yaml.v2 v2.3.0 + gopkg.in/yaml.v2 v2.4.0 ) diff --git a/go.sum b/go.sum index 064733a8e3b2..b6655438a2e9 100644 --- a/go.sum +++ b/go.sum @@ -55,8 +55,8 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkY github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.25.3/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.31.9/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= -github.com/aws/aws-sdk-go v1.37.24 h1:UmdPwGITvz//eFxNyuPlkq8KLlu4ZGvowsCQs+uFIp4= -github.com/aws/aws-sdk-go v1.37.24/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= +github.com/aws/aws-sdk-go v1.38.6 h1:h0AKIaz/A1kEJ50HxCv7tL1GW+KbxYbp75+lZ/nvFOI= +github.com/aws/aws-sdk-go v1.38.6/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs= github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= @@ -171,8 +171,8 @@ github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39 github.com/hashicorp/go-hclog v0.15.0 h1:qMuK0wxsoW4D0ddCCYwPSTm4KQv1X1ke3WmPWZ0Mvsk= github.com/hashicorp/go-hclog v0.15.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= -github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= -github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/hashicorp/go-plugin v1.3.0/go.mod h1:F9eH4LrE/ZsRdbwhfjs9k9HoDUwAHnYtXdgmf1AVNs0= github.com/hashicorp/go-plugin v1.4.0 h1:b0O7rs5uiJ99Iu9HugEzsM67afboErkHUWddUSpUO3A= github.com/hashicorp/go-plugin v1.4.0/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ= @@ -196,8 +196,8 @@ github.com/hashicorp/terraform-json v0.8.0 h1:XObQ3PgqU52YLQKEaJ08QtUshAfN3yu4u8 github.com/hashicorp/terraform-json v0.8.0/go.mod h1:3defM4kkMfttwiE7VakJDwCd4R+umhSQnvJwORXbprE= github.com/hashicorp/terraform-plugin-go v0.2.1 h1:EW/R8bB2Zbkjmugzsy1d27yS8/0454b3MtYHkzOknqA= github.com/hashicorp/terraform-plugin-go v0.2.1/go.mod h1:10V6F3taeDWVAoLlkmArKttR3IULlRWFAGtQIQTIDr4= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.4 h1:6k0WcxFgVqF/GUFHPvAH8FIrCkoA1RInXzSxhkKamPg= -github.com/hashicorp/terraform-plugin-sdk/v2 v2.4.4/go.mod h1:z+cMZ0iswzZOahBJ3XmNWgWkVnAd2bl8g+FhyyuPDH4= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0 h1:4EHNOAjwiYCeBxY16rt2KwyRNNVsCaVO3kWBbiXfYM0= +github.com/hashicorp/terraform-plugin-sdk/v2 v2.5.0/go.mod h1:z+cMZ0iswzZOahBJ3XmNWgWkVnAd2bl8g+FhyyuPDH4= github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d h1:kJCB4vdITiW1eC1vq2e6IsrXKrZit1bv/TDYFGMp4BQ= github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= @@ -248,8 +248,9 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mitchellh/cli v1.1.1/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= -github.com/mitchellh/copystructure v1.0.0 h1:Laisrj+bAB6b/yJwB5Bt3ITZhGJdqmxquMKeZ+mmkFQ= github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/copystructure v1.1.1 h1:Bp6x9R1Wn16SIz3OfeDr0b7RnCG2OB66Y7PQyC/cvq4= +github.com/mitchellh/copystructure v1.1.1/go.mod h1:EBArHfARyrSWO/+Wyr9zwEkc6XMFB9XyNgFNmRkZZU4= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -573,8 +574,8 @@ gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRN gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/infrastructure/repository/labels-service.tf b/infrastructure/repository/labels-service.tf index 1b7750b47889..acd17a275089 100644 --- a/infrastructure/repository/labels-service.tf +++ b/infrastructure/repository/labels-service.tf @@ -22,6 +22,7 @@ variable "service_labels" { "appstream", "appsync", "athena", + "auditmanager", "autoscaling", "autoscalingplans", "backup", diff --git a/scripts/validate-terraform.sh b/scripts/validate-terraform.sh index 41bcb8593479..08c54d82f95f 100755 --- a/scripts/validate-terraform.sh +++ b/scripts/validate-terraform.sh @@ -25,8 +25,6 @@ rules=( "--only=aws_instance_previous_type" "--only=aws_db_instance_previous_type" "--only=aws_elasticache_cluster_previous_type" - # Prevent some configuration errors - "--only=aws_route_specified_multiple_targets" ) while read -r filename ; do block_number=0 diff --git a/tools/go.mod b/tools/go.mod index ba4e4632fd68..55a6ef2245b6 100644 --- a/tools/go.mod +++ b/tools/go.mod @@ -3,7 +3,7 @@ module github.com/terraform-providers/terraform-provider-aws/tools go 1.15 require ( - github.com/bflad/tfproviderdocs v0.8.0 + github.com/bflad/tfproviderdocs v0.9.1 github.com/client9/misspell v0.3.4 github.com/golangci/golangci-lint v1.37.1 github.com/hashicorp/go-changelog v0.0.0-20201005170154-56335215ce3a diff --git a/tools/go.sum b/tools/go.sum index 573155057ab1..8ba54c132934 100644 --- a/tools/go.sum +++ b/tools/go.sum @@ -126,8 +126,8 @@ github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f/go.mod github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/bflad/tfproviderdocs v0.8.0 h1:LYzAkmd3MEF6465MRNZOhv6pW/xYCtR7XeRC6iurZFE= -github.com/bflad/tfproviderdocs v0.8.0/go.mod h1:gC+fjQ+tT1x1bqq+2yZ9G/y9VjRI24c6HDi+uEdgBG4= +github.com/bflad/tfproviderdocs v0.9.1 h1:C9Rkh61PgaQnRLbgfuBKRGCS8C8d8yEla3gpToC+b+o= +github.com/bflad/tfproviderdocs v0.9.1/go.mod h1:gC+fjQ+tT1x1bqq+2yZ9G/y9VjRI24c6HDi+uEdgBG4= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= diff --git a/website/allowed-subcategories.txt b/website/allowed-subcategories.txt index ee70be760e59..4bcf7aaf80ab 100644 --- a/website/allowed-subcategories.txt +++ b/website/allowed-subcategories.txt @@ -8,6 +8,7 @@ AppMesh AppSync Application Autoscaling Athena +Audit Manager Autoscaling Autoscaling Plans Amazon Managed Service for Prometheus (AMP) diff --git a/website/docs/d/acm_certificate.html.markdown b/website/docs/d/acm_certificate.html.markdown index 6d455ba6c04a..e95cc816cb6c 100644 --- a/website/docs/d/acm_certificate.html.markdown +++ b/website/docs/d/acm_certificate.html.markdown @@ -14,7 +14,7 @@ it by domain without having to hard code the ARNs as input. ## Example Usage -```hcl +```terraform # Find a certificate that is issued data "aws_acm_certificate" "issued" { domain = "tf.example.com" diff --git a/website/docs/d/acmpca_certificate_authority.html.markdown b/website/docs/d/acmpca_certificate_authority.html.markdown index b721c3dabd57..1b456f10e1ee 100644 --- a/website/docs/d/acmpca_certificate_authority.html.markdown +++ b/website/docs/d/acmpca_certificate_authority.html.markdown @@ -12,7 +12,7 @@ Get information on a AWS Certificate Manager Private Certificate Authority (ACM ## Example Usage -```hcl +```terraform data "aws_acmpca_certificate_authority" "example" { arn = "arn:aws:acm-pca:us-east-1:123456789012:certificate-authority/12345678-1234-1234-1234-123456789012" } diff --git a/website/docs/d/ami.html.markdown b/website/docs/d/ami.html.markdown index aa6f0717b0fa..42f655dc11c8 100644 --- a/website/docs/d/ami.html.markdown +++ b/website/docs/d/ami.html.markdown @@ -13,7 +13,7 @@ resources. ## Example Usage -```hcl +```terraform data "aws_ami" "example" { executable_users = ["self"] most_recent = true diff --git a/website/docs/d/ami_ids.html.markdown b/website/docs/d/ami_ids.html.markdown index 6721321473e4..39609196c378 100644 --- a/website/docs/d/ami_ids.html.markdown +++ b/website/docs/d/ami_ids.html.markdown @@ -12,7 +12,7 @@ Use this data source to get a list of AMI IDs matching the specified criteria. ## Example Usage -```hcl +```terraform data "aws_ami_ids" "ubuntu" { owners = ["099720109477"] diff --git a/website/docs/d/api_gateway_api_key.html.markdown b/website/docs/d/api_gateway_api_key.html.markdown index b4a737ca23ac..fe53bbe33718 100644 --- a/website/docs/d/api_gateway_api_key.html.markdown +++ b/website/docs/d/api_gateway_api_key.html.markdown @@ -13,7 +13,7 @@ example to supply credentials for a dependency microservice. ## Example Usage -```hcl +```terraform data "aws_api_gateway_api_key" "my_api_key" { id = "ru3mpjgse6" } diff --git a/website/docs/d/api_gateway_domain_name.html.markdown b/website/docs/d/api_gateway_domain_name.html.markdown index 0530a87c3aea..73c6f919509e 100644 --- a/website/docs/d/api_gateway_domain_name.html.markdown +++ b/website/docs/d/api_gateway_domain_name.html.markdown @@ -12,7 +12,7 @@ Use this data source to get the custom domain name for use with AWS API Gateway. ## Example Usage -```hcl +```terraform data "aws_api_gateway_domain_name" "example" { domain_name = "api.example.com" } diff --git a/website/docs/d/api_gateway_resource.html.markdown b/website/docs/d/api_gateway_resource.html.markdown index c2cd51eaa538..7d77e7268620 100644 --- a/website/docs/d/api_gateway_resource.html.markdown +++ b/website/docs/d/api_gateway_resource.html.markdown @@ -13,7 +13,7 @@ To fetch the Resource, you must provide the REST API id as well as the full path ## Example Usage -```hcl +```terraform data "aws_api_gateway_rest_api" "my_rest_api" { name = "my-rest-api" } diff --git a/website/docs/d/api_gateway_rest_api.html.markdown b/website/docs/d/api_gateway_rest_api.html.markdown index 1ad21fb09218..327038f45c57 100644 --- a/website/docs/d/api_gateway_rest_api.html.markdown +++ b/website/docs/d/api_gateway_rest_api.html.markdown @@ -15,7 +15,7 @@ error if there is more than one match. ## Example Usage -```hcl +```terraform data "aws_api_gateway_rest_api" "my_rest_api" { name = "my-rest-api" } diff --git a/website/docs/d/api_gateway_vpc_link.html.markdown b/website/docs/d/api_gateway_vpc_link.html.markdown index 822c0084cc5c..176622fef9ac 100644 --- a/website/docs/d/api_gateway_vpc_link.html.markdown +++ b/website/docs/d/api_gateway_vpc_link.html.markdown @@ -15,7 +15,7 @@ error if there is more than one match. ## Example Usage -```hcl +```terraform data "aws_api_gateway_vpc_link" "my_api_gateway_vpc_link" { name = "my-vpc-link" } diff --git a/website/docs/d/apigatewayv2_api.html.markdown b/website/docs/d/apigatewayv2_api.html.markdown index 7818255388cf..33ed77d7057b 100644 --- a/website/docs/d/apigatewayv2_api.html.markdown +++ b/website/docs/d/apigatewayv2_api.html.markdown @@ -12,7 +12,7 @@ Provides details about a specific Amazon API Gateway Version 2 API. ## Example Usage -```hcl +```terraform data "aws_apigatewayv2_api" "example" { api_id = "aabbccddee" } diff --git a/website/docs/d/apigatewayv2_apis.html.markdown b/website/docs/d/apigatewayv2_apis.html.markdown index 0ca932312762..ca63ed38621f 100644 --- a/website/docs/d/apigatewayv2_apis.html.markdown +++ b/website/docs/d/apigatewayv2_apis.html.markdown @@ -12,7 +12,7 @@ Provides details about multiple Amazon API Gateway Version 2 APIs. ## Example Usage -```hcl +```terraform data "aws_apigatewayv2_apis" "example" { protocol_type = "HTTP" } diff --git a/website/docs/d/arn.html.markdown b/website/docs/d/arn.html.markdown index 5c65d38c8eef..9f0eb646646f 100644 --- a/website/docs/d/arn.html.markdown +++ b/website/docs/d/arn.html.markdown @@ -12,7 +12,7 @@ Parses an Amazon Resource Name (ARN) into its constituent parts. ## Example Usage -```hcl +```terraform data "aws_arn" "db_instance" { arn = "arn:aws:rds:eu-west-1:123456789012:db:mysql-db" } diff --git a/website/docs/d/autoscaling_group.html.markdown b/website/docs/d/autoscaling_group.html.markdown index 5a73164fef0d..dacafe63e713 100644 --- a/website/docs/d/autoscaling_group.html.markdown +++ b/website/docs/d/autoscaling_group.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information on an existing autoscaling group. ## Example Usage -```hcl +```terraform data "aws_autoscaling_group" "foo" { name = "foo" } diff --git a/website/docs/d/autoscaling_groups.html.markdown b/website/docs/d/autoscaling_groups.html.markdown index bf88ea9987f9..d5591d1c8a53 100644 --- a/website/docs/d/autoscaling_groups.html.markdown +++ b/website/docs/d/autoscaling_groups.html.markdown @@ -13,7 +13,7 @@ ASGs within a specific region. This will allow you to pass a list of AutoScaling ## Example Usage -```hcl +```terraform data "aws_autoscaling_groups" "groups" { filter { name = "key" diff --git a/website/docs/d/availability_zone.html.markdown b/website/docs/d/availability_zone.html.markdown index 58b160b10749..0d3c62e41d9f 100644 --- a/website/docs/d/availability_zone.html.markdown +++ b/website/docs/d/availability_zone.html.markdown @@ -25,7 +25,7 @@ which provides a list of the available zones. The following example shows how this data source might be used to derive VPC and subnet CIDR prefixes systematically for an availability zone. -```hcl +```terraform variable "region_number" { # Arbitrary mapping of region name to number to use in # a VPC's CIDR prefix. diff --git a/website/docs/d/availability_zones.html.markdown b/website/docs/d/availability_zones.html.markdown index 98c64bf9d82d..3453115952d8 100644 --- a/website/docs/d/availability_zones.html.markdown +++ b/website/docs/d/availability_zones.html.markdown @@ -21,7 +21,7 @@ which provides some details about a specific availability zone. ### By State -```hcl +```terraform # Declare the data source data "aws_availability_zones" "available" { state = "available" @@ -46,7 +46,7 @@ resource "aws_subnet" "secondary" { All Local Zones (regardless of opt-in status): -```hcl +```terraform data "aws_availability_zones" "example" { all_availability_zones = true diff --git a/website/docs/d/backup_plan.html.markdown b/website/docs/d/backup_plan.html.markdown index 636a84eb0cc1..59940e4e2aa7 100644 --- a/website/docs/d/backup_plan.html.markdown +++ b/website/docs/d/backup_plan.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information on an existing backup plan. ## Example Usage -```hcl +```terraform data "aws_backup_plan" "example" { plan_id = "tf_example_backup_plan_id" } diff --git a/website/docs/d/backup_selection.html.markdown b/website/docs/d/backup_selection.html.markdown index cf5e36397d97..53631ecb43d1 100644 --- a/website/docs/d/backup_selection.html.markdown +++ b/website/docs/d/backup_selection.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information on an existing backup selection. ## Example Usage -```hcl +```terraform data "aws_backup_selection" "example" { plan_id = data.aws_backup_plan.example.id selection_id = "selection-id-example" diff --git a/website/docs/d/backup_vault.html.markdown b/website/docs/d/backup_vault.html.markdown index 37eafcc0b785..51d974ea5ce0 100644 --- a/website/docs/d/backup_vault.html.markdown +++ b/website/docs/d/backup_vault.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information on an existing backup vault. ## Example Usage -```hcl +```terraform data "aws_backup_vault" "example" { name = "example_backup_vault" } diff --git a/website/docs/d/batch_compute_environment.html.markdown b/website/docs/d/batch_compute_environment.html.markdown index 05bc3cc07d92..b4c7cd60372e 100644 --- a/website/docs/d/batch_compute_environment.html.markdown +++ b/website/docs/d/batch_compute_environment.html.markdown @@ -13,7 +13,7 @@ compute environment within AWS Batch. ## Example Usage -```hcl +```terraform data "aws_batch_compute_environment" "batch-mongo" { compute_environment_name = "batch-mongo-production" } diff --git a/website/docs/d/batch_job_queue.html.markdown b/website/docs/d/batch_job_queue.html.markdown index 3ad13c12883b..5c6a44df99af 100644 --- a/website/docs/d/batch_job_queue.html.markdown +++ b/website/docs/d/batch_job_queue.html.markdown @@ -13,7 +13,7 @@ job queue within AWS Batch. ## Example Usage -```hcl +```terraform data "aws_batch_job_queue" "test-queue" { name = "tf-test-batch-job-queue" } diff --git a/website/docs/d/billing_service_account.html.markdown b/website/docs/d/billing_service_account.html.markdown index 5680f0c9ace8..ca0ea5b979d8 100644 --- a/website/docs/d/billing_service_account.html.markdown +++ b/website/docs/d/billing_service_account.html.markdown @@ -12,7 +12,7 @@ Use this data source to get the Account ID of the [AWS Billing and Cost Manageme ## Example Usage -```hcl +```terraform data "aws_billing_service_account" "main" {} resource "aws_s3_bucket" "billing_logs" { diff --git a/website/docs/d/caller_identity.html.markdown b/website/docs/d/caller_identity.html.markdown index 2507ead90c18..d349ef137ef2 100644 --- a/website/docs/d/caller_identity.html.markdown +++ b/website/docs/d/caller_identity.html.markdown @@ -14,7 +14,7 @@ which Terraform is authorized. ## Example Usage -```hcl +```terraform data "aws_caller_identity" "current" {} output "account_id" { diff --git a/website/docs/d/canonical_user_id.html.markdown b/website/docs/d/canonical_user_id.html.markdown index 6bb82140cb2a..683d7f048d7a 100644 --- a/website/docs/d/canonical_user_id.html.markdown +++ b/website/docs/d/canonical_user_id.html.markdown @@ -14,7 +14,7 @@ for the effective account in which Terraform is working. ## Example Usage -```hcl +```terraform data "aws_canonical_user_id" "current" {} output "canonical_user_id" { diff --git a/website/docs/d/cloudformation_export.html.markdown b/website/docs/d/cloudformation_export.html.markdown index 18e13622f47a..53734939d8f9 100644 --- a/website/docs/d/cloudformation_export.html.markdown +++ b/website/docs/d/cloudformation_export.html.markdown @@ -15,7 +15,7 @@ exports specified in the [Output](http://docs.aws.amazon.com/AWSCloudFormation/l ## Example Usage -```hcl +```terraform data "aws_cloudformation_export" "subnet_id" { name = "mySubnetIdExportName" } diff --git a/website/docs/d/cloudformation_stack.html.markdown b/website/docs/d/cloudformation_stack.html.markdown index 5e4290015488..2afa17a69a8f 100644 --- a/website/docs/d/cloudformation_stack.html.markdown +++ b/website/docs/d/cloudformation_stack.html.markdown @@ -13,7 +13,7 @@ outputs and other useful data including the template body. ## Example Usage -```hcl +```terraform data "aws_cloudformation_stack" "network" { name = "my-network-stack" } diff --git a/website/docs/d/cloudfront_cache_policy.html.markdown b/website/docs/d/cloudfront_cache_policy.html.markdown index 007bf54878fd..cbbc79f3f868 100644 --- a/website/docs/d/cloudfront_cache_policy.html.markdown +++ b/website/docs/d/cloudfront_cache_policy.html.markdown @@ -12,7 +12,7 @@ description: |- The following example below creates a CloudFront cache policy. -```hcl +```terraform data "aws_cloudfront_cache_policy" "example" { name = "example-policy" } diff --git a/website/docs/d/cloudfront_distribution.html.markdown b/website/docs/d/cloudfront_distribution.html.markdown index d7cde052318f..e8472cc9811a 100644 --- a/website/docs/d/cloudfront_distribution.html.markdown +++ b/website/docs/d/cloudfront_distribution.html.markdown @@ -12,7 +12,7 @@ Use this data source to retrieve information about a CloudFront distribution. ## Example Usage -```hcl +```terraform data "aws_cloudfront_distribution" "test" { id = "EDFDVBD632BHDS5" } diff --git a/website/docs/d/cloudfront_origin_request_policy.html.markdown b/website/docs/d/cloudfront_origin_request_policy.html.markdown index 4e25a4ea5a1a..576bb6bf6c0d 100644 --- a/website/docs/d/cloudfront_origin_request_policy.html.markdown +++ b/website/docs/d/cloudfront_origin_request_policy.html.markdown @@ -12,7 +12,7 @@ description: |- The following example below creates a CloudFront origin request policy. -```hcl +```terraform data "aws_cloudfront_origin_request_policy" "example" { name = "example-policy" } diff --git a/website/docs/d/cloudhsm_v2_cluster.html.markdown b/website/docs/d/cloudhsm_v2_cluster.html.markdown index dd5ea96b69f6..89760b959d81 100644 --- a/website/docs/d/cloudhsm_v2_cluster.html.markdown +++ b/website/docs/d/cloudhsm_v2_cluster.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information about a CloudHSM v2 cluster ## Example Usage -```hcl +```terraform data "aws_cloudhsm_v2_cluster" "cluster" { cluster_id = "cluster-testclusterid" } diff --git a/website/docs/d/cloudtrail_service_account.html.markdown b/website/docs/d/cloudtrail_service_account.html.markdown index 163b7f44006e..19a5b57587e6 100644 --- a/website/docs/d/cloudtrail_service_account.html.markdown +++ b/website/docs/d/cloudtrail_service_account.html.markdown @@ -13,7 +13,7 @@ in a given region for the purpose of allowing CloudTrail to store trail data in ## Example Usage -```hcl +```terraform data "aws_cloudtrail_service_account" "main" {} resource "aws_s3_bucket" "bucket" { diff --git a/website/docs/d/cloudwatch_log_group.html.markdown b/website/docs/d/cloudwatch_log_group.html.markdown index ddfafb760441..9d5e4d00f753 100644 --- a/website/docs/d/cloudwatch_log_group.html.markdown +++ b/website/docs/d/cloudwatch_log_group.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information about an AWS Cloudwatch Log Group ## Example Usage -```hcl +```terraform data "aws_cloudwatch_log_group" "example" { name = "MyImportantLogs" } diff --git a/website/docs/d/codeartifact_authorization_token.html.markdown b/website/docs/d/codeartifact_authorization_token.html.markdown index e19e7e76852c..47f481307cd5 100644 --- a/website/docs/d/codeartifact_authorization_token.html.markdown +++ b/website/docs/d/codeartifact_authorization_token.html.markdown @@ -12,7 +12,7 @@ The CodeArtifact Authorization Token data source generates a temporary authentic ## Example Usage -```hcl +```terraform data "aws_codeartifact_authorization_token" "test" { domain = aws_codeartifact_domain.test.domain } diff --git a/website/docs/d/codeartifact_repository_endpoint.html.markdown b/website/docs/d/codeartifact_repository_endpoint.html.markdown index 19f90135004c..fc34d9cd076e 100644 --- a/website/docs/d/codeartifact_repository_endpoint.html.markdown +++ b/website/docs/d/codeartifact_repository_endpoint.html.markdown @@ -12,7 +12,7 @@ The CodeArtifact Repository Endpoint data source returns the endpoint of a repos ## Example Usage -```hcl +```terraform data "aws_codeartifact_repository_endpoint" "test" { domain = aws_codeartifact_domain.test.domain repository = aws_codeartifact_repository.test.repository diff --git a/website/docs/d/codecommit_repository.html.markdown b/website/docs/d/codecommit_repository.html.markdown index 783af21f8bd3..e8bd0614f5e5 100644 --- a/website/docs/d/codecommit_repository.html.markdown +++ b/website/docs/d/codecommit_repository.html.markdown @@ -12,7 +12,7 @@ The CodeCommit Repository data source allows the ARN, Repository ID, Repository ## Example Usage -```hcl +```terraform data "aws_codecommit_repository" "test" { repository_name = "MyTestRepository" } diff --git a/website/docs/d/codestarconnections_connection.html.markdown b/website/docs/d/codestarconnections_connection.html.markdown new file mode 100644 index 000000000000..acfc225d04b5 --- /dev/null +++ b/website/docs/d/codestarconnections_connection.html.markdown @@ -0,0 +1,35 @@ +--- +subcategory: "CodeStar Connections" +layout: "aws" +page_title: "AWS: aws_codestarconnections_connection" +description: |- + Provides details about CodeStar Connection +--- + +# Data Source: aws_codestarconnections_connection + +Provides details about CodeStar Connection. + +## Example Usage + +```terraform +data "aws_codestarconnections_connection" "example" { + arn = aws_codestarconnections_connection.example.arn +} +``` + +## Argument Reference + +The following arguments are supported: + +* `arn` - (Required) The CodeStar Connection ARN. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `connection_status` - The CodeStar Connection status. Possible values are `PENDING`, `AVAILABLE` and `ERROR`. +* `id` - The CodeStar Connection ARN. +* `name` - The name of the CodeStar Connection. The name is unique in the calling AWS account. +* `provider_type` - The name of the external provider where your third-party code repository is configured. Possible values are `Bitbucket`, `GitHub`, or `GitHubEnterpriseServer`. +* `tags` - Map of key-value resource tags to associate with the resource. diff --git a/website/docs/d/cognito_user_pools.markdown b/website/docs/d/cognito_user_pools.markdown index ee325efbabb3..fae711548075 100644 --- a/website/docs/d/cognito_user_pools.markdown +++ b/website/docs/d/cognito_user_pools.markdown @@ -12,7 +12,7 @@ Use this data source to get a list of cognito user pools. ## Example Usage -```hcl +```terraform data "aws_api_gateway_rest_api" "selected" { name = var.api_gateway_name } diff --git a/website/docs/d/cur_report_definition.html.markdown b/website/docs/d/cur_report_definition.html.markdown index 5fb104db1663..721b7bfce70d 100644 --- a/website/docs/d/cur_report_definition.html.markdown +++ b/website/docs/d/cur_report_definition.html.markdown @@ -16,7 +16,7 @@ Use this data source to get information on an AWS Cost and Usage Report Definiti ## Example Usage -```hcl +```terraform data "aws_cur_report_definition" "report_definition" { report_name = "example" } diff --git a/website/docs/d/customer_gateway.html.markdown b/website/docs/d/customer_gateway.html.markdown index 5b7cc5c08f54..66dd18c05705 100644 --- a/website/docs/d/customer_gateway.html.markdown +++ b/website/docs/d/customer_gateway.html.markdown @@ -12,7 +12,7 @@ Get an existing AWS Customer Gateway. ## Example Usage -```hcl +```terraform data "aws_customer_gateway" "foo" { filter { name = "tag:Name" diff --git a/website/docs/d/db_cluster_snapshot.html.markdown b/website/docs/d/db_cluster_snapshot.html.markdown index c7138d3b062f..b5c036508ae4 100644 --- a/website/docs/d/db_cluster_snapshot.html.markdown +++ b/website/docs/d/db_cluster_snapshot.html.markdown @@ -15,7 +15,7 @@ See the [`aws_db_snapshot` data source](/docs/providers/aws/d/db_snapshot.html) ## Example Usage -```hcl +```terraform data "aws_db_cluster_snapshot" "development_final_snapshot" { db_cluster_identifier = "development_cluster" most_recent = true diff --git a/website/docs/d/db_event_categories.html.markdown b/website/docs/d/db_event_categories.html.markdown index c3abe0fe671d..b31c7863863a 100644 --- a/website/docs/d/db_event_categories.html.markdown +++ b/website/docs/d/db_event_categories.html.markdown @@ -12,7 +12,7 @@ description: |- List the event categories of all the RDS resources. -```hcl +```terraform data "aws_db_event_categories" "example" {} output "example" { @@ -22,7 +22,7 @@ output "example" { List the event categories specific to the RDS resource `db-snapshot`. -```hcl +```terraform data "aws_db_event_categories" "example" { source_type = "db-snapshot" } diff --git a/website/docs/d/db_instance.html.markdown b/website/docs/d/db_instance.html.markdown index e2bc7b42dbad..3afcbe1ef91e 100644 --- a/website/docs/d/db_instance.html.markdown +++ b/website/docs/d/db_instance.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information about an RDS instance ## Example Usage -```hcl +```terraform data "aws_db_instance" "database" { db_instance_identifier = "my-test-database" } diff --git a/website/docs/d/db_snapshot.html.markdown b/website/docs/d/db_snapshot.html.markdown index cecda33f7acc..7e2e99dc27a3 100644 --- a/website/docs/d/db_snapshot.html.markdown +++ b/website/docs/d/db_snapshot.html.markdown @@ -15,7 +15,7 @@ See the [`aws_db_cluster_snapshot` data source](/docs/providers/aws/d/db_cluster ## Example Usage -```hcl +```terraform resource "aws_db_instance" "prod" { allocated_storage = 10 engine = "mysql" diff --git a/website/docs/d/db_subnet_group.html.markdown b/website/docs/d/db_subnet_group.html.markdown index b41cbaabb379..f2a956b658aa 100644 --- a/website/docs/d/db_subnet_group.html.markdown +++ b/website/docs/d/db_subnet_group.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information about an RDS subnet group. ## Example Usage -```hcl +```terraform data "aws_db_subnet_group" "database" { name = "my-test-database-subnet-group" } diff --git a/website/docs/d/directory_service_directory.html.markdown b/website/docs/d/directory_service_directory.html.markdown index e960f57f22d0..93ca929f94a1 100644 --- a/website/docs/d/directory_service_directory.html.markdown +++ b/website/docs/d/directory_service_directory.html.markdown @@ -12,7 +12,7 @@ Get attributes of AWS Directory Service directory (SimpleAD, Managed AD, AD Conn ## Example Usage -```hcl +```terraform data "aws_directory_service_directory" "example" { directory_id = aws_directory_service_directory.main.id } diff --git a/website/docs/d/docdb_engine_version.markdown b/website/docs/d/docdb_engine_version.markdown index dd62749f29f1..d81abdad7e0b 100644 --- a/website/docs/d/docdb_engine_version.markdown +++ b/website/docs/d/docdb_engine_version.markdown @@ -12,7 +12,7 @@ Information about a DocumentDB engine version. ## Example Usage -```hcl +```terraform data "aws_docdb_engine_version" "test" { version = "3.6.0" } diff --git a/website/docs/d/docdb_orderable_db_instance.markdown b/website/docs/d/docdb_orderable_db_instance.markdown index ce33cfc56734..bceba226f92c 100644 --- a/website/docs/d/docdb_orderable_db_instance.markdown +++ b/website/docs/d/docdb_orderable_db_instance.markdown @@ -12,7 +12,7 @@ Information about DocumentDB orderable DB instances. ## Example Usage -```hcl +```terraform data "aws_docdb_orderable_db_instance" "test" { engine = "docdb" engine_version = "3.6.0" diff --git a/website/docs/d/dx_gateway.html.markdown b/website/docs/d/dx_gateway.html.markdown index f6bb7eff9fe3..5f05db675982 100644 --- a/website/docs/d/dx_gateway.html.markdown +++ b/website/docs/d/dx_gateway.html.markdown @@ -12,7 +12,7 @@ Retrieve information about a Direct Connect Gateway. ## Example Usage -```hcl +```terraform data "aws_dx_gateway" "example" { name = "example" } diff --git a/website/docs/d/dynamodb_table.html.markdown b/website/docs/d/dynamodb_table.html.markdown index b79d147d22d4..81e8821496c1 100644 --- a/website/docs/d/dynamodb_table.html.markdown +++ b/website/docs/d/dynamodb_table.html.markdown @@ -12,7 +12,7 @@ Provides information about a DynamoDB table. ## Example Usage -```hcl +```terraform data "aws_dynamodb_table" "tableName" { name = "tableName" } diff --git a/website/docs/d/ebs_default_kms_key.html.markdown b/website/docs/d/ebs_default_kms_key.html.markdown index ad882d8104f8..6b55f389e7cc 100644 --- a/website/docs/d/ebs_default_kms_key.html.markdown +++ b/website/docs/d/ebs_default_kms_key.html.markdown @@ -12,7 +12,7 @@ Use this data source to get the default EBS encryption KMS key in the current re ## Example Usage -```hcl +```terraform data "aws_ebs_default_kms_key" "current" {} resource "aws_ebs_volume" "example" { diff --git a/website/docs/d/ebs_encryption_by_default.html.markdown b/website/docs/d/ebs_encryption_by_default.html.markdown index 433ea86eeea9..f83b16032314 100644 --- a/website/docs/d/ebs_encryption_by_default.html.markdown +++ b/website/docs/d/ebs_encryption_by_default.html.markdown @@ -12,7 +12,7 @@ Provides a way to check whether default EBS encryption is enabled for your AWS a ## Example Usage -```hcl +```terraform data "aws_ebs_encryption_by_default" "current" {} ``` diff --git a/website/docs/d/ebs_snapshot.html.markdown b/website/docs/d/ebs_snapshot.html.markdown index f0a7ea1c1107..b139275062f3 100644 --- a/website/docs/d/ebs_snapshot.html.markdown +++ b/website/docs/d/ebs_snapshot.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information about an EBS Snapshot for use when provi ## Example Usage -```hcl +```terraform data "aws_ebs_snapshot" "ebs_volume" { most_recent = true owners = ["self"] diff --git a/website/docs/d/ebs_snapshot_ids.html.markdown b/website/docs/d/ebs_snapshot_ids.html.markdown index f5bcf0e48f6b..c758c05160af 100644 --- a/website/docs/d/ebs_snapshot_ids.html.markdown +++ b/website/docs/d/ebs_snapshot_ids.html.markdown @@ -13,7 +13,7 @@ criteria. ## Example Usage -```hcl +```terraform data "aws_ebs_snapshot_ids" "ebs_volumes" { owners = ["self"] diff --git a/website/docs/d/ebs_volume.html.markdown b/website/docs/d/ebs_volume.html.markdown index a3d74495dc7d..3f094d448b07 100644 --- a/website/docs/d/ebs_volume.html.markdown +++ b/website/docs/d/ebs_volume.html.markdown @@ -13,7 +13,7 @@ resources. ## Example Usage -```hcl +```terraform data "aws_ebs_volume" "ebs_volume" { most_recent = true diff --git a/website/docs/d/ebs_volumes.html.markdown b/website/docs/d/ebs_volumes.html.markdown index 65e6d8f6136d..60bc178a6058 100644 --- a/website/docs/d/ebs_volumes.html.markdown +++ b/website/docs/d/ebs_volumes.html.markdown @@ -16,7 +16,7 @@ This data source can be useful for getting a list of volume IDs with (for exampl The following demonstrates obtaining a map of availability zone to EBS volume ID for volumes with a given tag value. -```hcl +```terraform data "aws_ebs_volumes" "example" { tags = { VolumeSet = "TestVolumeSet" @@ -50,7 +50,7 @@ which take the following arguments: [the underlying AWS API](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVolumes.html). For example, if matching against the `size` filter, use: -```hcl +```terraform data "aws_ebs_volumes" "ten_or_twenty_gb_volumes" { filter { name = "size" diff --git a/website/docs/d/ec2_coip_pool.html.markdown b/website/docs/d/ec2_coip_pool.html.markdown index 0114b780009f..ed5bcb6d977a 100644 --- a/website/docs/d/ec2_coip_pool.html.markdown +++ b/website/docs/d/ec2_coip_pool.html.markdown @@ -18,7 +18,7 @@ COIP Pool. The following example returns a specific coip pool ID -```hcl +```terraform variable "coip_pool_id" {} data "aws_ec2_coip_pool" "selected" { diff --git a/website/docs/d/ec2_coip_pools.html.markdown b/website/docs/d/ec2_coip_pools.html.markdown index 1a0f24d3c5ef..723e30d2519f 100644 --- a/website/docs/d/ec2_coip_pools.html.markdown +++ b/website/docs/d/ec2_coip_pools.html.markdown @@ -14,7 +14,7 @@ Provides information for multiple EC2 Customer-Owned IP Pools, such as their ide The following shows outputing all COIP Pool Ids. -```hcl +```terraform data "aws_ec2_coip_pools" "foo" {} output "foo" { diff --git a/website/docs/d/ec2_instance_type.html.markdown b/website/docs/d/ec2_instance_type.html.markdown index 7ec4a7a3bbfc..c76665a69e3a 100644 --- a/website/docs/d/ec2_instance_type.html.markdown +++ b/website/docs/d/ec2_instance_type.html.markdown @@ -13,7 +13,7 @@ Get characteristics for a single EC2 Instance Type. ## Example Usage -```hcl +```terraform data "aws_ec2_instance_type" "example" { instance_type = "t2.micro" } diff --git a/website/docs/d/ec2_instance_type_offering.html.markdown b/website/docs/d/ec2_instance_type_offering.html.markdown index 56b52924be69..c6839964aeb6 100644 --- a/website/docs/d/ec2_instance_type_offering.html.markdown +++ b/website/docs/d/ec2_instance_type_offering.html.markdown @@ -12,7 +12,7 @@ Information about single EC2 Instance Type Offering. ## Example Usage -```hcl +```terraform data "aws_ec2_instance_type_offering" "example" { filter { name = "instance-type" diff --git a/website/docs/d/ec2_instance_type_offerings.html.markdown b/website/docs/d/ec2_instance_type_offerings.html.markdown index ef8f5f7c13b2..e65360ae0773 100644 --- a/website/docs/d/ec2_instance_type_offerings.html.markdown +++ b/website/docs/d/ec2_instance_type_offerings.html.markdown @@ -12,7 +12,7 @@ Information about EC2 Instance Type Offerings. ## Example Usage -```hcl +```terraform data "aws_ec2_instance_type_offerings" "example" { filter { name = "instance-type" diff --git a/website/docs/d/ec2_local_gateway.html.markdown b/website/docs/d/ec2_local_gateway.html.markdown index ba1347cb3bd1..d4e4afa5ef93 100644 --- a/website/docs/d/ec2_local_gateway.html.markdown +++ b/website/docs/d/ec2_local_gateway.html.markdown @@ -14,7 +14,7 @@ Provides details about an EC2 Local Gateway. The following example shows how one might accept a local gateway id as a variable. -```hcl +```terraform variable "local_gateway_id" {} data "aws_ec2_local_gateway" "selected" { diff --git a/website/docs/d/ec2_local_gateway_route_table.html.markdown b/website/docs/d/ec2_local_gateway_route_table.html.markdown index a884015773ea..5e07470ca785 100644 --- a/website/docs/d/ec2_local_gateway_route_table.html.markdown +++ b/website/docs/d/ec2_local_gateway_route_table.html.markdown @@ -17,7 +17,7 @@ an input variable and needs to, for example, find the associated Outpost or Loca The following example returns a specific local gateway route table ID -```hcl +```terraform variable "aws_ec2_local_gateway_route_table" {} data "aws_ec2_local_gateway_route_table" "selected" { diff --git a/website/docs/d/ec2_local_gateway_route_tables.html.markdown b/website/docs/d/ec2_local_gateway_route_tables.html.markdown index 7df320c3918f..37fefa8d4ec7 100644 --- a/website/docs/d/ec2_local_gateway_route_tables.html.markdown +++ b/website/docs/d/ec2_local_gateway_route_tables.html.markdown @@ -14,7 +14,7 @@ Provides information for multiple EC2 Local Gateway Route Tables, such as their The following shows outputing all Local Gateway Route Table Ids. -```hcl +```terraform data "aws_ec2_local_gateway_route_table" "foo" {} output "foo" { diff --git a/website/docs/d/ec2_local_gateway_virtual_interface.html.markdown b/website/docs/d/ec2_local_gateway_virtual_interface.html.markdown index 2a9edab07390..091419ad841a 100644 --- a/website/docs/d/ec2_local_gateway_virtual_interface.html.markdown +++ b/website/docs/d/ec2_local_gateway_virtual_interface.html.markdown @@ -12,7 +12,7 @@ Provides details about an EC2 Local Gateway Virtual Interface. More information ## Example Usage -```hcl +```terraform data "aws_ec2_local_gateway_virtual_interface" "example" { for_each = data.aws_ec2_local_gateway_virtual_interface_group.example.local_gateway_virtual_interface_ids diff --git a/website/docs/d/ec2_local_gateway_virtual_interface_group.html.markdown b/website/docs/d/ec2_local_gateway_virtual_interface_group.html.markdown index 4616ea320de5..ae713865a8b7 100644 --- a/website/docs/d/ec2_local_gateway_virtual_interface_group.html.markdown +++ b/website/docs/d/ec2_local_gateway_virtual_interface_group.html.markdown @@ -12,7 +12,7 @@ Provides details about an EC2 Local Gateway Virtual Interface Group. More inform ## Example Usage -```hcl +```terraform data "aws_ec2_local_gateway_virtual_interface_group" "example" { local_gateway_id = data.aws_ec2_local_gateway.example.id } diff --git a/website/docs/d/ec2_local_gateway_virtual_interface_groups.html.markdown b/website/docs/d/ec2_local_gateway_virtual_interface_groups.html.markdown index 9dfe7df2473b..1b43af65b7ee 100644 --- a/website/docs/d/ec2_local_gateway_virtual_interface_groups.html.markdown +++ b/website/docs/d/ec2_local_gateway_virtual_interface_groups.html.markdown @@ -12,7 +12,7 @@ Provides details about multiple EC2 Local Gateway Virtual Interface Groups, such ## Example Usage -```hcl +```terraform data "aws_ec2_local_gateway_virtual_interface_groups" "all" {} ``` diff --git a/website/docs/d/ec2_local_gateways.html.markdown b/website/docs/d/ec2_local_gateways.html.markdown index 194d832c36b6..11ad1b34831c 100644 --- a/website/docs/d/ec2_local_gateways.html.markdown +++ b/website/docs/d/ec2_local_gateways.html.markdown @@ -14,7 +14,7 @@ Provides information for multiple EC2 Local Gateways, such as their identifiers. The following example retrieves Local Gateways with a resource tag of `service` set to `production`. -```hcl +```terraform data "aws_ec2_local_gateways" "foo" { tags = { service = "production" diff --git a/website/docs/d/ec2_managed_prefix_list.html.markdown b/website/docs/d/ec2_managed_prefix_list.html.markdown index 63986d99d477..edce53c44018 100644 --- a/website/docs/d/ec2_managed_prefix_list.html.markdown +++ b/website/docs/d/ec2_managed_prefix_list.html.markdown @@ -15,7 +15,7 @@ customer-managed prefix list in the current region. ### Find the regional DynamoDB prefix list -```hcl +```terraform data "aws_region" "current" {} data "aws_ec2_managed_prefix_list" "example" { @@ -25,7 +25,7 @@ data "aws_ec2_managed_prefix_list" "example" { ### Find a managed prefix list using filters -```hcl +```terraform data "aws_ec2_managed_prefix_list" "example" { filter { name = "prefix-list-name" diff --git a/website/docs/d/ec2_spot_price.html.markdown b/website/docs/d/ec2_spot_price.html.markdown index 95736419d7d1..c1701e74f635 100644 --- a/website/docs/d/ec2_spot_price.html.markdown +++ b/website/docs/d/ec2_spot_price.html.markdown @@ -12,7 +12,7 @@ Information about most recent Spot Price for a given EC2 instance. ## Example Usage -```hcl +```terraform data "aws_ec2_spot_price" "example" { instance_type = "t3.medium" availability_zone = "us-west-2a" diff --git a/website/docs/d/ec2_transit_gateway.html.markdown b/website/docs/d/ec2_transit_gateway.html.markdown index 96ce4a5e4094..72b19e5bdcea 100644 --- a/website/docs/d/ec2_transit_gateway.html.markdown +++ b/website/docs/d/ec2_transit_gateway.html.markdown @@ -14,7 +14,7 @@ Get information on an EC2 Transit Gateway. ### By Filter -```hcl +```terraform data "aws_ec2_transit_gateway" "example" { filter { name = "options.amazon-side-asn" @@ -25,7 +25,7 @@ data "aws_ec2_transit_gateway" "example" { ### By Identifier -```hcl +```terraform data "aws_ec2_transit_gateway" "example" { id = "tgw-12345678" } diff --git a/website/docs/d/ec2_transit_gateway_dx_gateway_attachment.html.markdown b/website/docs/d/ec2_transit_gateway_dx_gateway_attachment.html.markdown index ffa6c6d18b8b..9a0b4fd6a55f 100644 --- a/website/docs/d/ec2_transit_gateway_dx_gateway_attachment.html.markdown +++ b/website/docs/d/ec2_transit_gateway_dx_gateway_attachment.html.markdown @@ -14,7 +14,7 @@ Get information on an EC2 Transit Gateway's attachment to a Direct Connect Gatew ### By Transit Gateway and Direct Connect Gateway Identifiers -```hcl +```terraform data "aws_ec2_transit_gateway_dx_gateway_attachment" "example" { transit_gateway_id = aws_ec2_transit_gateway.example.id dx_gateway_id = aws_dx_gateway.example.id diff --git a/website/docs/d/ec2_transit_gateway_peering_attachment.html.markdown b/website/docs/d/ec2_transit_gateway_peering_attachment.html.markdown index 729d3214f574..8be0a80961f9 100644 --- a/website/docs/d/ec2_transit_gateway_peering_attachment.html.markdown +++ b/website/docs/d/ec2_transit_gateway_peering_attachment.html.markdown @@ -14,7 +14,7 @@ Get information on an EC2 Transit Gateway Peering Attachment. ### By Filter -```hcl +```terraform data "aws_ec2_transit_gateway_peering_attachment" "example" { filter { name = "transit-gateway-attachment-id" @@ -25,7 +25,7 @@ data "aws_ec2_transit_gateway_peering_attachment" "example" { ### By Identifier -```hcl +```terraform data "aws_ec2_transit_gateway_peering_attachment" "attachment" { id = "tgw-attach-12345678" } diff --git a/website/docs/d/ec2_transit_gateway_route_table.html.markdown b/website/docs/d/ec2_transit_gateway_route_table.html.markdown index 4768deb0769e..5e069b514d54 100644 --- a/website/docs/d/ec2_transit_gateway_route_table.html.markdown +++ b/website/docs/d/ec2_transit_gateway_route_table.html.markdown @@ -14,7 +14,7 @@ Get information on an EC2 Transit Gateway Route Table. ### By Filter -```hcl +```terraform data "aws_ec2_transit_gateway_route_table" "example" { filter { name = "default-association-route-table" @@ -30,7 +30,7 @@ data "aws_ec2_transit_gateway_route_table" "example" { ### By Identifier -```hcl +```terraform data "aws_ec2_transit_gateway_route_table" "example" { id = "tgw-rtb-12345678" } diff --git a/website/docs/d/ec2_transit_gateway_route_tables.html.markdown b/website/docs/d/ec2_transit_gateway_route_tables.html.markdown new file mode 100644 index 000000000000..f81312f47eaf --- /dev/null +++ b/website/docs/d/ec2_transit_gateway_route_tables.html.markdown @@ -0,0 +1,48 @@ +--- +subcategory: "EC2" +layout: "aws" +page_title: "AWS: aws_ec2_transit_gateway_route_tables" +description: |- + Provides information for multiple EC2 Transit Gateway Route Tables +--- + +# Data Source: aws_ec2_transit_gateway_route_tables + +Provides information for multiple EC2 Transit Gateway Route Tables, such as their identifiers. + +## Example Usage + +The following shows outputing all Transit Gateway Route Table Ids. + +```terraform +data "aws_ec2_transit_gateway_route_tables" "example" {} + +output "example" { + value = data.aws_ec2_transit_gateway_route_table.example.ids +} +``` + +## Argument Reference + +The following arguments are supported: + +* `filter` - (Optional) Custom filter block as described below. + +* `tags` - (Optional) A mapping of tags, each pair of which must exactly match + a pair on the desired transit gateway route table. + +More complex filters can be expressed using one or more `filter` sub-blocks, +which take the following arguments: + +* `name` - (Required) The name of the field to filter by, as defined by + [the underlying AWS API](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeTransitGatewayRouteTables.html). + +* `values` - (Required) Set of values that are accepted for the given field. + A Transit Gateway Route Table will be selected if any one of the given values matches. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - AWS Region. +* `ids` - Set of Transit Gateway Route Table identifiers. diff --git a/website/docs/d/ec2_transit_gateway_vpc_attachment.html.markdown b/website/docs/d/ec2_transit_gateway_vpc_attachment.html.markdown index 914ed2a68d65..6c995f22fdf6 100644 --- a/website/docs/d/ec2_transit_gateway_vpc_attachment.html.markdown +++ b/website/docs/d/ec2_transit_gateway_vpc_attachment.html.markdown @@ -14,7 +14,7 @@ Get information on an EC2 Transit Gateway VPC Attachment. ### By Filter -```hcl +```terraform data "aws_ec2_transit_gateway_vpc_attachment" "example" { filter { name = "vpc-id" @@ -25,7 +25,7 @@ data "aws_ec2_transit_gateway_vpc_attachment" "example" { ### By Identifier -```hcl +```terraform data "aws_ec2_transit_gateway_vpc_attachment" "example" { id = "tgw-attach-12345678" } diff --git a/website/docs/d/ec2_transit_gateway_vpn_attachment.html.markdown b/website/docs/d/ec2_transit_gateway_vpn_attachment.html.markdown index 1400d72fbee7..404b719a1aa5 100644 --- a/website/docs/d/ec2_transit_gateway_vpn_attachment.html.markdown +++ b/website/docs/d/ec2_transit_gateway_vpn_attachment.html.markdown @@ -16,7 +16,7 @@ Get information on an EC2 Transit Gateway VPN Attachment. ### By Transit Gateway and VPN Connection Identifiers -```hcl +```terraform data "aws_ec2_transit_gateway_vpn_attachment" "example" { transit_gateway_id = aws_ec2_transit_gateway.example.id vpn_connection_id = aws_vpn_connection.example.id @@ -25,7 +25,7 @@ data "aws_ec2_transit_gateway_vpn_attachment" "example" { ### Filter -```hcl +```terraform data "aws_ec2_transit_gateway_vpn_attachment" "test" { filter { name = "resource-id" diff --git a/website/docs/d/ecr_authorization_token.html.markdown b/website/docs/d/ecr_authorization_token.html.markdown index 9a21db713e09..39805477be33 100644 --- a/website/docs/d/ecr_authorization_token.html.markdown +++ b/website/docs/d/ecr_authorization_token.html.markdown @@ -12,7 +12,7 @@ The ECR Authorization Token data source allows the authorization token, proxy en ## Example Usage -```hcl +```terraform data "aws_ecr_authorization_token" "token" { } ``` diff --git a/website/docs/d/ecr_image.html.markdown b/website/docs/d/ecr_image.html.markdown index d42f76ddd3c1..fba0d7f8c357 100644 --- a/website/docs/d/ecr_image.html.markdown +++ b/website/docs/d/ecr_image.html.markdown @@ -12,7 +12,7 @@ The ECR Image data source allows the details of an image with a particular tag o ## Example Usage -```hcl +```terraform data "aws_ecr_image" "service_image" { repository_name = "my/service" image_tag = "latest" diff --git a/website/docs/d/ecr_repository.html.markdown b/website/docs/d/ecr_repository.html.markdown index f58000af7257..33db11b4e556 100644 --- a/website/docs/d/ecr_repository.html.markdown +++ b/website/docs/d/ecr_repository.html.markdown @@ -12,7 +12,7 @@ The ECR Repository data source allows the ARN, Repository URI and Registry ID to ## Example Usage -```hcl +```terraform data "aws_ecr_repository" "service" { name = "ecr-repository" } diff --git a/website/docs/d/ecs_cluster.html.markdown b/website/docs/d/ecs_cluster.html.markdown index 87d13275e255..abed422dcb49 100644 --- a/website/docs/d/ecs_cluster.html.markdown +++ b/website/docs/d/ecs_cluster.html.markdown @@ -13,7 +13,7 @@ cluster within an AWS ECS service. ## Example Usage -```hcl +```terraform data "aws_ecs_cluster" "ecs-mongo" { cluster_name = "ecs-mongo-production" } diff --git a/website/docs/d/ecs_container_definition.html.markdown b/website/docs/d/ecs_container_definition.html.markdown index d67ed4cf7281..794626ecfdd2 100644 --- a/website/docs/d/ecs_container_definition.html.markdown +++ b/website/docs/d/ecs_container_definition.html.markdown @@ -13,7 +13,7 @@ a specific container within an AWS ECS service. ## Example Usage -```hcl +```terraform data "aws_ecs_container_definition" "ecs-mongo" { task_definition = aws_ecs_task_definition.mongo.id container_name = "mongodb" diff --git a/website/docs/d/ecs_service.html.markdown b/website/docs/d/ecs_service.html.markdown index 65c95a849132..e12115e7ad2f 100644 --- a/website/docs/d/ecs_service.html.markdown +++ b/website/docs/d/ecs_service.html.markdown @@ -13,7 +13,7 @@ Service within a AWS ECS Cluster. ## Example Usage -```hcl +```terraform data "aws_ecs_service" "example" { service_name = "example" cluster_arn = data.aws_ecs_cluster.example.arn diff --git a/website/docs/d/ecs_task_definition.html.markdown b/website/docs/d/ecs_task_definition.html.markdown index 8e7a93a48cbf..6ff3f5e263ff 100644 --- a/website/docs/d/ecs_task_definition.html.markdown +++ b/website/docs/d/ecs_task_definition.html.markdown @@ -14,7 +14,7 @@ a specific AWS ECS task definition. ## Example Usage -```hcl +```terraform # Simply specify the family to find the latest ACTIVE revision in that family. data "aws_ecs_task_definition" "mongo" { task_definition = aws_ecs_task_definition.mongo.family diff --git a/website/docs/d/efs_access_point.html.markdown b/website/docs/d/efs_access_point.html.markdown index ad83ad94d4e9..2a3d8e53f9cc 100644 --- a/website/docs/d/efs_access_point.html.markdown +++ b/website/docs/d/efs_access_point.html.markdown @@ -12,7 +12,7 @@ Provides information about an Elastic File System (EFS) Access Point. ## Example Usage -```hcl +```terraform data "aws_efs_access_point" "test" { access_point_id = "fsap-12345678" } diff --git a/website/docs/d/efs_access_points.html.markdown b/website/docs/d/efs_access_points.html.markdown index 3f8482e432d7..01d5855e1f9e 100644 --- a/website/docs/d/efs_access_points.html.markdown +++ b/website/docs/d/efs_access_points.html.markdown @@ -12,7 +12,7 @@ Provides information about multiple Elastic File System (EFS) Access Points. ## Example Usage -```hcl +```terraform data "aws_efs_access_points" "test" { file_system_id = "fs-12345678" } diff --git a/website/docs/d/efs_file_system.html.markdown b/website/docs/d/efs_file_system.html.markdown index 9e8b0c12c570..0aef0be85486 100644 --- a/website/docs/d/efs_file_system.html.markdown +++ b/website/docs/d/efs_file_system.html.markdown @@ -12,7 +12,7 @@ Provides information about an Elastic File System (EFS) File System. ## Example Usage -```hcl +```terraform variable "file_system_id" { type = string default = "" diff --git a/website/docs/d/efs_mount_target.html.markdown b/website/docs/d/efs_mount_target.html.markdown index ca42eb248b8f..b982715e42c1 100644 --- a/website/docs/d/efs_mount_target.html.markdown +++ b/website/docs/d/efs_mount_target.html.markdown @@ -12,7 +12,7 @@ Provides information about an Elastic File System Mount Target (EFS). ## Example Usage -```hcl +```terraform variable "mount_target_id" { type = string default = "" diff --git a/website/docs/d/eip.html.markdown b/website/docs/d/eip.html.markdown index 074e6c0a4092..639c296fe0d9 100644 --- a/website/docs/d/eip.html.markdown +++ b/website/docs/d/eip.html.markdown @@ -14,7 +14,7 @@ description: |- ### Search By Allocation ID (VPC only) -```hcl +```terraform data "aws_eip" "by_allocation_id" { id = "eipalloc-12345678" } @@ -22,7 +22,7 @@ data "aws_eip" "by_allocation_id" { ### Search By Filters (EC2-Classic or VPC) -```hcl +```terraform data "aws_eip" "by_filter" { filter { name = "tag:Name" @@ -33,7 +33,7 @@ data "aws_eip" "by_filter" { ### Search By Public IP (EC2-Classic or VPC) -```hcl +```terraform data "aws_eip" "by_public_ip" { public_ip = "1.2.3.4" } @@ -41,7 +41,7 @@ data "aws_eip" "by_public_ip" { ### Search By Tags (EC2-Classic or VPC) -```hcl +```terraform data "aws_eip" "by_tags" { tags = { Name = "exampleNameTagValue" diff --git a/website/docs/d/eks_cluster.html.markdown b/website/docs/d/eks_cluster.html.markdown index 73cd492245eb..d01b573e2a0e 100644 --- a/website/docs/d/eks_cluster.html.markdown +++ b/website/docs/d/eks_cluster.html.markdown @@ -12,7 +12,7 @@ Retrieve information about an EKS Cluster. ## Example Usage -```hcl +```terraform data "aws_eks_cluster" "example" { name = "example" } diff --git a/website/docs/d/eks_cluster_auth.html.markdown b/website/docs/d/eks_cluster_auth.html.markdown index 33e8393868aa..88ba9f45189e 100644 --- a/website/docs/d/eks_cluster_auth.html.markdown +++ b/website/docs/d/eks_cluster_auth.html.markdown @@ -19,7 +19,7 @@ server configured. ## Example Usage -```hcl +```terraform data "aws_eks_cluster" "example" { name = "example" } diff --git a/website/docs/d/elastic_beanstalk_application.html.markdown b/website/docs/d/elastic_beanstalk_application.html.markdown index 5006099f8e0e..ee1186f0e57a 100644 --- a/website/docs/d/elastic_beanstalk_application.html.markdown +++ b/website/docs/d/elastic_beanstalk_application.html.markdown @@ -12,7 +12,7 @@ Retrieve information about an Elastic Beanstalk Application. ## Example Usage -```hcl +```terraform data "aws_elastic_beanstalk_application" "example" { name = "example" } diff --git a/website/docs/d/elastic_beanstalk_hosted_zone.html.markdown b/website/docs/d/elastic_beanstalk_hosted_zone.html.markdown index 90622dda362e..a3e7251d6aee 100644 --- a/website/docs/d/elastic_beanstalk_hosted_zone.html.markdown +++ b/website/docs/d/elastic_beanstalk_hosted_zone.html.markdown @@ -12,7 +12,7 @@ Use this data source to get the ID of an [elastic beanstalk hosted zone](http:// ## Example Usage -```hcl +```terraform data "aws_elastic_beanstalk_hosted_zone" "current" {} ``` diff --git a/website/docs/d/elastic_beanstalk_solution_stack.html.markdown b/website/docs/d/elastic_beanstalk_solution_stack.html.markdown index b1e64f942b9e..f0f6d7ae2058 100644 --- a/website/docs/d/elastic_beanstalk_solution_stack.html.markdown +++ b/website/docs/d/elastic_beanstalk_solution_stack.html.markdown @@ -12,7 +12,7 @@ Use this data source to get the name of a elastic beanstalk solution stack. ## Example Usage -```hcl +```terraform data "aws_elastic_beanstalk_solution_stack" "multi_docker" { most_recent = true diff --git a/website/docs/d/elasticache_cluster.html.markdown b/website/docs/d/elasticache_cluster.html.markdown index fb85f465755e..a828e553fe7f 100644 --- a/website/docs/d/elasticache_cluster.html.markdown +++ b/website/docs/d/elasticache_cluster.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information about an Elasticache Cluster ## Example Usage -```hcl +```terraform data "aws_elasticache_cluster" "my_cluster" { cluster_id = "my-cluster-id" } diff --git a/website/docs/d/elasticache_replication_group.html.markdown b/website/docs/d/elasticache_replication_group.html.markdown index e7bbee509496..04506f170dea 100644 --- a/website/docs/d/elasticache_replication_group.html.markdown +++ b/website/docs/d/elasticache_replication_group.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information about an Elasticache Replication Group. ## Example Usage -```hcl +```terraform data "aws_elasticache_replication_group" "bar" { replication_group_id = "example" } diff --git a/website/docs/d/elasticsearch_domain.html.markdown b/website/docs/d/elasticsearch_domain.html.markdown index b89efdf06b99..39ee83d88d4d 100644 --- a/website/docs/d/elasticsearch_domain.html.markdown +++ b/website/docs/d/elasticsearch_domain.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information about an Elasticsearch Domain ## Example Usage -```hcl +```terraform data "aws_elasticsearch_domain" "my_domain" { domain_name = "my-domain-name" } diff --git a/website/docs/d/elb.html.markdown b/website/docs/d/elb.html.markdown index e68e1db02041..125a10843af4 100644 --- a/website/docs/d/elb.html.markdown +++ b/website/docs/d/elb.html.markdown @@ -18,7 +18,7 @@ with it, etc. ## Example Usage -```hcl +```terraform variable "lb_name" { type = string default = "" diff --git a/website/docs/d/elb_hosted_zone_id.html.markdown b/website/docs/d/elb_hosted_zone_id.html.markdown index 51207333a75c..bbcb6a804259 100644 --- a/website/docs/d/elb_hosted_zone_id.html.markdown +++ b/website/docs/d/elb_hosted_zone_id.html.markdown @@ -13,7 +13,7 @@ in a given region for the purpose of using in an AWS Route53 Alias. ## Example Usage -```hcl +```terraform data "aws_elb_hosted_zone_id" "main" {} resource "aws_route53_record" "www" { diff --git a/website/docs/d/elb_service_account.html.markdown b/website/docs/d/elb_service_account.html.markdown index b1c1f87443f9..1495e8729a4d 100644 --- a/website/docs/d/elb_service_account.html.markdown +++ b/website/docs/d/elb_service_account.html.markdown @@ -13,7 +13,7 @@ in a given region for the purpose of permitting in S3 bucket policy. ## Example Usage -```hcl +```terraform data "aws_elb_service_account" "main" {} resource "aws_s3_bucket" "elb_logs" { diff --git a/website/docs/d/glue_script.html.markdown b/website/docs/d/glue_script.html.markdown index ed8839695bc4..63fbdc8ca943 100644 --- a/website/docs/d/glue_script.html.markdown +++ b/website/docs/d/glue_script.html.markdown @@ -14,7 +14,7 @@ Use this data source to generate a Glue script from a Directed Acyclic Graph (DA ### Generate Python Script -```hcl +```terraform data "aws_glue_script" "example" { language = "PYTHON" @@ -116,7 +116,7 @@ output "python_script" { ### Generate Scala Code -```hcl +```terraform data "aws_glue_script" "example" { language = "SCALA" diff --git a/website/docs/d/guardduty_detector.html.markdown b/website/docs/d/guardduty_detector.html.markdown index 3b4a3013297d..bdffbdbda4ea 100644 --- a/website/docs/d/guardduty_detector.html.markdown +++ b/website/docs/d/guardduty_detector.html.markdown @@ -12,7 +12,7 @@ Retrieve information about a GuardDuty detector. ## Example Usage -```hcl +```terraform data "aws_guardduty_detector" "example" {} ``` diff --git a/website/docs/d/iam_account_alias.html.markdown b/website/docs/d/iam_account_alias.html.markdown index 53a1aba0cff7..181a98e8d654 100644 --- a/website/docs/d/iam_account_alias.html.markdown +++ b/website/docs/d/iam_account_alias.html.markdown @@ -14,7 +14,7 @@ for the effective account in which Terraform is working. ## Example Usage -```hcl +```terraform data "aws_iam_account_alias" "current" {} output "account_id" { diff --git a/website/docs/d/iam_group.html.markdown b/website/docs/d/iam_group.html.markdown index 7f4085df90a8..7cfb6168f735 100644 --- a/website/docs/d/iam_group.html.markdown +++ b/website/docs/d/iam_group.html.markdown @@ -14,7 +14,7 @@ properties without having to hard code ARNs as input. ## Example Usage -```hcl +```terraform data "aws_iam_group" "example" { group_name = "an_example_group_name" } diff --git a/website/docs/d/iam_instance_profile.html.markdown b/website/docs/d/iam_instance_profile.html.markdown index 25c51eb1cf49..962c28794a45 100644 --- a/website/docs/d/iam_instance_profile.html.markdown +++ b/website/docs/d/iam_instance_profile.html.markdown @@ -14,7 +14,7 @@ instance profile properties without having to hard code ARNs as input. ## Example Usage -```hcl +```terraform data "aws_iam_instance_profile" "example" { name = "an_example_instance_profile_name" } diff --git a/website/docs/d/iam_policy.html.markdown b/website/docs/d/iam_policy.html.markdown index e4023ab48138..7ff5c9769920 100644 --- a/website/docs/d/iam_policy.html.markdown +++ b/website/docs/d/iam_policy.html.markdown @@ -13,7 +13,7 @@ IAM policy. ## Example Usage -```hcl +```terraform data "aws_iam_policy" "example" { arn = "arn:aws:iam::123456789012:policy/UsersManageOwnCredentials" } @@ -30,4 +30,6 @@ data "aws_iam_policy" "example" { * `path` - The path to the policy. * `description` - The description of the policy. * `policy` - The policy document of the policy. +* `policy_id` - The policy's ID. +* `tags` - Key-value mapping of tags for the IAM Policy diff --git a/website/docs/d/iam_policy_document.html.markdown b/website/docs/d/iam_policy_document.html.markdown index dc815f5b7994..10f57f9537c9 100644 --- a/website/docs/d/iam_policy_document.html.markdown +++ b/website/docs/d/iam_policy_document.html.markdown @@ -20,7 +20,7 @@ Using this data source to generate policy documents is *optional*. It is also va ### Basic Example -```hcl +```terraform data "aws_iam_policy_document" "example" { statement { sid = "1" @@ -79,7 +79,7 @@ resource "aws_iam_policy" "example" { You can specify multiple principal blocks with different types. You can also use this data source to generate an assume-role policy. -```hcl +```terraform data "aws_iam_policy_document" "event_stream_bucket_role_assume_role_policy" { statement { actions = ["sts:AssumeRole"] @@ -104,7 +104,7 @@ data "aws_iam_policy_document" "event_stream_bucket_role_assume_role_policy" { ### Example Using A Source Document -```hcl +```terraform data "aws_iam_policy_document" "source" { statement { actions = ["ec2:*"] @@ -162,7 +162,7 @@ data "aws_iam_policy_document" "source_json_example" { ### Example Using An Override Document -```hcl +```terraform data "aws_iam_policy_document" "override" { statement { sid = "SidToOverride" @@ -219,7 +219,7 @@ data "aws_iam_policy_document" "override_json_example" { You can also combine `source_json` and `override_json` in the same document. -```hcl +```terraform data "aws_iam_policy_document" "source" { statement { sid = "OverridePlaceholder" @@ -262,7 +262,7 @@ data "aws_iam_policy_document" "politik" { Multiple documents can be combined using the `source_policy_documents` or `override_policy_documents` attributes. `source_policy_documents` requires that all documents have unique Sids, while `override_policy_documents` will iteratively override matching Sids. -```hcl +```terraform data "aws_iam_policy_document" "source_one" { statement { actions = ["ec2:*"] @@ -335,7 +335,7 @@ data "aws_iam_policy_document" "combined" { ### Example of Merging Override Documents -```hcl +```terraform data "aws_iam_policy_document" "policy_one" { statement { sid = "OverridePlaceHolderOne" diff --git a/website/docs/d/iam_role.html.markdown b/website/docs/d/iam_role.html.markdown index cccb61268938..7a960aec6977 100644 --- a/website/docs/d/iam_role.html.markdown +++ b/website/docs/d/iam_role.html.markdown @@ -14,7 +14,7 @@ properties without having to hard code ARNs as input. ## Example Usage -```hcl +```terraform data "aws_iam_role" "example" { name = "an_example_role_name" } diff --git a/website/docs/d/iam_server_certificate.html.markdown b/website/docs/d/iam_server_certificate.html.markdown index 9de287cbfacd..806c302bdd26 100644 --- a/website/docs/d/iam_server_certificate.html.markdown +++ b/website/docs/d/iam_server_certificate.html.markdown @@ -12,7 +12,7 @@ Use this data source to lookup information about IAM Server Certificates. ## Example Usage -```hcl +```terraform data "aws_iam_server_certificate" "my-domain" { name_prefix = "my-domain.org" latest = true diff --git a/website/docs/d/iam_user.html.markdown b/website/docs/d/iam_user.html.markdown index 803020737bbe..62ee28b0b036 100644 --- a/website/docs/d/iam_user.html.markdown +++ b/website/docs/d/iam_user.html.markdown @@ -14,7 +14,7 @@ properties without having to hard code ARNs or unique IDs as input. ## Example Usage -```hcl +```terraform data "aws_iam_user" "example" { user_name = "an_example_user_name" } diff --git a/website/docs/d/identitystore_group.html.markdown b/website/docs/d/identitystore_group.html.markdown index 274e26065046..2e00896d5045 100644 --- a/website/docs/d/identitystore_group.html.markdown +++ b/website/docs/d/identitystore_group.html.markdown @@ -12,7 +12,7 @@ Use this data source to get an Identity Store Group. ## Example Usage -```hcl +```terraform data "aws_ssoadmin_instances" "example" {} data "aws_identitystore_group" "example" { diff --git a/website/docs/d/identitystore_user.html.markdown b/website/docs/d/identitystore_user.html.markdown index f5275130e0a0..b558d9c70b08 100644 --- a/website/docs/d/identitystore_user.html.markdown +++ b/website/docs/d/identitystore_user.html.markdown @@ -12,7 +12,7 @@ Use this data source to get an Identity Store User. ## Example Usage -```hcl +```terraform data "aws_ssoadmin_instances" "example" {} data "aws_identitystore_user" "example" { diff --git a/website/docs/d/imagebuilder_component.html.markdown b/website/docs/d/imagebuilder_component.html.markdown index 13c903cb3bfc..7dd2fbec63e8 100644 --- a/website/docs/d/imagebuilder_component.html.markdown +++ b/website/docs/d/imagebuilder_component.html.markdown @@ -12,7 +12,7 @@ Provides details about an Image Builder Component. ## Example Usage -```hcl +```terraform data "aws_imagebuilder_component" "example" { arn = "arn:aws:imagebuilder:us-west-2:aws:component/amazon-cloudwatch-agent-linux/1.0.0" } diff --git a/website/docs/d/imagebuilder_distribution_configuration.html.markdown b/website/docs/d/imagebuilder_distribution_configuration.html.markdown index 335a8d6a74dc..7064f4acea29 100644 --- a/website/docs/d/imagebuilder_distribution_configuration.html.markdown +++ b/website/docs/d/imagebuilder_distribution_configuration.html.markdown @@ -12,7 +12,7 @@ Provides details about an Image Builder Distribution Configuration. ## Example Usage -```hcl +```terraform data "aws_imagebuilder_distribution_configuration" "example" { arn = "arn:aws:imagebuilder:us-west-2:aws:distribution-configuration/example" } diff --git a/website/docs/d/imagebuilder_image.html.markdown b/website/docs/d/imagebuilder_image.html.markdown index 81d871924d04..72043b2ea6b2 100644 --- a/website/docs/d/imagebuilder_image.html.markdown +++ b/website/docs/d/imagebuilder_image.html.markdown @@ -14,7 +14,7 @@ Provides details about an Image Builder Image. ### Latest -```hcl +```terraform data "aws_imagebuilder_image" "example" { arn = "arn:aws:imagebuilder:us-west-2:aws:image/amazon-linux-2-x86/x.x.x" } diff --git a/website/docs/d/imagebuilder_image_pipeline.html.markdown b/website/docs/d/imagebuilder_image_pipeline.html.markdown index 76d976e40ea6..2e63d07fad73 100644 --- a/website/docs/d/imagebuilder_image_pipeline.html.markdown +++ b/website/docs/d/imagebuilder_image_pipeline.html.markdown @@ -12,7 +12,7 @@ Provides details about an Image Builder Image Pipeline. ## Example Usage -```hcl +```terraform data "aws_imagebuilder_image_pipeline" "example" { arn = "arn:aws:imagebuilder:us-west-2:aws:image-pipeline/example" } diff --git a/website/docs/d/imagebuilder_image_recipe.html.markdown b/website/docs/d/imagebuilder_image_recipe.html.markdown index a4d753fd3809..dbd0ef093422 100644 --- a/website/docs/d/imagebuilder_image_recipe.html.markdown +++ b/website/docs/d/imagebuilder_image_recipe.html.markdown @@ -12,7 +12,7 @@ Provides details about an Image Builder Image Recipe. ## Example Usage -```hcl +```terraform data "aws_imagebuilder_image_recipe" "example" { arn = "arn:aws:imagebuilder:us-east-1:aws:image-recipe/example/1.0.0" } diff --git a/website/docs/d/imagebuilder_infrastructure_configuration.html.markdown b/website/docs/d/imagebuilder_infrastructure_configuration.html.markdown index a7e81dbd3c03..6b40dcccc126 100644 --- a/website/docs/d/imagebuilder_infrastructure_configuration.html.markdown +++ b/website/docs/d/imagebuilder_infrastructure_configuration.html.markdown @@ -12,7 +12,7 @@ Provides details about an Image Builder Infrastructure Configuration. ## Example Usage -```hcl +```terraform data "aws_imagebuilder_infrastructure_configuration" "example" { arn = "arn:aws:imagebuilder:us-west-2:aws:infrastructure-configuration/example" } diff --git a/website/docs/d/inspector_rules_packages.html.markdown b/website/docs/d/inspector_rules_packages.html.markdown index ba2889c4e84a..808f39be72ee 100644 --- a/website/docs/d/inspector_rules_packages.html.markdown +++ b/website/docs/d/inspector_rules_packages.html.markdown @@ -14,7 +14,7 @@ configured in the provider. ## Example Usage -```hcl +```terraform # Declare the data source data "aws_inspector_rules_packages" "rules" {} diff --git a/website/docs/d/instance.html.markdown b/website/docs/d/instance.html.markdown index 11e83a511fc8..911a7f06071f 100644 --- a/website/docs/d/instance.html.markdown +++ b/website/docs/d/instance.html.markdown @@ -13,7 +13,7 @@ resources. ## Example Usage -```hcl +```terraform data "aws_instance" "foo" { instance_id = "i-instanceid" diff --git a/website/docs/d/instances.html.markdown b/website/docs/d/instances.html.markdown index 04c8ffb108fa..633ed28b8af9 100644 --- a/website/docs/d/instances.html.markdown +++ b/website/docs/d/instances.html.markdown @@ -23,7 +23,7 @@ and you'd need to re-run `apply` every time an instance comes up or dies. ## Example Usage -```hcl +```terraform data "aws_instances" "test" { instance_tags = { Role = "HardWorker" diff --git a/website/docs/d/internet_gateway.html.markdown b/website/docs/d/internet_gateway.html.markdown index efe81ced4d83..b311c816f6a0 100644 --- a/website/docs/d/internet_gateway.html.markdown +++ b/website/docs/d/internet_gateway.html.markdown @@ -12,7 +12,7 @@ description: |- ## Example Usage -```hcl +```terraform variable "vpc_id" {} data "aws_internet_gateway" "default" { diff --git a/website/docs/d/iot_endpoint.html.markdown b/website/docs/d/iot_endpoint.html.markdown index ac93ae1d09a5..e38e7ed26137 100644 --- a/website/docs/d/iot_endpoint.html.markdown +++ b/website/docs/d/iot_endpoint.html.markdown @@ -12,7 +12,7 @@ Returns a unique endpoint specific to the AWS account making the call. ## Example Usage -```hcl +```terraform data "aws_iot_endpoint" "example" {} resource "kubernetes_pod" "agent" { diff --git a/website/docs/d/ip_ranges.html.markdown b/website/docs/d/ip_ranges.html.markdown index a1d124215c48..a7d4d57b882b 100644 --- a/website/docs/d/ip_ranges.html.markdown +++ b/website/docs/d/ip_ranges.html.markdown @@ -12,7 +12,7 @@ Use this data source to get the IP ranges of various AWS products and services. ## Example Usage -```hcl +```terraform data "aws_ip_ranges" "european_ec2" { regions = ["eu-west-1", "eu-central-1"] services = ["ec2"] diff --git a/website/docs/d/kinesis_stream.html.markdown b/website/docs/d/kinesis_stream.html.markdown index 6613e8e84ce2..b6679da1d36e 100644 --- a/website/docs/d/kinesis_stream.html.markdown +++ b/website/docs/d/kinesis_stream.html.markdown @@ -15,7 +15,7 @@ For more details, see the [Amazon Kinesis Documentation][1]. ## Example Usage -```hcl +```terraform data "aws_kinesis_stream" "stream" { name = "stream-name" } diff --git a/website/docs/d/kinesis_stream_consumer.html.markdown b/website/docs/d/kinesis_stream_consumer.html.markdown new file mode 100644 index 000000000000..bd2c411976f5 --- /dev/null +++ b/website/docs/d/kinesis_stream_consumer.html.markdown @@ -0,0 +1,38 @@ +--- +subcategory: "Kinesis" +layout: "aws" +page_title: "AWS: aws_kinesis_stream_consumer" +description: |- + Provides details about a Kinesis Stream Consumer. +--- + +# Data Source: aws_kinesis_stream_consumer + +Provides details about a Kinesis Stream Consumer. + +For more details, see the [Amazon Kinesis Stream Consumer Documentation][1]. + +## Example Usage + +```terraform +data "aws_kinesis_stream_consumer" "example" { + name = "example-consumer" + stream_arn = aws_kinesis_stream.example.arn +} +``` + +## Argument Reference + +* `arn` - (Optional) Amazon Resource Name (ARN) of the stream consumer. +* `name` - (Optional) Name of the stream consumer. +* `stream_arn` - (Required) Amazon Resource Name (ARN) of the data stream the consumer is registered with. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `creation_timestamp` - Approximate timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) of when the stream consumer was created. +* `id` - Amazon Resource Name (ARN) of the stream consumer. +* `status` - The current status of the stream consumer. + +[1]: https://docs.aws.amazon.com/streams/latest/dev/amazon-kinesis-consumers.html diff --git a/website/docs/d/kms_alias.html.markdown b/website/docs/d/kms_alias.html.markdown index 3a3fdbcc6f7d..fcc656978014 100644 --- a/website/docs/d/kms_alias.html.markdown +++ b/website/docs/d/kms_alias.html.markdown @@ -14,7 +14,7 @@ without having to hard code the ARN as input. ## Example Usage -```hcl +```terraform data "aws_kms_alias" "s3" { name = "alias/aws/s3" } diff --git a/website/docs/d/kms_ciphertext.html.markdown b/website/docs/d/kms_ciphertext.html.markdown index 5f02b4fb0204..8c8c8746b33f 100644 --- a/website/docs/d/kms_ciphertext.html.markdown +++ b/website/docs/d/kms_ciphertext.html.markdown @@ -18,7 +18,7 @@ resource](/docs/providers/aws/r/kms_ciphertext.html). ## Example Usage -```hcl +```terraform resource "aws_kms_key" "oauth_config" { description = "oauth config" is_enabled = true diff --git a/website/docs/d/kms_key.html.markdown b/website/docs/d/kms_key.html.markdown index 450d397cdd39..c4b17293e144 100644 --- a/website/docs/d/kms_key.html.markdown +++ b/website/docs/d/kms_key.html.markdown @@ -15,7 +15,7 @@ without having to hard code the ARN as input. ## Example Usage -```hcl +```terraform data "aws_kms_key" "by_alias" { key_id = "alias/my-key" } diff --git a/website/docs/d/kms_secrets.html.markdown b/website/docs/d/kms_secrets.html.markdown index e3d0ca935575..a0d3077a9a73 100644 --- a/website/docs/d/kms_secrets.html.markdown +++ b/website/docs/d/kms_secrets.html.markdown @@ -26,7 +26,7 @@ AQECAHgaPa0J8WadplGCqqVAr4HNvDaFSQ+NaiwIBhmm6qDSFwAAAGIwYAYJKoZIhvcNAQcGoFMwUQIB That encrypted output can now be inserted into Terraform configurations without exposing the plaintext secret directly. -```hcl +```terraform data "aws_kms_secrets" "example" { secret { # ... potentially other configuration ... diff --git a/website/docs/d/lakeformation_data_lake_settings.html.markdown b/website/docs/d/lakeformation_data_lake_settings.html.markdown index 7babecaeacc1..bb60ade6b6c6 100644 --- a/website/docs/d/lakeformation_data_lake_settings.html.markdown +++ b/website/docs/d/lakeformation_data_lake_settings.html.markdown @@ -12,7 +12,7 @@ Get Lake Formation principals designated as data lake administrators and lists o ## Example Usage -```hcl +```terraform data "aws_lakeformation_data_lake_settings" "example" { catalog_id = "14916253649" } diff --git a/website/docs/d/lakeformation_permissions.html.markdown b/website/docs/d/lakeformation_permissions.html.markdown index 69872f971a26..05b943ddc4ee 100644 --- a/website/docs/d/lakeformation_permissions.html.markdown +++ b/website/docs/d/lakeformation_permissions.html.markdown @@ -16,7 +16,7 @@ Get permissions for a principal to access metadata in the Data Catalog and data ### Permissions For A Lake Formation S3 Resource -```hcl +```terraform data "aws_lakeformation_permissions" "test" { principal = aws_iam_role.workflow_role.arn @@ -28,7 +28,7 @@ data "aws_lakeformation_permissions" "test" { ### Permissions For A Glue Catalog Database -```hcl +```terraform data "aws_lakeformation_permissions" "test" { principal = aws_iam_role.workflow_role.arn diff --git a/website/docs/d/lakeformation_resource.html.markdown b/website/docs/d/lakeformation_resource.html.markdown index 70285dc50191..6fe72805b73a 100644 --- a/website/docs/d/lakeformation_resource.html.markdown +++ b/website/docs/d/lakeformation_resource.html.markdown @@ -12,7 +12,7 @@ Provides details about a Lake Formation resource. ## Example Usage -```hcl +```terraform data "aws_lakeformation_resource" "example" { arn = "arn:aws:s3:::tf-acc-test-9151654063908211878" } diff --git a/website/docs/d/lambda_alias.html.markdown b/website/docs/d/lambda_alias.html.markdown index b47756b6a462..72aa409d4038 100644 --- a/website/docs/d/lambda_alias.html.markdown +++ b/website/docs/d/lambda_alias.html.markdown @@ -12,7 +12,7 @@ Provides information about a Lambda Alias. ## Example Usage -```hcl +```terraform data "aws_lambda_alias" "production" { function_name = "my-lambda-func" name = "production" diff --git a/website/docs/d/lambda_code_signing_config.html.markdown b/website/docs/d/lambda_code_signing_config.html.markdown index bc6da053030d..1c15d1280414 100644 --- a/website/docs/d/lambda_code_signing_config.html.markdown +++ b/website/docs/d/lambda_code_signing_config.html.markdown @@ -14,7 +14,7 @@ For information about Lambda code signing configurations and how to use them, se ## Example Usage -```hcl +```terraform data "aws_lambda_code_signing_config" "existing_csc" { arn = "arn:aws:lambda:${var.aws_region}:${var.aws_account}:code-signing-config:csc-0f6c334abcdea4d8b" } diff --git a/website/docs/d/lambda_function.html.markdown b/website/docs/d/lambda_function.html.markdown index 1e49d8b29808..a419a22c097f 100644 --- a/website/docs/d/lambda_function.html.markdown +++ b/website/docs/d/lambda_function.html.markdown @@ -12,7 +12,7 @@ Provides information about a Lambda Function. ## Example Usage -```hcl +```terraform variable "function_name" { type = string } diff --git a/website/docs/d/lambda_invocation.html.markdown b/website/docs/d/lambda_invocation.html.markdown index 5d1c713a64a7..cea394a446cb 100644 --- a/website/docs/d/lambda_invocation.html.markdown +++ b/website/docs/d/lambda_invocation.html.markdown @@ -14,7 +14,7 @@ invocation type. ## Example Usage -```hcl +```terraform data "aws_lambda_invocation" "example" { function_name = aws_lambda_function.lambda_function_test.function_name diff --git a/website/docs/d/lambda_layer_version.html.markdown b/website/docs/d/lambda_layer_version.html.markdown index cedbf3831bf8..dad69104d142 100644 --- a/website/docs/d/lambda_layer_version.html.markdown +++ b/website/docs/d/lambda_layer_version.html.markdown @@ -12,7 +12,7 @@ Provides information about a Lambda Layer Version. ## Example Usage -```hcl +```terraform variable "layer_name" { type = string } diff --git a/website/docs/d/launch_configuration.html.markdown b/website/docs/d/launch_configuration.html.markdown index 68702126a222..1fb1edfa3cf8 100644 --- a/website/docs/d/launch_configuration.html.markdown +++ b/website/docs/d/launch_configuration.html.markdown @@ -12,7 +12,7 @@ Provides information about a Launch Configuration. ## Example Usage -```hcl +```terraform data "aws_launch_configuration" "ubuntu" { name = "test-launch-config" } diff --git a/website/docs/d/launch_template.html.markdown b/website/docs/d/launch_template.html.markdown index d84ba31afae9..8e060dea8189 100644 --- a/website/docs/d/launch_template.html.markdown +++ b/website/docs/d/launch_template.html.markdown @@ -12,7 +12,7 @@ Provides information about a Launch Template. ## Example Usage -```hcl +```terraform data "aws_launch_template" "default" { name = "my-launch-template" } @@ -20,7 +20,7 @@ data "aws_launch_template" "default" { ### Filter -```hcl +```terraform data "aws_launch_template" "test" { filter { name = "launch-template-name" diff --git a/website/docs/d/lb.html.markdown b/website/docs/d/lb.html.markdown index d7d7747b8d32..341506f05aa9 100644 --- a/website/docs/d/lb.html.markdown +++ b/website/docs/d/lb.html.markdown @@ -18,7 +18,7 @@ with it, etc. ## Example Usage -```hcl +```terraform variable "lb_arn" { type = string default = "" diff --git a/website/docs/d/lb_listener.html.markdown b/website/docs/d/lb_listener.html.markdown index c4a3318ad55b..f4750f7a9ca1 100644 --- a/website/docs/d/lb_listener.html.markdown +++ b/website/docs/d/lb_listener.html.markdown @@ -18,7 +18,7 @@ information specific to the listener in question. ## Example Usage -```hcl +```terraform # get listener from listener arn variable "listener_arn" { diff --git a/website/docs/d/lb_target_group.html.markdown b/website/docs/d/lb_target_group.html.markdown index 4455a346d0c3..1eb2af9588c9 100644 --- a/website/docs/d/lb_target_group.html.markdown +++ b/website/docs/d/lb_target_group.html.markdown @@ -18,7 +18,7 @@ an LB Target Group for use in other resources, given LB Target Group name. ## Example Usage -```hcl +```terraform variable "lb_tg_arn" { type = string default = "" diff --git a/website/docs/d/lex_bot.html.markdown b/website/docs/d/lex_bot.html.markdown index d90aa5149d2a..f32ec10a7053 100644 --- a/website/docs/d/lex_bot.html.markdown +++ b/website/docs/d/lex_bot.html.markdown @@ -12,7 +12,7 @@ Provides details about a specific Amazon Lex Bot. ## Example Usage -```hcl +```terraform data "aws_lex_bot" "order_flowers_bot" { name = "OrderFlowers" version = "$LATEST" diff --git a/website/docs/d/lex_bot_alias.html.markdown b/website/docs/d/lex_bot_alias.html.markdown index 4669fc501b55..2821c412c5d9 100644 --- a/website/docs/d/lex_bot_alias.html.markdown +++ b/website/docs/d/lex_bot_alias.html.markdown @@ -12,7 +12,7 @@ Provides details about a specific Amazon Lex Bot Alias. ## Example Usage -```hcl +```terraform data "aws_lex_bot_alias" "order_flowers_prod" { bot_name = "OrderFlowers" name = "OrderFlowersProd" diff --git a/website/docs/d/lex_intent.html.markdown b/website/docs/d/lex_intent.html.markdown index dc2c2d4233b9..fa49c4427a53 100644 --- a/website/docs/d/lex_intent.html.markdown +++ b/website/docs/d/lex_intent.html.markdown @@ -12,7 +12,7 @@ Provides details about a specific Amazon Lex Intent. ## Example Usage -```hcl +```terraform data "aws_lex_intent" "order_flowers" { name = "OrderFlowers" version = "$LATEST" diff --git a/website/docs/d/lex_slot_type.html.markdown b/website/docs/d/lex_slot_type.html.markdown index 9a424c07c544..143335b83687 100644 --- a/website/docs/d/lex_slot_type.html.markdown +++ b/website/docs/d/lex_slot_type.html.markdown @@ -12,7 +12,7 @@ Provides details about a specific Amazon Lex Slot Type. ## Example Usage -```hcl +```terraform data "aws_lex_slot_type" "flower_types" { name = "FlowerTypes" version = "1" diff --git a/website/docs/d/mq_broker.html.markdown b/website/docs/d/mq_broker.html.markdown index afb5d3ae903d..6b456c775c40 100644 --- a/website/docs/d/mq_broker.html.markdown +++ b/website/docs/d/mq_broker.html.markdown @@ -12,7 +12,7 @@ Provides information about a MQ Broker. ## Example Usage -```hcl +```terraform variable "broker_id" { type = string default = "" diff --git a/website/docs/d/msk_cluster.html.markdown b/website/docs/d/msk_cluster.html.markdown index 48785c6adf69..a5ac3e56b3c5 100644 --- a/website/docs/d/msk_cluster.html.markdown +++ b/website/docs/d/msk_cluster.html.markdown @@ -12,7 +12,7 @@ Get information on an Amazon MSK Cluster. ## Example Usage -```hcl +```terraform data "aws_msk_cluster" "example" { cluster_name = "example" } diff --git a/website/docs/d/msk_configuration.html.markdown b/website/docs/d/msk_configuration.html.markdown index 378c7e83db2e..355b09f3b371 100644 --- a/website/docs/d/msk_configuration.html.markdown +++ b/website/docs/d/msk_configuration.html.markdown @@ -12,7 +12,7 @@ Get information on an Amazon MSK Configuration. ## Example Usage -```hcl +```terraform data "aws_msk_configuration" "example" { name = "example" } diff --git a/website/docs/d/nat_gateway.html.markdown b/website/docs/d/nat_gateway.html.markdown index 405839fe4a73..ab46bb1c75fc 100644 --- a/website/docs/d/nat_gateway.html.markdown +++ b/website/docs/d/nat_gateway.html.markdown @@ -12,7 +12,7 @@ Provides details about a specific Nat Gateway. ## Example Usage -```hcl +```terraform variable "subnet_id" {} data "aws_nat_gateway" "default" { @@ -22,7 +22,7 @@ data "aws_nat_gateway" "default" { Usage with tags: -```hcl +```terraform data "aws_nat_gateway" "default" { subnet_id = aws_subnet.public.id diff --git a/website/docs/d/neptune_engine_version.markdown b/website/docs/d/neptune_engine_version.markdown index dcfba4218565..7f0913768504 100644 --- a/website/docs/d/neptune_engine_version.markdown +++ b/website/docs/d/neptune_engine_version.markdown @@ -12,7 +12,7 @@ Information about a Neptune engine version. ## Example Usage -```hcl +```terraform data "aws_neptune_engine_version" "test" { preferred_versions = ["1.0.3.0", "1.0.2.2", "1.0.2.1"] } diff --git a/website/docs/d/neptune_orderable_db_instance.markdown b/website/docs/d/neptune_orderable_db_instance.markdown index f08da2b2784c..65582a351800 100644 --- a/website/docs/d/neptune_orderable_db_instance.markdown +++ b/website/docs/d/neptune_orderable_db_instance.markdown @@ -12,7 +12,7 @@ Information about Neptune orderable DB instances. ## Example Usage -```hcl +```terraform data "aws_neptune_orderable_db_instance" "test" { engine_version = "1.0.3.0" preferred_instance_classes = ["db.r5.large", "db.r4.large", "db.t3.medium"] diff --git a/website/docs/d/network_acls.html.markdown b/website/docs/d/network_acls.html.markdown index dfd9d09153e9..5a0d21ce824d 100644 --- a/website/docs/d/network_acls.html.markdown +++ b/website/docs/d/network_acls.html.markdown @@ -12,7 +12,7 @@ description: |- The following shows outputing all network ACL ids in a vpc. -```hcl +```terraform data "aws_network_acls" "example" { vpc_id = var.vpc_id } @@ -25,7 +25,7 @@ output "example" { The following example retrieves a list of all network ACL ids in a VPC with a custom tag of `Tier` set to a value of "Private". -```hcl +```terraform data "aws_network_acls" "example" { vpc_id = var.vpc_id @@ -38,7 +38,7 @@ data "aws_network_acls" "example" { The following example retrieves a network ACL id in a VPC which associated with specific subnet. -```hcl +```terraform data "aws_network_acls" "example" { vpc_id = var.vpc_id diff --git a/website/docs/d/network_interface.html.markdown b/website/docs/d/network_interface.html.markdown index d1436d78831f..05c8168804cb 100644 --- a/website/docs/d/network_interface.html.markdown +++ b/website/docs/d/network_interface.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information about a Network Interface. ## Example Usage -```hcl +```terraform data "aws_network_interface" "bar" { id = "eni-01234567" } diff --git a/website/docs/d/network_interfaces.html.markdown b/website/docs/d/network_interfaces.html.markdown index ebc3e3bad7bc..0a5a6ec6c6be 100644 --- a/website/docs/d/network_interfaces.html.markdown +++ b/website/docs/d/network_interfaces.html.markdown @@ -12,7 +12,7 @@ description: |- The following shows outputing all network interface ids in a region. -```hcl +```terraform data "aws_network_interfaces" "example" {} output "example" { @@ -22,7 +22,7 @@ output "example" { The following example retrieves a list of all network interface ids with a custom tag of `Name` set to a value of `test`. -```hcl +```terraform data "aws_network_interfaces" "example" { tags = { Name = "test" @@ -37,7 +37,7 @@ output "example1" { The following example retrieves a network interface ids which associated with specific subnet. -```hcl +```terraform data "aws_network_interfaces" "example" { filter { name = "subnet-id" diff --git a/website/docs/d/organizations_organization.html.markdown b/website/docs/d/organizations_organization.html.markdown index b40f4f9c8a85..65a80e77172f 100644 --- a/website/docs/d/organizations_organization.html.markdown +++ b/website/docs/d/organizations_organization.html.markdown @@ -14,7 +14,7 @@ Get information about the organization that the user's account belongs to ### List all account IDs for the organization -```hcl +```terraform data "aws_organizations_organization" "example" {} output "account_ids" { @@ -24,7 +24,7 @@ output "account_ids" { ### SNS topic that can be interacted by the organization only -```hcl +```terraform data "aws_organizations_organization" "example" {} resource "aws_sns_topic" "sns_topic" { diff --git a/website/docs/d/organizations_organizational_units.html.markdown b/website/docs/d/organizations_organizational_units.html.markdown index 4994ff7830ca..fc1e1711cab3 100644 --- a/website/docs/d/organizations_organizational_units.html.markdown +++ b/website/docs/d/organizations_organizational_units.html.markdown @@ -11,7 +11,7 @@ Get all direct child organizational units under a parent organizational unit. Th ## Example Usage -```hcl +```terraform data "aws_organizations_organization" "org" {} data "aws_organizations_organizational_units" "ou" { diff --git a/website/docs/d/outposts_outpost.html.markdown b/website/docs/d/outposts_outpost.html.markdown index 82c2ea1d47b2..7b0de38d456a 100644 --- a/website/docs/d/outposts_outpost.html.markdown +++ b/website/docs/d/outposts_outpost.html.markdown @@ -12,7 +12,7 @@ Provides details about an Outposts Outpost. ## Example Usage -```hcl +```terraform data "aws_outposts_outpost" "example" { name = "example" } diff --git a/website/docs/d/outposts_outpost_instance_type.html.markdown b/website/docs/d/outposts_outpost_instance_type.html.markdown index 9e1484370685..0d75851c0d30 100644 --- a/website/docs/d/outposts_outpost_instance_type.html.markdown +++ b/website/docs/d/outposts_outpost_instance_type.html.markdown @@ -12,7 +12,7 @@ Information about single Outpost Instance Type. ## Example Usage -```hcl +```terraform data "aws_outposts_outpost_instance_type" "example" { arn = data.aws_outposts_outpost.example.arn preferred_instance_types = ["m5.large", "m5.4xlarge"] diff --git a/website/docs/d/outposts_outpost_instance_types.html.markdown b/website/docs/d/outposts_outpost_instance_types.html.markdown index 87303d1178fb..ba36cf5eaf95 100644 --- a/website/docs/d/outposts_outpost_instance_types.html.markdown +++ b/website/docs/d/outposts_outpost_instance_types.html.markdown @@ -12,7 +12,7 @@ Information about Outposts Instance Types. ## Example Usage -```hcl +```terraform data "aws_outposts_outpost_instance_types" "example" { arn = data.aws_outposts_outpost.example.arn } diff --git a/website/docs/d/outposts_outposts.html.markdown b/website/docs/d/outposts_outposts.html.markdown index 9dddab045187..3ffb782bad21 100644 --- a/website/docs/d/outposts_outposts.html.markdown +++ b/website/docs/d/outposts_outposts.html.markdown @@ -12,7 +12,7 @@ Provides details about multiple Outposts. ## Example Usage -```hcl +```terraform data "aws_outposts_outposts" "example" { site_id = data.aws_outposts_site.id } diff --git a/website/docs/d/outposts_site.html.markdown b/website/docs/d/outposts_site.html.markdown index 91f366ab7e45..778e6ece86dd 100644 --- a/website/docs/d/outposts_site.html.markdown +++ b/website/docs/d/outposts_site.html.markdown @@ -12,7 +12,7 @@ Provides details about an Outposts Site. ## Example Usage -```hcl +```terraform data "aws_outposts_site" "example" { name = "example" } diff --git a/website/docs/d/outposts_sites.html.markdown b/website/docs/d/outposts_sites.html.markdown index e749b32308f4..c9e623578ab7 100644 --- a/website/docs/d/outposts_sites.html.markdown +++ b/website/docs/d/outposts_sites.html.markdown @@ -12,7 +12,7 @@ Provides details about multiple Outposts Sites. ## Example Usage -```hcl +```terraform data "aws_outposts_sites" "all" {} ``` diff --git a/website/docs/d/partition.html.markdown b/website/docs/d/partition.html.markdown index 741ffd1b9b80..112e13d8df70 100644 --- a/website/docs/d/partition.html.markdown +++ b/website/docs/d/partition.html.markdown @@ -13,7 +13,7 @@ which Terraform is working. ## Example Usage -```hcl +```terraform data "aws_partition" "current" {} data "aws_iam_policy_document" "s3_policy" { diff --git a/website/docs/d/prefix_list.html.markdown b/website/docs/d/prefix_list.html.markdown index 0a0bc0fc04d1..553d958e0387 100644 --- a/website/docs/d/prefix_list.html.markdown +++ b/website/docs/d/prefix_list.html.markdown @@ -18,7 +18,7 @@ rules. ## Example Usage -```hcl +```terraform resource "aws_vpc_endpoint" "private_s3" { vpc_id = aws_vpc.foo.id service_name = "com.amazonaws.us-west-2.s3" @@ -46,7 +46,7 @@ resource "aws_network_acl_rule" "private_s3" { ### Filter -```hcl +```terraform data "aws_prefix_list" "test" { filter { name = "prefix-list-id" diff --git a/website/docs/d/pricing_product.html.markdown b/website/docs/d/pricing_product.html.markdown index 9fff60634102..d4337b1de12c 100644 --- a/website/docs/d/pricing_product.html.markdown +++ b/website/docs/d/pricing_product.html.markdown @@ -13,7 +13,7 @@ This data source is only available in a us-east-1 or ap-south-1 provider. ## Example Usage -```hcl +```terraform data "aws_pricing_product" "example" { service_code = "AmazonEC2" @@ -54,7 +54,7 @@ data "aws_pricing_product" "example" { } ``` -```hcl +```terraform data "aws_pricing_product" "example" { service_code = "AmazonRedshift" diff --git a/website/docs/d/qldb_ledger.html.markdown b/website/docs/d/qldb_ledger.html.markdown index 874e26926b3d..804abe17c9f2 100644 --- a/website/docs/d/qldb_ledger.html.markdown +++ b/website/docs/d/qldb_ledger.html.markdown @@ -12,7 +12,7 @@ Use this data source to fetch information about a Quantum Ledger Database. ## Example Usage -```hcl +```terraform data "aws_qldb_ledger" "example" { name = "an_example_ledger" } diff --git a/website/docs/d/ram_resource_share.html.markdown b/website/docs/d/ram_resource_share.html.markdown index 28d4647ba92f..b4433a6049ea 100644 --- a/website/docs/d/ram_resource_share.html.markdown +++ b/website/docs/d/ram_resource_share.html.markdown @@ -12,7 +12,7 @@ description: |- ## Example Usage -```hcl +```terraform data "aws_ram_resource_share" "example" { name = "example" resource_owner = "SELF" @@ -21,7 +21,7 @@ data "aws_ram_resource_share" "example" { ## Search by filters -```hcl +```terraform data "aws_ram_resource_share" "tag_filter" { name = "MyResourceName" resource_owner = "SELF" diff --git a/website/docs/d/rds_certificate.html.markdown b/website/docs/d/rds_certificate.html.markdown index e4a11beb31b2..05ad0a8950a1 100644 --- a/website/docs/d/rds_certificate.html.markdown +++ b/website/docs/d/rds_certificate.html.markdown @@ -12,7 +12,7 @@ Information about an RDS Certificate. ## Example Usage -```hcl +```terraform data "aws_rds_certificate" "example" { latest_valid_till = true } diff --git a/website/docs/d/rds_cluster.html.markdown b/website/docs/d/rds_cluster.html.markdown index 82fcd66693e5..c8e78751d0ea 100644 --- a/website/docs/d/rds_cluster.html.markdown +++ b/website/docs/d/rds_cluster.html.markdown @@ -12,7 +12,7 @@ Provides information about an RDS cluster. ## Example Usage -```hcl +```terraform data "aws_rds_cluster" "clusterName" { cluster_identifier = "clusterName" } diff --git a/website/docs/d/rds_engine_version.markdown b/website/docs/d/rds_engine_version.markdown index 5b2caa7c5907..fa31a175a2f7 100644 --- a/website/docs/d/rds_engine_version.markdown +++ b/website/docs/d/rds_engine_version.markdown @@ -12,7 +12,7 @@ Information about an RDS engine version. ## Example Usage -```hcl +```terraform data "aws_rds_engine_version" "test" { engine = "mysql" preferred_versions = ["5.7.42", "5.7.19", "5.7.17"] diff --git a/website/docs/d/rds_orderable_db_instance.markdown b/website/docs/d/rds_orderable_db_instance.markdown index ec9884bbdc12..7635e9928a4a 100644 --- a/website/docs/d/rds_orderable_db_instance.markdown +++ b/website/docs/d/rds_orderable_db_instance.markdown @@ -12,7 +12,7 @@ Information about RDS orderable DB instances and valid parameter combinations. ## Example Usage -```hcl +```terraform data "aws_rds_orderable_db_instance" "test" { engine = "mysql" engine_version = "5.7.22" @@ -25,7 +25,7 @@ data "aws_rds_orderable_db_instance" "test" { Valid parameter combinations can also be found with `preferred_engine_versions` and/or `preferred_instance_classes`. -```hcl +```terraform data "aws_rds_orderable_db_instance" "test" { engine = "mysql" license_model = "general-public-license" diff --git a/website/docs/d/redshift_cluster.html.markdown b/website/docs/d/redshift_cluster.html.markdown index 15a6f21719ab..f4be77cf7129 100644 --- a/website/docs/d/redshift_cluster.html.markdown +++ b/website/docs/d/redshift_cluster.html.markdown @@ -12,7 +12,7 @@ Provides details about a specific redshift cluster. ## Example Usage -```hcl +```terraform data "aws_redshift_cluster" "test_cluster" { cluster_identifier = "test-cluster" } diff --git a/website/docs/d/redshift_orderable_cluster.html.markdown b/website/docs/d/redshift_orderable_cluster.html.markdown index b22dd82f8df6..4cf7fdd9e38f 100644 --- a/website/docs/d/redshift_orderable_cluster.html.markdown +++ b/website/docs/d/redshift_orderable_cluster.html.markdown @@ -12,7 +12,7 @@ Information about Redshift Orderable Clusters and valid parameter combinations. ## Example Usage -```hcl +```terraform data "aws_redshift_orderable_cluster" "test" { cluster_type = "multi-node" preferred_node_types = ["dc2.large", "ds2.xlarge"] diff --git a/website/docs/d/redshift_service_account.html.markdown b/website/docs/d/redshift_service_account.html.markdown index 75a7658aa316..3716f6213d91 100644 --- a/website/docs/d/redshift_service_account.html.markdown +++ b/website/docs/d/redshift_service_account.html.markdown @@ -13,7 +13,7 @@ in a given region for the purpose of allowing Redshift to store audit data in S3 ## Example Usage -```hcl +```terraform data "aws_redshift_service_account" "main" {} resource "aws_s3_bucket" "bucket" { diff --git a/website/docs/d/region.html.markdown b/website/docs/d/region.html.markdown index 5a2de0f9ffd3..a1014c0564ed 100644 --- a/website/docs/d/region.html.markdown +++ b/website/docs/d/region.html.markdown @@ -20,7 +20,7 @@ configuration from its parent module. The following example shows how the resource might be used to obtain the name of the AWS region configured on the provider. -```hcl +```terraform data "aws_region" "current" {} ``` diff --git a/website/docs/d/regions.html.markdown b/website/docs/d/regions.html.markdown index b34b171dd104..bc597a62fe99 100644 --- a/website/docs/d/regions.html.markdown +++ b/website/docs/d/regions.html.markdown @@ -14,13 +14,13 @@ Provides information about AWS Regions. Can be used to filter regions i.e. by Op Enabled AWS Regions: -```hcl +```terraform data "aws_regions" "current" {} ``` All the regions regardless of the availability -```hcl +```terraform data "aws_regions" "current" { all_regions = true } @@ -28,7 +28,7 @@ data "aws_regions" "current" { To see regions that are filtered by `"not-opted-in"`, the `all_regions` argument needs to be set to `true` or no results will be returned. -```hcl +```terraform data "aws_regions" "current" { all_regions = true diff --git a/website/docs/d/route.html.markdown b/website/docs/d/route.html.markdown index 9ce2b8fedb99..bb2293c2c3a8 100644 --- a/website/docs/d/route.html.markdown +++ b/website/docs/d/route.html.markdown @@ -10,16 +10,13 @@ description: |- `aws_route` provides details about a specific Route. -This resource can prove useful when finding the resource -associated with a CIDR. For example, finding the peering -connection associated with a CIDR value. +This resource can prove useful when finding the resource associated with a CIDR. For example, finding the peering connection associated with a CIDR value. ## Example Usage -The following example shows how one might use a CIDR value to find a network interface id -and use this to create a data source of that network interface. +The following example shows how one might use a CIDR value to find a network interface id and use this to create a data source of that network interface. -```hcl +```terraform variable "subnet_id" {} data "aws_route_table" "selected" { @@ -38,33 +35,26 @@ data "aws_network_interface" "interface" { ## Argument Reference -The arguments of this data source act as filters for querying the available -Route in the current region. The given filters must match exactly one -Route whose data will be exported as attributes. +The arguments of this data source act as filters for querying the available Route in the current region. The given filters must match exactly oneRoute whose data will be exported as attributes. -* `route_table_id` - (Required) The id of the specific Route Table containing the Route entry. +The following arguments are required: -* `destination_cidr_block` - (Optional) The CIDR block of the Route belonging to the Route Table. +* `route_table_id` - (Required) The ID of the specific Route Table containing the Route entry. -* `destination_ipv6_cidr_block` - (Optional) The IPv6 CIDR block of the Route belonging to the Route Table. +The following arguments are optional: -* `egress_only_gateway_id` - (Optional) The Egress Only Gateway ID of the Route belonging to the Route Table. - -* `gateway_id` - (Optional) The Gateway ID of the Route belonging to the Route Table. - -* `instance_id` - (Optional) The Instance ID of the Route belonging to the Route Table. - -* `nat_gateway_id` - (Optional) The NAT Gateway ID of the Route belonging to the Route Table. - -* `local_gateway_id` - (Optional) The Local Gateway ID of the Route belonging to the Route Table. - -* `transit_gateway_id` - (Optional) The EC2 Transit Gateway ID of the Route belonging to the Route Table. - -* `vpc_peering_connection_id` - (Optional) The VPC Peering Connection ID of the Route belonging to the Route Table. - -* `network_interface_id` - (Optional) The Network Interface ID of the Route belonging to the Route Table. +* `carrier_gateway_id` - (Optional) EC2 Carrier Gateway ID of the Route belonging to the Route Table. +* `destination_cidr_block` - (Optional) CIDR block of the Route belonging to the Route Table. +* `destination_ipv6_cidr_block` - (Optional) IPv6 CIDR block of the Route belonging to the Route Table. +* `egress_only_gateway_id` - (Optional) Egress Only Gateway ID of the Route belonging to the Route Table. +* `gateway_id` - (Optional) Gateway ID of the Route belonging to the Route Table. +* `instance_id` - (Optional) Instance ID of the Route belonging to the Route Table. +* `local_gateway_id` - (Optional) Local Gateway ID of the Route belonging to the Route Table. +* `nat_gateway_id` - (Optional) NAT Gateway ID of the Route belonging to the Route Table. +* `network_interface_id` - (Optional) Network Interface ID of the Route belonging to the Route Table. +* `transit_gateway_id` - (Optional) EC2 Transit Gateway ID of the Route belonging to the Route Table. +* `vpc_peering_connection_id` - (Optional) VPC Peering Connection ID of the Route belonging to the Route Table. ## Attributes Reference -All of the argument attributes are also exported as -result attributes when there is data available. For example, the `vpc_peering_connection_id` field will be empty when the route is attached to a Network Interface. +All of the argument attributes are also exported as result attributes when there is data available. For example, the `vpc_peering_connection_id` field will be empty when the route is attached to a Network Interface. diff --git a/website/docs/d/route53_delegation_set.html.markdown b/website/docs/d/route53_delegation_set.html.markdown index 0b262490fefb..8e1c9b8591d7 100644 --- a/website/docs/d/route53_delegation_set.html.markdown +++ b/website/docs/d/route53_delegation_set.html.markdown @@ -16,7 +16,7 @@ This data source allows to find a list of name servers associated with a specifi The following example shows how to get a delegation set from its id. -```hcl +```terraform data "aws_route53_delegation_set" "dset" { id = "MQWGHCBFAKEID" } diff --git a/website/docs/d/route53_resolver_endpoint.html.markdown b/website/docs/d/route53_resolver_endpoint.html.markdown index f6a112ce300c..f6dc2fc2374d 100644 --- a/website/docs/d/route53_resolver_endpoint.html.markdown +++ b/website/docs/d/route53_resolver_endpoint.html.markdown @@ -14,13 +14,13 @@ This data source allows to find a list of IPaddresses associated with a specific ## Example Usage -```hcl +```terraform data "aws_route53_resolver_endpoint" "example" { resolver_endpoint_id = "rslvr-in-1abc2345ef678g91h" } ``` -```hcl +```terraform data "aws_route53_resolver_endpoint" "example" { filter { name = "NAME" diff --git a/website/docs/d/route53_resolver_rule.html.markdown b/website/docs/d/route53_resolver_rule.html.markdown index dff5a5b1e643..3b408cfc032f 100644 --- a/website/docs/d/route53_resolver_rule.html.markdown +++ b/website/docs/d/route53_resolver_rule.html.markdown @@ -14,7 +14,7 @@ description: |- The following example shows how to get a Route53 Resolver rule based on its associated domain name and rule type. -```hcl +```terraform data "aws_route53_resolver_rule" "example" { domain_name = "subdomain.example.com" rule_type = "SYSTEM" diff --git a/website/docs/d/route53_resolver_rules.html.markdown b/website/docs/d/route53_resolver_rules.html.markdown index dde2f13b6994..232f072f9b25 100644 --- a/website/docs/d/route53_resolver_rules.html.markdown +++ b/website/docs/d/route53_resolver_rules.html.markdown @@ -14,7 +14,7 @@ description: |- Retrieving the default resolver rule. -```hcl +```terraform data "aws_route53_resolver_rules" "example" { owner_id = "Route 53 Resolver" rule_type = "RECURSIVE" @@ -22,7 +22,7 @@ data "aws_route53_resolver_rules" "example" { } ``` -```hcl +```terraform data "aws_route53_resolver_rules" "example" { rule_type = "FORWARD" share_status = "SHARED_WITH_ME" diff --git a/website/docs/d/route53_zone.html.markdown b/website/docs/d/route53_zone.html.markdown index bcf14106c037..d5074f708f29 100644 --- a/website/docs/d/route53_zone.html.markdown +++ b/website/docs/d/route53_zone.html.markdown @@ -17,7 +17,7 @@ This data source allows to find a Hosted Zone ID given Hosted Zone name and cert The following example shows how to get a Hosted Zone from its name and from this data how to create a Record Set. -```hcl +```terraform data "aws_route53_zone" "selected" { name = "test.com." private_zone = true diff --git a/website/docs/d/route_table.html.markdown b/website/docs/d/route_table.html.markdown index b2f8caefd46e..d88999387fdb 100644 --- a/website/docs/d/route_table.html.markdown +++ b/website/docs/d/route_table.html.markdown @@ -16,7 +16,7 @@ This resource can prove useful when a module accepts a Subnet ID as an input var The following example shows how one might accept a Route Table ID as a variable and use this data source to obtain the data necessary to create a route. -```hcl +```terraform variable "subnet_id" {} data "aws_route_table" "selected" { diff --git a/website/docs/d/route_tables.html.markdown b/website/docs/d/route_tables.html.markdown index bb66ba77c0cd..98733cad730f 100644 --- a/website/docs/d/route_tables.html.markdown +++ b/website/docs/d/route_tables.html.markdown @@ -16,7 +16,7 @@ The following adds a route for a particular cidr block to every (private kops) route table in a specified vpc to use a particular vpc peering connection. -```hcl +```terraform data "aws_route_tables" "rts" { vpc_id = var.vpc_id diff --git a/website/docs/d/s3_bucket.html.markdown b/website/docs/d/s3_bucket.html.markdown index 17bf0742c320..f7f717a160b1 100644 --- a/website/docs/d/s3_bucket.html.markdown +++ b/website/docs/d/s3_bucket.html.markdown @@ -17,7 +17,7 @@ Distribution. ### Route53 Record -```hcl +```terraform data "aws_s3_bucket" "selected" { bucket = "bucket.test.com" } @@ -40,7 +40,7 @@ resource "aws_route53_record" "example" { ### CloudFront Origin -```hcl +```terraform data "aws_s3_bucket" "selected" { bucket = "a-test-bucket" } diff --git a/website/docs/d/s3_bucket_object.html.markdown b/website/docs/d/s3_bucket_object.html.markdown index dd305c107cbd..494f0217ca24 100644 --- a/website/docs/d/s3_bucket_object.html.markdown +++ b/website/docs/d/s3_bucket_object.html.markdown @@ -18,7 +18,7 @@ _optionally_ (see below) content of an object stored inside S3 bucket. The following example retrieves a text object (which must have a `Content-Type` value starting with `text/`) and uses it as the `user_data` for an EC2 instance: -```hcl +```terraform data "aws_s3_bucket_object" "bootstrap_script" { bucket = "ourcorp-deploy-config" key = "ec2-bootstrap-script.sh" @@ -37,7 +37,7 @@ to AWS Lambda for use as a function implementation. More information about Lambda functions is available in the documentation for [`aws_lambda_function`](/docs/providers/aws/r/lambda_function.html). -```hcl +```terraform data "aws_s3_bucket_object" "lambda" { bucket = "ourcorp-lambda-functions" key = "hello-world.zip" diff --git a/website/docs/d/s3_bucket_objects.html.markdown b/website/docs/d/s3_bucket_objects.html.markdown index eb467392e5f9..8e246023c1f9 100644 --- a/website/docs/d/s3_bucket_objects.html.markdown +++ b/website/docs/d/s3_bucket_objects.html.markdown @@ -16,7 +16,7 @@ The bucket-objects data source returns keys (i.e., file names) and other metadat The following example retrieves a list of all object keys in an S3 bucket and creates corresponding Terraform object data sources: -```hcl +```terraform data "aws_s3_bucket_objects" "my_objects" { bucket = "ourcorp" } diff --git a/website/docs/d/sagemaker_prebuilt_ecr_image.html.markdown b/website/docs/d/sagemaker_prebuilt_ecr_image.html.markdown index 229d47bf4905..39b057083fe7 100644 --- a/website/docs/d/sagemaker_prebuilt_ecr_image.html.markdown +++ b/website/docs/d/sagemaker_prebuilt_ecr_image.html.markdown @@ -16,7 +16,7 @@ Get information about prebuilt Amazon SageMaker Docker images. Basic usage: -```hcl +```terraform data "aws_sagemaker_prebuilt_ecr_image" "test" { repository_name = "sagemaker-scikit-learn" image_tag = "2.2-1.0.11.0" diff --git a/website/docs/d/secretsmanager_secret.html.markdown b/website/docs/d/secretsmanager_secret.html.markdown index eb886f19209f..d7f064d62771 100644 --- a/website/docs/d/secretsmanager_secret.html.markdown +++ b/website/docs/d/secretsmanager_secret.html.markdown @@ -14,7 +14,7 @@ Retrieve metadata information about a Secrets Manager secret. To retrieve a secr ### ARN -```hcl +```terraform data "aws_secretsmanager_secret" "by-arn" { arn = "arn:aws:secretsmanager:us-east-1:123456789012:secret:example-123456" } @@ -22,7 +22,7 @@ data "aws_secretsmanager_secret" "by-arn" { ### Name -```hcl +```terraform data "aws_secretsmanager_secret" "by-name" { name = "example" } diff --git a/website/docs/d/secretsmanager_secret_rotation.html.markdown b/website/docs/d/secretsmanager_secret_rotation.html.markdown index 23f641920bda..7f155187d895 100644 --- a/website/docs/d/secretsmanager_secret_rotation.html.markdown +++ b/website/docs/d/secretsmanager_secret_rotation.html.markdown @@ -14,7 +14,7 @@ Retrieve information about a Secrets Manager secret rotation. To retrieve secret ### Retrieve Secret Rotation Configuration -```hcl +```terraform data "aws_secretsmanager_secret_rotation" "example" { secret_id = data.aws_secretsmanager_secret.example.id } diff --git a/website/docs/d/secretsmanager_secret_version.html.markdown b/website/docs/d/secretsmanager_secret_version.html.markdown index 6cd6e930ef72..c3c218612471 100644 --- a/website/docs/d/secretsmanager_secret_version.html.markdown +++ b/website/docs/d/secretsmanager_secret_version.html.markdown @@ -16,7 +16,7 @@ Retrieve information about a Secrets Manager secret version, including its secre By default, this data sources retrieves information based on the `AWSCURRENT` staging label. -```hcl +```terraform data "aws_secretsmanager_secret_version" "example" { secret_id = data.aws_secretsmanager_secret.example.id } @@ -24,7 +24,7 @@ data "aws_secretsmanager_secret_version" "example" { ### Retrieve Specific Secret Version -```hcl +```terraform data "aws_secretsmanager_secret_version" "by-version-stage" { secret_id = data.aws_secretsmanager_secret.example.id version_stage = "example" @@ -35,7 +35,7 @@ data "aws_secretsmanager_secret_version" "by-version-stage" { Reading key-value pairs from JSON back into a native Terraform map can be accomplished in Terraform 0.12 and later with the [`jsondecode()` function](https://www.terraform.io/docs/configuration/functions/jsondecode.html): -```hcl +```terraform output "example" { value = jsondecode(data.aws_secretsmanager_secret_version.example.secret_string)["key1"] } diff --git a/website/docs/d/security_group.html.markdown b/website/docs/d/security_group.html.markdown index 181a2e517990..c9efe9aa0f2e 100644 --- a/website/docs/d/security_group.html.markdown +++ b/website/docs/d/security_group.html.markdown @@ -19,7 +19,7 @@ VPC that the security group belongs to. The following example shows how one might accept a Security Group id as a variable and use this data source to obtain the data necessary to create a subnet. -```hcl +```terraform variable "security_group_id" {} data "aws_security_group" "selected" { diff --git a/website/docs/d/security_groups.html.markdown b/website/docs/d/security_groups.html.markdown index 07c6f259133e..28aa0ee99e91 100644 --- a/website/docs/d/security_groups.html.markdown +++ b/website/docs/d/security_groups.html.markdown @@ -12,7 +12,7 @@ Use this data source to get IDs and VPC membership of Security Groups that are c ## Example Usage -```hcl +```terraform data "aws_security_groups" "test" { tags = { Application = "k8s" @@ -21,7 +21,7 @@ data "aws_security_groups" "test" { } ``` -```hcl +```terraform data "aws_security_groups" "test" { filter { name = "group-name" diff --git a/website/docs/d/serverlessapplicationrepository_application.html.markdown b/website/docs/d/serverlessapplicationrepository_application.html.markdown index 939c006e7813..7c45c8d3ac3d 100644 --- a/website/docs/d/serverlessapplicationrepository_application.html.markdown +++ b/website/docs/d/serverlessapplicationrepository_application.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information about an AWS Serverless Application Repo ## Example Usage -```hcl +```terraform data "aws_serverlessapplicationrepository_application" "example" { application_id = "arn:aws:serverlessrepo:us-east-1:123456789012:applications/ExampleApplication" } diff --git a/website/docs/d/servicequotas_service.html.markdown b/website/docs/d/servicequotas_service.html.markdown index c0716465c36e..a3d593d833e9 100644 --- a/website/docs/d/servicequotas_service.html.markdown +++ b/website/docs/d/servicequotas_service.html.markdown @@ -12,7 +12,7 @@ Retrieve information about a Service Quotas Service. ## Example Usage -```hcl +```terraform data "aws_servicequotas_service" "example" { service_name = "Amazon Virtual Private Cloud (Amazon VPC)" } diff --git a/website/docs/d/servicequotas_service_quota.html.markdown b/website/docs/d/servicequotas_service_quota.html.markdown index 928ef0d5f582..a92ce39eebc1 100644 --- a/website/docs/d/servicequotas_service_quota.html.markdown +++ b/website/docs/d/servicequotas_service_quota.html.markdown @@ -12,7 +12,7 @@ Retrieve information about a Service Quota. ## Example Usage -```hcl +```terraform data "aws_servicequotas_service_quota" "by_quota_code" { quota_code = "L-F678F1CE" service_code = "vpc" diff --git a/website/docs/d/sfn_activity.html.markdown b/website/docs/d/sfn_activity.html.markdown index 365c576c63c4..99311462731d 100644 --- a/website/docs/d/sfn_activity.html.markdown +++ b/website/docs/d/sfn_activity.html.markdown @@ -12,7 +12,7 @@ Provides a Step Functions Activity data source ## Example Usage -```hcl +```terraform data "aws_sfn_activity" "sfn_activity" { name = "my-activity" } diff --git a/website/docs/d/sfn_state_machine.html.markdown b/website/docs/d/sfn_state_machine.html.markdown index f418cbea4195..386f202646da 100644 --- a/website/docs/d/sfn_state_machine.html.markdown +++ b/website/docs/d/sfn_state_machine.html.markdown @@ -14,7 +14,7 @@ state machine without having to hard code the ARNs as input. ## Example Usage -```hcl +```terraform data "aws_sfn_state_machine" "example" { name = "an_example_sfn_name" } diff --git a/website/docs/d/signer_signing_job.html.markdown b/website/docs/d/signer_signing_job.html.markdown index f85077e07245..672f46e7b599 100644 --- a/website/docs/d/signer_signing_job.html.markdown +++ b/website/docs/d/signer_signing_job.html.markdown @@ -12,7 +12,7 @@ Provides information about a Signer Signing Job. ## Example Usage -```hcl +```terraform data "aws_signer_signing_job" "build_signing_job" { job_id = "9ed7e5c3-b8d4-4da0-8459-44e0b068f7ee" } diff --git a/website/docs/d/signer_signing_profile.html.markdown b/website/docs/d/signer_signing_profile.html.markdown index 7f3787b3893d..878124b36516 100644 --- a/website/docs/d/signer_signing_profile.html.markdown +++ b/website/docs/d/signer_signing_profile.html.markdown @@ -12,7 +12,7 @@ Provides information about a Signer Signing Profile. ## Example Usage -```hcl +```terraform data "aws_signer_signing_profile" "production_signing_profile" { name = "prod_profile_DdW3Mk1foYL88fajut4mTVFGpuwfd4ACO6ANL0D1uIj7lrn8adK" } diff --git a/website/docs/d/sns_topic.html.markdown b/website/docs/d/sns_topic.html.markdown index c7a92d1447b4..793c204401bb 100644 --- a/website/docs/d/sns_topic.html.markdown +++ b/website/docs/d/sns_topic.html.markdown @@ -14,7 +14,7 @@ without having to hard code the ARNs as input. ## Example Usage -```hcl +```terraform data "aws_sns_topic" "example" { name = "an_example_topic" } diff --git a/website/docs/d/sqs_queue.html.markdown b/website/docs/d/sqs_queue.html.markdown index dbf846b0528c..67e2779afb50 100644 --- a/website/docs/d/sqs_queue.html.markdown +++ b/website/docs/d/sqs_queue.html.markdown @@ -14,7 +14,7 @@ the ARNs as input. ## Example Usage -```hcl +```terraform data "aws_sqs_queue" "example" { name = "queue" } diff --git a/website/docs/d/ssm_document.html.markdown b/website/docs/d/ssm_document.html.markdown index 697afdd700ec..b467a0d78abf 100644 --- a/website/docs/d/ssm_document.html.markdown +++ b/website/docs/d/ssm_document.html.markdown @@ -14,7 +14,7 @@ Gets the contents of the specified Systems Manager document. To get the contents of the document owned by AWS. -```hcl +```terraform data "aws_ssm_document" "foo" { name = "AWS-GatherSoftwareInventory" document_format = "YAML" @@ -27,7 +27,7 @@ output "content" { To get the contents of the custom document. -```hcl +```terraform data "aws_ssm_document" "test" { name = aws_ssm_document.test.name document_format = "JSON" diff --git a/website/docs/d/ssm_parameter.html.markdown b/website/docs/d/ssm_parameter.html.markdown index 44ea48185dda..1508f99b6c1d 100644 --- a/website/docs/d/ssm_parameter.html.markdown +++ b/website/docs/d/ssm_parameter.html.markdown @@ -12,7 +12,7 @@ Provides an SSM Parameter data source. ## Example Usage -```hcl +```terraform data "aws_ssm_parameter" "foo" { name = "foo" } diff --git a/website/docs/d/ssm_patch_baseline.html.markdown b/website/docs/d/ssm_patch_baseline.html.markdown index a1dc49dc2f3d..bf1ba81979ba 100644 --- a/website/docs/d/ssm_patch_baseline.html.markdown +++ b/website/docs/d/ssm_patch_baseline.html.markdown @@ -14,7 +14,7 @@ Provides an SSM Patch Baseline data source. Useful if you wish to reuse the defa To retrieve a baseline provided by AWS: -```hcl +```terraform data "aws_ssm_patch_baseline" "centos" { owner = "AWS" name_prefix = "AWS-" @@ -24,7 +24,7 @@ data "aws_ssm_patch_baseline" "centos" { To retrieve a baseline on your account: -```hcl +```terraform data "aws_ssm_patch_baseline" "default_custom" { owner = "Self" name_prefix = "MyCustomBaseline" diff --git a/website/docs/d/ssoadmin_instances.html.markdown b/website/docs/d/ssoadmin_instances.html.markdown index b8d55b5e1cb9..951c470706ea 100644 --- a/website/docs/d/ssoadmin_instances.html.markdown +++ b/website/docs/d/ssoadmin_instances.html.markdown @@ -12,7 +12,7 @@ Use this data source to get ARNs and Identity Store IDs of Single Sign-On (SSO) ## Example Usage -```hcl +```terraform data "aws_ssoadmin_instances" "example" {} output "arn" { diff --git a/website/docs/d/ssoadmin_permission_set.html.markdown b/website/docs/d/ssoadmin_permission_set.html.markdown index 18d34fde3908..3b74a41b826d 100644 --- a/website/docs/d/ssoadmin_permission_set.html.markdown +++ b/website/docs/d/ssoadmin_permission_set.html.markdown @@ -12,7 +12,7 @@ Use this data source to get a Single Sign-On (SSO) Permission Set. ## Example Usage -```hcl +```terraform data "aws_ssoadmin_instances" "example" {} data "aws_ssoadmin_permission_set" "example" { diff --git a/website/docs/d/storagegateway_local_disk.html.markdown b/website/docs/d/storagegateway_local_disk.html.markdown index 34b107d2d10d..d9ecb852be3d 100644 --- a/website/docs/d/storagegateway_local_disk.html.markdown +++ b/website/docs/d/storagegateway_local_disk.html.markdown @@ -12,7 +12,7 @@ Retrieve information about a Storage Gateway local disk. The disk identifier is ## Example Usage -```hcl +```terraform data "aws_storagegateway_local_disk" "test" { disk_path = aws_volume_attachment.test.device_name gateway_arn = aws_storagegateway_gateway.test.arn diff --git a/website/docs/d/subnet.html.markdown b/website/docs/d/subnet.html.markdown index 4fe5e29b0f44..f9335a75a304 100644 --- a/website/docs/d/subnet.html.markdown +++ b/website/docs/d/subnet.html.markdown @@ -16,7 +16,7 @@ This resource can prove useful when a module accepts a subnet ID as an input var The following example shows how one might accept a subnet ID as a variable and use this data source to obtain the data necessary to create a security group that allows connections from hosts in that subnet. -```hcl +```terraform variable "subnet_id" {} data "aws_subnet" "selected" { @@ -39,7 +39,7 @@ resource "aws_security_group" "subnet" { If you want to match against tag `Name`, use: -```hcl +```terraform data "aws_subnet" "selected" { filter { name = "tag:Name" diff --git a/website/docs/d/subnet_ids.html.markdown b/website/docs/d/subnet_ids.html.markdown index 1be3a96df844..a69a6323fa9e 100644 --- a/website/docs/d/subnet_ids.html.markdown +++ b/website/docs/d/subnet_ids.html.markdown @@ -16,7 +16,7 @@ This resource can be useful for getting back a set of subnet ids for a vpc. The following shows outputing all cidr blocks for every subnet id in a vpc. -```hcl +```terraform data "aws_subnet_ids" "example" { vpc_id = var.vpc_id } @@ -35,7 +35,7 @@ The following example retrieves a set of all subnets in a VPC with a custom tag of `Tier` set to a value of "Private" so that the `aws_instance` resource can loop through the subnets, putting instances across availability zones. -```hcl +```terraform data "aws_subnet_ids" "private" { vpc_id = var.vpc_id @@ -68,7 +68,7 @@ which take the following arguments: [the underlying AWS API](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSubnets.html). For example, if matching against tag `Name`, use: -```hcl +```terraform data "aws_subnet_ids" "selected" { filter { name = "tag:Name" diff --git a/website/docs/d/transfer_server.html.markdown b/website/docs/d/transfer_server.html.markdown index c2f1116a2b50..40d0e8d4819b 100644 --- a/website/docs/d/transfer_server.html.markdown +++ b/website/docs/d/transfer_server.html.markdown @@ -13,7 +13,7 @@ resources. ## Example Usage -```hcl +```terraform data "aws_transfer_server" "example" { server_id = "s-1234567" } diff --git a/website/docs/d/vpc.html.markdown b/website/docs/d/vpc.html.markdown index d90b2b6f957c..d121ae321843 100644 --- a/website/docs/d/vpc.html.markdown +++ b/website/docs/d/vpc.html.markdown @@ -20,7 +20,7 @@ The following example shows how one might accept a VPC id as a variable and use this data source to obtain the data necessary to create a subnet within it. -```hcl +```terraform variable "vpc_id" {} data "aws_vpc" "selected" { diff --git a/website/docs/d/vpc_dhcp_options.html.markdown b/website/docs/d/vpc_dhcp_options.html.markdown index f3942d9d7ea7..cce98124771b 100644 --- a/website/docs/d/vpc_dhcp_options.html.markdown +++ b/website/docs/d/vpc_dhcp_options.html.markdown @@ -14,7 +14,7 @@ Retrieve information about an EC2 DHCP Options configuration. ### Lookup by DHCP Options ID -```hcl +```terraform data "aws_vpc_dhcp_options" "example" { dhcp_options_id = "dopts-12345678" } @@ -22,7 +22,7 @@ data "aws_vpc_dhcp_options" "example" { ### Lookup by Filter -```hcl +```terraform data "aws_vpc_dhcp_options" "example" { filter { name = "key" diff --git a/website/docs/d/vpc_endpoint.html.markdown b/website/docs/d/vpc_endpoint.html.markdown index ef9d3a032e74..b43aa2f73d8e 100644 --- a/website/docs/d/vpc_endpoint.html.markdown +++ b/website/docs/d/vpc_endpoint.html.markdown @@ -13,7 +13,7 @@ a specific VPC endpoint. ## Example Usage -```hcl +```terraform # Declare the data source data "aws_vpc_endpoint" "s3" { vpc_id = aws_vpc.foo.id diff --git a/website/docs/d/vpc_endpoint_service.html.markdown b/website/docs/d/vpc_endpoint_service.html.markdown index 201da1070cda..30be4a509879 100644 --- a/website/docs/d/vpc_endpoint_service.html.markdown +++ b/website/docs/d/vpc_endpoint_service.html.markdown @@ -15,7 +15,7 @@ can be specified when creating a VPC endpoint within the region configured in th ### AWS Service -```hcl +```terraform # Declare the data source data "aws_vpc_endpoint_service" "s3" { service = "s3" @@ -36,7 +36,7 @@ resource "aws_vpc_endpoint" "ep" { ### Non-AWS Service -```hcl +```terraform data "aws_vpc_endpoint_service" "custome" { service_name = "com.amazonaws.vpce.us-west-2.vpce-svc-0e87519c997c63cd8" } @@ -44,7 +44,7 @@ data "aws_vpc_endpoint_service" "custome" { ### Filter -```hcl +```terraform data "aws_vpc_endpoint_service" "test" { filter { name = "service-name" diff --git a/website/docs/d/vpc_peering_connection.html.markdown b/website/docs/d/vpc_peering_connection.html.markdown index 568e6095685b..f185329d586a 100644 --- a/website/docs/d/vpc_peering_connection.html.markdown +++ b/website/docs/d/vpc_peering_connection.html.markdown @@ -13,7 +13,7 @@ a specific VPC peering connection. ## Example Usage -```hcl +```terraform # Declare the data source data "aws_vpc_peering_connection" "pc" { vpc_id = aws_vpc.foo.id diff --git a/website/docs/d/vpc_peering_connections.html.markdown b/website/docs/d/vpc_peering_connections.html.markdown index 5942ba9cf904..8b7fa6db4aa0 100644 --- a/website/docs/d/vpc_peering_connections.html.markdown +++ b/website/docs/d/vpc_peering_connections.html.markdown @@ -16,7 +16,7 @@ the data source, as noted in [issue 4149](https://github.com/hashicorp/terraform ## Example Usage -```hcl +```terraform # Declare the data source data "aws_vpc_peering_connections" "pcs" { filter { diff --git a/website/docs/d/vpcs.html.markdown b/website/docs/d/vpcs.html.markdown index c0f0e99619c5..56b26fcc18a2 100644 --- a/website/docs/d/vpcs.html.markdown +++ b/website/docs/d/vpcs.html.markdown @@ -16,7 +16,7 @@ The following example retrieves a list of VPC Ids with a custom tag of `service` The following shows outputing all VPC Ids. -```hcl +```terraform data "aws_vpcs" "foo" { tags = { service = "production" @@ -30,7 +30,7 @@ output "foo" { An example use case would be interpolate the `aws_vpcs` output into `count` of an aws_flow_log resource. -```hcl +```terraform data "aws_vpcs" "foo" {} data "aws_vpc" "foo" { diff --git a/website/docs/d/vpn_gateway.html.markdown b/website/docs/d/vpn_gateway.html.markdown index 22bf57836763..b9460ec21199 100644 --- a/website/docs/d/vpn_gateway.html.markdown +++ b/website/docs/d/vpn_gateway.html.markdown @@ -13,7 +13,7 @@ a specific VPN gateway. ## Example Usage -```hcl +```terraform data "aws_vpn_gateway" "selected" { filter { name = "tag:Name" diff --git a/website/docs/d/waf_ipset.html.markdown b/website/docs/d/waf_ipset.html.markdown index 11af5b0ced5a..c27cac214e2b 100644 --- a/website/docs/d/waf_ipset.html.markdown +++ b/website/docs/d/waf_ipset.html.markdown @@ -12,7 +12,7 @@ description: |- ## Example Usage -```hcl +```terraform data "aws_waf_ipset" "example" { name = "tfWAFIPSet" } diff --git a/website/docs/d/waf_rate_based_rule.html.markdown b/website/docs/d/waf_rate_based_rule.html.markdown index b9d7ecac66ee..e3df41216485 100644 --- a/website/docs/d/waf_rate_based_rule.html.markdown +++ b/website/docs/d/waf_rate_based_rule.html.markdown @@ -12,7 +12,7 @@ description: |- ## Example Usage -```hcl +```terraform data "aws_waf_rate_based_rule" "example" { name = "tfWAFRateBasedRule" } diff --git a/website/docs/d/waf_rule.html.markdown b/website/docs/d/waf_rule.html.markdown index 6e440fa8002a..32681f694e8e 100644 --- a/website/docs/d/waf_rule.html.markdown +++ b/website/docs/d/waf_rule.html.markdown @@ -12,7 +12,7 @@ description: |- ## Example Usage -```hcl +```terraform data "aws_waf_rule" "example" { name = "tfWAFRule" } diff --git a/website/docs/d/waf_web_acl.html.markdown b/website/docs/d/waf_web_acl.html.markdown index ee2b962cc33e..69cc53baef2e 100644 --- a/website/docs/d/waf_web_acl.html.markdown +++ b/website/docs/d/waf_web_acl.html.markdown @@ -12,7 +12,7 @@ description: |- ## Example Usage -```hcl +```terraform data "aws_waf_web_acl" "example" { name = "tfWAFWebACL" } diff --git a/website/docs/d/wafregional_ipset.html.markdown b/website/docs/d/wafregional_ipset.html.markdown index 503900da75a6..9814ed711fc2 100644 --- a/website/docs/d/wafregional_ipset.html.markdown +++ b/website/docs/d/wafregional_ipset.html.markdown @@ -12,7 +12,7 @@ description: |- ## Example Usage -```hcl +```terraform data "aws_wafregional_ipset" "example" { name = "tfWAFRegionalIPSet" } diff --git a/website/docs/d/wafregional_rate_based_rule.html.markdown b/website/docs/d/wafregional_rate_based_rule.html.markdown index 53328e9407d5..15665626ec7d 100644 --- a/website/docs/d/wafregional_rate_based_rule.html.markdown +++ b/website/docs/d/wafregional_rate_based_rule.html.markdown @@ -12,7 +12,7 @@ description: |- ## Example Usage -```hcl +```terraform data "aws_wafregional_rate_based_rule" "example" { name = "tfWAFRegionalRateBasedRule" } diff --git a/website/docs/d/wafregional_rule.html.markdown b/website/docs/d/wafregional_rule.html.markdown index 089619ec1f26..5f9861dd0697 100644 --- a/website/docs/d/wafregional_rule.html.markdown +++ b/website/docs/d/wafregional_rule.html.markdown @@ -12,7 +12,7 @@ description: |- ## Example Usage -```hcl +```terraform data "aws_wafregional_rule" "example" { name = "tfWAFRegionalRule" } diff --git a/website/docs/d/wafregional_web_acl.html.markdown b/website/docs/d/wafregional_web_acl.html.markdown index fc80483cb330..2b5370511a29 100644 --- a/website/docs/d/wafregional_web_acl.html.markdown +++ b/website/docs/d/wafregional_web_acl.html.markdown @@ -12,7 +12,7 @@ description: |- ## Example Usage -```hcl +```terraform data "aws_wafregional_web_acl" "example" { name = "tfWAFRegionalWebACL" } diff --git a/website/docs/d/wafv2_ip_set.html.markdown b/website/docs/d/wafv2_ip_set.html.markdown index 7991878ddeaf..d24e5a671547 100644 --- a/website/docs/d/wafv2_ip_set.html.markdown +++ b/website/docs/d/wafv2_ip_set.html.markdown @@ -12,7 +12,7 @@ Retrieves the summary of a WAFv2 IP Set. ## Example Usage -```hcl +```terraform data "aws_wafv2_ip_set" "example" { name = "some-ip-set" scope = "REGIONAL" diff --git a/website/docs/d/wafv2_regex_pattern_set.html.markdown b/website/docs/d/wafv2_regex_pattern_set.html.markdown index 43c4db2bfec6..ce4a11193923 100644 --- a/website/docs/d/wafv2_regex_pattern_set.html.markdown +++ b/website/docs/d/wafv2_regex_pattern_set.html.markdown @@ -12,7 +12,7 @@ Retrieves the summary of a WAFv2 Regex Pattern Set. ## Example Usage -```hcl +```terraform data "aws_wafv2_regex_pattern_set" "example" { name = "some-regex-pattern-set" scope = "REGIONAL" diff --git a/website/docs/d/wafv2_rule_group.html.markdown b/website/docs/d/wafv2_rule_group.html.markdown index a3a72a9e3c4d..aaa48143065b 100644 --- a/website/docs/d/wafv2_rule_group.html.markdown +++ b/website/docs/d/wafv2_rule_group.html.markdown @@ -12,7 +12,7 @@ Retrieves the summary of a WAFv2 Rule Group. ## Example Usage -```hcl +```terraform data "aws_wafv2_rule_group" "example" { name = "some-rule-group" scope = "REGIONAL" diff --git a/website/docs/d/wafv2_web_acl.html.markdown b/website/docs/d/wafv2_web_acl.html.markdown index caaa3b6aa7cf..77522675a1a8 100644 --- a/website/docs/d/wafv2_web_acl.html.markdown +++ b/website/docs/d/wafv2_web_acl.html.markdown @@ -12,7 +12,7 @@ Retrieves the summary of a WAFv2 Web ACL. ## Example Usage -```hcl +```terraform data "aws_wafv2_web_acl" "example" { name = "some-web-acl" scope = "REGIONAL" diff --git a/website/docs/d/workspaces_bundle.html.markdown b/website/docs/d/workspaces_bundle.html.markdown index 349874b98d28..cfe032e65f67 100644 --- a/website/docs/d/workspaces_bundle.html.markdown +++ b/website/docs/d/workspaces_bundle.html.markdown @@ -14,7 +14,7 @@ Retrieve information about an AWS WorkSpaces bundle. ### By ID -```hcl +```terraform data "aws_workspaces_bundle" "example" { bundle_id = "wsb-b0s22j3d7" } @@ -22,7 +22,7 @@ data "aws_workspaces_bundle" "example" { ### By Owner & Name -```hcl +```terraform data "aws_workspaces_bundle" "example" { owner = "AMAZON" name = "Value with Windows 10 and Office 2016" diff --git a/website/docs/d/workspaces_directory.html.markdown b/website/docs/d/workspaces_directory.html.markdown index 0ed407e3e172..dc0bddb356ab 100644 --- a/website/docs/d/workspaces_directory.html.markdown +++ b/website/docs/d/workspaces_directory.html.markdown @@ -12,7 +12,7 @@ Retrieve information about an AWS WorkSpaces directory. ## Example Usage -```hcl +```terraform data "aws_workspaces_directory" "example" { directory_id = "d-9067783251" } diff --git a/website/docs/d/workspaces_image.html.markdown b/website/docs/d/workspaces_image.html.markdown index 107a80eb463b..38d00ae5c2ea 100644 --- a/website/docs/d/workspaces_image.html.markdown +++ b/website/docs/d/workspaces_image.html.markdown @@ -12,7 +12,7 @@ Use this data source to get information about a Workspaces image. ## Example Usage -```hcl +```terraform data aws_workspaces_image example { image_id = "wsi-ten5h0y19" } diff --git a/website/docs/d/workspaces_workspace.html.markdown b/website/docs/d/workspaces_workspace.html.markdown index eb49085ded0c..df923bd0e100 100644 --- a/website/docs/d/workspaces_workspace.html.markdown +++ b/website/docs/d/workspaces_workspace.html.markdown @@ -14,7 +14,7 @@ Use this data source to get information about a workspace in [AWS Workspaces](ht ### Filter By Workspace ID -```hcl +```terraform data "aws_workspaces_workspace" "example" { workspace_id = "ws-cj5xcxsz5" } @@ -22,7 +22,7 @@ data "aws_workspaces_workspace" "example" { ### Filter By Directory ID & User Name -```hcl +```terraform data "aws_workspaces_workspace" "example" { directory_id = "d-9967252f57" user_name = "Example" diff --git a/website/docs/guides/custom-service-endpoints.html.md b/website/docs/guides/custom-service-endpoints.html.md index 8d42da3429ae..5dbefb8ff78e 100644 --- a/website/docs/guides/custom-service-endpoints.html.md +++ b/website/docs/guides/custom-service-endpoints.html.md @@ -28,7 +28,7 @@ This guide outlines how to get started with customizing endpoints, the available To configure the Terraform AWS Provider to use customized endpoints, it can be done within `provider` declarations using the `endpoints` configuration block, e.g. -```hcl +```terraform provider "aws" { # ... potentially other provider configuration ... @@ -65,6 +65,7 @@ The Terraform AWS Provider allows the following endpoints to be customized:
  • appstream
  • appsync
  • athena
  • +
  • auditmanager
  • autoscaling
  • autoscalingplans
  • backup
  • @@ -221,7 +222,7 @@ The Amazon DynamoDB service offers a downloadable version for writing and testin An example provider configuration: -```hcl +```terraform provider "aws" { access_key = "mock_access_key" region = "us-east-1" @@ -242,7 +243,7 @@ provider "aws" { An example provider configuration: -```hcl +```terraform provider "aws" { access_key = "mock_access_key" region = "us-east-1" diff --git a/website/docs/guides/resource-tagging.html.md b/website/docs/guides/resource-tagging.html.md index f28afb7186c4..84412895c86f 100644 --- a/website/docs/guides/resource-tagging.html.md +++ b/website/docs/guides/resource-tagging.html.md @@ -26,7 +26,7 @@ Many AWS services implement [resource tags](https://docs.aws.amazon.com/general/ Terraform AWS Provider resources that support resource tags implement a consistent argument named `tags` which accepts a key-value map, e.g. -```hcl +```terraform resource "aws_vpc" "example" { # ... other configuration ... @@ -40,7 +40,7 @@ The tags for the resource are wholly managed by Terraform except tag keys beginn For most environments and use cases, this is the typical implementation pattern, whether it be in a standalone Terraform configuration or within a [Terraform Module](https://www.terraform.io/docs/modules/). The Terraform configuration language also enables less repetitive configurations via [variables](https://www.terraform.io/docs/configuration/variables.html), [locals](https://www.terraform.io/docs/configuration/locals.html), or potentially a combination of these, e.g. -```hcl +```terraform # Terraform 0.12 and later syntax variable "additional_tags" { default = {} @@ -71,7 +71,7 @@ All Terraform resources support the [`lifecycle` configuration block `ignore_cha In this example, the `Name` tag will be added to the VPC on resource creation, however any external changes to the `Name` tag value or the addition/removal of any tag (including the `Name` tag) will be ignored: -```hcl +```terraform # Terraform 0.12 and later syntax resource "aws_vpc" "example" { # ... other configuration ... @@ -88,7 +88,7 @@ resource "aws_vpc" "example" { In this example, the `Name` and `Owner` tags will be added to the VPC on resource creation, however any external changes to the value of the `Name` tag will be ignored while any changes to other tags (including the `Owner` tag and any additions) will still be proposed: -```hcl +```terraform # Terraform 0.12 and later syntax resource "aws_vpc" "example" { # ... other configuration ... @@ -110,7 +110,7 @@ As of version 2.60.0 of the Terraform AWS Provider, there is support for ignorin In this example, all resources will ignore any addition of the `LastScanned` tag: -```hcl +```terraform provider "aws" { # ... potentially other configuration ... @@ -122,7 +122,7 @@ provider "aws" { In this example, all resources will ignore any addition of tags with the `kubernetes.io/` prefix, such as `kubernetes.io/cluster/name` or `kubernetes.io/role/elb`: -```hcl +```terraform provider "aws" { # ... potentially other configuration ... @@ -144,7 +144,7 @@ Certain Terraform AWS Provider services support a special resource for managing -> Not all services supported by the Terraform AWS Provider implement these resources. Browse the Terraform AWS Provider resource documentation pages for a resource with a type ending in `_tag`. If there is a use case where this type of resource is missing, a [feature request](https://github.com/hashicorp/terraform-provider-aws/issues/new?labels=enhancement&template=Feature_Request.md) can be submitted. -```hcl +```terraform # Terraform 0.12 and later syntax # ... other configuration ... @@ -157,7 +157,7 @@ resource "aws_ec2_tag" "example" { To manage multiple tags for a resource in this scenario, [`for_each`](https://www.terraform.io/docs/configuration/meta-arguments/for_each.html) can be used: -```hcl +```terraform # Terraform 0.12 and later syntax # ... other configuration ... diff --git a/website/docs/guides/version-2-upgrade.html.md b/website/docs/guides/version-2-upgrade.html.md index 090f198a800f..51d654a7b262 100644 --- a/website/docs/guides/version-2-upgrade.html.md +++ b/website/docs/guides/version-2-upgrade.html.md @@ -59,7 +59,7 @@ It is recommended to use [version constraints when configuring Terraform provide Update to latest 1.X version: -```hcl +```terraform provider "aws" { # ... other configuration ... @@ -69,7 +69,7 @@ provider "aws" { Update to latest 2.X version: -```hcl +```terraform provider "aws" { # ... other configuration ... @@ -87,7 +87,7 @@ The provider will now return an error to ensure operators understand the implica If necessary, the AWS account ID lookup logic can be skipped via: -```hcl +```terraform provider "aws" { # ... other configuration ... @@ -134,7 +134,7 @@ Terraform configuration migration steps: As an example, lets take the below sample configuration and migrate it. -```hcl +```terraform # Below example configuration will not be supported in Terraform AWS provider version 2.0.0 data "aws_kms_secret" "example" { @@ -162,7 +162,7 @@ Notice that the `aws_kms_secret` data source previously was taking the two `secr Updating the sample configuration from above: -```hcl +```terraform data "aws_kms_secrets" "example" { secret { # ... potentially other configuration ... @@ -207,7 +207,7 @@ Since the API Gateway usage plans feature was launched on August 11, 2016, usage For example, given this previous configuration: -```hcl +```terraform resource "aws_api_gateway_rest_api" "example" { name = "example" } @@ -229,7 +229,7 @@ resource "aws_api_gateway_api_key" "example" { An updated configuration: -```hcl +```terraform resource "aws_api_gateway_rest_api" "example" { name = "example" } @@ -267,7 +267,7 @@ Switch your Terraform configuration to the `request_parameters` argument instead For example, given this previous configuration: -```hcl +```terraform resource "aws_api_gateway_integration" "example" { # ... other configuration ... @@ -281,7 +281,7 @@ PARAMS An updated configuration: -```hcl +```terraform resource "aws_api_gateway_integration" "example" { # ... other configuration ... @@ -299,7 +299,7 @@ Switch your Terraform configuration to the `response_parameters` argument instea For example, given this previous configuration: -```hcl +```terraform resource "aws_api_gateway_integration_response" "example" { # ... other configuration ... @@ -313,7 +313,7 @@ PARAMS An updated configuration: -```hcl +```terraform resource "aws_api_gateway_integration_response" "example" { # ... other configuration ... @@ -331,7 +331,7 @@ Switch your Terraform configuration to the `request_parameters` argument instead For example, given this previous configuration: -```hcl +```terraform resource "aws_api_gateway_method" "example" { # ... other configuration ... @@ -346,7 +346,7 @@ PARAMS An updated configuration: -```hcl +```terraform resource "aws_api_gateway_method" "example" { # ... other configuration ... @@ -365,7 +365,7 @@ Switch your Terraform configuration to the `response_parameters` argument instea For example, given this previous configuration: -```hcl +```terraform resource "aws_api_gateway_method_response" "example" { # ... other configuration ... @@ -379,7 +379,7 @@ PARAMS An updated configuration: -```hcl +```terraform resource "aws_api_gateway_method_response" "example" { # ... other configuration ... @@ -403,7 +403,7 @@ The following arguments have been moved into a nested argument named `step_scali For example, given this previous configuration: -```hcl +```terraform resource "aws_appautoscaling_policy" "example" { # ... other configuration ... @@ -420,7 +420,7 @@ resource "aws_appautoscaling_policy" "example" { An updated configuration: -```hcl +```terraform resource "aws_appautoscaling_policy" "example" { # ... other configuration ... @@ -445,7 +445,7 @@ Switch your Terraform configuration to the `min_adjustment_magnitude` argument i For example, given this previous configuration: -```hcl +```terraform resource "aws_autoscaling_policy" "example" { # ... other configuration ... @@ -455,7 +455,7 @@ resource "aws_autoscaling_policy" "example" { An updated configuration: -```hcl +```terraform resource "aws_autoscaling_policy" "example" { # ... other configuration ... @@ -477,7 +477,7 @@ Switch your Terraform configuration to the `ordered_cache_behavior` argument ins For example, given this previous configuration: -```hcl +```terraform resource "aws_cloudfront_distribution" "example" { # ... other configuration ... @@ -493,7 +493,7 @@ resource "aws_cloudfront_distribution" "example" { An updated configuration: -```hcl +```terraform resource "aws_cloudfront_distribution" "example" { # ... other configuration ... @@ -532,7 +532,7 @@ Default connections have been removed as part of LAG creation. To migrate your T For example, given this previous configuration: -```hcl +```terraform resource "aws_dx_lag" "example" { name = "example" connections_bandwidth = "1Gbps" @@ -543,7 +543,7 @@ resource "aws_dx_lag" "example" { An updated configuration: -```hcl +```terraform resource "aws_dx_connection" "example" { name = "example" bandwidth = "1Gbps" @@ -570,7 +570,7 @@ Switch your Terraform configuration to the `ordered_placement_strategy` argument For example, given this previous configuration: -```hcl +```terraform resource "aws_ecs_service" "example" { # ... other configuration ... @@ -586,7 +586,7 @@ resource "aws_ecs_service" "example" { An updated configuration: -```hcl +```terraform resource "aws_ecs_service" "example" { # ... other configuration ... @@ -608,7 +608,7 @@ Switch your Terraform configuration to the `creation_token` argument instead. For example, given this previous configuration: -```hcl +```terraform resource "aws_efs_file_system" "example" { # ... other configuration ... @@ -618,7 +618,7 @@ resource "aws_efs_file_system" "example" { An updated configuration: -```hcl +```terraform resource "aws_efs_file_system" "example" { # ... other configuration ... @@ -634,7 +634,7 @@ Switch your Terraform configuration to the `preferred_availability_zones` argume For example, given this previous configuration: -```hcl +```terraform resource "aws_elasticache_cluster" "example" { # ... other configuration ... @@ -644,7 +644,7 @@ resource "aws_elasticache_cluster" "example" { An updated configuration: -```hcl +```terraform resource "aws_elasticache_cluster" "example" { # ... other configuration ... @@ -688,7 +688,7 @@ Switch your Terraform configuration to the `subnet_ids` argument instead. For example, given this previous configuration: -```hcl +```terraform resource "aws_network_acl" "example" { # ... other configuration ... @@ -698,7 +698,7 @@ resource "aws_network_acl" "example" { An updated configuration: -```hcl +```terraform resource "aws_network_acl" "example" { # ... other configuration ... @@ -718,7 +718,7 @@ The following arguments have been moved into a nested argument named `logging`: For example, given this previous configuration: -```hcl +```terraform resource "aws_redshift_cluster" "example" { # ... other configuration ... @@ -730,7 +730,7 @@ resource "aws_redshift_cluster" "example" { An updated configuration: -```hcl +```terraform resource "aws_redshift_cluster" "example" { # ... other configuration ... @@ -758,7 +758,7 @@ The resource now requires existing Route 53 Records to be imported into the Terr For example, if the `www.example.com` Route 53 Record in the `example.com` Route 53 Hosted Zone existed previously and this new Terraform configuration was introduced: -```hcl +```terraform resource "aws_route53_record" "www" { # ... other configuration ... name = "www.example.com" @@ -783,7 +783,7 @@ Switch your Terraform configuration to `vpc` configuration block(s) instead. For example, given this previous configuration: -```hcl +```terraform resource "aws_route53_zone" "example" { # ... other configuration ... @@ -793,7 +793,7 @@ resource "aws_route53_zone" "example" { An updated configuration: -```hcl +```terraform resource "aws_route53_zone" "example" { # ... other configuration ... @@ -811,7 +811,7 @@ Switch your Terraform configuration to the `byte_match_tuples` argument instead. For example, given this previous configuration: -```hcl +```terraform resource "aws_wafregional_byte_match_set" "example" { # ... other configuration ... @@ -827,7 +827,7 @@ resource "aws_wafregional_byte_match_set" "example" { An updated configuration: -```hcl +```terraform resource "aws_wafregional_byte_match_set" "example" { # ... other configuration ... diff --git a/website/docs/guides/version-3-upgrade.html.md b/website/docs/guides/version-3-upgrade.html.md index 435c5ccd0fe6..4fb62166d49e 100644 --- a/website/docs/guides/version-3-upgrade.html.md +++ b/website/docs/guides/version-3-upgrade.html.md @@ -67,7 +67,7 @@ It is recommended to use [version constraints when configuring Terraform provide For example, given this previous configuration: -```hcl +```terraform provider "aws" { # ... other configuration ... @@ -77,7 +77,7 @@ provider "aws" { Update to latest 3.X version: -```hcl +```terraform provider "aws" { # ... other configuration ... @@ -122,7 +122,7 @@ The [custom service endpoints](custom-service-endpoints.html) for Kinesis Analyt For example, given this previous configuration: -```hcl +```terraform provider "aws" { # ... potentially other configuration ... @@ -137,7 +137,7 @@ provider "aws" { An updated configuration: -```hcl +```terraform provider "aws" { # ... potentially other configuration ... @@ -158,7 +158,7 @@ Switch your Terraform configuration to the `exclude_names` attribute instead. For example, given this previous configuration: -```hcl +```terraform data "aws_availability_zones" "example" { blacklisted_names = ["us-west-2d"] } @@ -166,7 +166,7 @@ data "aws_availability_zones" "example" { An updated configuration: -```hcl +```terraform data "aws_availability_zones" "example" { exclude_names = ["us-west-2d"] } @@ -178,7 +178,7 @@ Switch your Terraform configuration to the `exclude_zone_ids` attribute instead. For example, given this previous configuration: -```hcl +```terraform data "aws_availability_zones" "example" { blacklisted_zone_ids = ["usw2-az4"] } @@ -186,7 +186,7 @@ data "aws_availability_zones" "example" { An updated configuration: -```hcl +```terraform data "aws_availability_zones" "example" { exclude_zone_ids = ["usw2-az4"] } @@ -200,7 +200,7 @@ Switch your Terraform configuration to the `result` attribute with the [`jsondec For example, given this previous configuration: -```hcl +```terraform # In Terraform 0.11 and earlier, the result_map attribute can be used # to convert a result JSON string to a map of string keys to string values. output "lambda_result" { @@ -210,7 +210,7 @@ output "lambda_result" { An updated configuration: -```hcl +```terraform # In Terraform 0.12 and later, the jsondecode() function can be used # to convert a result JSON string to native Terraform types. output "lambda_result" { @@ -271,7 +271,7 @@ Configuration references to this attribute will likely require updates since set For example, given this previous configuration using a `count` based resource approach that may have been used in certain environments: -```hcl +```terraform data "aws_route53_zone" "public_root_domain" { name = var.public_root_domain } @@ -320,7 +320,7 @@ This value does not have any indices. Since the `domain_validation_options` attribute changed from a list to a set and sets cannot be indexed in Terraform, the recommendation is to update the configuration to use the more stable [resource `for_each` support](https://www.terraform.io/docs/configuration/meta-arguments/for_each.html) instead of [`count`](https://www.terraform.io/docs/configuration/meta-arguments/count.html). Note the slight change in the `validation_record_fqdns` syntax as well. -```hcl +```terraform resource "aws_route53_record" "existing" { for_each = { for dvo in aws_acm_certificate.existing.domain_validation_options : dvo.domain_name => { @@ -606,7 +606,7 @@ If you previously set one of these arguments to an empty list to enable drift de For example, given this previous configuration: -```hcl +```terraform resource "aws_autoscaling_group" "example" { # ... other configuration ... load_balancers = [] @@ -616,7 +616,7 @@ resource "aws_autoscaling_group" "example" { An updated configuration: -```hcl +```terraform resource "aws_autoscaling_group" "example" { # ... other configuration ... target_group_arns = [aws_lb_target_group.example.arn] @@ -627,7 +627,7 @@ If `aws_autoscaling_attachment` resources reference your ASG configurations, you For example, given this previous configuration: -```hcl +```terraform resource "aws_autoscaling_attachment" "example" { autoscaling_group_name = aws_autoscaling_group.example.id elb = aws_elb.example.id @@ -640,7 +640,7 @@ resource "aws_autoscaling_group" "example" { An updated configuration: -```hcl +```terraform resource "aws_autoscaling_attachment" "example" { autoscaling_group_name = aws_autoscaling_group.example.id elb = aws_elb.example.id @@ -686,7 +686,7 @@ Previously, the resource returned the Amazon Resource Name (ARN) directly from t Workarounds, such as using `replace()` as shown below, should be removed: -```hcl +```terraform resource "aws_cloudwatch_log_group" "example" { name = "example" } @@ -698,7 +698,7 @@ resource "aws_datasync_task" "example" { Removing the `:*` suffix is a breaking change for some configurations. Fix these configurations using string interpolations as demonstrated below. For example, this configuration is now broken: -```hcl +```terraform data "aws_iam_policy_document" "ad-log-policy" { statement { actions = [ @@ -717,7 +717,7 @@ data "aws_iam_policy_document" "ad-log-policy" { An updated configuration: -```hcl +```terraform data "aws_iam_policy_document" "ad-log-policy" { statement { actions = [ @@ -746,7 +746,7 @@ For example, given this previous configuration: $ GITHUB_TOKEN= terraform apply ``` -```hcl +```terraform resource "aws_codepipeline" "example" { # ... other configuration ... @@ -777,7 +777,7 @@ The configuration could be updated as follows: $ TF_VAR_github_token= terraform apply ``` -```hcl +```terraform variable "github_token" {} resource "aws_codepipeline" "example" { @@ -813,7 +813,7 @@ The Cognito API previously deprecated the `admin_create_user_config` configurati For example, given this previous configuration: -```hcl +```terraform resource "aws_cognito_user_pool" "example" { # ... other configuration ... @@ -827,7 +827,7 @@ resource "aws_cognito_user_pool" "example" { An updated configuration: -```hcl +```terraform resource "aws_cognito_user_pool" "example" { # ... other configuration ... @@ -853,7 +853,7 @@ Switch your Terraform configuration to the `associated_gateway_id` argument inst For example, given this previous configuration: -```hcl +```terraform resource "aws_dx_gateway_association" "example" { # ... other configuration ... vpn_gateway_id = aws_vpn_gateway.example.id @@ -862,7 +862,7 @@ resource "aws_dx_gateway_association" "example" { An updated configuration: -```hcl +```terraform resource "aws_dx_gateway_association" "example" { # ... other configuration ... associated_gateway_id = aws_vpn_gateway.example.id @@ -877,7 +877,7 @@ Switch your Terraform configuration to the `associated_gateway_id` argument inst For example, given this previous configuration: -```hcl +```terraform resource "aws_dx_gateway_association_proposal" "example" { # ... other configuration ... vpn_gateway_id = aws_vpn_gateway.example.id @@ -886,7 +886,7 @@ resource "aws_dx_gateway_association_proposal" "example" { An updated configuration: -```hcl +```terraform resource "aws_dx_gateway_association_proposal" "example" { # ... other configuration ... associated_gateway_id = aws_vpn_gateway.example.id @@ -914,7 +914,7 @@ Switch your Terraform configuration to the `core_instance_group` configuration b For example, given this previous configuration: -```hcl +```terraform resource "aws_emr_cluster" "example" { # ... other configuration ... @@ -924,7 +924,7 @@ resource "aws_emr_cluster" "example" { An updated configuration: -```hcl +```terraform resource "aws_emr_cluster" "example" { # ... other configuration ... @@ -942,7 +942,7 @@ Switch your Terraform configuration to the `core_instance_group` configuration b For example, given this previous configuration: -```hcl +```terraform resource "aws_emr_cluster" "example" { # ... other configuration ... @@ -952,7 +952,7 @@ resource "aws_emr_cluster" "example" { An updated configuration: -```hcl +```terraform resource "aws_emr_cluster" "example" { # ... other configuration ... @@ -968,7 +968,7 @@ Switch your Terraform configuration to the `master_instance_group` and `core_ins For example, given this previous configuration: -```hcl +```terraform resource "aws_emr_cluster" "example" { # ... other configuration ... @@ -993,7 +993,7 @@ resource "aws_emr_cluster" "example" { An updated configuration: -```hcl +```terraform resource "aws_emr_cluster" "example" { # ... other configuration ... @@ -1020,7 +1020,7 @@ Switch your Terraform configuration to the `master_instance_group` configuration For example, given this previous configuration: -```hcl +```terraform resource "aws_emr_cluster" "example" { # ... other configuration ... @@ -1030,7 +1030,7 @@ resource "aws_emr_cluster" "example" { An updated configuration: -```hcl +```terraform resource "aws_emr_cluster" "example" { # ... other configuration ... @@ -1048,7 +1048,7 @@ The Glue API has deprecated the `allocated_capacity` argument. Switch your Terra For example, given this previous configuration: -```hcl +```terraform resource "aws_glue_job" "example" { # ... other configuration ... @@ -1058,7 +1058,7 @@ resource "aws_glue_job" "example" { An updated configuration: -```hcl +```terraform resource "aws_glue_job" "example" { # ... other configuration ... @@ -1080,7 +1080,7 @@ Switch your Terraform configuration to the `role` argument instead. For example, given this previous configuration: -```hcl +```terraform resource "aws_iam_instance_profile" "example" { # ... other configuration ... @@ -1090,7 +1090,7 @@ resource "aws_iam_instance_profile" "example" { An updated configuration: -```hcl +```terraform resource "aws_iam_instance_profile" "example" { # ... other configuration ... @@ -1125,7 +1125,7 @@ The `network_interfaces.delete_on_termination` argument is now of type `string`, For example, given this previous configuration: -```hcl +```terraform resource "aws_launch_template" "example" { # ... other configuration ... @@ -1139,7 +1139,7 @@ resource "aws_launch_template" "example" { An updated configuration: -```hcl +```terraform resource "aws_launch_template" "example" { # ... other configuration ... @@ -1159,7 +1159,7 @@ Switch your Terraform configuration to use the `host_header` or `path_pattern` c For example, given this previous configuration: -```hcl +```terraform resource "aws_lb_listener_rule" "example" { # ... other configuration ... @@ -1172,7 +1172,7 @@ resource "aws_lb_listener_rule" "example" { An updated configuration: -```hcl +```terraform resource "aws_lb_listener_rule" "example" { # ... other configuration ... @@ -1192,7 +1192,7 @@ A few weeks after general availability launch and initial release of the `aws_ms To continue using the old default when it was previously not configured, add or modify this configuration: -```hcl +```terraform resource "aws_msk_cluster" "example" { # ... other configuration ... @@ -1240,7 +1240,7 @@ The `region` attribute is no longer configurable, but it remains as a read-only For example, given this previous configuration: -```hcl +```terraform resource "aws_s3_bucket" "example" { # ... other configuration ... @@ -1250,7 +1250,7 @@ resource "aws_s3_bucket" "example" { An updated configuration: -```hcl +```terraform resource "aws_s3_bucket" "example" { # ... other configuration ... } @@ -1264,7 +1264,7 @@ The `filter` configuration block no longer supports the empty block `{}` and req For example, given this previous configuration: -```hcl +```terraform resource "aws_s3_bucket_metric" "example" { # ... other configuration ... @@ -1274,7 +1274,7 @@ resource "aws_s3_bucket_metric" "example" { An updated configuration: -```hcl +```terraform resource "aws_s3_bucket_metric" "example" { # ... other configuration ... } @@ -1306,7 +1306,7 @@ Switch your Terraform configuration to the `task_invocation_parameters` configur For example, given this previous configuration: -```hcl +```terraform resource "aws_ssm_maintenance_window_task" "example" { # ... other configuration ... @@ -1319,7 +1319,7 @@ resource "aws_ssm_maintenance_window_task" "example" { An updated configuration: -```hcl +```terraform resource "aws_ssm_maintenance_window_task" "example" { # ... other configuration ... @@ -1342,7 +1342,7 @@ Switch your Terraform configuration to the `task_invocation_parameters` configur For example, given this previous configuration: -```hcl +```terraform resource "aws_ssm_maintenance_window_task" "example" { # ... other configuration ... @@ -1355,7 +1355,7 @@ resource "aws_ssm_maintenance_window_task" "example" { An updated configuration: -```hcl +```terraform resource "aws_ssm_maintenance_window_task" "example" { # ... other configuration ... diff --git a/website/docs/index.html.markdown b/website/docs/index.html.markdown index ee1f9fed757d..44d0fec791d9 100644 --- a/website/docs/index.html.markdown +++ b/website/docs/index.html.markdown @@ -17,7 +17,7 @@ Use the navigation to the left to read about the available resources. Terraform 0.13 and later: -```hcl +```terraform terraform { required_providers { aws = { @@ -40,7 +40,7 @@ resource "aws_vpc" "example" { Terraform 0.12 and earlier: -```hcl +```terraform # Configure the AWS Provider provider "aws" { version = "~> 3.0" @@ -76,7 +76,7 @@ in-line in the AWS provider block: Usage: -```hcl +```terraform provider "aws" { region = "us-west-2" access_key = "my-access-key" @@ -94,7 +94,7 @@ will override the use of `AWS_SHARED_CREDENTIALS_FILE` and `AWS_PROFILE`. The `AWS_DEFAULT_REGION` and `AWS_SESSION_TOKEN` environment variables are also used, if applicable: -```hcl +```terraform provider "aws" {} ``` @@ -113,7 +113,7 @@ You can use an [AWS credentials or configuration file](https://docs.aws.amazon.c Usage: -```hcl +```terraform provider "aws" { region = "us-west-2" shared_credentials_file = "/Users/tf_user/.aws/creds" @@ -158,7 +158,7 @@ using the supplied credentials. Usage: -```hcl +```terraform provider "aws" { assume_role { role_arn = "arn:aws:iam::ACCOUNT_ID:role/ROLE_NAME" @@ -215,6 +215,14 @@ for more information about connecting to alternate AWS endpoints or AWS compatib AWS account IDs to prevent you from mistakenly using the wrong one (and potentially end up destroying a live environment). Conflicts with `allowed_account_ids`. + +* `default_tags` - (Optional) **NOTE: This functionality is in public preview and there are no compatibility promises with future versions of the Terraform AWS Provider until a general availability announcement.** +Map of tags to apply across all resources handled by this provider (see the [Terraform multiple provider instances documentation](/docs/configuration/providers.html#alias-multiple-provider-instances) for more information about additional provider configurations). +This is designed to replace redundant per-resource `tags` configurations. At this time, tags defined within this configuration block can be overridden with new values, but not excluded from specific resources. To override tag values defined within this configuration block, use the `tags` argument within a resource to configure new tag values for matching keys. +See the [`default_tags`](#default_tags-configuration-block) Configuration Block section below for example usage and available arguments. +This functionality is only supported in the following resources: + - `aws_subnet` + - `aws_vpc` * `ignore_tags` - (Optional) Configuration block with resource tag settings to ignore across all resources handled by this provider (except any individual service tag resources such as `aws_ec2_tag`) for situations where external systems are managing certain resource tags. Arguments to the configuration block are described below in the `ignore_tags` Configuration Block section. See the [Terraform multiple provider instances documentation](https://www.terraform.io/docs/configuration/providers.html#alias-multiple-provider-configurations) for more information about additional provider configurations. @@ -248,7 +256,6 @@ for more information about connecting to alternate AWS endpoints or AWS compatib - [`aws_budgets_budget` resource](/docs/providers/aws/r/budgets_budget.html) - [`aws_cognito_identity_pool` resource](/docs/providers/aws/r/cognito_identity_pool.html) - [`aws_cognito_user_pools` data source](/docs/providers/aws/d/cognito_user_pools.html) - - [`aws_default_network_acl` resource](/docs/providers/aws/r/default_network_acl.html) - [`aws_default_vpc_dhcp_options`](/docs/providers/aws/r/default_vpc_dhcp_options.html) - [`aws_dms_event_subscription` resource](/docs/providers/aws/r/dms_event_subscription.html) - [`aws_dms_replication_subnet_group` resource](/docs/providers/aws/r/dms_replication_subnet_group.html) @@ -301,12 +308,9 @@ for more information about connecting to alternate AWS endpoints or AWS compatib - [`aws_guardduty_threatintelset` resource](/docs/providers/aws/r/guardduty_threatintelset.html) - [`aws_instance` data source](/docs/providers/aws/d/instance.html) - [`aws_instance` resource](/docs/providers/aws/r/instance.html) - - [`aws_internet_gateway` data source](/docs/providers/aws/d/internet_gateway.html) - - [`aws_internet_gateway` resource](/docs/providers/aws/r/internet_gateway.html) - [`aws_key_pair` resource](/docs/providers/aws/r/key_pair.html) - [`aws_launch_template` data source](/docs/providers/aws/d/launch_template.html) - [`aws_launch_template` resource](/docs/providers/aws/r/launch_template.html) - - [`aws_network_acl` resource](/docs/providers/aws/r/network_acl.html) - [`aws_placement_group` resource](/docs/providers/aws/r/placement_group.html) - [`aws_redshift_cluster` resource](/docs/providers/aws/r/redshift_cluster.html) - [`aws_redshift_event_subscription` resource](/docs/providers/aws/r/redshift_event_subscription.html) @@ -329,14 +333,8 @@ for more information about connecting to alternate AWS endpoints or AWS compatib - [`aws_ssm_parameter` data source](/docs/providers/aws/d/ssm_parameter.html) - [`aws_ssm_parameter` resource](/docs/providers/aws/r/ssm_parameter.html) - [`aws_synthetics_canary` resource](/docs/providers/aws/r/synthetics_canary.html) - - [`aws_vpc_dhcp_options` data source](/docs/providers/aws/d/vpc_dhcp_options.html) - - [`aws_vpc_dhcp_options` resource](/docs/providers/aws/r/vpc_dhcp_options.html) - [`aws_vpc_endpoint_service` data source](/docs/providers/aws/d/vpc_endpoint_service.html) - [`aws_vpc_endpoint_service` resource](/docs/providers/aws/r/vpc_endpoint_service.html) - - [`aws_vpc_endpoint` data source](/docs/providers/aws/d/vpc_endpoint.html) - - [`aws_vpc_endpoint` resource](/docs/providers/aws/r/vpc_endpoint.html) - - [`aws_vpc` data source](/docs/providers/aws/d/vpc.html) - - [`aws_vpc` resource](/docs/providers/aws/r/vpc.html) - [`aws_vpn_connection` resource](/docs/providers/aws/r/vpn_connection.html) - [`aws_vpn_gateway` data source](/docs/providers/aws/d/vpn_gateway.html) - [`aws_vpn_gateway` resource](/docs/providers/aws/r/vpn_gateway.html) @@ -382,11 +380,144 @@ The `assume_role` configuration block supports the following optional arguments: * `tags` - (Optional) Map of assume role session tags. * `transitive_tag_keys` - (Optional) Set of assume role session tag keys to pass to any subsequent sessions. +### default_tags Configuration Block + +Example: Resource with provider default tags + +```terraform +provider "aws" { + default_tags { + tags = { + Environment = "Test" + Name = "Provider Tag" + } + } +} + +resource "aws_vpc" "example" { + # ..other configuration... +} + +output "vpc_resource_level_tags" { + value = aws_vpc.example.tags +} + +output "vpc_all_tags" { + value = aws_vpc.example.tags_all +} +``` + +Outputs: + +```console +$ terraform apply +... +Outputs: + +vpc_all_tags = tomap({ + "Environment" = "Test" + "Name" = "Provider Tag" +}) +``` + +Example: Resource with tags and provider default tags + +```terraform +provider "aws" { + default_tags { + tags = { + Environment = "Test" + Name = "Provider Tag" + } + } +} + +resource "aws_vpc" "example" { + # ..other configuration... + tags = { + Owner = "example" + } +} + +output "vpc_resource_level_tags" { + value = aws_vpc.example.tags +} + +output "vpc_all_tags" { + value = aws_vpc.example.tags_all +} +``` + +Outputs: + +```console +$ terraform apply +... +Outputs: + +vpc_all_tags = tomap({ + "Environment" = "Test" + "Name" = "Provider Tag" + "Owner" = "example" +}) +vpc_resource_level_tags = tomap({ + "Owner" = "example" +}) +``` + +Example: Resource overriding provider default tags + +```terraform +provider "aws" { + default_tags { + tags = { + Environment = "Test" + Name = "Provider Tag" + } + } +} + +resource "aws_vpc" "example" { + # ..other configuration... + tags = { + Environment = "Production" + } +} + +output "vpc_resource_level_tags" { + value = aws_vpc.example.tags +} + +output "vpc_all_tags" { + value = aws_vpc.example.tags_all +} +``` + +Outputs: + +```console +$ terraform apply +... +Outputs: + +vpc_all_tags = tomap({ + "Environment" = "Production" + "Name" = "Provider Tag" +}) +vpc_resource_level_tags = tomap({ + "Environment" = "Production" +}) +``` + +The `default_tags` configuration block supports the following argument: + +* `tags` - (Optional) **NOTE: This functionality is in public preview and only supported by the [`aws_subnet`](/docs/providers/aws/r/subnet.html) and [`aws_vpc`](/docs/providers/aws/r/vpc.html) resources.** Key-value map of tags to apply to all resources. + ### ignore_tags Configuration Block Example: -```hcl +```terraform provider "aws" { ignore_tags { keys = ["TagKey1"] diff --git a/website/docs/r/accessanalyzer_analyzer.html.markdown b/website/docs/r/accessanalyzer_analyzer.html.markdown index 82cef7d93f5e..df0b7ae0e92b 100644 --- a/website/docs/r/accessanalyzer_analyzer.html.markdown +++ b/website/docs/r/accessanalyzer_analyzer.html.markdown @@ -14,7 +14,7 @@ Manages an Access Analyzer Analyzer. More information can be found in the [Acces ### Account Analyzer -```hcl +```terraform resource "aws_accessanalyzer_analyzer" "example" { analyzer_name = "example" } @@ -22,7 +22,7 @@ resource "aws_accessanalyzer_analyzer" "example" { ### Organization Analyzer -```hcl +```terraform resource "aws_organizations_organization" "example" { aws_service_access_principals = ["access-analyzer.amazonaws.com"] } diff --git a/website/docs/r/acm_certificate.html.markdown b/website/docs/r/acm_certificate.html.markdown index 632596cc7721..c33ffd1a0322 100644 --- a/website/docs/r/acm_certificate.html.markdown +++ b/website/docs/r/acm_certificate.html.markdown @@ -28,9 +28,9 @@ which is currently in use (eg, by [`aws_lb_listener`](lb_listener.html)). ## Example Usage -### Certificate creation +### Create Certificate -```hcl +```terraform resource "aws_acm_certificate" "cert" { domain_name = "example.com" validation_method = "DNS" @@ -45,9 +45,9 @@ resource "aws_acm_certificate" "cert" { } ``` -### Importing an existing certificate +### Existing Certificate Body Import -```hcl +```terraform resource "tls_private_key" "example" { algorithm = "RSA" } @@ -80,7 +80,7 @@ resource "aws_acm_certificate" "cert" { See the [`aws_acm_certificate_validation` resource](acm_certificate_validation.html) for a full example of performing DNS validation. -```hcl +```terraform resource "aws_route53_record" "example" { for_each = { for dvo in aws_acm_certificate.example.domain_validation_options : dvo.domain_name => { diff --git a/website/docs/r/acm_certificate_validation.html.markdown b/website/docs/r/acm_certificate_validation.html.markdown index ea7ddc68acf3..822d7c574afb 100644 --- a/website/docs/r/acm_certificate_validation.html.markdown +++ b/website/docs/r/acm_certificate_validation.html.markdown @@ -22,7 +22,7 @@ deploy the required validation records and wait for validation to complete. ### DNS Validation with Route 53 -```hcl +```terraform resource "aws_acm_certificate" "example" { domain_name = "example.com" validation_method = "DNS" @@ -64,7 +64,7 @@ resource "aws_lb_listener" "example" { ### Alternative Domains DNS Validation with Route 53 -```hcl +```terraform resource "aws_acm_certificate" "example" { domain_name = "example.com" subject_alternative_names = ["www.example.com", "example.org"] @@ -115,7 +115,7 @@ resource "aws_lb_listener" "example" { In this situation, the resource is simply a waiter for manual email approval of ACM certificates. -```hcl +```terraform resource "aws_acm_certificate" "example" { domain_name = "example.com" validation_method = "EMAIL" diff --git a/website/docs/r/acmpca_certificate.html.markdown b/website/docs/r/acmpca_certificate.html.markdown index 1088ee2135fc..cdc205e6c8ad 100644 --- a/website/docs/r/acmpca_certificate.html.markdown +++ b/website/docs/r/acmpca_certificate.html.markdown @@ -68,7 +68,7 @@ The following arguments are supported: * `value` - (Required) If `type` is `DAYS`, `MONTHS`, or `YEARS`, the relative time until the certificate expires. If `type` is `ABSOLUTE`, the date in seconds since the Unix epoch. If `type` is `END_DATE`, the date in RFC 3339 format. -## Attribute Reference +## Attributes Reference In addition to all arguments above, the following attributes are exported: diff --git a/website/docs/r/acmpca_certificate_authority.html.markdown b/website/docs/r/acmpca_certificate_authority.html.markdown index 205a66631561..a7c0e3dafdcc 100644 --- a/website/docs/r/acmpca_certificate_authority.html.markdown +++ b/website/docs/r/acmpca_certificate_authority.html.markdown @@ -16,7 +16,7 @@ Provides a resource to manage AWS Certificate Manager Private Certificate Author ### Basic -```hcl +```terraform resource "aws_acmpca_certificate_authority" "example" { certificate_authority_configuration { key_algorithm = "RSA_4096" @@ -33,7 +33,7 @@ resource "aws_acmpca_certificate_authority" "example" { ### Enable Certificate Revocation List -```hcl +```terraform resource "aws_s3_bucket" "example" { bucket = "example" } diff --git a/website/docs/r/acmpca_certificate_authority_certificate.html.markdown b/website/docs/r/acmpca_certificate_authority_certificate.html.markdown index 9cfe798fc48a..be9f93c1a2cd 100644 --- a/website/docs/r/acmpca_certificate_authority_certificate.html.markdown +++ b/website/docs/r/acmpca_certificate_authority_certificate.html.markdown @@ -111,3 +111,7 @@ The following arguments are supported: * `certificate` - (Required) The PEM-encoded certificate for the Certificate Authority. * `certificate_authority_arn` - (Required) Amazon Resource Name (ARN) of the Certificate Authority. * `certificate_chain` - (Optional) The PEM-encoded certificate chain that includes any intermediate certificates and chains up to root CA. Required for subordinate Certificate Authorities. Not allowed for root Certificate Authorities. + +## Attributes Reference + +No additional attributes are exported. diff --git a/website/docs/r/ami.html.markdown b/website/docs/r/ami.html.markdown index 9edb3b972d5d..48b02c9ace70 100644 --- a/website/docs/r/ami.html.markdown +++ b/website/docs/r/ami.html.markdown @@ -19,7 +19,7 @@ it's better to use `aws_ami_launch_permission` instead. ## Example Usage -```hcl +```terraform # Create an AMI that will start a machine whose root device is backed by # an EBS volume populated from a snapshot. It is assumed that such a snapshot # already exists with the id "snap-xxxxxxxx". @@ -110,6 +110,7 @@ In addition to all arguments above, the following attributes are exported: * `arn` - The ARN of the AMI. * `id` - The ID of the created AMI. +* `owner_id` - The AWS account ID of the image owner. * `root_snapshot_id` - The Snapshot ID for the root volume (for EBS-backed AMIs) * `usage_operation` - The operation of the Amazon EC2 instance and the billing code that is associated with the AMI. * `platform_details` - The platform details associated with the billing code of the AMI. diff --git a/website/docs/r/ami_copy.html.markdown b/website/docs/r/ami_copy.html.markdown index fe7244fcf8bf..c5df365c33d2 100644 --- a/website/docs/r/ami_copy.html.markdown +++ b/website/docs/r/ami_copy.html.markdown @@ -22,7 +22,7 @@ block until the new AMI is available for use on new instances. ## Example Usage -```hcl +```terraform resource "aws_ami_copy" "example" { name = "terraform-example" description = "A copy of ami-xxxxxxxx" diff --git a/website/docs/r/ami_from_instance.html.markdown b/website/docs/r/ami_from_instance.html.markdown index a4bd2a6c6b76..d7fffe3dd210 100644 --- a/website/docs/r/ami_from_instance.html.markdown +++ b/website/docs/r/ami_from_instance.html.markdown @@ -28,7 +28,7 @@ to produce a fresh snapshot. ## Example Usage -```hcl +```terraform resource "aws_ami_from_instance" "example" { name = "terraform-example" source_instance_id = "i-xxxxxxxx" diff --git a/website/docs/r/ami_launch_permission.html.markdown b/website/docs/r/ami_launch_permission.html.markdown index a55d9a87e0c7..8c9aec85fedc 100644 --- a/website/docs/r/ami_launch_permission.html.markdown +++ b/website/docs/r/ami_launch_permission.html.markdown @@ -12,7 +12,7 @@ Adds launch permission to Amazon Machine Image (AMI) from another AWS account. ## Example Usage -```hcl +```terraform resource "aws_ami_launch_permission" "example" { image_id = "ami-12345678" account_id = "123456789012" diff --git a/website/docs/r/api_gateway_account.html.markdown b/website/docs/r/api_gateway_account.html.markdown index 45ea5de6b37b..fafd8dc44d82 100644 --- a/website/docs/r/api_gateway_account.html.markdown +++ b/website/docs/r/api_gateway_account.html.markdown @@ -14,7 +14,7 @@ Provides a settings of an API Gateway Account. Settings is applied region-wide p ## Example Usage -```hcl +```terraform resource "aws_api_gateway_account" "demo" { cloudwatch_role_arn = aws_iam_role.cloudwatch.arn } diff --git a/website/docs/r/api_gateway_api_key.html.markdown b/website/docs/r/api_gateway_api_key.html.markdown index ef122139d8ff..da6b3bf482e4 100644 --- a/website/docs/r/api_gateway_api_key.html.markdown +++ b/website/docs/r/api_gateway_api_key.html.markdown @@ -14,7 +14,7 @@ Provides an API Gateway API Key. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_api_key" "MyDemoApiKey" { name = "demo" } diff --git a/website/docs/r/api_gateway_authorizer.html.markdown b/website/docs/r/api_gateway_authorizer.html.markdown index 5422d686bace..4e6b004f5251 100644 --- a/website/docs/r/api_gateway_authorizer.html.markdown +++ b/website/docs/r/api_gateway_authorizer.html.markdown @@ -12,7 +12,7 @@ Provides an API Gateway Authorizer. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_authorizer" "demo" { name = "demo" rest_api_id = aws_api_gateway_rest_api.demo.id diff --git a/website/docs/r/api_gateway_base_path_mapping.html.markdown b/website/docs/r/api_gateway_base_path_mapping.html.markdown index 671be127304a..4e85fa78b470 100644 --- a/website/docs/r/api_gateway_base_path_mapping.html.markdown +++ b/website/docs/r/api_gateway_base_path_mapping.html.markdown @@ -16,7 +16,7 @@ custom domain name. An end-to-end example of a REST API configured with OpenAPI can be found in the [`/examples/api-gateway-rest-api-openapi` directory within the GitHub repository](https://github.com/hashicorp/terraform-provider-aws/tree/main/examples/api-gateway-rest-api-openapi). -```hcl +```terraform resource "aws_api_gateway_stage" "example" { deployment_id = aws_api_gateway_deployment.example.id rest_api_id = aws_api_gateway_rest_api.example.id @@ -48,6 +48,10 @@ The following arguments are supported: * `stage_name` - (Optional) The name of a specific deployment stage to expose at the given path. If omitted, callers may select any stage by including its name as a path element after the base path. * `base_path` - (Optional) Path segment that must be prepended to the path when accessing the API via this mapping. If omitted, the API is exposed at the root of the given domain. +## Attributes Reference + +No additional attributes are exported. + ## Import `aws_api_gateway_base_path_mapping` can be imported by using the domain name and base path, e.g. diff --git a/website/docs/r/api_gateway_client_certificate.html.markdown b/website/docs/r/api_gateway_client_certificate.html.markdown index 77e71ff9a23a..a52811b92261 100644 --- a/website/docs/r/api_gateway_client_certificate.html.markdown +++ b/website/docs/r/api_gateway_client_certificate.html.markdown @@ -12,7 +12,7 @@ Provides an API Gateway Client Certificate. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_client_certificate" "demo" { description = "My client certificate" } diff --git a/website/docs/r/api_gateway_deployment.html.markdown b/website/docs/r/api_gateway_deployment.html.markdown index 731cf2400137..2674590f4f5d 100644 --- a/website/docs/r/api_gateway_deployment.html.markdown +++ b/website/docs/r/api_gateway_deployment.html.markdown @@ -25,7 +25,7 @@ To properly capture all REST API configuration in a deployment, this resource mu An end-to-end example of a REST API configured with OpenAPI can be found in the [`/examples/api-gateway-rest-api-openapi` directory within the GitHub repository](https://github.com/hashicorp/terraform-provider-aws/tree/main/examples/api-gateway-rest-api-openapi). -```hcl +```terraform resource "aws_api_gateway_rest_api" "example" { body = jsonencode({ openapi = "3.0.1" @@ -71,7 +71,7 @@ resource "aws_api_gateway_stage" "example" { ### Terraform Resources -```hcl +```terraform resource "aws_api_gateway_rest_api" "example" { name = "example" } diff --git a/website/docs/r/api_gateway_documentation_part.html.markdown b/website/docs/r/api_gateway_documentation_part.html.markdown index f9b8eeae12ac..de4d372f606a 100644 --- a/website/docs/r/api_gateway_documentation_part.html.markdown +++ b/website/docs/r/api_gateway_documentation_part.html.markdown @@ -12,7 +12,7 @@ Provides a settings of an API Gateway Documentation Part. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_documentation_part" "example" { location { type = "METHOD" diff --git a/website/docs/r/api_gateway_documentation_version.html.markdown b/website/docs/r/api_gateway_documentation_version.html.markdown index 7a54109b8610..dfe8e9e55d92 100644 --- a/website/docs/r/api_gateway_documentation_version.html.markdown +++ b/website/docs/r/api_gateway_documentation_version.html.markdown @@ -12,7 +12,7 @@ Provides a resource to manage an API Gateway Documentation Version. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_documentation_version" "example" { version = "example_version" rest_api_id = aws_api_gateway_rest_api.example.id diff --git a/website/docs/r/api_gateway_domain_name.html.markdown b/website/docs/r/api_gateway_domain_name.html.markdown index 3eefe3b2bdc9..eaae7711161c 100644 --- a/website/docs/r/api_gateway_domain_name.html.markdown +++ b/website/docs/r/api_gateway_domain_name.html.markdown @@ -44,7 +44,7 @@ An end-to-end example of a REST API configured with OpenAPI can be found in the ### Edge Optimized (ACM Certificate) -```hcl +```terraform resource "aws_api_gateway_domain_name" "example" { certificate_arn = aws_acm_certificate_validation.example.certificate_arn domain_name = "api.example.com" @@ -67,7 +67,7 @@ resource "aws_route53_record" "example" { ### Edge Optimized (IAM Certificate) -```hcl +```terraform resource "aws_api_gateway_domain_name" "example" { domain_name = "api.example.com" @@ -95,7 +95,7 @@ resource "aws_route53_record" "example" { ### Regional (ACM Certificate) -```hcl +```terraform resource "aws_api_gateway_domain_name" "example" { domain_name = "api.example.com" regional_certificate_arn = aws_acm_certificate_validation.example.certificate_arn @@ -122,7 +122,7 @@ resource "aws_route53_record" "example" { ### Regional (IAM Certificate) -```hcl +```terraform resource "aws_api_gateway_domain_name" "example" { certificate_body = file("${path.module}/example.com/example.crt") certificate_chain = file("${path.module}/example.com/ca.crt") diff --git a/website/docs/r/api_gateway_gateway_response.markdown b/website/docs/r/api_gateway_gateway_response.markdown index 1322b6dac302..3a8c08666494 100644 --- a/website/docs/r/api_gateway_gateway_response.markdown +++ b/website/docs/r/api_gateway_gateway_response.markdown @@ -12,7 +12,7 @@ Provides an API Gateway Gateway Response for a REST API Gateway. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_rest_api" "main" { name = "MyDemoAPI" } @@ -42,6 +42,10 @@ The following arguments are supported: * `response_templates` - (Optional) A map specifying the templates used to transform the response body. * `response_parameters` - (Optional) A map specifying the parameters (paths, query strings and headers) of the Gateway Response. +## Attributes Reference + +No additional attributes are exported. + ## Import `aws_api_gateway_gateway_response` can be imported using `REST-API-ID/RESPONSE-TYPE`, e.g. diff --git a/website/docs/r/api_gateway_integration.html.markdown b/website/docs/r/api_gateway_integration.html.markdown index 6f87ab650025..fc87991a249e 100644 --- a/website/docs/r/api_gateway_integration.html.markdown +++ b/website/docs/r/api_gateway_integration.html.markdown @@ -12,7 +12,7 @@ Provides an HTTP Method Integration for an API Gateway Integration. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_rest_api" "MyDemoAPI" { name = "MyDemoAPI" description = "This is my API for demonstration purposes" @@ -57,7 +57,7 @@ EOF ## Lambda integration -```hcl +```terraform # Variables variable "myregion" {} @@ -138,7 +138,7 @@ POLICY ## VPC Link -```hcl +```terraform variable "name" {} variable "subnet_id" {} @@ -237,6 +237,10 @@ The `tls_config` configuration block supports the following arguments: * `insecure_skip_verification` - (Optional) Specifies whether or not API Gateway skips verification that the certificate for an integration endpoint is issued by a [supported certificate authority](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-supported-certificate-authorities-for-http-endpoints.html). This isn’t recommended, but it enables you to use certificates that are signed by private certificate authorities, or certificates that are self-signed. If enabled, API Gateway still performs basic certificate validation, which includes checking the certificate's expiration date, hostname, and presence of a root certificate authority. Supported only for `HTTP` and `HTTP_PROXY` integrations. +## Attributes Reference + +No additional attributes are exported. + ## Import `aws_api_gateway_integration` can be imported using `REST-API-ID/RESOURCE-ID/HTTP-METHOD`, e.g. diff --git a/website/docs/r/api_gateway_integration_response.html.markdown b/website/docs/r/api_gateway_integration_response.html.markdown index 9347801b5e57..c02e9bde277e 100644 --- a/website/docs/r/api_gateway_integration_response.html.markdown +++ b/website/docs/r/api_gateway_integration_response.html.markdown @@ -15,7 +15,7 @@ you might need to add an explicit `depends_on` for clean runs. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_rest_api" "MyDemoAPI" { name = "MyDemoAPI" description = "This is my API for demonstration purposes" @@ -84,6 +84,10 @@ The following arguments are supported: For example: `response_parameters = { "method.response.header.X-Some-Header" = "integration.response.header.X-Some-Other-Header" }` * `content_handling` - (Optional) Specifies how to handle request payload content type conversions. Supported values are `CONVERT_TO_BINARY` and `CONVERT_TO_TEXT`. If this property is not defined, the response payload will be passed through from the integration response to the method response without modification. +## Attributes Reference + +No additional attributes are exported. + ## Import `aws_api_gateway_integration_response` can be imported using `REST-API-ID/RESOURCE-ID/HTTP-METHOD/STATUS-CODE`, e.g. diff --git a/website/docs/r/api_gateway_method.html.markdown b/website/docs/r/api_gateway_method.html.markdown index 59917adb05db..405ae9f1d326 100644 --- a/website/docs/r/api_gateway_method.html.markdown +++ b/website/docs/r/api_gateway_method.html.markdown @@ -12,7 +12,7 @@ Provides a HTTP Method for an API Gateway Resource. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_rest_api" "MyDemoAPI" { name = "MyDemoAPI" description = "This is my API for demonstration purposes" @@ -34,7 +34,7 @@ resource "aws_api_gateway_method" "MyDemoMethod" { ## Usage with Cognito User Pool Authorizer -```hcl +```terraform variable "cognito_user_pool_name" {} data "aws_cognito_user_pools" "this" { @@ -90,6 +90,10 @@ The following arguments are supported: * `request_parameters` - (Optional) A map of request parameters (from the path, query string and headers) that should be passed to the integration. The boolean value indicates whether the parameter is required (`true`) or optional (`false`). For example: `request_parameters = {"method.request.header.X-Some-Header" = true "method.request.querystring.some-query-param" = true}` would define that the header `X-Some-Header` and the query string `some-query-param` must be provided in the request. +## Attributes Reference + +No additional attributes are exported. + ## Import `aws_api_gateway_method` can be imported using `REST-API-ID/RESOURCE-ID/HTTP-METHOD`, e.g. diff --git a/website/docs/r/api_gateway_method_response.html.markdown b/website/docs/r/api_gateway_method_response.html.markdown index 2a4a51f970fe..fa47c18f6981 100644 --- a/website/docs/r/api_gateway_method_response.html.markdown +++ b/website/docs/r/api_gateway_method_response.html.markdown @@ -12,7 +12,7 @@ Provides an HTTP Method Response for an API Gateway Resource. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_rest_api" "MyDemoAPI" { name = "MyDemoAPI" description = "This is my API for demonstration purposes" @@ -59,6 +59,10 @@ The following arguments are supported: For example: `response_parameters = { "method.response.header.X-Some-Header" = true }` would define that the header `X-Some-Header` can be provided on the response. +## Attributes Reference + +No additional attributes are exported. + ## Import `aws_api_gateway_method_response` can be imported using `REST-API-ID/RESOURCE-ID/HTTP-METHOD/STATUS-CODE`, e.g. diff --git a/website/docs/r/api_gateway_method_settings.html.markdown b/website/docs/r/api_gateway_method_settings.html.markdown index d7f7a9d8f0f8..7c829c556a99 100644 --- a/website/docs/r/api_gateway_method_settings.html.markdown +++ b/website/docs/r/api_gateway_method_settings.html.markdown @@ -16,7 +16,7 @@ Manages API Gateway Stage Method Settings. For example, CloudWatch logging and m An end-to-end example of a REST API configured with OpenAPI can be found in the [`/examples/api-gateway-rest-api-openapi` directory within the GitHub repository](https://github.com/hashicorp/terraform-provider-aws/tree/main/examples/api-gateway-rest-api-openapi). -```hcl +```terraform resource "aws_api_gateway_rest_api" "example" { body = jsonencode({ openapi = "3.0.1" @@ -104,6 +104,10 @@ The following arguments are supported: * `require_authorization_for_cache_control` - (Optional) Specifies whether authorization is required for a cache invalidation request. * `unauthorized_cache_control_header_strategy` - (Optional) Specifies how to handle unauthorized requests for cache invalidation. The available values are `FAIL_WITH_403`, `SUCCEED_WITH_RESPONSE_HEADER`, `SUCCEED_WITHOUT_RESPONSE_HEADER`. +## Attributes Reference + +No additional attributes are exported. + ## Import `aws_api_gateway_method_settings` can be imported using `REST-API-ID/STAGE-NAME/METHOD-PATH`, e.g. diff --git a/website/docs/r/api_gateway_model.html.markdown b/website/docs/r/api_gateway_model.html.markdown index 0df3eb6de70c..ba95c6d03f49 100644 --- a/website/docs/r/api_gateway_model.html.markdown +++ b/website/docs/r/api_gateway_model.html.markdown @@ -12,7 +12,7 @@ Provides a Model for a REST API Gateway. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_rest_api" "MyDemoAPI" { name = "MyDemoAPI" description = "This is my API for demonstration purposes" diff --git a/website/docs/r/api_gateway_request_validator.html.markdown b/website/docs/r/api_gateway_request_validator.html.markdown index 3641b216878f..ea823cee2075 100644 --- a/website/docs/r/api_gateway_request_validator.html.markdown +++ b/website/docs/r/api_gateway_request_validator.html.markdown @@ -12,7 +12,7 @@ Manages an API Gateway Request Validator. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_request_validator" "example" { name = "example" rest_api_id = aws_api_gateway_rest_api.example.id diff --git a/website/docs/r/api_gateway_resource.html.markdown b/website/docs/r/api_gateway_resource.html.markdown index fc64b4a06a22..d69b87693992 100644 --- a/website/docs/r/api_gateway_resource.html.markdown +++ b/website/docs/r/api_gateway_resource.html.markdown @@ -12,7 +12,7 @@ Provides an API Gateway Resource. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_rest_api" "MyDemoAPI" { name = "MyDemoAPI" description = "This is my API for demonstration purposes" diff --git a/website/docs/r/api_gateway_rest_api.html.markdown b/website/docs/r/api_gateway_rest_api.html.markdown index def040b490a6..e83f089f6524 100644 --- a/website/docs/r/api_gateway_rest_api.html.markdown +++ b/website/docs/r/api_gateway_rest_api.html.markdown @@ -18,7 +18,7 @@ Manages an API Gateway REST API. The REST API can be configured via [importing a An end-to-end example of a REST API configured with OpenAPI can be found in the [`/examples/api-gateway-rest-api-openapi` directory within the GitHub repository](https://github.com/hashicorp/terraform-provider-aws/tree/main/examples/api-gateway-rest-api-openapi). -```hcl +```terraform resource "aws_api_gateway_rest_api" "example" { body = jsonencode({ openapi = "3.0.1" @@ -68,7 +68,7 @@ resource "aws_api_gateway_stage" "example" { ### Terraform Resources -```hcl +```terraform resource "aws_api_gateway_rest_api" "example" { name = "example" } diff --git a/website/docs/r/api_gateway_rest_api_policy.html.markdown b/website/docs/r/api_gateway_rest_api_policy.html.markdown index ffdad097ec36..cb4886fa25d4 100644 --- a/website/docs/r/api_gateway_rest_api_policy.html.markdown +++ b/website/docs/r/api_gateway_rest_api_policy.html.markdown @@ -16,7 +16,7 @@ Provides an API Gateway REST API Policy. ### Basic -```hcl +```terraform resource "aws_api_gateway_rest_api" "test" { name = "example-rest-api" } diff --git a/website/docs/r/api_gateway_stage.html.markdown b/website/docs/r/api_gateway_stage.html.markdown index de7286e1e2d6..0d9740045b37 100644 --- a/website/docs/r/api_gateway_stage.html.markdown +++ b/website/docs/r/api_gateway_stage.html.markdown @@ -14,7 +14,7 @@ Manages an API Gateway Stage. A stage is a named reference to a deployment, whic An end-to-end example of a REST API configured with OpenAPI can be found in the [`/examples/api-gateway-rest-api-openapi` directory within the GitHub repository](https://github.com/hashicorp/terraform-provider-aws/tree/main/examples/api-gateway-rest-api-openapi). -```hcl +```terraform resource "aws_api_gateway_rest_api" "example" { body = jsonencode({ openapi = "3.0.1" @@ -75,7 +75,7 @@ API Gateway provides the ability to [enable CloudWatch API logging](https://docs -> The below configuration uses [`depends_on`](https://www.terraform.io/docs/configuration/meta-arguments/depends_on.html) to prevent ordering issues with API Gateway automatically creating the log group first and a variable for naming consistency. Other ordering and naming methodologies may be more appropriate for your environment. -```hcl +```terraform variable "stage_name" { default = "example" type = string diff --git a/website/docs/r/api_gateway_usage_plan.html.markdown b/website/docs/r/api_gateway_usage_plan.html.markdown index 877ec1971337..abf20ee150eb 100644 --- a/website/docs/r/api_gateway_usage_plan.html.markdown +++ b/website/docs/r/api_gateway_usage_plan.html.markdown @@ -12,7 +12,7 @@ Provides an API Gateway Usage Plan. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_rest_api" "example" { body = jsonencode({ openapi = "3.0.1" diff --git a/website/docs/r/api_gateway_usage_plan_key.html.markdown b/website/docs/r/api_gateway_usage_plan_key.html.markdown index f4b96e3727dc..84db6d1b58ca 100644 --- a/website/docs/r/api_gateway_usage_plan_key.html.markdown +++ b/website/docs/r/api_gateway_usage_plan_key.html.markdown @@ -12,7 +12,7 @@ Provides an API Gateway Usage Plan Key. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_rest_api" "test" { name = "MyDemoAPI" } diff --git a/website/docs/r/api_gateway_vpc_link.html.markdown b/website/docs/r/api_gateway_vpc_link.html.markdown index 7bf9d0990ba5..21a766a484c4 100644 --- a/website/docs/r/api_gateway_vpc_link.html.markdown +++ b/website/docs/r/api_gateway_vpc_link.html.markdown @@ -15,7 +15,7 @@ To enable private integration for HTTP APIs, use the Amazon API Gateway Version ## Example Usage -```hcl +```terraform resource "aws_lb" "example" { name = "example" internal = true diff --git a/website/docs/r/apigatewayv2_api.html.markdown b/website/docs/r/apigatewayv2_api.html.markdown index eada23d62719..b73950ecb16e 100644 --- a/website/docs/r/apigatewayv2_api.html.markdown +++ b/website/docs/r/apigatewayv2_api.html.markdown @@ -16,7 +16,7 @@ Manages an Amazon API Gateway Version 2 API. ### Basic WebSocket API -```hcl +```terraform resource "aws_apigatewayv2_api" "example" { name = "example-websocket-api" protocol_type = "WEBSOCKET" @@ -26,7 +26,7 @@ resource "aws_apigatewayv2_api" "example" { ### Basic HTTP API -```hcl +```terraform resource "aws_apigatewayv2_api" "example" { name = "example-http-api" protocol_type = "HTTP" diff --git a/website/docs/r/apigatewayv2_api_mapping.html.markdown b/website/docs/r/apigatewayv2_api_mapping.html.markdown index d3b0a484bbd0..f71a7d365c50 100644 --- a/website/docs/r/apigatewayv2_api_mapping.html.markdown +++ b/website/docs/r/apigatewayv2_api_mapping.html.markdown @@ -15,7 +15,7 @@ More information can be found in the [Amazon API Gateway Developer Guide](https: ### Basic -```hcl +```terraform resource "aws_apigatewayv2_api_mapping" "example" { api_id = aws_apigatewayv2_api.example.id domain_name = aws_apigatewayv2_domain_name.example.id diff --git a/website/docs/r/apigatewayv2_authorizer.html.markdown b/website/docs/r/apigatewayv2_authorizer.html.markdown index ab64754a6153..35265d0344dd 100644 --- a/website/docs/r/apigatewayv2_authorizer.html.markdown +++ b/website/docs/r/apigatewayv2_authorizer.html.markdown @@ -15,7 +15,7 @@ More information can be found in the [Amazon API Gateway Developer Guide](https: ### Basic WebSocket API -```hcl +```terraform resource "aws_apigatewayv2_authorizer" "example" { api_id = aws_apigatewayv2_api.example.id authorizer_type = "REQUEST" @@ -27,7 +27,7 @@ resource "aws_apigatewayv2_authorizer" "example" { ### Basic HTTP API -```hcl +```terraform resource "aws_apigatewayv2_authorizer" "example" { api_id = aws_apigatewayv2_api.example.id authorizer_type = "JWT" diff --git a/website/docs/r/apigatewayv2_deployment.html.markdown b/website/docs/r/apigatewayv2_deployment.html.markdown index 181de827201f..ba6789caa7b5 100644 --- a/website/docs/r/apigatewayv2_deployment.html.markdown +++ b/website/docs/r/apigatewayv2_deployment.html.markdown @@ -19,7 +19,7 @@ More information can be found in the [Amazon API Gateway Developer Guide](https: ### Basic -```hcl +```terraform resource "aws_apigatewayv2_deployment" "example" { api_id = aws_apigatewayv2_route.example.api_id description = "Example deployment" @@ -34,7 +34,7 @@ resource "aws_apigatewayv2_deployment" "example" { -> **NOTE:** This is an optional and Terraform 0.12 (or later) advanced configuration that shows calculating a hash of the API's Terraform resources to determine changes that should trigger a new deployment. This value will change after the first Terraform apply of new resources, triggering an immediate redeployment, however it will stabilize afterwards except for resource changes. The `triggers` map can also be configured in other, more complex ways to fit the environment, avoiding the immediate redeployment issue. -```hcl +```terraform resource "aws_apigatewayv2_deployment" "example" { api_id = aws_apigatewayv2_api.example.id description = "Example deployment" diff --git a/website/docs/r/apigatewayv2_domain_name.html.markdown b/website/docs/r/apigatewayv2_domain_name.html.markdown index c28383ab6dcd..c6bde688df8f 100644 --- a/website/docs/r/apigatewayv2_domain_name.html.markdown +++ b/website/docs/r/apigatewayv2_domain_name.html.markdown @@ -18,7 +18,7 @@ a particular domain name. An API stage can be associated with the domain name us ### Basic -```hcl +```terraform resource "aws_apigatewayv2_domain_name" "example" { domain_name = "ws-api.example.com" @@ -32,7 +32,7 @@ resource "aws_apigatewayv2_domain_name" "example" { ### Associated Route 53 Resource Record -```hcl +```terraform resource "aws_apigatewayv2_domain_name" "example" { domain_name = "http-api.example.com" @@ -92,6 +92,7 @@ In addition to all arguments above, the following attributes are exported: `aws_apigatewayv2_domain_name` provides the following [Timeouts](https://www.terraform.io/docs/configuration/blocks/resources/syntax.html#operation-timeouts) configuration options: +- `create` - (Default `10 minutes`) Used for creating the domain name - `update` - (Default `60 minutes`) Used for updating the domain name ## Import diff --git a/website/docs/r/apigatewayv2_integration.html.markdown b/website/docs/r/apigatewayv2_integration.html.markdown index e7d89fa05dd1..d0925af91009 100644 --- a/website/docs/r/apigatewayv2_integration.html.markdown +++ b/website/docs/r/apigatewayv2_integration.html.markdown @@ -15,7 +15,7 @@ More information can be found in the [Amazon API Gateway Developer Guide](https: ### Basic -```hcl +```terraform resource "aws_apigatewayv2_integration" "example" { api_id = aws_apigatewayv2_api.example.id integration_type = "MOCK" @@ -24,7 +24,7 @@ resource "aws_apigatewayv2_integration" "example" { ### Lambda Integration -```hcl +```terraform resource "aws_lambda_function" "example" { filename = "example.zip" function_name = "Example" @@ -48,7 +48,7 @@ resource "aws_apigatewayv2_integration" "example" { ### AWS Service Integration -```hcl +```terraform resource "aws_apigatewayv2_integration" "example" { api_id = aws_apigatewayv2_api.example.id credentials_arn = aws_iam_role.example.arn @@ -65,7 +65,7 @@ resource "aws_apigatewayv2_integration" "example" { ### Private Integration -```hcl +```terraform resource "aws_apigatewayv2_integration" "example" { api_id = aws_apigatewayv2_api.example.id credentials_arn = aws_iam_role.example.arn diff --git a/website/docs/r/apigatewayv2_integration_response.html.markdown b/website/docs/r/apigatewayv2_integration_response.html.markdown index eabdaec005db..05ab9fd92c74 100644 --- a/website/docs/r/apigatewayv2_integration_response.html.markdown +++ b/website/docs/r/apigatewayv2_integration_response.html.markdown @@ -15,7 +15,7 @@ More information can be found in the [Amazon API Gateway Developer Guide](https: ### Basic -```hcl +```terraform resource "aws_apigatewayv2_integration_response" "example" { api_id = aws_apigatewayv2_api.example.id integration_id = aws_apigatewayv2_integration.example.id diff --git a/website/docs/r/apigatewayv2_model.html.markdown b/website/docs/r/apigatewayv2_model.html.markdown index b707e0bc0627..107a15164eca 100644 --- a/website/docs/r/apigatewayv2_model.html.markdown +++ b/website/docs/r/apigatewayv2_model.html.markdown @@ -14,7 +14,7 @@ Manages an Amazon API Gateway Version 2 [model](https://docs.aws.amazon.com/apig ### Basic -```hcl +```terraform resource "aws_apigatewayv2_model" "example" { api_id = aws_apigatewayv2_api.example.id content_type = "application/json" diff --git a/website/docs/r/apigatewayv2_route.html.markdown b/website/docs/r/apigatewayv2_route.html.markdown index e45a982ef5df..11d9a7463d2d 100644 --- a/website/docs/r/apigatewayv2_route.html.markdown +++ b/website/docs/r/apigatewayv2_route.html.markdown @@ -15,7 +15,7 @@ More information can be found in the [Amazon API Gateway Developer Guide](https: ### Basic -```hcl +```terraform resource "aws_apigatewayv2_api" "example" { name = "example-websocket-api" protocol_type = "WEBSOCKET" @@ -30,7 +30,7 @@ resource "aws_apigatewayv2_route" "example" { ### HTTP Proxy Integration -```hcl +```terraform resource "aws_apigatewayv2_api" "example" { name = "example-http-api" protocol_type = "HTTP" diff --git a/website/docs/r/apigatewayv2_route_response.html.markdown b/website/docs/r/apigatewayv2_route_response.html.markdown index ec8e62775263..38b494adf77d 100644 --- a/website/docs/r/apigatewayv2_route_response.html.markdown +++ b/website/docs/r/apigatewayv2_route_response.html.markdown @@ -15,7 +15,7 @@ More information can be found in the [Amazon API Gateway Developer Guide](https: ### Basic -```hcl +```terraform resource "aws_apigatewayv2_route_response" "example" { api_id = aws_apigatewayv2_api.example.id route_id = aws_apigatewayv2_route.example.id diff --git a/website/docs/r/apigatewayv2_stage.html.markdown b/website/docs/r/apigatewayv2_stage.html.markdown index 38958ea4dab9..33e736aea002 100644 --- a/website/docs/r/apigatewayv2_stage.html.markdown +++ b/website/docs/r/apigatewayv2_stage.html.markdown @@ -15,7 +15,7 @@ More information can be found in the [Amazon API Gateway Developer Guide](https: ### Basic -```hcl +```terraform resource "aws_apigatewayv2_stage" "example" { api_id = aws_apigatewayv2_api.example.id name = "example-stage" diff --git a/website/docs/r/apigatewayv2_vpc_link.html.markdown b/website/docs/r/apigatewayv2_vpc_link.html.markdown index dcaa94baf4da..0d3e66777225 100644 --- a/website/docs/r/apigatewayv2_vpc_link.html.markdown +++ b/website/docs/r/apigatewayv2_vpc_link.html.markdown @@ -15,7 +15,7 @@ To enable private integration for REST APIs, use the Amazon API Gateway Version ## Example Usage -```hcl +```terraform resource "aws_apigatewayv2_vpc_link" "example" { name = "example" security_group_ids = [data.aws_security_group.example.id] diff --git a/website/docs/r/app_cookie_stickiness_policy.html.markdown b/website/docs/r/app_cookie_stickiness_policy.html.markdown index fd3a9e535f30..a5087e39a4cc 100644 --- a/website/docs/r/app_cookie_stickiness_policy.html.markdown +++ b/website/docs/r/app_cookie_stickiness_policy.html.markdown @@ -12,7 +12,7 @@ Provides an application cookie stickiness policy, which allows an ELB to wed its ## Example Usage -```hcl +```terraform resource "aws_elb" "lb" { name = "test-lb" availability_zones = ["us-east-1a"] diff --git a/website/docs/r/appautoscaling_policy.html.markdown b/website/docs/r/appautoscaling_policy.html.markdown index ff7d6034bdb9..9b4fe1ea0369 100644 --- a/website/docs/r/appautoscaling_policy.html.markdown +++ b/website/docs/r/appautoscaling_policy.html.markdown @@ -14,7 +14,7 @@ Provides an Application AutoScaling Policy resource. ### DynamoDB Table Autoscaling -```hcl +```terraform resource "aws_appautoscaling_target" "dynamodb_table_read_target" { max_capacity = 100 min_capacity = 5 @@ -42,7 +42,7 @@ resource "aws_appautoscaling_policy" "dynamodb_table_read_policy" { ### ECS Service Autoscaling -```hcl +```terraform resource "aws_appautoscaling_target" "ecs_target" { max_capacity = 4 min_capacity = 1 @@ -73,7 +73,7 @@ resource "aws_appautoscaling_policy" "ecs_policy" { ### Preserve desired count when updating an autoscaled ECS Service -```hcl +```terraform resource "aws_ecs_service" "ecs_service" { name = "serviceName" cluster = "clusterName" @@ -88,7 +88,7 @@ resource "aws_ecs_service" "ecs_service" { ### Aurora Read Replica Autoscaling -```hcl +```terraform resource "aws_appautoscaling_target" "replicas" { service_namespace = "rds" scalable_dimension = "rds:cluster:ReadReplicaCount" @@ -138,7 +138,7 @@ The `step_scaling_policy_configuration` configuration block supports the followi * `min_adjustment_magnitude` - (Optional) The minimum number to adjust your scalable dimension as a result of a scaling activity. If the adjustment type is PercentChangeInCapacity, the scaling policy changes the scalable dimension of the scalable target by this amount. * `step_adjustment` - (Optional) A set of adjustments that manage scaling. These have the following structure: - ```hcl + ```terraform resource "aws_appautoscaling_policy" "ecs_policy" { # ... @@ -179,7 +179,7 @@ The `target_tracking_scaling_policy_configuration` configuration block supports Example usage: -```hcl +```terraform resource "aws_appautoscaling_policy" "example" { policy_type = "TargetTrackingScaling" diff --git a/website/docs/r/appautoscaling_scheduled_action.html.markdown b/website/docs/r/appautoscaling_scheduled_action.html.markdown index 8f7c8b60eb1e..7170188f3916 100644 --- a/website/docs/r/appautoscaling_scheduled_action.html.markdown +++ b/website/docs/r/appautoscaling_scheduled_action.html.markdown @@ -14,7 +14,7 @@ Provides an Application AutoScaling ScheduledAction resource. ### DynamoDB Table Autoscaling -```hcl +```terraform resource "aws_appautoscaling_target" "dynamodb" { max_capacity = 100 min_capacity = 5 @@ -39,7 +39,7 @@ resource "aws_appautoscaling_scheduled_action" "dynamodb" { ### ECS Service Autoscaling -```hcl +```terraform resource "aws_appautoscaling_target" "ecs" { max_capacity = 4 min_capacity = 1 diff --git a/website/docs/r/appautoscaling_target.html.markdown b/website/docs/r/appautoscaling_target.html.markdown index c3363716d20f..83f670bb956e 100644 --- a/website/docs/r/appautoscaling_target.html.markdown +++ b/website/docs/r/appautoscaling_target.html.markdown @@ -16,7 +16,7 @@ Provides an Application AutoScaling ScalableTarget resource. To manage policies ### DynamoDB Table Autoscaling -```hcl +```terraform resource "aws_appautoscaling_target" "dynamodb_table_read_target" { max_capacity = 100 min_capacity = 5 @@ -28,7 +28,7 @@ resource "aws_appautoscaling_target" "dynamodb_table_read_target" { ### DynamoDB Index Autoscaling -```hcl +```terraform resource "aws_appautoscaling_target" "dynamodb_index_read_target" { max_capacity = 100 min_capacity = 5 @@ -40,7 +40,7 @@ resource "aws_appautoscaling_target" "dynamodb_index_read_target" { ### ECS Service Autoscaling -```hcl +```terraform resource "aws_appautoscaling_target" "ecs_target" { max_capacity = 4 min_capacity = 1 @@ -52,7 +52,7 @@ resource "aws_appautoscaling_target" "ecs_target" { ### Aurora Read Replica Autoscaling -```hcl +```terraform resource "aws_appautoscaling_target" "replicas" { service_namespace = "rds" scalable_dimension = "rds:cluster:ReadReplicaCount" @@ -73,6 +73,10 @@ The following arguments are supported: * `scalable_dimension` - (Required) The scalable dimension of the scalable target. Documentation can be found in the `ScalableDimension` parameter at: [AWS Application Auto Scaling API Reference](https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html#API_RegisterScalableTarget_RequestParameters) * `service_namespace` - (Required) The AWS service namespace of the scalable target. Documentation can be found in the `ServiceNamespace` parameter at: [AWS Application Auto Scaling API Reference](https://docs.aws.amazon.com/autoscaling/application/APIReference/API_RegisterScalableTarget.html#API_RegisterScalableTarget_RequestParameters) +## Attributes Reference + +No additional attributes are exported. + ## Import Application AutoScaling Target can be imported using the `service-namespace` , `resource-id` and `scalable-dimension` separated by `/`. diff --git a/website/docs/r/appmesh_gateway_route.html.markdown b/website/docs/r/appmesh_gateway_route.html.markdown index 350337e3932a..730e1a9e5891 100644 --- a/website/docs/r/appmesh_gateway_route.html.markdown +++ b/website/docs/r/appmesh_gateway_route.html.markdown @@ -12,7 +12,7 @@ Provides an AWS App Mesh gateway route resource. ## Example Usage -```hcl +```terraform resource "aws_appmesh_gateway_route" "example" { name = "example-gateway-route" mesh_name = "example-service-mesh" diff --git a/website/docs/r/appmesh_mesh.html.markdown b/website/docs/r/appmesh_mesh.html.markdown index b21352f02e6e..d633cd16156f 100644 --- a/website/docs/r/appmesh_mesh.html.markdown +++ b/website/docs/r/appmesh_mesh.html.markdown @@ -14,7 +14,7 @@ Provides an AWS App Mesh service mesh resource. ### Basic -```hcl +```terraform resource "aws_appmesh_mesh" "simple" { name = "simpleapp" } @@ -22,7 +22,7 @@ resource "aws_appmesh_mesh" "simple" { ### Egress Filter -```hcl +```terraform resource "aws_appmesh_mesh" "simple" { name = "simpleapp" diff --git a/website/docs/r/appmesh_route.html.markdown b/website/docs/r/appmesh_route.html.markdown index b7891b6c5963..688a8215ff2e 100644 --- a/website/docs/r/appmesh_route.html.markdown +++ b/website/docs/r/appmesh_route.html.markdown @@ -14,7 +14,7 @@ Provides an AWS App Mesh route resource. ### HTTP Routing -```hcl +```terraform resource "aws_appmesh_route" "serviceb" { name = "serviceB-route" mesh_name = aws_appmesh_mesh.simple.id @@ -44,7 +44,7 @@ resource "aws_appmesh_route" "serviceb" { ### HTTP Header Routing -```hcl +```terraform resource "aws_appmesh_route" "serviceb" { name = "serviceB-route" mesh_name = aws_appmesh_mesh.simple.id @@ -79,7 +79,7 @@ resource "aws_appmesh_route" "serviceb" { ### Retry Policy -```hcl +```terraform resource "aws_appmesh_route" "serviceb" { name = "serviceB-route" mesh_name = aws_appmesh_mesh.simple.id @@ -116,7 +116,7 @@ resource "aws_appmesh_route" "serviceb" { ### TCP Routing -```hcl +```terraform resource "aws_appmesh_route" "serviceb" { name = "serviceB-route" mesh_name = aws_appmesh_mesh.simple.id diff --git a/website/docs/r/appmesh_virtual_gateway.html.markdown b/website/docs/r/appmesh_virtual_gateway.html.markdown index 604342c7eeda..12a7b1c8b4e9 100644 --- a/website/docs/r/appmesh_virtual_gateway.html.markdown +++ b/website/docs/r/appmesh_virtual_gateway.html.markdown @@ -14,7 +14,7 @@ Provides an AWS App Mesh virtual gateway resource. ### Basic -```hcl +```terraform resource "aws_appmesh_virtual_gateway" "example" { name = "example-virtual-gateway" mesh_name = "example-service-mesh" @@ -36,7 +36,7 @@ resource "aws_appmesh_virtual_gateway" "example" { ### Access Logs and TLS -```hcl +```terraform resource "aws_appmesh_virtual_gateway" "example" { name = "example-virtual-gateway" mesh_name = "example-service-mesh" diff --git a/website/docs/r/appmesh_virtual_node.html.markdown b/website/docs/r/appmesh_virtual_node.html.markdown index 76d251dca779..ba03b9ee10e9 100644 --- a/website/docs/r/appmesh_virtual_node.html.markdown +++ b/website/docs/r/appmesh_virtual_node.html.markdown @@ -25,7 +25,7 @@ The Terraform state associated with existing resources will automatically be mig ### Basic -```hcl +```terraform resource "aws_appmesh_virtual_node" "serviceb1" { name = "serviceBv1" mesh_name = aws_appmesh_mesh.simple.id @@ -55,7 +55,7 @@ resource "aws_appmesh_virtual_node" "serviceb1" { ### AWS Cloud Map Service Discovery -```hcl +```terraform resource "aws_service_discovery_http_namespace" "example" { name = "example-ns" } @@ -94,7 +94,7 @@ resource "aws_appmesh_virtual_node" "serviceb1" { ### Listener Health Check -```hcl +```terraform resource "aws_appmesh_virtual_node" "serviceb1" { name = "serviceBv1" mesh_name = aws_appmesh_mesh.simple.id @@ -133,7 +133,7 @@ resource "aws_appmesh_virtual_node" "serviceb1" { ### Logging -```hcl +```terraform resource "aws_appmesh_virtual_node" "serviceb1" { name = "serviceBv1" mesh_name = aws_appmesh_mesh.simple.id diff --git a/website/docs/r/appmesh_virtual_router.html.markdown b/website/docs/r/appmesh_virtual_router.html.markdown index 50631ab31bb4..13b05463ffd4 100644 --- a/website/docs/r/appmesh_virtual_router.html.markdown +++ b/website/docs/r/appmesh_virtual_router.html.markdown @@ -24,7 +24,7 @@ The Terraform state associated with existing resources will automatically be mig ## Example Usage -```hcl +```terraform resource "aws_appmesh_virtual_router" "serviceb" { name = "serviceB" mesh_name = aws_appmesh_mesh.simple.id diff --git a/website/docs/r/appmesh_virtual_service.html.markdown b/website/docs/r/appmesh_virtual_service.html.markdown index 9c5d3fb05849..a803fd538e05 100644 --- a/website/docs/r/appmesh_virtual_service.html.markdown +++ b/website/docs/r/appmesh_virtual_service.html.markdown @@ -14,7 +14,7 @@ Provides an AWS App Mesh virtual service resource. ### Virtual Node Provider -```hcl +```terraform resource "aws_appmesh_virtual_service" "servicea" { name = "servicea.simpleapp.local" mesh_name = aws_appmesh_mesh.simple.id @@ -31,7 +31,7 @@ resource "aws_appmesh_virtual_service" "servicea" { ### Virtual Router Provider -```hcl +```terraform resource "aws_appmesh_virtual_service" "servicea" { name = "servicea.simpleapp.local" mesh_name = aws_appmesh_mesh.simple.id diff --git a/website/docs/r/appsync_api_key.html.markdown b/website/docs/r/appsync_api_key.html.markdown index a6c913367c9e..3d5b2dace463 100644 --- a/website/docs/r/appsync_api_key.html.markdown +++ b/website/docs/r/appsync_api_key.html.markdown @@ -12,7 +12,7 @@ Provides an AppSync API Key. ## Example Usage -```hcl +```terraform resource "aws_appsync_graphql_api" "example" { authentication_type = "API_KEY" name = "example" diff --git a/website/docs/r/appsync_datasource.html.markdown b/website/docs/r/appsync_datasource.html.markdown index e13af7858b3c..3f0eba9798a3 100644 --- a/website/docs/r/appsync_datasource.html.markdown +++ b/website/docs/r/appsync_datasource.html.markdown @@ -12,7 +12,7 @@ Provides an AppSync DataSource. ## Example Usage -```hcl +```terraform resource "aws_dynamodb_table" "example" { name = "example" read_capacity = 1 diff --git a/website/docs/r/appsync_function.html.markdown b/website/docs/r/appsync_function.html.markdown index 120ca8771d24..7df8ee88b47e 100644 --- a/website/docs/r/appsync_function.html.markdown +++ b/website/docs/r/appsync_function.html.markdown @@ -12,7 +12,7 @@ Provides an AppSync Function. ## Example Usage -```hcl +```terraform resource "aws_appsync_graphql_api" "example" { authentication_type = "API_KEY" name = "example" diff --git a/website/docs/r/appsync_graphql_api.html.markdown b/website/docs/r/appsync_graphql_api.html.markdown index 73ea4a92a100..b69b1dc48e44 100644 --- a/website/docs/r/appsync_graphql_api.html.markdown +++ b/website/docs/r/appsync_graphql_api.html.markdown @@ -14,7 +14,7 @@ Provides an AppSync GraphQL API. ### API Key Authentication -```hcl +```terraform resource "aws_appsync_graphql_api" "example" { authentication_type = "API_KEY" name = "example" @@ -23,7 +23,7 @@ resource "aws_appsync_graphql_api" "example" { ### AWS Cognito User Pool Authentication -```hcl +```terraform resource "aws_appsync_graphql_api" "example" { authentication_type = "AMAZON_COGNITO_USER_POOLS" name = "example" @@ -38,7 +38,7 @@ resource "aws_appsync_graphql_api" "example" { ### AWS IAM Authentication -```hcl +```terraform resource "aws_appsync_graphql_api" "example" { authentication_type = "AWS_IAM" name = "example" @@ -47,7 +47,7 @@ resource "aws_appsync_graphql_api" "example" { ### With Schema -```hcl +```terraform resource "aws_appsync_graphql_api" "example" { authentication_type = "AWS_IAM" name = "example" @@ -65,7 +65,7 @@ EOF ### OpenID Connect Authentication -```hcl +```terraform resource "aws_appsync_graphql_api" "example" { authentication_type = "OPENID_CONNECT" name = "example" @@ -78,7 +78,7 @@ resource "aws_appsync_graphql_api" "example" { ### With Multiple Authentication Providers -```hcl +```terraform resource "aws_appsync_graphql_api" "example" { authentication_type = "API_KEY" name = "example" @@ -91,7 +91,7 @@ resource "aws_appsync_graphql_api" "example" { ### Enabling Logging -```hcl +```terraform resource "aws_iam_role" "example" { name = "example" diff --git a/website/docs/r/appsync_resolver.html.markdown b/website/docs/r/appsync_resolver.html.markdown index 56373c351e35..516fa22ddc5a 100644 --- a/website/docs/r/appsync_resolver.html.markdown +++ b/website/docs/r/appsync_resolver.html.markdown @@ -12,7 +12,7 @@ Provides an AppSync Resolver. ## Example Usage -```hcl +```terraform resource "aws_appsync_graphql_api" "test" { authentication_type = "API_KEY" name = "tf-example" diff --git a/website/docs/r/athena_database.html.markdown b/website/docs/r/athena_database.html.markdown index edb85238d166..53ee0b6d92ba 100644 --- a/website/docs/r/athena_database.html.markdown +++ b/website/docs/r/athena_database.html.markdown @@ -12,7 +12,7 @@ Provides an Athena database. ## Example Usage -```hcl +```terraform resource "aws_s3_bucket" "hoge" { bucket = "hoge" } diff --git a/website/docs/r/athena_named_query.html.markdown b/website/docs/r/athena_named_query.html.markdown index 49d57b32f775..c6442aba4371 100644 --- a/website/docs/r/athena_named_query.html.markdown +++ b/website/docs/r/athena_named_query.html.markdown @@ -12,7 +12,7 @@ Provides an Athena Named Query resource. ## Example Usage -```hcl +```terraform resource "aws_s3_bucket" "hoge" { bucket = "tf-test" } diff --git a/website/docs/r/athena_workgroup.html.markdown b/website/docs/r/athena_workgroup.html.markdown index 7b3ea2312f97..1cffc581aa8b 100644 --- a/website/docs/r/athena_workgroup.html.markdown +++ b/website/docs/r/athena_workgroup.html.markdown @@ -12,7 +12,7 @@ Provides an Athena Workgroup. ## Example Usage -```hcl +```terraform resource "aws_athena_workgroup" "example" { name = "example" diff --git a/website/docs/r/autoscaling_attachment.html.markdown b/website/docs/r/autoscaling_attachment.html.markdown index 6c6fc929f0a4..41c5497589fe 100644 --- a/website/docs/r/autoscaling_attachment.html.markdown +++ b/website/docs/r/autoscaling_attachment.html.markdown @@ -21,7 +21,7 @@ to ignore changes to the `load_balancers` and `target_group_arns` arguments with ## Example Usage -```hcl +```terraform # Create a new load balancer attachment resource "aws_autoscaling_attachment" "asg_attachment_bar" { autoscaling_group_name = aws_autoscaling_group.asg.id @@ -29,7 +29,7 @@ resource "aws_autoscaling_attachment" "asg_attachment_bar" { } ``` -```hcl +```terraform # Create a new ALB Target Group attachment resource "aws_autoscaling_attachment" "asg_attachment_bar" { autoscaling_group_name = aws_autoscaling_group.asg.id @@ -39,7 +39,7 @@ resource "aws_autoscaling_attachment" "asg_attachment_bar" { ## With An AutoScaling Group Resource -```hcl +```terraform resource "aws_autoscaling_group" "asg" { # ... other configuration ... @@ -62,3 +62,6 @@ The following arguments are supported: * `elb` - (Optional) The name of the ELB. * `alb_target_group_arn` - (Optional) The ARN of an ALB Target Group. +## Attributes Reference + +No additional attributes are exported. diff --git a/website/docs/r/autoscaling_group.html.markdown b/website/docs/r/autoscaling_group.html.markdown index d9bd775984bc..8571f7884f14 100644 --- a/website/docs/r/autoscaling_group.html.markdown +++ b/website/docs/r/autoscaling_group.html.markdown @@ -23,7 +23,7 @@ to ignore changes to the `load_balancers` and `target_group_arns` arguments with ## Example Usage -```hcl +```terraform resource "aws_placement_group" "test" { name = "test" strategy = "cluster" @@ -77,7 +77,7 @@ EOF ### With Latest Version Of Launch Template -```hcl +```terraform resource "aws_launch_template" "foobar" { name_prefix = "foobar" image_id = "ami-1a2b3c" @@ -99,7 +99,7 @@ resource "aws_autoscaling_group" "bar" { ### Mixed Instances Policy -```hcl +```terraform resource "aws_launch_template" "example" { name_prefix = "example" image_id = data.aws_ami.example.id @@ -134,7 +134,7 @@ resource "aws_autoscaling_group" "example" { ### Mixed Instances Policy with Spot Instances and Capacity Rebalance -```hcl +```terraform resource "aws_launch_template" "example" { name_prefix = "example" image_id = data.aws_ami.example.id @@ -178,7 +178,7 @@ resource "aws_autoscaling_group" "example" { When using a diverse instance set, some instance types might require a launch template with configuration values unique to that instance type such as a different AMI (Graviton2), architecture specific user data script, different EBS configuration, or different networking configuration. -```hcl +```terraform resource "aws_launch_template" "example" { name_prefix = "example" image_id = data.aws_ami.example.id @@ -221,7 +221,7 @@ resource "aws_autoscaling_group" "example" { ### Interpolated tags -```hcl +```terraform variable "extra_tags" { default = [ { @@ -264,7 +264,7 @@ resource "aws_autoscaling_group" "bar" { ### Automatically refresh all instances after the group is updated -```hcl +```terraform resource "aws_autoscaling_group" "example" { availability_zones = ["us-east-1a"] desired_capacity = 1 diff --git a/website/docs/r/autoscaling_lifecycle_hook.html.markdown b/website/docs/r/autoscaling_lifecycle_hook.html.markdown index c981b134bffa..9c6914bd08fa 100644 --- a/website/docs/r/autoscaling_lifecycle_hook.html.markdown +++ b/website/docs/r/autoscaling_lifecycle_hook.html.markdown @@ -24,7 +24,7 @@ but take care to not duplicate those hooks with this resource. ## Example Usage -```hcl +```terraform resource "aws_autoscaling_group" "foobar" { availability_zones = ["us-west-2a"] name = "terraform-test-foobar5" @@ -69,6 +69,10 @@ The following arguments are supported: * `notification_target_arn` - (Optional) The ARN of the notification target that Auto Scaling will use to notify you when an instance is in the transition state for the lifecycle hook. This ARN target can be either an SQS queue or an SNS topic. * `role_arn` - (Optional) The ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. +## Attributes Reference + +No additional attributes are exported. + ## Import AutoScaling Lifecycle Hooks can be imported using the role autoscaling_group_name and name separated by `/`. diff --git a/website/docs/r/autoscaling_notification.html.markdown b/website/docs/r/autoscaling_notification.html.markdown index f142a051bb50..e02990ef953a 100644 --- a/website/docs/r/autoscaling_notification.html.markdown +++ b/website/docs/r/autoscaling_notification.html.markdown @@ -16,7 +16,7 @@ Services, and are applied to each AutoScaling Group you supply. Basic usage: -```hcl +```terraform resource "aws_autoscaling_notification" "example_notifications" { group_names = [ aws_autoscaling_group.bar.name, diff --git a/website/docs/r/autoscaling_policy.html.markdown b/website/docs/r/autoscaling_policy.html.markdown index 22b347426f2d..70c146513dc2 100644 --- a/website/docs/r/autoscaling_policy.html.markdown +++ b/website/docs/r/autoscaling_policy.html.markdown @@ -18,7 +18,7 @@ or [dynamic](https://docs.aws.amazon.com/AutoScaling/latest/DeveloperGuide/as-sc ## Example Usage -```hcl +```terraform resource "aws_autoscaling_policy" "bat" { name = "foobar3-terraform-test" scaling_adjustment = 4 @@ -62,7 +62,7 @@ The following arguments are only available to "StepScaling" type policies: * `step_adjustment` - (Optional) A set of adjustments that manage group scaling. These have the following structure: -```hcl +```terraform resource "aws_autoscaling_policy" "example" { # ... other configuration ... @@ -99,7 +99,7 @@ The following arguments are only available to "TargetTrackingScaling" type polic * `target_tracking_configuration` - (Optional) A target tracking policy. These have the following structure: -```hcl +```terraform resource "aws_autoscaling_policy" "example" { # ... other configuration ... diff --git a/website/docs/r/autoscaling_schedule.html.markdown b/website/docs/r/autoscaling_schedule.html.markdown index 851387d97b00..fef7b6656f08 100644 --- a/website/docs/r/autoscaling_schedule.html.markdown +++ b/website/docs/r/autoscaling_schedule.html.markdown @@ -12,7 +12,7 @@ Provides an AutoScaling Schedule resource. ## Example Usage -```hcl +```terraform resource "aws_autoscaling_group" "foobar" { availability_zones = ["us-west-2a"] name = "terraform-test-foobar5" diff --git a/website/docs/r/autoscalingplans_scaling_plan.html.markdown b/website/docs/r/autoscalingplans_scaling_plan.html.markdown index 73298f160d9e..e28dcaf236f7 100644 --- a/website/docs/r/autoscalingplans_scaling_plan.html.markdown +++ b/website/docs/r/autoscalingplans_scaling_plan.html.markdown @@ -19,7 +19,7 @@ See the [AWS documentation](https://docs.aws.amazon.com/autoscaling/plans/usergu ### Basic Dynamic Scaling -```hcl +```terraform data "aws_availability_zones" "available" {} resource "aws_autoscaling_group" "example" { @@ -70,7 +70,7 @@ resource "aws_autoscalingplans_scaling_plan" "example" { ### Basic Predictive Scaling -```hcl +```terraform data "aws_availability_zones" "available" {} resource "aws_autoscaling_group" "example" { diff --git a/website/docs/r/backup_global_settings.html.markdown b/website/docs/r/backup_global_settings.html.markdown index aaac9911e7bb..c49517aae274 100644 --- a/website/docs/r/backup_global_settings.html.markdown +++ b/website/docs/r/backup_global_settings.html.markdown @@ -12,7 +12,7 @@ Provides an AWS Backup Global Settings resource. ## Example Usage -```hcl +```terraform resource "aws_backup_global_settings" "test" { global_settings = { "isCrossAccountBackupEnabled" = "true" diff --git a/website/docs/r/backup_plan.html.markdown b/website/docs/r/backup_plan.html.markdown index 9f63eba71724..832e9b298666 100644 --- a/website/docs/r/backup_plan.html.markdown +++ b/website/docs/r/backup_plan.html.markdown @@ -12,7 +12,7 @@ Provides an AWS Backup plan resource. ## Example Usage -```hcl +```terraform resource "aws_backup_plan" "example" { name = "tf_example_backup_plan" diff --git a/website/docs/r/backup_region_settings.html.markdown b/website/docs/r/backup_region_settings.html.markdown index ce08d1187753..422840e27f1f 100644 --- a/website/docs/r/backup_region_settings.html.markdown +++ b/website/docs/r/backup_region_settings.html.markdown @@ -12,7 +12,7 @@ Provides an AWS Backup Region Settings resource. ## Example Usage -```hcl +```terraform resource "aws_backup_region_settings" "test" { resource_type_opt_in_preference = { "DynamoDB" = true diff --git a/website/docs/r/backup_selection.html.markdown b/website/docs/r/backup_selection.html.markdown index c45e47dc1654..c8178bcbe741 100644 --- a/website/docs/r/backup_selection.html.markdown +++ b/website/docs/r/backup_selection.html.markdown @@ -18,7 +18,7 @@ Manages selection conditions for AWS Backup plan resources. The below example creates an IAM role with the default managed IAM Policy for allowing AWS Backup to create backups. -```hcl +```terraform resource "aws_iam_role" "example" { name = "example" assume_role_policy = < **Note:** Further managing the automatically created Bitbucket/GitHub webhook with the `bitbucket_hook`/`github_repository_webhook` resource is only possible with importing that resource after creation of the `aws_codebuild_webhook` resource. The CodeBuild API does not ever provide the `secret` attribute for the `aws_codebuild_webhook` resource in this scenario. -```hcl +```terraform resource "aws_codebuild_webhook" "example" { project_name = aws_codebuild_project.example.name @@ -44,7 +44,7 @@ When working with [GitHub Enterprise](https://enterprise.github.com/) source Cod More information creating webhooks with GitHub Enterprise can be found in the [CodeBuild User Guide](https://docs.aws.amazon.com/codebuild/latest/userguide/sample-github-enterprise.html). -```hcl +```terraform resource "aws_codebuild_webhook" "example" { project_name = aws_codebuild_project.example.name } diff --git a/website/docs/r/codecommit_repository.html.markdown b/website/docs/r/codecommit_repository.html.markdown index 30ef0d92eadf..295b231b39de 100644 --- a/website/docs/r/codecommit_repository.html.markdown +++ b/website/docs/r/codecommit_repository.html.markdown @@ -12,7 +12,7 @@ Provides a CodeCommit Repository Resource. ## Example Usage -```hcl +```terraform resource "aws_codecommit_repository" "test" { repository_name = "MyTestRepository" description = "This is the Sample App Repository" diff --git a/website/docs/r/codecommit_trigger.html.markdown b/website/docs/r/codecommit_trigger.html.markdown index 43e58723c017..19bfbddb6a36 100644 --- a/website/docs/r/codecommit_trigger.html.markdown +++ b/website/docs/r/codecommit_trigger.html.markdown @@ -12,7 +12,7 @@ Provides a CodeCommit Trigger Resource. ## Example Usage -```hcl +```terraform resource "aws_codecommit_repository" "test" { repository_name = "test" } @@ -38,3 +38,9 @@ The following arguments are supported: * `custom_data` - (Optional) Any custom data associated with the trigger that will be included in the information sent to the target of the trigger. * `branches` - (Optional) The branches that will be included in the trigger configuration. If no branches are specified, the trigger will apply to all branches. * `events` - (Required) The repository events that will cause the trigger to run actions in another service, such as sending a notification through Amazon Simple Notification Service (SNS). If no events are specified, the trigger will run for all repository events. Event types include: `all`, `updateReference`, `createReference`, `deleteReference`. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `configuration_id` - System-generated unique identifier. diff --git a/website/docs/r/codedeploy_app.html.markdown b/website/docs/r/codedeploy_app.html.markdown index a838fd75553b..1003a2d99307 100644 --- a/website/docs/r/codedeploy_app.html.markdown +++ b/website/docs/r/codedeploy_app.html.markdown @@ -14,7 +14,7 @@ Provides a CodeDeploy application to be used as a basis for deployments ### ECS Application -```hcl +```terraform resource "aws_codedeploy_app" "example" { compute_platform = "ECS" name = "example" @@ -23,7 +23,7 @@ resource "aws_codedeploy_app" "example" { ### Lambda Application -```hcl +```terraform resource "aws_codedeploy_app" "example" { compute_platform = "Lambda" name = "example" @@ -32,7 +32,7 @@ resource "aws_codedeploy_app" "example" { ### Server Application -```hcl +```terraform resource "aws_codedeploy_app" "example" { compute_platform = "Server" name = "example" diff --git a/website/docs/r/codedeploy_deployment_config.html.markdown b/website/docs/r/codedeploy_deployment_config.html.markdown index a28f04f82956..a34f99cd77ca 100644 --- a/website/docs/r/codedeploy_deployment_config.html.markdown +++ b/website/docs/r/codedeploy_deployment_config.html.markdown @@ -14,7 +14,7 @@ Provides a CodeDeploy deployment config for an application ### Server Usage -```hcl +```terraform resource "aws_codedeploy_deployment_config" "foo" { deployment_config_name = "test-deployment-config" @@ -56,7 +56,7 @@ resource "aws_codedeploy_deployment_group" "foo" { ### Lambda Usage -```hcl +```terraform resource "aws_codedeploy_deployment_config" "foo" { deployment_config_name = "test-deployment-config" compute_platform = "Lambda" diff --git a/website/docs/r/codedeploy_deployment_group.html.markdown b/website/docs/r/codedeploy_deployment_group.html.markdown index 9f69bd4b7f66..fae6fd59634c 100644 --- a/website/docs/r/codedeploy_deployment_group.html.markdown +++ b/website/docs/r/codedeploy_deployment_group.html.markdown @@ -14,7 +14,7 @@ Provides a CodeDeploy Deployment Group for a CodeDeploy Application ## Example Usage -```hcl +```terraform resource "aws_iam_role" "example" { name = "example-role" @@ -87,7 +87,7 @@ resource "aws_codedeploy_deployment_group" "example" { ### Blue Green Deployments with ECS -```hcl +```terraform resource "aws_codedeploy_app" "example" { compute_platform = "ECS" name = "example" @@ -145,7 +145,7 @@ resource "aws_codedeploy_deployment_group" "example" { ### Blue Green Deployments with Servers and Classic ELB -```hcl +```terraform resource "aws_codedeploy_app" "example" { name = "example-app" } diff --git a/website/docs/r/codepipeline.markdown b/website/docs/r/codepipeline.markdown index 33ee75b2aa2e..eed175db2f56 100644 --- a/website/docs/r/codepipeline.markdown +++ b/website/docs/r/codepipeline.markdown @@ -12,7 +12,7 @@ Provides a CodePipeline. ## Example Usage -```hcl +```terraform resource "aws_codepipeline" "codepipeline" { name = "tf-test-pipeline" role_arn = aws_iam_role.codepipeline_role.arn diff --git a/website/docs/r/codepipeline_webhook.markdown b/website/docs/r/codepipeline_webhook.markdown index 9daf1fc66df8..132564080067 100644 --- a/website/docs/r/codepipeline_webhook.markdown +++ b/website/docs/r/codepipeline_webhook.markdown @@ -12,7 +12,7 @@ Provides a CodePipeline Webhook. ## Example Usage -```hcl +```terraform resource "aws_codepipeline" "bar" { name = "tf-test-pipeline" role_arn = aws_iam_role.bar.arn diff --git a/website/docs/r/codestarconnections_connection.markdown b/website/docs/r/codestarconnections_connection.markdown index a64de09c2e39..373b6beaa0c4 100644 --- a/website/docs/r/codestarconnections_connection.markdown +++ b/website/docs/r/codestarconnections_connection.markdown @@ -14,7 +14,7 @@ Provides a CodeStar Connection. ## Example Usage -```hcl +```terraform resource "aws_codestarconnections_connection" "example" { name = "example-connection" provider_type = "Bitbucket" diff --git a/website/docs/r/codestarnotifications_notification_rule.markdown b/website/docs/r/codestarnotifications_notification_rule.markdown index 1a61f9bc9098..0fcbe934c24c 100644 --- a/website/docs/r/codestarnotifications_notification_rule.markdown +++ b/website/docs/r/codestarnotifications_notification_rule.markdown @@ -12,7 +12,7 @@ Provides a CodeStar Notifications Rule. ## Example Usage -```hcl +```terraform resource "aws_codecommit_repository" "code" { repository_name = "example-code-repo" } diff --git a/website/docs/r/cognito_identity_pool.markdown b/website/docs/r/cognito_identity_pool.markdown index db5fc44718cc..e4865eb4fb53 100644 --- a/website/docs/r/cognito_identity_pool.markdown +++ b/website/docs/r/cognito_identity_pool.markdown @@ -12,7 +12,7 @@ Provides an AWS Cognito Identity Pool. ## Example Usage -```hcl +```terraform resource "aws_iam_saml_provider" "default" { name = "my-saml-provider" saml_metadata_document = file("saml-metadata.xml") diff --git a/website/docs/r/cognito_identity_pool_roles_attachment.markdown b/website/docs/r/cognito_identity_pool_roles_attachment.markdown index b1e322f9d3ba..e2130ddcf319 100644 --- a/website/docs/r/cognito_identity_pool_roles_attachment.markdown +++ b/website/docs/r/cognito_identity_pool_roles_attachment.markdown @@ -12,7 +12,7 @@ Provides an AWS Cognito Identity Pool Roles Attachment. ## Example Usage -```hcl +```terraform resource "aws_cognito_identity_pool" "main" { identity_pool_name = "identity pool" allow_unauthenticated_identities = false diff --git a/website/docs/r/cognito_identity_provider.html.markdown b/website/docs/r/cognito_identity_provider.html.markdown index 3729b95a6167..c3b7ed32407c 100644 --- a/website/docs/r/cognito_identity_provider.html.markdown +++ b/website/docs/r/cognito_identity_provider.html.markdown @@ -13,7 +13,7 @@ Provides a Cognito User Identity Provider resource. ## Example Usage -```hcl +```terraform resource "aws_cognito_user_pool" "example" { name = "example-pool" auto_verified_attributes = ["email"] @@ -48,6 +48,10 @@ The following arguments are supported: * `idp_identifiers` (Optional) - The list of identity providers. * `provider_details` (Optional) - The map of identity details, such as access token +## Attributes Reference + +No additional attributes are exported. + ## Import `aws_cognito_identity_provider` resources can be imported using their User Pool ID and Provider Name, e.g. diff --git a/website/docs/r/cognito_resource_server.markdown b/website/docs/r/cognito_resource_server.markdown index 39577c6a6558..a8b62e576e63 100644 --- a/website/docs/r/cognito_resource_server.markdown +++ b/website/docs/r/cognito_resource_server.markdown @@ -15,7 +15,7 @@ Provides a Cognito Resource Server. ### Create a basic resource server -```hcl +```terraform resource "aws_cognito_user_pool" "pool" { name = "pool" } @@ -30,7 +30,7 @@ resource "aws_cognito_resource_server" "resource" { ### Create a resource server with sample-scope -```hcl +```terraform resource "aws_cognito_user_pool" "pool" { name = "pool" } diff --git a/website/docs/r/cognito_user_group.html.markdown b/website/docs/r/cognito_user_group.html.markdown index 3dd4bd65068d..3961908ab0a0 100644 --- a/website/docs/r/cognito_user_group.html.markdown +++ b/website/docs/r/cognito_user_group.html.markdown @@ -12,7 +12,7 @@ Provides a Cognito User Group resource. ## Example Usage -```hcl +```terraform resource "aws_cognito_user_pool" "main" { name = "identity pool" } @@ -64,6 +64,10 @@ The following arguments are supported: * `precedence` - (Optional) The precedence of the user group. * `role_arn` - (Optional) The ARN of the IAM role to be associated with the user group. +## Attributes Reference + +No additional attributes are exported. + ## Import Cognito User Groups can be imported using the `user_pool_id`/`name` attributes concatenated, e.g. diff --git a/website/docs/r/cognito_user_pool.markdown b/website/docs/r/cognito_user_pool.markdown index 3fc8ee879e15..1ddb82d6ba8a 100644 --- a/website/docs/r/cognito_user_pool.markdown +++ b/website/docs/r/cognito_user_pool.markdown @@ -14,7 +14,7 @@ Provides a Cognito User Pool resource. ### Basic configuration -```hcl +```terraform resource "aws_cognito_user_pool" "pool" { name = "mypool" } @@ -22,7 +22,7 @@ resource "aws_cognito_user_pool" "pool" { ### Enabling SMS and Software Token Multi-Factor Authentication -```hcl +```terraform resource "aws_cognito_user_pool" "example" { # ... other configuration ... @@ -42,7 +42,7 @@ resource "aws_cognito_user_pool" "example" { ### Using Account Recovery Setting -```hcl +```terraform resource "aws_cognito_user_pool" "test" { name = "mypool" @@ -158,7 +158,7 @@ The following arguments are optional: The [standard attributes](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#cognito-user-pools-standard-attributes) have the following defaults. Note that attributes which match the default values are not stored in Terraform state when importing. -```hcl +```terraform resource "aws_cognito_user_pool" "example" { # ... other configuration ... diff --git a/website/docs/r/cognito_user_pool_client.markdown b/website/docs/r/cognito_user_pool_client.markdown index c8b6ec2193ef..a4fed4fc222c 100644 --- a/website/docs/r/cognito_user_pool_client.markdown +++ b/website/docs/r/cognito_user_pool_client.markdown @@ -14,7 +14,7 @@ Provides a Cognito User Pool Client resource. ### Create a basic user pool client -```hcl +```terraform resource "aws_cognito_user_pool" "pool" { name = "pool" } @@ -28,7 +28,7 @@ resource "aws_cognito_user_pool_client" "client" { ### Create a user pool client with no SRP authentication -```hcl +```terraform resource "aws_cognito_user_pool" "pool" { name = "pool" } @@ -45,7 +45,7 @@ resource "aws_cognito_user_pool_client" "client" { ### Create a user pool client with pinpoint analytics -```hcl +```terraform data "aws_caller_identity" "current" {} resource "aws_cognito_user_pool" "test" { @@ -155,7 +155,7 @@ Valid values for the following arguments are: `seconds`, `minutes`, `hours` or ` * `id_token` - (Optional) Time unit in for the value in `id_token_validity`, defaults to `hours`. * `refresh_token` - (Optional) Time unit in for the value in `refresh_token_validity`, defaults to `days`. -## Attribute Reference +## Attributes Reference In addition to all arguments above, the following attributes are exported: diff --git a/website/docs/r/cognito_user_pool_domain.markdown b/website/docs/r/cognito_user_pool_domain.markdown index c3f48487dd53..bdd9cd007678 100644 --- a/website/docs/r/cognito_user_pool_domain.markdown +++ b/website/docs/r/cognito_user_pool_domain.markdown @@ -14,7 +14,7 @@ Provides a Cognito User Pool Domain resource. ### Amazon Cognito domain -```hcl +```terraform resource "aws_cognito_user_pool_domain" "main" { domain = "example-domain" user_pool_id = aws_cognito_user_pool.example.id @@ -27,7 +27,7 @@ resource "aws_cognito_user_pool" "example" { ### Custom Cognito domain -```hcl +```terraform resource "aws_cognito_user_pool_domain" "main" { domain = "example-domain.example.com" certificate_arn = aws_acm_certificate.cert.arn diff --git a/website/docs/r/cognito_user_pool_ui_customization.html.markdown b/website/docs/r/cognito_user_pool_ui_customization.html.markdown index cca7ca7da7d7..e0a253525889 100644 --- a/website/docs/r/cognito_user_pool_ui_customization.html.markdown +++ b/website/docs/r/cognito_user_pool_ui_customization.html.markdown @@ -12,11 +12,11 @@ Provides a Cognito User Pool UI Customization resource. ~> **Note:** To use this resource, the user pool must have a domain associated with it. For more information, see the Amazon Cognito Developer Guide on [Customizing the Built-in Sign-In and Sign-up Webpages](https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-app-ui-customization.html). -### Example Usage +## Example Usage ### UI customization settings for a single client -```hcl +```terraform resource "aws_cognito_user_pool" "example" { name = "example" } @@ -45,7 +45,7 @@ resource "aws_cognito_user_pool_ui_customization" "example" { ### UI customization settings for all clients -```hcl +```terraform resource "aws_cognito_user_pool" "example" { name = "example" } diff --git a/website/docs/r/config_aggregate_authorization.markdown b/website/docs/r/config_aggregate_authorization.markdown index 87fdf32a48e1..6f6c8e65f667 100644 --- a/website/docs/r/config_aggregate_authorization.markdown +++ b/website/docs/r/config_aggregate_authorization.markdown @@ -12,7 +12,7 @@ Manages an AWS Config Aggregate Authorization ## Example Usage -```hcl +```terraform resource "aws_config_aggregate_authorization" "example" { account_id = "123456789012" region = "eu-west-2" diff --git a/website/docs/r/config_config_rule.html.markdown b/website/docs/r/config_config_rule.html.markdown index 59414d768f19..a830efce5a35 100644 --- a/website/docs/r/config_config_rule.html.markdown +++ b/website/docs/r/config_config_rule.html.markdown @@ -18,7 +18,7 @@ Provides an AWS Config Rule. AWS managed rules can be used by setting the source owner to `AWS` and the source identifier to the name of the managed rule. More information about AWS managed rules can be found in the [AWS Config Developer Guide](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_use-managed-rules.html). -```hcl +```terraform resource "aws_config_config_rule" "r" { name = "example" @@ -79,7 +79,7 @@ POLICY Custom rules can be used by setting the source owner to `CUSTOM_LAMBDA` and the source identifier to the Amazon Resource Name (ARN) of the Lambda Function. The AWS Config service must have permissions to invoke the Lambda Function, e.g. via the [`aws_lambda_permission` resource](/docs/providers/aws/r/lambda_permission.html). More information about custom rules can be found in the [AWS Config Developer Guide](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_develop-rules.html). -```hcl +```terraform resource "aws_config_configuration_recorder" "example" { # ... other configuration ... } diff --git a/website/docs/r/config_configuration_aggregator.html.markdown b/website/docs/r/config_configuration_aggregator.html.markdown index e9ed6be2419f..bd91080600bd 100644 --- a/website/docs/r/config_configuration_aggregator.html.markdown +++ b/website/docs/r/config_configuration_aggregator.html.markdown @@ -14,7 +14,7 @@ Manages an AWS Config Configuration Aggregator ### Account Based Aggregation -```hcl +```terraform resource "aws_config_configuration_aggregator" "account" { name = "example" @@ -27,7 +27,7 @@ resource "aws_config_configuration_aggregator" "account" { ### Organization Based Aggregation -```hcl +```terraform resource "aws_config_configuration_aggregator" "organization" { depends_on = [aws_iam_role_policy_attachment.organization] diff --git a/website/docs/r/config_configuration_recorder.html.markdown b/website/docs/r/config_configuration_recorder.html.markdown index 9557b27bfa8a..5b36ce0aeb61 100644 --- a/website/docs/r/config_configuration_recorder.html.markdown +++ b/website/docs/r/config_configuration_recorder.html.markdown @@ -14,7 +14,7 @@ Provides an AWS Config Configuration Recorder. Please note that this resource ** ## Example Usage -```hcl +```terraform resource "aws_config_configuration_recorder" "foo" { name = "example" role_arn = aws_iam_role.r.arn diff --git a/website/docs/r/config_configuration_recorder_status.html.markdown b/website/docs/r/config_configuration_recorder_status.html.markdown index f0aa73bc5cee..08c22b3331c7 100644 --- a/website/docs/r/config_configuration_recorder_status.html.markdown +++ b/website/docs/r/config_configuration_recorder_status.html.markdown @@ -14,7 +14,7 @@ Manages status (recording / stopped) of an AWS Config Configuration Recorder. ## Example Usage -```hcl +```terraform resource "aws_config_configuration_recorder_status" "foo" { name = aws_config_configuration_recorder.foo.name is_enabled = true @@ -91,6 +91,10 @@ The following arguments are supported: * `name` - (Required) The name of the recorder * `is_enabled` - (Required) Whether the configuration recorder should be enabled or disabled. +## Attributes Reference + +No additional attributes are exported. + ## Import Configuration Recorder Status can be imported using the name of the Configuration Recorder, e.g. diff --git a/website/docs/r/config_conformance_pack.html.markdown b/website/docs/r/config_conformance_pack.html.markdown index bd2f77c50f9e..19186eea110d 100644 --- a/website/docs/r/config_conformance_pack.html.markdown +++ b/website/docs/r/config_conformance_pack.html.markdown @@ -17,9 +17,11 @@ Sample Conformance Pack templates may be found in the successfully create or update. See also the [`aws_config_configuration_recorder` resource](/docs/providers/aws/r/config_configuration_recorder.html). -## Example Usage with Template Body +## Example Usage -```hcl +### Template Body + +```terraform resource "aws_config_conformance_pack" "example" { name = "example" @@ -46,9 +48,9 @@ EOT } ``` -## Example Usage with Template S3 URI +### Template S3 URI -```hcl +```terraform resource "aws_config_conformance_pack" "example" { name = "example" template_s3_uri = "s3://${aws_s3_bucket.example.bucket}/${aws_s3_bucket_object.example.key}" @@ -98,7 +100,7 @@ The `input_parameter` configuration block supports the following arguments: ## Attributes Reference -In addition to all arguments above (except for `template_body` and `template_s3_uri`), the following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `arn` - Amazon Resource Name (ARN) of the conformance pack. diff --git a/website/docs/r/config_delivery_channel.html.markdown b/website/docs/r/config_delivery_channel.html.markdown index 75c6eabc229a..673821cb6798 100644 --- a/website/docs/r/config_delivery_channel.html.markdown +++ b/website/docs/r/config_delivery_channel.html.markdown @@ -14,7 +14,7 @@ Provides an AWS Config Delivery Channel. ## Example Usage -```hcl +```terraform resource "aws_config_delivery_channel" "foo" { name = "example" s3_bucket_name = aws_s3_bucket.b.bucket diff --git a/website/docs/r/config_organization_custom_rule.html.markdown b/website/docs/r/config_organization_custom_rule.html.markdown index b3b21b39db03..169a199be3ef 100644 --- a/website/docs/r/config_organization_custom_rule.html.markdown +++ b/website/docs/r/config_organization_custom_rule.html.markdown @@ -16,7 +16,7 @@ Manages a Config Organization Custom Rule. More information about these rules ca ## Example Usage -```hcl +```terraform resource "aws_lambda_permission" "example" { action = "lambda:InvokeFunction" function_name = aws_lambda_function.example.arn diff --git a/website/docs/r/config_organization_managed_rule.html.markdown b/website/docs/r/config_organization_managed_rule.html.markdown index bf6cf84c072f..243d1680cdef 100644 --- a/website/docs/r/config_organization_managed_rule.html.markdown +++ b/website/docs/r/config_organization_managed_rule.html.markdown @@ -16,7 +16,7 @@ Manages a Config Organization Managed Rule. More information about these rules c ## Example Usage -```hcl +```terraform resource "aws_organizations_organization" "example" { aws_service_access_principals = ["config-multiaccountsetup.amazonaws.com"] feature_set = "ALL" diff --git a/website/docs/r/config_remediation_configuration.html.markdown b/website/docs/r/config_remediation_configuration.html.markdown index 9a58229e7db1..f9d5fa71dab9 100644 --- a/website/docs/r/config_remediation_configuration.html.markdown +++ b/website/docs/r/config_remediation_configuration.html.markdown @@ -16,7 +16,7 @@ Provides an AWS Config Remediation Configuration. AWS managed rules can be used by setting the source owner to `AWS` and the source identifier to the name of the managed rule. More information about AWS managed rules can be found in the [AWS Config Developer Guide](https://docs.aws.amazon.com/config/latest/developerguide/evaluate-config_use-managed-rules.html). -```hcl +```terraform resource "aws_config_config_rule" "this" { name = "example" @@ -69,6 +69,12 @@ You must select either a dynamic value or a static value. * `resource_value` - (Optional) The value is dynamic and changes at run-time. * `static_value` - (Optional) The value is static and does not change at run-time. +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `arn` - Amazon Resource Name (ARN) of the Config Remediation Configuration. + ## Import Remediation Configurations can be imported using the name config_rule_name, e.g. diff --git a/website/docs/r/cur_report_definition.html.markdown b/website/docs/r/cur_report_definition.html.markdown index 615dfb3971f4..eb89dea79e76 100644 --- a/website/docs/r/cur_report_definition.html.markdown +++ b/website/docs/r/cur_report_definition.html.markdown @@ -16,7 +16,7 @@ Manages Cost and Usage Report Definitions. ## Example Usage -```hcl +```terraform resource "aws_cur_report_definition" "example_cur_report_definition" { report_name = "example-cur-report-definition" time_unit = "HOURLY" @@ -45,6 +45,10 @@ The following arguments are supported: * `refresh_closed_reports` - (Optional) Set to true to update your reports after they have been finalized if AWS detects charges related to previous months. * `report_versioning` - (Optional) Overwrite the previous version of each report or to deliver the report in addition to the previous versions. Valid values are: CREATE_NEW_REPORT, OVERWRITE_REPORT +## Attributes Reference + +No additional attributes are exported. + ## Import Report Definitions can be imported using the `report_name`, e.g. diff --git a/website/docs/r/customer_gateway.html.markdown b/website/docs/r/customer_gateway.html.markdown index b1804ea5c559..0660af1c0914 100644 --- a/website/docs/r/customer_gateway.html.markdown +++ b/website/docs/r/customer_gateway.html.markdown @@ -14,7 +14,7 @@ Provides a customer gateway inside a VPC. These objects can be connected to VPN ## Example Usage -```hcl +```terraform resource "aws_customer_gateway" "main" { bgp_asn = 65000 ip_address = "172.83.124.10" diff --git a/website/docs/r/datapipeline_pipeline.html.markdown b/website/docs/r/datapipeline_pipeline.html.markdown index 013d2919a7e7..1be26a3e65b9 100644 --- a/website/docs/r/datapipeline_pipeline.html.markdown +++ b/website/docs/r/datapipeline_pipeline.html.markdown @@ -12,7 +12,7 @@ Provides a Data Pipeline resource. ## Example Usage -```hcl +```terraform resource "aws_datapipeline_pipeline" "default" { name = "tf-pipeline-default" } diff --git a/website/docs/r/datasync_agent.html.markdown b/website/docs/r/datasync_agent.html.markdown index e4d5415eb04d..11646cbe1e1e 100644 --- a/website/docs/r/datasync_agent.html.markdown +++ b/website/docs/r/datasync_agent.html.markdown @@ -14,7 +14,7 @@ Manages an AWS DataSync Agent deployed on premises. ## Example Usage -```hcl +```terraform resource "aws_datasync_agent" "example" { ip_address = "1.2.3.4" name = "example" diff --git a/website/docs/r/datasync_location_efs.html.markdown b/website/docs/r/datasync_location_efs.html.markdown index abdf1bb8c276..1e816e52644d 100644 --- a/website/docs/r/datasync_location_efs.html.markdown +++ b/website/docs/r/datasync_location_efs.html.markdown @@ -14,7 +14,7 @@ Manages an AWS DataSync EFS Location. ## Example Usage -```hcl +```terraform resource "aws_datasync_location_efs" "example" { # The below example uses aws_efs_mount_target as a reference to ensure a mount target already exists when resource creation occurs. # You can accomplish the same behavior with depends_on or an aws_efs_mount_target data source reference. diff --git a/website/docs/r/datasync_location_fsx_windows_file_system.html.markdown b/website/docs/r/datasync_location_fsx_windows_file_system.html.markdown index 838998fb2370..9bab3cafac19 100644 --- a/website/docs/r/datasync_location_fsx_windows_file_system.html.markdown +++ b/website/docs/r/datasync_location_fsx_windows_file_system.html.markdown @@ -12,7 +12,7 @@ Manages an AWS DataSync FSx Windows Location. ## Example Usage -```hcl +```terraform resource "aws_datasync_location_fsx_windows_file_system" "example" { fsx_filesystem_arn = aws_fsx_windows_file_system.example.arn user = "SomeUser" diff --git a/website/docs/r/datasync_location_nfs.html.markdown b/website/docs/r/datasync_location_nfs.html.markdown index 850bb53df152..dc91763895ad 100644 --- a/website/docs/r/datasync_location_nfs.html.markdown +++ b/website/docs/r/datasync_location_nfs.html.markdown @@ -14,7 +14,7 @@ Manages an NFS Location within AWS DataSync. ## Example Usage -```hcl +```terraform resource "aws_datasync_location_nfs" "example" { server_hostname = "nfs.example.com" subdirectory = "/exported/path" diff --git a/website/docs/r/datasync_location_s3.html.markdown b/website/docs/r/datasync_location_s3.html.markdown index cff58134272b..3e4a50ebba12 100644 --- a/website/docs/r/datasync_location_s3.html.markdown +++ b/website/docs/r/datasync_location_s3.html.markdown @@ -12,7 +12,7 @@ Manages an S3 Location within AWS DataSync. ## Example Usage -```hcl +```terraform resource "aws_datasync_location_s3" "example" { s3_bucket_arn = aws_s3_bucket.example.arn subdirectory = "/example/prefix" diff --git a/website/docs/r/datasync_location_smb.html.markdown b/website/docs/r/datasync_location_smb.html.markdown index 2766dd15b33b..298a8e4690ca 100644 --- a/website/docs/r/datasync_location_smb.html.markdown +++ b/website/docs/r/datasync_location_smb.html.markdown @@ -14,7 +14,7 @@ Manages a SMB Location within AWS DataSync. ## Example Usage -```hcl +```terraform resource "aws_datasync_location_smb" "example" { server_hostname = "smb.example.com" subdirectory = "/exported/path" diff --git a/website/docs/r/datasync_task.html.markdown b/website/docs/r/datasync_task.html.markdown index e16ef80e9040..3bbdf693228a 100644 --- a/website/docs/r/datasync_task.html.markdown +++ b/website/docs/r/datasync_task.html.markdown @@ -12,7 +12,7 @@ Manages an AWS DataSync Task, which represents a configuration for synchronizati ## Example Usage -```hcl +```terraform resource "aws_datasync_task" "example" { destination_location_arn = aws_datasync_location_s3.destination.arn name = "example" diff --git a/website/docs/r/dax_cluster.html.markdown b/website/docs/r/dax_cluster.html.markdown index d77981acbb27..c49ff1b550bc 100644 --- a/website/docs/r/dax_cluster.html.markdown +++ b/website/docs/r/dax_cluster.html.markdown @@ -12,7 +12,7 @@ Provides a DAX Cluster resource. ## Example Usage -```hcl +```terraform resource "aws_dax_cluster" "bar" { cluster_name = "cluster-example" iam_role_arn = data.aws_iam_role.example.arn diff --git a/website/docs/r/dax_parameter_group.html.markdown b/website/docs/r/dax_parameter_group.html.markdown index b8a05770a816..0ee9101d618f 100644 --- a/website/docs/r/dax_parameter_group.html.markdown +++ b/website/docs/r/dax_parameter_group.html.markdown @@ -12,7 +12,7 @@ Provides a DAX Parameter Group resource. ## Example Usage -```hcl +```terraform resource "aws_dax_parameter_group" "example" { name = "example" diff --git a/website/docs/r/dax_subnet_group.html.markdown b/website/docs/r/dax_subnet_group.html.markdown index 186c8fca9ca9..e1f2ec59f2a1 100644 --- a/website/docs/r/dax_subnet_group.html.markdown +++ b/website/docs/r/dax_subnet_group.html.markdown @@ -12,7 +12,7 @@ Provides a DAX Subnet Group resource. ## Example Usage -```hcl +```terraform resource "aws_dax_subnet_group" "example" { name = "example" subnet_ids = [aws_subnet.example1.id, aws_subnet.example2.id] diff --git a/website/docs/r/db_cluster_snapshot.html.markdown b/website/docs/r/db_cluster_snapshot.html.markdown index 955c252dce41..4723271772ac 100644 --- a/website/docs/r/db_cluster_snapshot.html.markdown +++ b/website/docs/r/db_cluster_snapshot.html.markdown @@ -12,7 +12,7 @@ Manages an RDS database cluster snapshot for Aurora clusters. For managing RDS d ## Example Usage -```hcl +```terraform resource "aws_db_cluster_snapshot" "example" { db_cluster_identifier = aws_rds_cluster.example.id db_cluster_snapshot_identifier = "resourcetestsnapshot1234" diff --git a/website/docs/r/db_event_subscription.html.markdown b/website/docs/r/db_event_subscription.html.markdown index 21f7f2267247..3a19d2553edd 100644 --- a/website/docs/r/db_event_subscription.html.markdown +++ b/website/docs/r/db_event_subscription.html.markdown @@ -12,7 +12,7 @@ Provides a DB event subscription resource. ## Example Usage -```hcl +```terraform resource "aws_db_instance" "default" { allocated_storage = 10 engine = "mysql" @@ -64,9 +64,9 @@ The following arguments are supported: * `enabled` - (Optional) A boolean flag to enable/disable the subscription. Defaults to true. * `tags` - (Optional) A map of tags to assign to the resource. -## Attributes +## Attributes Reference -The following additional atttributes are provided: +In addition to all arguments above, the following attributes are exported: * `id` - The name of the RDS event notification subscription * `arn` - The Amazon Resource Name of the RDS event notification subscription diff --git a/website/docs/r/db_instance.html.markdown b/website/docs/r/db_instance.html.markdown index 594284368d96..61189b9d9372 100644 --- a/website/docs/r/db_instance.html.markdown +++ b/website/docs/r/db_instance.html.markdown @@ -38,7 +38,7 @@ about [DB Instance Class Types](https://docs.aws.amazon.com/AmazonRDS/latest/Use ### Basic Usage -```hcl +```terraform resource "aws_db_instance" "default" { allocated_storage = 10 engine = "mysql" @@ -56,7 +56,7 @@ resource "aws_db_instance" "default" { To enable Storage Autoscaling with instances that support the feature, define the `max_allocated_storage` argument higher than the `allocated_storage` argument. Terraform will automatically hide differences with the `allocated_storage` argument value if autoscaling occurs. -```hcl +```terraform resource "aws_db_instance" "example" { # ... other configuration ... @@ -225,7 +225,7 @@ The `restore_to_point_in_time` block supports the following arguments: Full details on the core parameters and impacts are in the API Docs: [RestoreDBInstanceFromS3](http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_RestoreDBInstanceFromS3.html). Sample -```hcl +```terraform resource "aws_db_instance" "db" { s3_import { source_engine = "mysql" diff --git a/website/docs/r/db_instance_role_association.html.markdown b/website/docs/r/db_instance_role_association.html.markdown index 219f83990f03..e10eae0a6860 100644 --- a/website/docs/r/db_instance_role_association.html.markdown +++ b/website/docs/r/db_instance_role_association.html.markdown @@ -17,7 +17,7 @@ Manages an RDS DB Instance association with an IAM Role. Example use cases: ## Example Usage -```hcl +```terraform resource "aws_db_instance_role_association" "example" { db_instance_identifier = aws_db_instance.example.id feature_name = "S3_INTEGRATION" diff --git a/website/docs/r/db_option_group.html.markdown b/website/docs/r/db_option_group.html.markdown index 428241cd265c..dc2057fb1924 100644 --- a/website/docs/r/db_option_group.html.markdown +++ b/website/docs/r/db_option_group.html.markdown @@ -17,7 +17,7 @@ Provides an RDS DB option group resource. Documentation of the available options ## Example Usage -```hcl +```terraform resource "aws_db_option_group" "example" { name = "option-group-test-terraform" option_group_description = "Terraform Option Group" diff --git a/website/docs/r/db_parameter_group.html.markdown b/website/docs/r/db_parameter_group.html.markdown index b6a583f92cae..fe49f530b79f 100644 --- a/website/docs/r/db_parameter_group.html.markdown +++ b/website/docs/r/db_parameter_group.html.markdown @@ -18,7 +18,7 @@ Provides an RDS DB parameter group resource .Documentation of the available para ## Example Usage -```hcl +```terraform resource "aws_db_parameter_group" "default" { name = "rds-pg" family = "mysql5.6" diff --git a/website/docs/r/db_proxy.html.markdown b/website/docs/r/db_proxy.html.markdown index 1aac841c7c9c..f7b8ed6a42e5 100644 --- a/website/docs/r/db_proxy.html.markdown +++ b/website/docs/r/db_proxy.html.markdown @@ -12,7 +12,7 @@ Provides an RDS DB proxy resource. For additional information, see the [RDS User ## Example Usage -```hcl +```terraform resource "aws_db_proxy" "example" { name = "example" debug_logging = false diff --git a/website/docs/r/db_proxy_default_target_group.html.markdown b/website/docs/r/db_proxy_default_target_group.html.markdown index c5aec6ce9201..117cac1cf37b 100644 --- a/website/docs/r/db_proxy_default_target_group.html.markdown +++ b/website/docs/r/db_proxy_default_target_group.html.markdown @@ -14,7 +14,7 @@ The `aws_db_proxy_default_target_group` behaves differently from normal resource ## Example Usage -```hcl +```terraform resource "aws_db_proxy" "example" { name = "example" debug_logging = false diff --git a/website/docs/r/db_proxy_target.html.markdown b/website/docs/r/db_proxy_target.html.markdown index 017d55bf9837..d4c1caff4348 100644 --- a/website/docs/r/db_proxy_target.html.markdown +++ b/website/docs/r/db_proxy_target.html.markdown @@ -12,7 +12,7 @@ Provides an RDS DB proxy target resource. ## Example Usage -```hcl +```terraform resource "aws_db_proxy" "example" { name = "example" debug_logging = false diff --git a/website/docs/r/db_security_group.html.markdown b/website/docs/r/db_security_group.html.markdown index 95c57f9fbcaf..c8af799f62e0 100644 --- a/website/docs/r/db_security_group.html.markdown +++ b/website/docs/r/db_security_group.html.markdown @@ -15,7 +15,7 @@ attribute instead. ## Example Usage -```hcl +```terraform resource "aws_db_security_group" "default" { name = "rds_sg" diff --git a/website/docs/r/db_snapshot.html.markdown b/website/docs/r/db_snapshot.html.markdown index 384d2b4347af..fb9132d82efe 100644 --- a/website/docs/r/db_snapshot.html.markdown +++ b/website/docs/r/db_snapshot.html.markdown @@ -12,7 +12,7 @@ Manages an RDS database instance snapshot. For managing RDS database cluster sna ## Example Usage -```hcl +```terraform resource "aws_db_instance" "bar" { allocated_storage = 10 engine = "MySQL" diff --git a/website/docs/r/db_subnet_group.html.markdown b/website/docs/r/db_subnet_group.html.markdown index c17bed69653e..7b4d1251c05d 100644 --- a/website/docs/r/db_subnet_group.html.markdown +++ b/website/docs/r/db_subnet_group.html.markdown @@ -12,7 +12,7 @@ Provides an RDS DB subnet group resource. ## Example Usage -```hcl +```terraform resource "aws_db_subnet_group" "default" { name = "main" subnet_ids = [aws_subnet.frontend.id, aws_subnet.backend.id] diff --git a/website/docs/r/default_network_acl.html.markdown b/website/docs/r/default_network_acl.html.markdown index b164d40d208e..eca4fe266bbb 100644 --- a/website/docs/r/default_network_acl.html.markdown +++ b/website/docs/r/default_network_acl.html.markdown @@ -24,7 +24,7 @@ For more information about Network ACLs, see the AWS Documentation on [Network A The following config gives the Default Network ACL the same rules that AWS includes but pulls the resource under management by Terraform. This means that any ACL rules added or changed will be detected as drift. -```hcl +```terraform resource "aws_vpc" "mainvpc" { cidr_block = "10.1.0.0/16" } @@ -56,7 +56,7 @@ resource "aws_default_network_acl" "default" { The following denies all Egress traffic by omitting any `egress` rules, while including the default `ingress` rule to allow all traffic. -```hcl +```terraform resource "aws_vpc" "mainvpc" { cidr_block = "10.1.0.0/16" } @@ -79,7 +79,7 @@ resource "aws_default_network_acl" "default" { This config denies all traffic in the Default ACL. This can be useful if you want to lock down the VPC to force all resources to assign a non-default ACL. -```hcl +```terraform resource "aws_vpc" "mainvpc" { cidr_block = "10.1.0.0/16" } @@ -101,7 +101,7 @@ Because Subnets are by default associated with the Default Network ACL, any non- As an alternative to the above, you can also specify the following lifecycle configuration in your `aws_default_network_acl` resource: -```hcl +```terraform resource "aws_default_network_acl" "default" { # ... other configuration ... diff --git a/website/docs/r/default_route_table.html.markdown b/website/docs/r/default_route_table.html.markdown index 003d7ad777ad..1a43ee8ff6db 100644 --- a/website/docs/r/default_route_table.html.markdown +++ b/website/docs/r/default_route_table.html.markdown @@ -18,16 +18,36 @@ For more information, see the Amazon VPC User Guide on [Route Tables](https://do ## Example Usage -```hcl -resource "aws_default_route_table" "r" { - default_route_table_id = aws_vpc.foo.default_route_table_id +```terraform +resource "aws_default_route_table" "example" { + default_route_table_id = aws_vpc.example.default_route_table_id route { - # ... + cidr_block = "10.0.1.0/24" + gateway_id = aws_internet_gateway.example.id } + route { + ipv6_cidr_block = "::/0" + egress_only_gateway_id = aws_egress_only_internet_gateway.example.id + } + + tags = { + Name = "example" + } +} +``` + +To subsequently remove all managed routes: + +```terraform +resource "aws_default_route_table" "example" { + default_route_table_id = aws_vpc.example.default_route_table_id + + route = [] + tags = { - Name = "default table" + Name = "example" } } ``` @@ -41,7 +61,7 @@ The following arguments are required: The following arguments are optional: * `propagating_vgws` - (Optional) List of virtual gateways for propagation. -* `route` - (Optional) Configuration block of routes. Detailed below. +* `route` - (Optional) Configuration block of routes. Detailed below. This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above. * `tags` - (Optional) Map of tags to assign to the resource. ### route @@ -71,6 +91,7 @@ Note that the default route, mapping the VPC's CIDR block to "local", is created In addition to all arguments above, the following attributes are exported: * `id` - ID of the route table. +* `arn` - The ARN of the route table. * `owner_id` - ID of the AWS account that owns the route table. * `vpc_id` - ID of the VPC. diff --git a/website/docs/r/default_security_group.html.markdown b/website/docs/r/default_security_group.html.markdown index a9a6b620b00e..13557964dec2 100644 --- a/website/docs/r/default_security_group.html.markdown +++ b/website/docs/r/default_security_group.html.markdown @@ -24,7 +24,7 @@ For more information about default security groups, see the AWS documentation on The following config gives the default security group the same rules that AWS provides by default but under management by Terraform. This means that any ingress or egress rules added or changed will be detected as drift. -```hcl +```terraform resource "aws_vpc" "mainvpc" { cidr_block = "10.1.0.0/16" } @@ -52,7 +52,7 @@ resource "aws_default_security_group" "default" { The following denies all Egress traffic by omitting any `egress` rules, while including the default `ingress` rule to allow all traffic. -```hcl +```terraform resource "aws_vpc" "mainvpc" { cidr_block = "10.1.0.0/16" } diff --git a/website/docs/r/default_subnet.html.markdown b/website/docs/r/default_subnet.html.markdown index eaf0fe853a32..b5785ed4fe6a 100644 --- a/website/docs/r/default_subnet.html.markdown +++ b/website/docs/r/default_subnet.html.markdown @@ -16,7 +16,7 @@ The `aws_default_subnet` resource allows you to manage a region's default VPC su ## Example Usage -```hcl +```terraform resource "aws_default_subnet" "default_az1" { availability_zone = "us-west-2a" diff --git a/website/docs/r/default_vpc.html.markdown b/website/docs/r/default_vpc.html.markdown index f0ec2cd9f624..f113ad7f228f 100644 --- a/website/docs/r/default_vpc.html.markdown +++ b/website/docs/r/default_vpc.html.markdown @@ -23,7 +23,7 @@ into management. Basic usage with tags: -```hcl +```terraform resource "aws_default_vpc" "default" { tags = { Name = "Default VPC" diff --git a/website/docs/r/default_vpc_dhcp_options.html.markdown b/website/docs/r/default_vpc_dhcp_options.html.markdown index 826b5ee26e1a..9c46ffe3ef4c 100644 --- a/website/docs/r/default_vpc_dhcp_options.html.markdown +++ b/website/docs/r/default_vpc_dhcp_options.html.markdown @@ -23,7 +23,7 @@ into management. Basic usage with tags: -```hcl +```terraform resource "aws_default_vpc_dhcp_options" "default" { tags = { Name = "Default DHCP Option Set" diff --git a/website/docs/r/devicefarm_project.html.markdown b/website/docs/r/devicefarm_project.html.markdown index 7c77699b4d9f..725f073618c2 100644 --- a/website/docs/r/devicefarm_project.html.markdown +++ b/website/docs/r/devicefarm_project.html.markdown @@ -15,10 +15,10 @@ For more information about Device Farm Projects, see the AWS Documentation on ~> **NOTE:** AWS currently has limited regional support for Device Farm (e.g. `us-west-2`). See [AWS Device Farm endpoints and quotas](https://docs.aws.amazon.com/general/latest/gr/devicefarm.html) for information on supported regions. -## Basic Example Usage +## Example Usage -```hcl +```terraform resource "aws_devicefarm_project" "awesome_devices" { name = "my-device-farm" } diff --git a/website/docs/r/directory_service_conditional_forwarder.html.markdown b/website/docs/r/directory_service_conditional_forwarder.html.markdown index bbb3e15eea4d..1fd58889b5f6 100644 --- a/website/docs/r/directory_service_conditional_forwarder.html.markdown +++ b/website/docs/r/directory_service_conditional_forwarder.html.markdown @@ -12,7 +12,7 @@ Provides a conditional forwarder for managed Microsoft AD in AWS Directory Servi ## Example Usage -```hcl +```terraform resource "aws_directory_service_conditional_forwarder" "example" { directory_id = aws_directory_service_directory.ad.id remote_domain_name = "example.com" @@ -32,6 +32,10 @@ The following arguments are supported: * `dns_ips` - (Required) A list of forwarder IP addresses. * `remote_domain_name` - (Required) The fully qualified domain name of the remote domain for which forwarders will be used. +## Attributes Reference + +No additional attributes are exported. + ## Import Conditional forwarders can be imported using the directory id and remote_domain_name, e.g. diff --git a/website/docs/r/directory_service_directory.html.markdown b/website/docs/r/directory_service_directory.html.markdown index fddf2014434f..af971f81748c 100644 --- a/website/docs/r/directory_service_directory.html.markdown +++ b/website/docs/r/directory_service_directory.html.markdown @@ -17,7 +17,7 @@ Provides a Simple or Managed Microsoft directory in AWS Directory Service. ### SimpleAD -```hcl +```terraform resource "aws_directory_service_directory" "bar" { name = "corp.notexample.com" password = "SuperSecretPassw0rd" @@ -52,7 +52,7 @@ resource "aws_subnet" "bar" { ### Microsoft Active Directory (MicrosoftAD) -```hcl +```terraform resource "aws_directory_service_directory" "bar" { name = "corp.notexample.com" password = "SuperSecretPassw0rd" @@ -88,7 +88,7 @@ resource "aws_subnet" "bar" { ### Microsoft Active Directory Connector (ADConnector) -```hcl +```terraform resource "aws_directory_service_directory" "connector" { name = "corp.notexample.com" password = "SuperSecretPassw0rd" diff --git a/website/docs/r/directory_service_log_subscription.html.markdown b/website/docs/r/directory_service_log_subscription.html.markdown index 2fda1aac4fd7..355b122dc2e4 100644 --- a/website/docs/r/directory_service_log_subscription.html.markdown +++ b/website/docs/r/directory_service_log_subscription.html.markdown @@ -12,7 +12,7 @@ Provides a Log subscription for AWS Directory Service that pushes logs to cloudw ## Example Usage -```hcl +```terraform resource "aws_cloudwatch_log_group" "example" { name = "/aws/directoryservice/${aws_directory_service_directory.example.id}" retention_in_days = 14 @@ -54,6 +54,10 @@ The following arguments are supported: * `directory_id` - (Required) The id of directory. * `log_group_name` - (Required) Name of the cloudwatch log group to which the logs should be published. The log group should be already created and the directory service principal should be provided with required permission to create stream and publish logs. Changing this value would delete the current subscription and create a new one. A directory can only have one log subscription at a time. +## Attributes Reference + +No additional attributes are exported. + ## Import Directory Service Log Subscriptions can be imported using the directory id, e.g. diff --git a/website/docs/r/dlm_lifecycle_policy.markdown b/website/docs/r/dlm_lifecycle_policy.markdown index 98efb542d017..ee494757d037 100644 --- a/website/docs/r/dlm_lifecycle_policy.markdown +++ b/website/docs/r/dlm_lifecycle_policy.markdown @@ -12,7 +12,7 @@ Provides a [Data Lifecycle Manager (DLM) lifecycle policy](https://docs.aws.amaz ## Example Usage -```hcl +```terraform resource "aws_iam_role" "dlm_lifecycle_role" { name = "dlm-lifecycle-role" diff --git a/website/docs/r/dms_certificate.html.markdown b/website/docs/r/dms_certificate.html.markdown index 8ab27b88edd2..2a40eca204a9 100644 --- a/website/docs/r/dms_certificate.html.markdown +++ b/website/docs/r/dms_certificate.html.markdown @@ -15,7 +15,7 @@ Provides a DMS (Data Migration Service) certificate resource. DMS certificates c ## Example Usage -```hcl +```terraform # Create a new certificate resource "aws_dms_certificate" "test" { certificate_id = "test-dms-certificate-tf" @@ -37,7 +37,7 @@ The following arguments are supported: - Must contain from 1 to 255 alphanumeric characters and hyphens. * `certificate_pem` - (Optional) The contents of the .pem X.509 certificate file for the certificate. Either `certificate_pem` or `certificate_wallet` must be set. -* `certificate_wallet` - (Optional) The contents of the Oracle Wallet certificate for use with SSL. Either `certificate_pem` or `certificate_wallet` must be set. +* `certificate_wallet` - (Optional) The contents of the Oracle Wallet certificate for use with SSL, provided as a base64-encoded String. Either `certificate_pem` or `certificate_wallet` must be set. * `tags` - (Optional) A map of tags to assign to the resource. ## Attributes Reference diff --git a/website/docs/r/dms_endpoint.html.markdown b/website/docs/r/dms_endpoint.html.markdown index 46d0dcffe5ef..f9d964913f34 100644 --- a/website/docs/r/dms_endpoint.html.markdown +++ b/website/docs/r/dms_endpoint.html.markdown @@ -15,7 +15,7 @@ Provides a DMS (Data Migration Service) endpoint resource. DMS endpoints can be ## Example Usage -```hcl +```terraform # Create a new endpoint resource "aws_dms_endpoint" "test" { certificate_arn = "arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012" diff --git a/website/docs/r/dms_event_subscription.html.markdown b/website/docs/r/dms_event_subscription.html.markdown index e0f69d24182b..72907fe7a1b0 100644 --- a/website/docs/r/dms_event_subscription.html.markdown +++ b/website/docs/r/dms_event_subscription.html.markdown @@ -12,7 +12,7 @@ Provides a DMS (Data Migration Service) event subscription resource. ## Example Usage -```hcl +```terraform resource "aws_dms_event_subscription" "example" { enabled = true event_categories = ["creation", "failure"] @@ -38,6 +38,12 @@ The following arguments are supported: * `source_ids` - (Required) Ids of sources to listen to. * `sns_topic_arn` - (Required) SNS topic arn to send events on. +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `arn` - Amazon Resource Name (ARN) of the DMS Event Subscription. + ## Timeouts `aws_dms_event_subscription` provides the following [Timeouts](https://www.terraform.io/docs/configuration/blocks/resources/syntax.html#operation-timeouts) configuration options: diff --git a/website/docs/r/dms_replication_instance.html.markdown b/website/docs/r/dms_replication_instance.html.markdown index b40204af91b5..efacf1bb933a 100644 --- a/website/docs/r/dms_replication_instance.html.markdown +++ b/website/docs/r/dms_replication_instance.html.markdown @@ -12,7 +12,7 @@ Provides a DMS (Data Migration Service) replication instance resource. DMS repli ## Example Usage -```hcl +```terraform # Database Migration Service requires the below IAM Roles to be created before # replication instances can be created. See the DMS Documentation for # additional information: https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Security.html#CHAP_Security.APIRole diff --git a/website/docs/r/dms_replication_subnet_group.html.markdown b/website/docs/r/dms_replication_subnet_group.html.markdown index 730caba70ead..d3f7746530b6 100644 --- a/website/docs/r/dms_replication_subnet_group.html.markdown +++ b/website/docs/r/dms_replication_subnet_group.html.markdown @@ -12,7 +12,7 @@ Provides a DMS (Data Migration Service) replication subnet group resource. DMS r ## Example Usage -```hcl +```terraform # Create a new replication subnet group resource "aws_dms_replication_subnet_group" "test" { replication_subnet_group_description = "Test replication subnet group" diff --git a/website/docs/r/dms_replication_task.html.markdown b/website/docs/r/dms_replication_task.html.markdown index 075e2aed5a57..a648dc107896 100644 --- a/website/docs/r/dms_replication_task.html.markdown +++ b/website/docs/r/dms_replication_task.html.markdown @@ -12,7 +12,7 @@ Provides a DMS (Data Migration Service) replication task resource. DMS replicati ## Example Usage -```hcl +```terraform # Create a new replication task resource "aws_dms_replication_task" "test" { cdc_start_time = 1484346880 diff --git a/website/docs/r/docdb_cluster.html.markdown b/website/docs/r/docdb_cluster.html.markdown index 928c12978ea6..bc4d549ba5e4 100644 --- a/website/docs/r/docdb_cluster.html.markdown +++ b/website/docs/r/docdb_cluster.html.markdown @@ -23,7 +23,7 @@ phase because a modification has not yet taken place. You can use the ## Example Usage -```hcl +```terraform resource "aws_docdb_cluster" "docdb" { cluster_identifier = "my-docdb-cluster" engine = "docdb" diff --git a/website/docs/r/docdb_cluster_instance.html.markdown b/website/docs/r/docdb_cluster_instance.html.markdown index f3a43ada5588..bf7b97a2ec8b 100644 --- a/website/docs/r/docdb_cluster_instance.html.markdown +++ b/website/docs/r/docdb_cluster_instance.html.markdown @@ -19,7 +19,7 @@ Cluster, or you may specify different Cluster Instance resources with various ## Example Usage -```hcl +```terraform resource "aws_docdb_cluster_instance" "cluster_instances" { count = 2 identifier = "docdb-cluster-demo-${count.index}" diff --git a/website/docs/r/docdb_cluster_parameter_group.html.markdown b/website/docs/r/docdb_cluster_parameter_group.html.markdown index 8c5000b3be4e..8063d8ba3660 100644 --- a/website/docs/r/docdb_cluster_parameter_group.html.markdown +++ b/website/docs/r/docdb_cluster_parameter_group.html.markdown @@ -12,7 +12,7 @@ Manages a DocumentDB Cluster Parameter Group ## Example Usage -```hcl +```terraform resource "aws_docdb_cluster_parameter_group" "example" { family = "docdb3.6" name = "example" diff --git a/website/docs/r/docdb_cluster_snapshot.html.markdown b/website/docs/r/docdb_cluster_snapshot.html.markdown index 84dfd2099a11..6e20930482fd 100644 --- a/website/docs/r/docdb_cluster_snapshot.html.markdown +++ b/website/docs/r/docdb_cluster_snapshot.html.markdown @@ -12,7 +12,7 @@ Manages a DocDB database cluster snapshot for DocDB clusters. ## Example Usage -```hcl +```terraform resource "aws_docdb_cluster_snapshot" "example" { db_cluster_identifier = aws_docdb_cluster.example.id db_cluster_snapshot_identifier = "resourcetestsnapshot1234" diff --git a/website/docs/r/docdb_subnet_group.html.markdown b/website/docs/r/docdb_subnet_group.html.markdown index 404df33b22e7..a6a4a906f49c 100644 --- a/website/docs/r/docdb_subnet_group.html.markdown +++ b/website/docs/r/docdb_subnet_group.html.markdown @@ -12,7 +12,7 @@ Provides an DocumentDB subnet group resource. ## Example Usage -```hcl +```terraform resource "aws_docdb_subnet_group" "default" { name = "main" subnet_ids = [aws_subnet.frontend.id, aws_subnet.backend.id] diff --git a/website/docs/r/dx_bgp_peer.html.markdown b/website/docs/r/dx_bgp_peer.html.markdown index 39aa635099da..cb0c0add7017 100644 --- a/website/docs/r/dx_bgp_peer.html.markdown +++ b/website/docs/r/dx_bgp_peer.html.markdown @@ -12,7 +12,7 @@ Provides a Direct Connect BGP peer resource. ## Example Usage -```hcl +```terraform resource "aws_dx_bgp_peer" "peer" { virtual_interface_id = aws_dx_private_virtual_interface.foo.id address_family = "ipv6" diff --git a/website/docs/r/dx_connection.html.markdown b/website/docs/r/dx_connection.html.markdown index 5882af86ae55..ce0192570a95 100644 --- a/website/docs/r/dx_connection.html.markdown +++ b/website/docs/r/dx_connection.html.markdown @@ -12,7 +12,7 @@ Provides a Connection of Direct Connect. ## Example Usage -```hcl +```terraform resource "aws_dx_connection" "hoge" { name = "tf-dx-connection" bandwidth = "1Gbps" diff --git a/website/docs/r/dx_connection_association.html.markdown b/website/docs/r/dx_connection_association.html.markdown index 715e9d5e2c04..3ffdd34fde71 100644 --- a/website/docs/r/dx_connection_association.html.markdown +++ b/website/docs/r/dx_connection_association.html.markdown @@ -12,7 +12,7 @@ Associates a Direct Connect Connection with a LAG. ## Example Usage -```hcl +```terraform resource "aws_dx_connection" "example" { name = "example" bandwidth = "1Gbps" @@ -37,3 +37,7 @@ The following arguments are supported: * `connection_id` - (Required) The ID of the connection. * `lag_id` - (Required) The ID of the LAG with which to associate the connection. + +## Attributes Reference + +No additional attributes are exported. diff --git a/website/docs/r/dx_gateway.html.markdown b/website/docs/r/dx_gateway.html.markdown index a0ef2722e351..89a8e0713426 100644 --- a/website/docs/r/dx_gateway.html.markdown +++ b/website/docs/r/dx_gateway.html.markdown @@ -12,7 +12,7 @@ Provides a Direct Connect Gateway. ## Example Usage -```hcl +```terraform resource "aws_dx_gateway" "example" { name = "tf-dxg-example" amazon_side_asn = "64512" diff --git a/website/docs/r/dx_gateway_association.html.markdown b/website/docs/r/dx_gateway_association.html.markdown index bd8811c6884b..a64944f1dd6c 100644 --- a/website/docs/r/dx_gateway_association.html.markdown +++ b/website/docs/r/dx_gateway_association.html.markdown @@ -18,7 +18,7 @@ by creating an `aws_dx_gateway_association` resource with the `proposal_id` and ### VPN Gateway Association -```hcl +```terraform resource "aws_dx_gateway" "example" { name = "example" amazon_side_asn = "64512" @@ -40,7 +40,7 @@ resource "aws_dx_gateway_association" "example" { ### Transit Gateway Association -```hcl +```terraform resource "aws_dx_gateway" "example" { name = "example" amazon_side_asn = "64512" @@ -62,7 +62,7 @@ resource "aws_dx_gateway_association" "example" { ### Allowed Prefixes -```hcl +```terraform resource "aws_dx_gateway" "example" { name = "example" amazon_side_asn = "64512" diff --git a/website/docs/r/dx_gateway_association_proposal.html.markdown b/website/docs/r/dx_gateway_association_proposal.html.markdown index 4fae6c595fa6..c0d44155067a 100644 --- a/website/docs/r/dx_gateway_association_proposal.html.markdown +++ b/website/docs/r/dx_gateway_association_proposal.html.markdown @@ -12,7 +12,7 @@ Manages a Direct Connect Gateway Association Proposal, typically for enabling cr ## Example Usage -```hcl +```terraform resource "aws_dx_gateway_association_proposal" "example" { dx_gateway_id = aws_dx_gateway.example.id dx_gateway_owner_account_id = aws_dx_gateway.example.owner_account_id diff --git a/website/docs/r/dx_hosted_private_virtual_interface.html.markdown b/website/docs/r/dx_hosted_private_virtual_interface.html.markdown index 1c36e486cb49..913c02ac7478 100644 --- a/website/docs/r/dx_hosted_private_virtual_interface.html.markdown +++ b/website/docs/r/dx_hosted_private_virtual_interface.html.markdown @@ -13,7 +13,7 @@ A hosted virtual interface is a virtual interface that is owned by another AWS a ## Example Usage -```hcl +```terraform resource "aws_dx_hosted_private_virtual_interface" "foo" { connection_id = "dxcon-zzzzzzzz" diff --git a/website/docs/r/dx_hosted_private_virtual_interface_accepter.html.markdown b/website/docs/r/dx_hosted_private_virtual_interface_accepter.html.markdown index 97c7597eb668..00730b61c20b 100644 --- a/website/docs/r/dx_hosted_private_virtual_interface_accepter.html.markdown +++ b/website/docs/r/dx_hosted_private_virtual_interface_accepter.html.markdown @@ -13,7 +13,7 @@ This resource accepts ownership of a private virtual interface created by anothe ## Example Usage -```hcl +```terraform provider "aws" { # Creator's credentials. } diff --git a/website/docs/r/dx_hosted_public_virtual_interface.html.markdown b/website/docs/r/dx_hosted_public_virtual_interface.html.markdown index 233f63a17f55..a09430e4f205 100644 --- a/website/docs/r/dx_hosted_public_virtual_interface.html.markdown +++ b/website/docs/r/dx_hosted_public_virtual_interface.html.markdown @@ -13,7 +13,7 @@ A hosted virtual interface is a virtual interface that is owned by another AWS a ## Example Usage -```hcl +```terraform resource "aws_dx_hosted_public_virtual_interface" "foo" { connection_id = "dxcon-zzzzzzzz" diff --git a/website/docs/r/dx_hosted_public_virtual_interface_accepter.html.markdown b/website/docs/r/dx_hosted_public_virtual_interface_accepter.html.markdown index 26d74d6c7344..1ddb6722349b 100644 --- a/website/docs/r/dx_hosted_public_virtual_interface_accepter.html.markdown +++ b/website/docs/r/dx_hosted_public_virtual_interface_accepter.html.markdown @@ -13,7 +13,7 @@ This resource accepts ownership of a public virtual interface created by another ## Example Usage -```hcl +```terraform provider "aws" { # Creator's credentials. } diff --git a/website/docs/r/dx_hosted_transit_virtual_interface.html.markdown b/website/docs/r/dx_hosted_transit_virtual_interface.html.markdown index 5a38a6ecdcd0..3f4bb3a9b19a 100644 --- a/website/docs/r/dx_hosted_transit_virtual_interface.html.markdown +++ b/website/docs/r/dx_hosted_transit_virtual_interface.html.markdown @@ -14,7 +14,7 @@ A hosted virtual interface is a virtual interface that is owned by another AWS a ## Example Usage -```hcl +```terraform resource "aws_dx_hosted_transit_virtual_interface" "example" { connection_id = aws_dx_connection.example.id diff --git a/website/docs/r/dx_hosted_transit_virtual_interface_accepter.html.markdown b/website/docs/r/dx_hosted_transit_virtual_interface_accepter.html.markdown index ec73c108d887..eac517290aed 100644 --- a/website/docs/r/dx_hosted_transit_virtual_interface_accepter.html.markdown +++ b/website/docs/r/dx_hosted_transit_virtual_interface_accepter.html.markdown @@ -15,7 +15,7 @@ This resource accepts ownership of a transit virtual interface created by anothe ## Example Usage -```hcl +```terraform provider "aws" { # Creator's credentials. } diff --git a/website/docs/r/dx_lag.html.markdown b/website/docs/r/dx_lag.html.markdown index b4930e403ecd..5a299088458f 100644 --- a/website/docs/r/dx_lag.html.markdown +++ b/website/docs/r/dx_lag.html.markdown @@ -14,7 +14,7 @@ Provides a Direct Connect LAG. Connections can be added to the LAG via the [`aws ## Example Usage -```hcl +```terraform resource "aws_dx_lag" "hoge" { name = "tf-dx-lag" connections_bandwidth = "1Gbps" diff --git a/website/docs/r/dx_private_virtual_interface.html.markdown b/website/docs/r/dx_private_virtual_interface.html.markdown index 278e6d13839e..4a6d521ad934 100644 --- a/website/docs/r/dx_private_virtual_interface.html.markdown +++ b/website/docs/r/dx_private_virtual_interface.html.markdown @@ -12,7 +12,7 @@ Provides a Direct Connect private virtual interface resource. ## Example Usage -```hcl +```terraform resource "aws_dx_private_virtual_interface" "foo" { connection_id = "dxcon-zzzzzzzz" diff --git a/website/docs/r/dx_public_virtual_interface.html.markdown b/website/docs/r/dx_public_virtual_interface.html.markdown index ca88dafefacb..0b093788a53b 100644 --- a/website/docs/r/dx_public_virtual_interface.html.markdown +++ b/website/docs/r/dx_public_virtual_interface.html.markdown @@ -12,7 +12,7 @@ Provides a Direct Connect public virtual interface resource. ## Example Usage -```hcl +```terraform resource "aws_dx_public_virtual_interface" "foo" { connection_id = "dxcon-zzzzzzzz" diff --git a/website/docs/r/dx_transit_virtual_interface.html.markdown b/website/docs/r/dx_transit_virtual_interface.html.markdown index 230783776ce5..8ab1a3084210 100644 --- a/website/docs/r/dx_transit_virtual_interface.html.markdown +++ b/website/docs/r/dx_transit_virtual_interface.html.markdown @@ -13,7 +13,7 @@ A transit virtual interface is a VLAN that transports traffic from a [Direct Con ## Example Usage -```hcl +```terraform resource "aws_dx_gateway" "example" { name = "tf-dxg-example" amazon_side_asn = 64512 diff --git a/website/docs/r/dynamodb_global_table.html.markdown b/website/docs/r/dynamodb_global_table.html.markdown index 4e7b93ec503d..95e558304640 100644 --- a/website/docs/r/dynamodb_global_table.html.markdown +++ b/website/docs/r/dynamodb_global_table.html.markdown @@ -16,7 +16,7 @@ Manages [DynamoDB Global Tables V1 (version 2017.11.29)](https://docs.aws.amazon ## Example Usage -```hcl +```terraform provider "aws" { alias = "us-east-1" region = "us-east-1" diff --git a/website/docs/r/dynamodb_table.html.markdown b/website/docs/r/dynamodb_table.html.markdown index d93972c0c09d..cf88fc894e24 100644 --- a/website/docs/r/dynamodb_table.html.markdown +++ b/website/docs/r/dynamodb_table.html.markdown @@ -17,7 +17,7 @@ Provides a DynamoDB table resource The following dynamodb table description models the table and GSI shown in the [AWS SDK example documentation](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html) -```hcl +```terraform resource "aws_dynamodb_table" "basic-dynamodb-table" { name = "GameScores" billing_mode = "PROVISIONED" @@ -67,7 +67,7 @@ resource "aws_dynamodb_table" "basic-dynamodb-table" { This resource implements support for [DynamoDB Global Tables V2 (version 2019.11.21)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V2.html) via `replica` configuration blocks. For working with [DynamoDB Global Tables V1 (version 2017.11.29)](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/globaltables.V1.html), see the [`aws_dynamodb_global_table` resource](/docs/providers/aws/r/dynamodb_global_table.html). -```hcl +```terraform resource "aws_dynamodb_table" "example" { name = "example" hash_key = "TestTableHashKey" diff --git a/website/docs/r/dynamodb_table_item.html.markdown b/website/docs/r/dynamodb_table_item.html.markdown index 6083feb73f72..803e2d8c5fbb 100644 --- a/website/docs/r/dynamodb_table_item.html.markdown +++ b/website/docs/r/dynamodb_table_item.html.markdown @@ -15,7 +15,7 @@ Provides a DynamoDB table item resource ## Example Usage -```hcl +```terraform resource "aws_dynamodb_table_item" "example" { table_name = aws_dynamodb_table.example.name hash_key = aws_dynamodb_table.example.hash_key diff --git a/website/docs/r/ebs_default_kms_key.html.markdown b/website/docs/r/ebs_default_kms_key.html.markdown index a5afe25554c7..85691038b7d4 100644 --- a/website/docs/r/ebs_default_kms_key.html.markdown +++ b/website/docs/r/ebs_default_kms_key.html.markdown @@ -19,7 +19,7 @@ By using the `aws_ebs_default_kms_key` resource, you can specify a customer-mana ## Example Usage -```hcl +```terraform resource "aws_ebs_default_kms_key" "example" { key_arn = aws_kms_key.example.arn } @@ -31,6 +31,10 @@ The following arguments are supported: * `key_arn` - (Required, ForceNew) The ARN of the AWS Key Management Service (AWS KMS) customer master key (CMK) to use to encrypt the EBS volume. +## Attributes Reference + +No additional attributes are exported. + ## Import The EBS default KMS CMK can be imported with the KMS key ARN, e.g. diff --git a/website/docs/r/ebs_encryption_by_default.html.markdown b/website/docs/r/ebs_encryption_by_default.html.markdown index 0acbc4554ffe..ebe1b074ee4c 100644 --- a/website/docs/r/ebs_encryption_by_default.html.markdown +++ b/website/docs/r/ebs_encryption_by_default.html.markdown @@ -14,7 +14,7 @@ Provides a resource to manage whether default EBS encryption is enabled for your ## Example Usage -```hcl +```terraform resource "aws_ebs_encryption_by_default" "example" { enabled = true } @@ -25,3 +25,7 @@ resource "aws_ebs_encryption_by_default" "example" { The following arguments are supported: * `enabled` - (Optional) Whether or not default EBS encryption is enabled. Valid values are `true` or `false`. Defaults to `true`. + +## Attributes Reference + +No additional attributes are exported. diff --git a/website/docs/r/ebs_snapshot.html.markdown b/website/docs/r/ebs_snapshot.html.markdown index 190630ff90ce..254ba3b8b558 100644 --- a/website/docs/r/ebs_snapshot.html.markdown +++ b/website/docs/r/ebs_snapshot.html.markdown @@ -12,7 +12,7 @@ Creates a Snapshot of an EBS Volume. ## Example Usage -```hcl +```terraform resource "aws_ebs_volume" "example" { availability_zone = "us-west-2a" size = 40 diff --git a/website/docs/r/ebs_snapshot_copy.html.markdown b/website/docs/r/ebs_snapshot_copy.html.markdown index 42c0c65b4749..f6afda85f117 100644 --- a/website/docs/r/ebs_snapshot_copy.html.markdown +++ b/website/docs/r/ebs_snapshot_copy.html.markdown @@ -12,7 +12,7 @@ Creates a Snapshot of a snapshot. ## Example Usage -```hcl +```terraform resource "aws_ebs_volume" "example" { availability_zone = "us-west-2a" size = 40 diff --git a/website/docs/r/ebs_volume.html.markdown b/website/docs/r/ebs_volume.html.markdown index f5746c4142df..687a7b8941e1 100644 --- a/website/docs/r/ebs_volume.html.markdown +++ b/website/docs/r/ebs_volume.html.markdown @@ -12,7 +12,7 @@ Manages a single EBS volume. ## Example Usage -```hcl +```terraform resource "aws_ebs_volume" "example" { availability_zone = "us-west-2a" size = 40 diff --git a/website/docs/r/ec2_availability_zone_group.html.markdown b/website/docs/r/ec2_availability_zone_group.html.markdown index 76b9e2dd27d4..5870bd61d806 100644 --- a/website/docs/r/ec2_availability_zone_group.html.markdown +++ b/website/docs/r/ec2_availability_zone_group.html.markdown @@ -14,7 +14,7 @@ Manages an EC2 Availability Zone Group, such as updating its opt-in status. ## Example Usage -```hcl +```terraform resource "aws_ec2_availability_zone_group" "example" { group_name = "us-west-2-lax-1" opt_in_status = "opted-in" diff --git a/website/docs/r/ec2_capacity_reservation.html.markdown b/website/docs/r/ec2_capacity_reservation.html.markdown index 7ebd333c6969..00cf6a7f0376 100644 --- a/website/docs/r/ec2_capacity_reservation.html.markdown +++ b/website/docs/r/ec2_capacity_reservation.html.markdown @@ -12,7 +12,7 @@ Provides an EC2 Capacity Reservation. This allows you to reserve capacity for yo ## Example Usage -```hcl +```terraform resource "aws_ec2_capacity_reservation" "default" { instance_type = "t2.micro" instance_platform = "Linux/UNIX" diff --git a/website/docs/r/ec2_carrier_gateway.html.markdown b/website/docs/r/ec2_carrier_gateway.html.markdown index 805b29f21c30..b64ef31ef540 100644 --- a/website/docs/r/ec2_carrier_gateway.html.markdown +++ b/website/docs/r/ec2_carrier_gateway.html.markdown @@ -12,7 +12,7 @@ Manages an EC2 Carrier Gateway. See the AWS [documentation](https://docs.aws.ama ## Example Usage -```hcl +```terraform resource "aws_ec2_carrier_gateway" "example" { vpc_id = aws_vpc.example.id diff --git a/website/docs/r/ec2_client_vpn_authorization_rule.html.markdown b/website/docs/r/ec2_client_vpn_authorization_rule.html.markdown index 7abfc44f3b07..9e9cf11d500c 100644 --- a/website/docs/r/ec2_client_vpn_authorization_rule.html.markdown +++ b/website/docs/r/ec2_client_vpn_authorization_rule.html.markdown @@ -13,7 +13,7 @@ Provides authorization rules for AWS Client VPN endpoints. For more information ## Example Usage -```hcl +```terraform resource "aws_ec2_client_vpn_authorization_rule" "example" { client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.example.id target_network_cidr = aws_subnet.example.cidr_block @@ -31,6 +31,10 @@ The following arguments are supported: * `authorize_all_groups` - (Optional) Indicates whether the authorization rule grants access to all clients. One of `access_group_id` or `authorize_all_groups` must be set. * `description` - (Optional) A brief description of the authorization rule. +## Attributes Reference + +No additional attributes are exported. + ## Import AWS Client VPN authorization rules can be imported using the endpoint ID and target network CIDR. If there is a specific group name that is included as well. All values are separated by a `,`. diff --git a/website/docs/r/ec2_client_vpn_endpoint.html.markdown b/website/docs/r/ec2_client_vpn_endpoint.html.markdown index 83f12c245f4f..e06290ba2caa 100644 --- a/website/docs/r/ec2_client_vpn_endpoint.html.markdown +++ b/website/docs/r/ec2_client_vpn_endpoint.html.markdown @@ -13,7 +13,7 @@ Provides an AWS Client VPN endpoint for OpenVPN clients. For more information on ## Example Usage -```hcl +```terraform resource "aws_ec2_client_vpn_endpoint" "example" { description = "terraform-clientvpn-example" server_certificate_arn = aws_acm_certificate.cert.arn diff --git a/website/docs/r/ec2_client_vpn_network_association.html.markdown b/website/docs/r/ec2_client_vpn_network_association.html.markdown index c8c694e35823..6f8d23558c02 100644 --- a/website/docs/r/ec2_client_vpn_network_association.html.markdown +++ b/website/docs/r/ec2_client_vpn_network_association.html.markdown @@ -15,7 +15,7 @@ Provides network associations for AWS Client VPN endpoints. For more information ### Using default security group -```hcl +```terraform resource "aws_ec2_client_vpn_network_association" "example" { client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.example.id subnet_id = aws_subnet.example.id @@ -24,7 +24,7 @@ resource "aws_ec2_client_vpn_network_association" "example" { ### Using custom security groups -```hcl +```terraform resource "aws_ec2_client_vpn_network_association" "example" { client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.example.id subnet_id = aws_subnet.example.id diff --git a/website/docs/r/ec2_client_vpn_route.html.markdown b/website/docs/r/ec2_client_vpn_route.html.markdown index 036c5f481a29..3effe2208095 100644 --- a/website/docs/r/ec2_client_vpn_route.html.markdown +++ b/website/docs/r/ec2_client_vpn_route.html.markdown @@ -13,7 +13,7 @@ Provides additional routes for AWS Client VPN endpoints. For more information on ## Example Usage -```hcl +```terraform resource "aws_ec2_client_vpn_route" "example" { client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.example.id destination_cidr_block = "0.0.0.0/0" diff --git a/website/docs/r/ec2_fleet.html.markdown b/website/docs/r/ec2_fleet.html.markdown index 9a0f06c01a62..17e5cb2c4220 100644 --- a/website/docs/r/ec2_fleet.html.markdown +++ b/website/docs/r/ec2_fleet.html.markdown @@ -12,7 +12,7 @@ Provides a resource to manage EC2 Fleets. ## Example Usage -```hcl +```terraform resource "aws_ec2_fleet" "example" { launch_template_config { launch_template_specification { @@ -60,7 +60,7 @@ The following arguments are supported: Example: -```hcl +```terraform resource "aws_ec2_fleet" "example" { # ... other configuration ... diff --git a/website/docs/r/ec2_local_gateway_route.html.markdown b/website/docs/r/ec2_local_gateway_route.html.markdown index ef94eed35171..d21931e41485 100644 --- a/website/docs/r/ec2_local_gateway_route.html.markdown +++ b/website/docs/r/ec2_local_gateway_route.html.markdown @@ -12,7 +12,7 @@ Manages an EC2 Local Gateway Route. More information can be found in the [Outpos ## Example Usage -```hcl +```terraform resource "aws_ec2_local_gateway_route" "example" { destination_cidr_block = "172.16.0.0/16" local_gateway_route_table_id = data.aws_ec2_local_gateway_route_table.example.id diff --git a/website/docs/r/ec2_local_gateway_route_table_vpc_association.html.markdown b/website/docs/r/ec2_local_gateway_route_table_vpc_association.html.markdown index c9e5d11f6d88..bbd3173684dc 100644 --- a/website/docs/r/ec2_local_gateway_route_table_vpc_association.html.markdown +++ b/website/docs/r/ec2_local_gateway_route_table_vpc_association.html.markdown @@ -12,7 +12,7 @@ Manages an EC2 Local Gateway Route Table VPC Association. More information can b ## Example Usage -```hcl +```terraform data "aws_ec2_local_gateway_route_table" "example" { outpost_arn = "arn:aws:outposts:us-west-2:123456789012:outpost/op-1234567890abcdef" } diff --git a/website/docs/r/ec2_managed_prefix_list.html.markdown b/website/docs/r/ec2_managed_prefix_list.html.markdown index 98c480a4e450..66fb791bc2fd 100644 --- a/website/docs/r/ec2_managed_prefix_list.html.markdown +++ b/website/docs/r/ec2_managed_prefix_list.html.markdown @@ -20,7 +20,7 @@ as 20 rules for the security group. Basic usage -```hcl +```terraform resource "aws_ec2_managed_prefix_list" "example" { name = "All VPC CIDR-s" address_family = "IPv4" diff --git a/website/docs/r/ec2_tag.html.markdown b/website/docs/r/ec2_tag.html.markdown index 3eef93e294c2..09fca91185f8 100644 --- a/website/docs/r/ec2_tag.html.markdown +++ b/website/docs/r/ec2_tag.html.markdown @@ -16,7 +16,7 @@ Manages an individual EC2 resource tag. This resource should only be used in cas ## Example Usage -```hcl +```terraform resource "aws_ec2_transit_gateway" "example" {} resource "aws_customer_gateway" "example" { diff --git a/website/docs/r/ec2_traffic_mirror_filter.html.markdown b/website/docs/r/ec2_traffic_mirror_filter.html.markdown index d4fb95cb685a..7e044c6dc55c 100644 --- a/website/docs/r/ec2_traffic_mirror_filter.html.markdown +++ b/website/docs/r/ec2_traffic_mirror_filter.html.markdown @@ -15,7 +15,7 @@ Read [limits and considerations](https://docs.aws.amazon.com/vpc/latest/mirrorin To create a basic traffic mirror filter -```hcl +```terraform resource "aws_ec2_traffic_mirror_filter" "foo" { description = "traffic mirror filter - terraform example" network_services = ["amazon-dns"] diff --git a/website/docs/r/ec2_traffic_mirror_filter_rule.html.markdown b/website/docs/r/ec2_traffic_mirror_filter_rule.html.markdown index f5fd1340ac96..5acc90fb1f7a 100644 --- a/website/docs/r/ec2_traffic_mirror_filter_rule.html.markdown +++ b/website/docs/r/ec2_traffic_mirror_filter_rule.html.markdown @@ -15,7 +15,7 @@ Read [limits and considerations](https://docs.aws.amazon.com/vpc/latest/mirrorin To create a basic traffic mirror session -```hcl +```terraform resource "aws_ec2_traffic_mirror_filter" "filter" { description = "traffic mirror filter - terraform example" network_services = ["amazon-dns"] diff --git a/website/docs/r/ec2_traffic_mirror_session.html.markdown b/website/docs/r/ec2_traffic_mirror_session.html.markdown index 4f609b32c5b7..1a03e02d1561 100644 --- a/website/docs/r/ec2_traffic_mirror_session.html.markdown +++ b/website/docs/r/ec2_traffic_mirror_session.html.markdown @@ -15,7 +15,7 @@ Read [limits and considerations](https://docs.aws.amazon.com/vpc/latest/mirrorin To create a basic traffic mirror session -```hcl +```terraform resource "aws_ec2_traffic_mirror_filter" "filter" { description = "traffic mirror filter - terraform example" network_services = ["amazon-dns"] @@ -52,6 +52,7 @@ In addition to all arguments above, the following attributes are exported: * `arn` - The ARN of the traffic mirror session. * `id` - The name of the session. +* `owner_id` - The AWS account ID of the session owner. ## Import diff --git a/website/docs/r/ec2_traffic_mirror_target.html.markdown b/website/docs/r/ec2_traffic_mirror_target.html.markdown index cc1857727238..314b74d82889 100644 --- a/website/docs/r/ec2_traffic_mirror_target.html.markdown +++ b/website/docs/r/ec2_traffic_mirror_target.html.markdown @@ -15,7 +15,7 @@ Read [limits and considerations](https://docs.aws.amazon.com/vpc/latest/mirrorin To create a basic traffic mirror session -```hcl +```terraform resource "aws_ec2_traffic_mirror_target" "nlb" { description = "NLB target" network_load_balancer_arn = aws_lb.lb.arn @@ -44,6 +44,7 @@ In addition to all arguments above, the following attributes are exported: * `id` - The ID of the Traffic Mirror target. * `arn` - The ARN of the traffic mirror target. +* `owner_id` - The ID of the AWS account that owns the traffic mirror target. ## Import diff --git a/website/docs/r/ec2_transit_gateway.html.markdown b/website/docs/r/ec2_transit_gateway.html.markdown index 4832b4f3933f..bf6e983c917b 100644 --- a/website/docs/r/ec2_transit_gateway.html.markdown +++ b/website/docs/r/ec2_transit_gateway.html.markdown @@ -12,7 +12,7 @@ Manages an EC2 Transit Gateway. ## Example Usage -```hcl +```terraform resource "aws_ec2_transit_gateway" "example" { description = "example" } diff --git a/website/docs/r/ec2_transit_gateway_peering_attachment.html.markdown b/website/docs/r/ec2_transit_gateway_peering_attachment.html.markdown index acac16792fb7..c4e64f2141f1 100644 --- a/website/docs/r/ec2_transit_gateway_peering_attachment.html.markdown +++ b/website/docs/r/ec2_transit_gateway_peering_attachment.html.markdown @@ -13,7 +13,7 @@ For examples of custom route table association and propagation, see the [EC2 Tra ## Example Usage -```hcl +```terraform provider "aws" { alias = "local" region = "us-east-1" diff --git a/website/docs/r/ec2_transit_gateway_peering_attachment_accepter.markdown b/website/docs/r/ec2_transit_gateway_peering_attachment_accepter.markdown index 971c88616baf..73b926a6f400 100644 --- a/website/docs/r/ec2_transit_gateway_peering_attachment_accepter.markdown +++ b/website/docs/r/ec2_transit_gateway_peering_attachment_accepter.markdown @@ -12,7 +12,7 @@ Manages the accepter's side of an EC2 Transit Gateway Peering Attachment. ## Example Usage -```hcl +```terraform resource "aws_ec2_transit_gateway_peering_attachment_accepter" "example" { transit_gateway_attachment_id = aws_ec2_transit_gateway_peering_attachment.example.id diff --git a/website/docs/r/ec2_transit_gateway_prefix_list_reference.html.markdown b/website/docs/r/ec2_transit_gateway_prefix_list_reference.html.markdown index f6d884e8837e..01acdc26ce5f 100644 --- a/website/docs/r/ec2_transit_gateway_prefix_list_reference.html.markdown +++ b/website/docs/r/ec2_transit_gateway_prefix_list_reference.html.markdown @@ -14,7 +14,7 @@ Manages an EC2 Transit Gateway Prefix List Reference. ### Attachment Routing -```hcl +```terraform resource "aws_ec2_transit_gateway_prefix_list_reference" "example" { prefix_list_id = aws_ec2_managed_prefix_list.example.id transit_gateway_attachment_id = aws_ec2_transit_gateway_vpc_attachment.example.id @@ -24,7 +24,7 @@ resource "aws_ec2_transit_gateway_prefix_list_reference" "example" { ### Blackhole Routing -```hcl +```terraform resource "aws_ec2_transit_gateway_prefix_list_reference" "example" { blackhole = true prefix_list_id = aws_ec2_managed_prefix_list.example.id diff --git a/website/docs/r/ec2_transit_gateway_route.html.markdown b/website/docs/r/ec2_transit_gateway_route.html.markdown index 2140ce706ace..58dff7dbbb83 100644 --- a/website/docs/r/ec2_transit_gateway_route.html.markdown +++ b/website/docs/r/ec2_transit_gateway_route.html.markdown @@ -14,7 +14,7 @@ Manages an EC2 Transit Gateway Route. ### Standard usage -```hcl +```terraform resource "aws_ec2_transit_gateway_route" "example" { destination_cidr_block = "0.0.0.0/0" transit_gateway_attachment_id = aws_ec2_transit_gateway_vpc_attachment.example.id @@ -24,7 +24,7 @@ resource "aws_ec2_transit_gateway_route" "example" { ### Blackhole route -```hcl +```terraform resource "aws_ec2_transit_gateway_route" "example" { destination_cidr_block = "0.0.0.0/0" blackhole = true diff --git a/website/docs/r/ec2_transit_gateway_route_table.html.markdown b/website/docs/r/ec2_transit_gateway_route_table.html.markdown index e92d770d23ef..bfb7ef648373 100644 --- a/website/docs/r/ec2_transit_gateway_route_table.html.markdown +++ b/website/docs/r/ec2_transit_gateway_route_table.html.markdown @@ -12,7 +12,7 @@ Manages an EC2 Transit Gateway Route Table. ## Example Usage -```hcl +```terraform resource "aws_ec2_transit_gateway_route_table" "example" { transit_gateway_id = aws_ec2_transit_gateway.example.id } diff --git a/website/docs/r/ec2_transit_gateway_route_table_association.html.markdown b/website/docs/r/ec2_transit_gateway_route_table_association.html.markdown index c80377d7855b..29bccf1d7589 100644 --- a/website/docs/r/ec2_transit_gateway_route_table_association.html.markdown +++ b/website/docs/r/ec2_transit_gateway_route_table_association.html.markdown @@ -12,7 +12,7 @@ Manages an EC2 Transit Gateway Route Table association. ## Example Usage -```hcl +```terraform resource "aws_ec2_transit_gateway_route_table_association" "example" { transit_gateway_attachment_id = aws_ec2_transit_gateway_vpc_attachment.example.id transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.example.id diff --git a/website/docs/r/ec2_transit_gateway_route_table_propagation.html.markdown b/website/docs/r/ec2_transit_gateway_route_table_propagation.html.markdown index 2be0ca4d2afa..a5050798360a 100644 --- a/website/docs/r/ec2_transit_gateway_route_table_propagation.html.markdown +++ b/website/docs/r/ec2_transit_gateway_route_table_propagation.html.markdown @@ -12,7 +12,7 @@ Manages an EC2 Transit Gateway Route Table propagation. ## Example Usage -```hcl +```terraform resource "aws_ec2_transit_gateway_route_table_propagation" "example" { transit_gateway_attachment_id = aws_ec2_transit_gateway_vpc_attachment.example.id transit_gateway_route_table_id = aws_ec2_transit_gateway_route_table.example.id diff --git a/website/docs/r/ec2_transit_gateway_vpc_attachment.html.markdown b/website/docs/r/ec2_transit_gateway_vpc_attachment.html.markdown index 18a39409679a..4ff12d864ef5 100644 --- a/website/docs/r/ec2_transit_gateway_vpc_attachment.html.markdown +++ b/website/docs/r/ec2_transit_gateway_vpc_attachment.html.markdown @@ -12,7 +12,7 @@ Manages an EC2 Transit Gateway VPC Attachment. For examples of custom route tabl ## Example Usage -```hcl +```terraform resource "aws_ec2_transit_gateway_vpc_attachment" "example" { subnet_ids = [aws_subnet.example.id] transit_gateway_id = aws_ec2_transit_gateway.example.id diff --git a/website/docs/r/ec2_transit_gateway_vpc_attachment_accepter.html.markdown b/website/docs/r/ec2_transit_gateway_vpc_attachment_accepter.html.markdown index bba56d0c9ed7..9890fc3c4ed5 100644 --- a/website/docs/r/ec2_transit_gateway_vpc_attachment_accepter.html.markdown +++ b/website/docs/r/ec2_transit_gateway_vpc_attachment_accepter.html.markdown @@ -18,7 +18,7 @@ connection into management. ## Example Usage -```hcl +```terraform resource "aws_ec2_transit_gateway_vpc_attachment_accepter" "example" { transit_gateway_attachment_id = aws_ec2_transit_gateway_vpc_attachment.example.id diff --git a/website/docs/r/ecr_lifecycle_policy.html.markdown b/website/docs/r/ecr_lifecycle_policy.html.markdown index 4db3efe103c4..35412f0ad817 100644 --- a/website/docs/r/ecr_lifecycle_policy.html.markdown +++ b/website/docs/r/ecr_lifecycle_policy.html.markdown @@ -18,7 +18,7 @@ Manages an ECR repository lifecycle policy. ### Policy on untagged image -```hcl +```terraform resource "aws_ecr_repository" "foo" { name = "bar" } @@ -50,7 +50,7 @@ EOF ### Policy on tagged image -```hcl +```terraform resource "aws_ecr_repository" "foo" { name = "bar" } diff --git a/website/docs/r/ecr_repository.html.markdown b/website/docs/r/ecr_repository.html.markdown index 20f9d7d57d10..7814383a8ae3 100644 --- a/website/docs/r/ecr_repository.html.markdown +++ b/website/docs/r/ecr_repository.html.markdown @@ -12,7 +12,7 @@ Provides an Elastic Container Registry Repository. ## Example Usage -```hcl +```terraform resource "aws_ecr_repository" "foo" { name = "bar" image_tag_mutability = "MUTABLE" diff --git a/website/docs/r/ecr_repository_policy.html.markdown b/website/docs/r/ecr_repository_policy.html.markdown index 4ed0b9daad56..59b2fe974b81 100644 --- a/website/docs/r/ecr_repository_policy.html.markdown +++ b/website/docs/r/ecr_repository_policy.html.markdown @@ -14,7 +14,7 @@ Note that currently only one policy may be applied to a repository. ## Example Usage -```hcl +```terraform resource "aws_ecr_repository" "foo" { name = "bar" } diff --git a/website/docs/r/ecrpublic_repository.html.markdown b/website/docs/r/ecrpublic_repository.html.markdown index a83cff9ad2a3..ab50ef3514ac 100644 --- a/website/docs/r/ecrpublic_repository.html.markdown +++ b/website/docs/r/ecrpublic_repository.html.markdown @@ -12,7 +12,7 @@ Provides a Public Elastic Container Registry Repository. ## Example Usage -```hcl +```terraform resource "aws_ecrpublic_repository" "foo" { repository_name = "bar" diff --git a/website/docs/r/ecs_capacity_provider.html.markdown b/website/docs/r/ecs_capacity_provider.html.markdown index c80d69eaf98f..d024cadbbf2a 100644 --- a/website/docs/r/ecs_capacity_provider.html.markdown +++ b/website/docs/r/ecs_capacity_provider.html.markdown @@ -14,7 +14,7 @@ Provides an ECS cluster capacity provider. More information can be found on the ## Example Usage -```hcl +```terraform resource "aws_autoscaling_group" "test" { # ... other configuration, including potentially other tags ... diff --git a/website/docs/r/ecs_cluster.html.markdown b/website/docs/r/ecs_cluster.html.markdown index 15e5c8f5cad2..d0c9892040ff 100644 --- a/website/docs/r/ecs_cluster.html.markdown +++ b/website/docs/r/ecs_cluster.html.markdown @@ -12,7 +12,7 @@ Provides an ECS cluster. ## Example Usage -```hcl +```terraform resource "aws_ecs_cluster" "foo" { name = "white-hart" } diff --git a/website/docs/r/ecs_service.html.markdown b/website/docs/r/ecs_service.html.markdown index 73e43562fc73..9aee88093a05 100644 --- a/website/docs/r/ecs_service.html.markdown +++ b/website/docs/r/ecs_service.html.markdown @@ -16,7 +16,7 @@ See [ECS Services section in AWS developer guide](https://docs.aws.amazon.com/Am ## Example Usage -```hcl +```terraform resource "aws_ecs_service" "mongo" { name = "mongodb" cluster = aws_ecs_cluster.foo.id @@ -47,7 +47,7 @@ resource "aws_ecs_service" "mongo" { You can utilize the generic Terraform resource [lifecycle configuration block](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html) with `ignore_changes` to create an ECS service with an initial count of running instances, then ignore any changes to that count caused externally (e.g. Application Autoscaling). -```hcl +```terraform resource "aws_ecs_service" "example" { # ... other configurations ... @@ -63,7 +63,7 @@ resource "aws_ecs_service" "example" { ### Daemon Scheduling Strategy -```hcl +```terraform resource "aws_ecs_service" "bar" { name = "bar" cluster = aws_ecs_cluster.foo.id @@ -74,7 +74,7 @@ resource "aws_ecs_service" "bar" { ### External Deployment Controller -```hcl +```terraform resource "aws_ecs_service" "example" { name = "example" cluster = aws_ecs_cluster.example.id @@ -87,62 +87,84 @@ resource "aws_ecs_service" "example" { ## Argument Reference -The following arguments are supported: +The following arguments are required: -* `name` - (Required) The name of the service (up to 255 letters, numbers, hyphens, and underscores) -* `capacity_provider_strategy` - (Optional) The capacity provider strategy to use for the service. Can be one or more. Defined below. +* `name` - (Required) Name of the service (up to 255 letters, numbers, hyphens, and underscores) + +The following arguments are optional: + +* `capacity_provider_strategy` - (Optional) Capacity provider strategy to use for the service. Can be one or more. Detailed below. * `cluster` - (Optional) ARN of an ECS cluster -* `deployment_controller` - (Optional) Configuration block containing deployment controller configuration. Defined below. -* `deployment_maximum_percent` - (Optional) The upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment. Not valid when using the `DAEMON` scheduling strategy. -* `deployment_minimum_healthy_percent` - (Optional) The lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment. -* `desired_count` - (Optional) The number of instances of the task definition to place and keep running. Defaults to 0. Do not specify if using the `DAEMON` scheduling strategy. +* `deployment_circuit_breaker` - (Optional) Configuration block for deployment circuit breaker. Detailed below. +* `deployment_controller` - (Optional) Configuration block for deployment controller configuration. Detailed below. +* `deployment_maximum_percent` - (Optional) Upper limit (as a percentage of the service's desiredCount) of the number of running tasks that can be running in a service during a deployment. Not valid when using the `DAEMON` scheduling strategy. +* `deployment_minimum_healthy_percent` - (Optional) Lower limit (as a percentage of the service's desiredCount) of the number of running tasks that must remain running and healthy in a service during a deployment. +* `desired_count` - (Optional) Number of instances of the task definition to place and keep running. Defaults to 0. Do not specify if using the `DAEMON` scheduling strategy. * `enable_ecs_managed_tags` - (Optional) Specifies whether to enable Amazon ECS managed tags for the tasks within the service. +* `enable_execute_command` - (Optional) Specifies whether to enable Amazon ECS Exec for the tasks within the service. * `force_new_deployment` - (Optional) Enable to force a new task deployment of the service. This can be used to update tasks to use a newer Docker image with same image/tag combination (e.g. `myimage:latest`), roll Fargate tasks onto a newer platform version, or immediately deploy `ordered_placement_strategy` and `placement_constraints` updates. * `health_check_grace_period_seconds` - (Optional) Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent premature shutdown, up to 2147483647. Only valid for services configured to use load balancers. * `iam_role` - (Optional) ARN of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. This parameter is required if you are using a load balancer with your service, but only if your task definition does not use the `awsvpc` network mode. If using `awsvpc` network mode, do not specify this role. If your account has already created the Amazon ECS service-linked role, that role is used by default for your service unless you specify a role here. -* `launch_type` - (Optional) The launch type on which to run your service. The valid values are `EC2` and `FARGATE`. Defaults to `EC2`. -* `load_balancer` - (Optional) A load balancer block. Load balancers documented below. -* `network_configuration` - (Optional) The network configuration for the service. This parameter is required for task definitions that use the `awsvpc` network mode to receive their own Elastic Network Interface, and it is not supported for other network modes. -* `ordered_placement_strategy` - (Optional) Service level strategy rules that are taken into consideration during task placement. List from top to bottom in order of precedence. Updates to this configuration will take effect next task deployment unless `force_new_deployment` is enabled. The maximum number of `ordered_placement_strategy` blocks is `5`. Defined below. -* `placement_constraints` - (Optional) rules that are taken into consideration during task placement. Updates to this configuration will take effect next task deployment unless `force_new_deployment` is enabled. Maximum number of `placement_constraints` is `10`. Defined below. -* `platform_version` - (Optional) The platform version on which to run your service. Only applicable for `launch_type` set to `FARGATE`. Defaults to `LATEST`. More information about Fargate platform versions can be found in the [AWS ECS User Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html). +* `launch_type` - (Optional) Launch type on which to run your service. The valid values are `EC2` and `FARGATE`. Defaults to `EC2`. +* `load_balancer` - (Optional) Configuration block for load balancers. Detailed below. +* `network_configuration` - (Optional) Network configuration for the service. This parameter is required for task definitions that use the `awsvpc` network mode to receive their own Elastic Network Interface, and it is not supported for other network modes. Detailed below. +* `ordered_placement_strategy` - (Optional) Service level strategy rules that are taken into consideration during task placement. List from top to bottom in order of precedence. Updates to this configuration will take effect next task deployment unless `force_new_deployment` is enabled. The maximum number of `ordered_placement_strategy` blocks is `5`. Detailed below. +* `placement_constraints` - (Optional) Rules that are taken into consideration during task placement. Updates to this configuration will take effect next task deployment unless `force_new_deployment` is enabled. Maximum number of `placement_constraints` is `10`. Detailed below. +* `platform_version` - (Optional) Platform version on which to run your service. Only applicable for `launch_type` set to `FARGATE`. Defaults to `LATEST`. More information about Fargate platform versions can be found in the [AWS ECS User Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html). * `propagate_tags` - (Optional) Specifies whether to propagate the tags from the task definition or the service to the tasks. The valid values are `SERVICE` and `TASK_DEFINITION`. -* `scheduling_strategy` - (Optional) The scheduling strategy to use for the service. The valid values are `REPLICA` and `DAEMON`. Defaults to `REPLICA`. Note that [*Tasks using the Fargate launch type or the `CODE_DEPLOY` or `EXTERNAL` deployment controller types don't support the `DAEMON` scheduling strategy*](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateService.html). -* `service_registries` - (Optional) The service discovery registries for the service. The maximum number of `service_registries` blocks is `1`. +* `scheduling_strategy` - (Optional) Scheduling strategy to use for the service. The valid values are `REPLICA` and `DAEMON`. Defaults to `REPLICA`. Note that [*Tasks using the Fargate launch type or the `CODE_DEPLOY` or `EXTERNAL` deployment controller types don't support the `DAEMON` scheduling strategy*](https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_CreateService.html). +* `service_registries` - (Optional) Service discovery registries for the service. The maximum number of `service_registries` blocks is `1`. Detailed below. * `tags` - (Optional) Key-value map of resource tags -* `task_definition` - (Optional) The family and revision (`family:revision`) or full ARN of the task definition that you want to run in your service. Required unless using the `EXTERNAL` deployment controller. If a revision is not specified, the latest `ACTIVE` revision is used. +* `task_definition` - (Optional) Family and revision (`family:revision`) or full ARN of the task definition that you want to run in your service. Required unless using the `EXTERNAL` deployment controller. If a revision is not specified, the latest `ACTIVE` revision is used. * `wait_for_steady_state` - (Optional) If `true`, Terraform will wait for the service to reach a steady state (like [`aws ecs wait services-stable`](https://docs.aws.amazon.com/cli/latest/reference/ecs/wait/services-stable.html)) before continuing. Default `false`. -## capacity_provider_strategy +### capacity_provider_strategy The `capacity_provider_strategy` configuration block supports the following: -* `capacity_provider` - (Required) The short name of the capacity provider. -* `weight` - (Required) The relative percentage of the total number of launched tasks that should use the specified capacity provider. -* `base` - (Optional) The number of tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. +* `base` - (Optional) Number of tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. +* `capacity_provider` - (Required) Short name of the capacity provider. +* `weight` - (Required) Relative percentage of the total number of launched tasks that should use the specified capacity provider. + +### deployment_circuit_breaker + +The `deployment_circuit_breaker` configuration block supports the following: + +* `enable` - (Required) Whether to enable the deployment circuit breaker logic for the service. +* `rollback` - (Required) Whether to enable Amazon ECS to roll back the service if a service deployment fails. If rollback is enabled, when a service deployment fails, the service is rolled back to the last deployment that completed successfully. -## deployment_controller +### deployment_controller The `deployment_controller` configuration block supports the following: * `type` - (Optional) Type of deployment controller. Valid values: `CODE_DEPLOY`, `ECS`, `EXTERNAL`. Default: `ECS`. -## load_balancer +### load_balancer `load_balancer` supports the following: -* `elb_name` - (Required for ELB Classic) The name of the ELB (Classic) to associate with the service. -* `target_group_arn` - (Required for ALB/NLB) The ARN of the Load Balancer target group to associate with the service. -* `container_name` - (Required) The name of the container to associate with the load balancer (as it appears in a container definition). -* `container_port` - (Required) The port on the container to associate with the load balancer. +* `elb_name` - (Required for ELB Classic) Name of the ELB (Classic) to associate with the service. +* `target_group_arn` - (Required for ALB/NLB) ARN of the Load Balancer target group to associate with the service. +* `container_name` - (Required) Name of the container to associate with the load balancer (as it appears in a container definition). +* `container_port` - (Required) Port on the container to associate with the load balancer. -> **Version note:** Multiple `load_balancer` configuration block support was added in Terraform AWS Provider version 2.22.0. This allows configuration of [ECS service support for multiple target groups](https://aws.amazon.com/about-aws/whats-new/2019/07/amazon-ecs-services-now-support-multiple-load-balancer-target-groups/). -## ordered_placement_strategy +### network_configuration + +`network_configuration` support the following: + +* `subnets` - (Required) Subnets associated with the task or service. +* `security_groups` - (Optional) Security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used. +* `assign_public_ip` - (Optional) Assign a public IP address to the ENI (Fargate launch type only). Valid values are `true` or `false`. Default `false`. + +For more information, see [Task Networking](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html) + +### ordered_placement_strategy `ordered_placement_strategy` supports the following: -* `type` - (Required) The type of placement strategy. Must be one of: `binpack`, `random`, or `spread` +* `type` - (Required) Type of placement strategy. Must be one of: `binpack`, `random`, or `spread` * `field` - (Optional) For the `spread` placement strategy, valid values are `instanceId` (or `host`, which has the same effect), or any platform or custom attribute that is applied to a container instance. For the `binpack` type, valid values are `memory` and `cpu`. For the `random` type, this attribute is not @@ -150,50 +172,35 @@ The `deployment_controller` configuration block supports the following: -> **Note:** for `spread`, `host` and `instanceId` will be normalized, by AWS, to be `instanceId`. This means the statefile will show `instanceId` but your config will differ if you use `host`. -## placement_constraints +### placement_constraints `placement_constraints` support the following: -* `type` - (Required) The type of constraint. The only valid values at this time are `memberOf` and `distinctInstance`. -* `expression` - (Optional) Cluster Query Language expression to apply to the constraint. Does not need to be specified -for the `distinctInstance` type. -For more information, see [Cluster Query Language in the Amazon EC2 Container -Service Developer -Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html). - -## network_configuration - -`network_configuration` support the following: - -* `subnets` - (Required) The subnets associated with the task or service. -* `security_groups` - (Optional) The security groups associated with the task or service. If you do not specify a security group, the default security group for the VPC is used. -* `assign_public_ip` - (Optional) Assign a public IP address to the ENI (Fargate launch type only). Valid values are `true` or `false`. Default `false`. - -For more information, see [Task Networking](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-networking.html) +* `type` - (Required) Type of constraint. The only valid values at this time are `memberOf` and `distinctInstance`. +* `expression` - (Optional) Cluster Query Language expression to apply to the constraint. Does not need to be specified for the `distinctInstance` type. For more information, see [Cluster Query Language in the Amazon EC2 Container Service Developer Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query-language.html). -## service_registries +### service_registries `service_registries` support the following: -* `registry_arn` - (Required) The ARN of the Service Registry. The currently supported service registry is Amazon Route 53 Auto Naming Service(`aws_service_discovery_service`). For more information, see [Service](https://docs.aws.amazon.com/Route53/latest/APIReference/API_autonaming_Service.html) -* `port` - (Optional) The port value used if your Service Discovery service specified an SRV record. -* `container_port` - (Optional) The port value, already specified in the task definition, to be used for your service discovery service. -* `container_name` - (Optional) The container name value, already specified in the task definition, to be used for your service discovery service. +* `registry_arn` - (Required) ARN of the Service Registry. The currently supported service registry is Amazon Route 53 Auto Naming Service(`aws_service_discovery_service`). For more information, see [Service](https://docs.aws.amazon.com/Route53/latest/APIReference/API_autonaming_Service.html) +* `port` - (Optional) Port value used if your Service Discovery service specified an SRV record. +* `container_port` - (Optional) Port value, already specified in the task definition, to be used for your service discovery service. +* `container_name` - (Optional) Container name value, already specified in the task definition, to be used for your service discovery service. ## Attributes Reference In addition to all arguments above, the following attributes are exported: -* `id` - The Amazon Resource Name (ARN) that identifies the service -* `name` - The name of the service -* `cluster` - The Amazon Resource Name (ARN) of cluster which the service runs on -* `iam_role` - The ARN of IAM role used for ELB -* `desired_count` - The number of instances of the task definition +* `cluster` - Amazon Resource Name (ARN) of cluster which the service runs on. +* `desired_count` - Number of instances of the task definition. +* `iam_role` - ARN of IAM role used for ELB. +* `id` - ARN that identifies the service. +* `name` - Name of the service. ## Timeouts -`aws_ecs_service` provides the following -[Timeouts](https://www.terraform.io/docs/configuration/blocks/resources/syntax.html#operation-timeouts) configuration options: +`aws_ecs_service` provides the following [Timeouts](https://www.terraform.io/docs/configuration/blocks/resources/syntax.html#operation-timeouts) configuration options: - `delete` - (Default `20 minutes`) diff --git a/website/docs/r/ecs_task_definition.html.markdown b/website/docs/r/ecs_task_definition.html.markdown index 3683054e1c91..7ee5583ca473 100644 --- a/website/docs/r/ecs_task_definition.html.markdown +++ b/website/docs/r/ecs_task_definition.html.markdown @@ -12,10 +12,37 @@ Manages a revision of an ECS task definition to be used in `aws_ecs_service`. ## Example Usage -```hcl +```terraform resource "aws_ecs_task_definition" "service" { - family = "service" - container_definitions = file("task-definitions/service.json") + family = "service" + container_definitions = jsonencode([ + { + name = "first" + image = "service-first" + cpu = 10 + memory = 512 + essential = true + portMappings = [ + { + containerPort = 80 + hostPort = 80 + } + ] + }, + { + name = "second" + image = "service-second" + cpu = 10 + memory = 256 + essential = true + portMappings = [ + { + containerPort = 443 + hostPort = 443 + } + ] + } + ]) volume { name = "service-storage" @@ -29,45 +56,9 @@ resource "aws_ecs_task_definition" "service" { } ``` -The referenced `task-definitions/service.json` file contains a valid JSON document, -which is shown below, and its content is going to be passed directly into the -`container_definitions` attribute as a string. Please note that this example -contains only a small subset of the available parameters. - -```json -[ - { - "name": "first", - "image": "service-first", - "cpu": 10, - "memory": 512, - "essential": true, - "portMappings": [ - { - "containerPort": 80, - "hostPort": 80 - } - ] - }, - { - "name": "second", - "image": "service-second", - "cpu": 10, - "memory": 256, - "essential": true, - "portMappings": [ - { - "containerPort": 443, - "hostPort": 443 - } - ] - } -] -``` - ### With AppMesh Proxy -```hcl +```terraform resource "aws_ecs_task_definition" "service" { family = "service" container_definitions = file("task-definitions/service.json") @@ -135,7 +126,7 @@ For more information, see [Specifying a Docker volume in your Task Definition De ##### Example Usage -```hcl +```terraform resource "aws_ecs_task_definition" "service" { family = "service" container_definitions = file("task-definitions/service.json") @@ -172,7 +163,7 @@ For more information, see [Specifying an EFS volume in your Task Definition Deve ##### Example Usage -```hcl +```terraform resource "aws_ecs_task_definition" "service" { family = "service" container_definitions = file("task-definitions/service.json") @@ -217,7 +208,7 @@ Guide](http://docs.aws.amazon.com/AmazonECS/latest/developerguide/cluster-query- ##### Example Usage -```hcl +```terraform resource "aws_ecs_task_definition" "test" { family = "test" container_definitions = < The below configuration uses [`depends_on`](https://www.terraform.io/docs/configuration/meta-arguments/depends_on.html) to prevent ordering issues with EKS automatically creating the log group first and a variable for naming consistency. Other ordering and naming methodologies may be more appropriate for your environment. -```hcl +```terraform variable "cluster_name" { default = "example" type = string @@ -110,7 +110,7 @@ resource "aws_cloudwatch_log_group" "example" { Only available on Kubernetes version 1.13 and 1.14 clusters created or upgraded on or after September 3, 2019. For more information about this feature, see the [EKS User Guide](https://docs.aws.amazon.com/eks/latest/userguide/enable-iam-roles-for-service-accounts.html). -```hcl +```terraform resource "aws_eks_cluster" "example" { # ... other configuration ... } diff --git a/website/docs/r/eks_fargate_profile.html.markdown b/website/docs/r/eks_fargate_profile.html.markdown index 6294a0693067..1d46729e3cbb 100644 --- a/website/docs/r/eks_fargate_profile.html.markdown +++ b/website/docs/r/eks_fargate_profile.html.markdown @@ -12,7 +12,7 @@ Manages an EKS Fargate Profile. ## Example Usage -```hcl +```terraform resource "aws_eks_fargate_profile" "example" { cluster_name = aws_eks_cluster.example.name fargate_profile_name = "example" @@ -27,7 +27,7 @@ resource "aws_eks_fargate_profile" "example" { ### Example IAM Role for EKS Fargate Profile -```hcl +```terraform resource "aws_iam_role" "example" { name = "eks-fargate-profile-example" diff --git a/website/docs/r/eks_node_group.html.markdown b/website/docs/r/eks_node_group.html.markdown index e22a29131bd0..8a937fff17b2 100644 --- a/website/docs/r/eks_node_group.html.markdown +++ b/website/docs/r/eks_node_group.html.markdown @@ -12,7 +12,7 @@ Manages an EKS Node Group, which can provision and optionally update an Auto Sca ## Example Usage -```hcl +```terraform resource "aws_eks_node_group" "example" { cluster_name = aws_eks_cluster.example.name node_group_name = "example" @@ -39,7 +39,7 @@ resource "aws_eks_node_group" "example" { You can utilize the generic Terraform resource [lifecycle configuration block](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html) with `ignore_changes` to create an EKS Node Group with an initial size of running instances, then ignore any changes to that count caused externally (e.g. Application Autoscaling). -```hcl +```terraform resource "aws_eks_node_group" "example" { # ... other configurations ... @@ -59,7 +59,7 @@ resource "aws_eks_node_group" "example" { ### Example IAM Role for EKS Node Group -```hcl +```terraform resource "aws_iam_role" "example" { name = "eks-node-group-example" @@ -93,7 +93,7 @@ resource "aws_iam_role_policy_attachment" "example-AmazonEC2ContainerRegistryRea ### Example Subnets for EKS Node Group -```hcl +```terraform data "aws_availability_zones" "available" { state = "available" } diff --git a/website/docs/r/elastic_beanstalk_application.html.markdown b/website/docs/r/elastic_beanstalk_application.html.markdown index 21aafbc78b3d..4e325de0a7fa 100644 --- a/website/docs/r/elastic_beanstalk_application.html.markdown +++ b/website/docs/r/elastic_beanstalk_application.html.markdown @@ -17,7 +17,7 @@ This resource creates an application that has one configuration template named ## Example Usage -```hcl +```terraform resource "aws_elastic_beanstalk_application" "tftest" { name = "tf-test-name" description = "tf-test-desc" diff --git a/website/docs/r/elastic_beanstalk_application_version.html.markdown b/website/docs/r/elastic_beanstalk_application_version.html.markdown index a6be6db3402c..d1e3dc9a3b54 100644 --- a/website/docs/r/elastic_beanstalk_application_version.html.markdown +++ b/website/docs/r/elastic_beanstalk_application_version.html.markdown @@ -22,7 +22,7 @@ To work around this you can either create each environment in a separate AWS acc ## Example Usage -```hcl +```terraform resource "aws_s3_bucket" "default" { bucket = "tftest.applicationversion.bucket" } diff --git a/website/docs/r/elastic_beanstalk_configuration_template.html.markdown b/website/docs/r/elastic_beanstalk_configuration_template.html.markdown index da4482d2fade..e0c5ad36e13b 100644 --- a/website/docs/r/elastic_beanstalk_configuration_template.html.markdown +++ b/website/docs/r/elastic_beanstalk_configuration_template.html.markdown @@ -14,7 +14,7 @@ application with the same configuration settings. ## Example Usage -```hcl +```terraform resource "aws_elastic_beanstalk_application" "tftest" { name = "tf-test-name" description = "tf-test-desc" diff --git a/website/docs/r/elastic_beanstalk_environment.html.markdown b/website/docs/r/elastic_beanstalk_environment.html.markdown index 3e96a5c3cd46..63f19fe9d0d5 100644 --- a/website/docs/r/elastic_beanstalk_environment.html.markdown +++ b/website/docs/r/elastic_beanstalk_environment.html.markdown @@ -17,7 +17,7 @@ Environments are often things such as `development`, `integration`, or ## Example Usage -```hcl +```terraform resource "aws_elastic_beanstalk_application" "tftest" { name = "tf-test-name" description = "tf-test-desc" @@ -79,7 +79,7 @@ The `setting` and `all_settings` mappings support the following format: ### Example With Options -```hcl +```terraform resource "aws_elastic_beanstalk_application" "tftest" { name = "tf-test-name" description = "tf-test-desc" diff --git a/website/docs/r/elasticache_cluster.html.markdown b/website/docs/r/elasticache_cluster.html.markdown index 8b0dcaaee2df..21b57b5ee104 100644 --- a/website/docs/r/elasticache_cluster.html.markdown +++ b/website/docs/r/elasticache_cluster.html.markdown @@ -32,7 +32,7 @@ for more information. ### Memcached Cluster -```hcl +```terraform resource "aws_elasticache_cluster" "example" { cluster_id = "cluster-example" engine = "memcached" @@ -45,7 +45,7 @@ resource "aws_elasticache_cluster" "example" { ### Redis Instance -```hcl +```terraform resource "aws_elasticache_cluster" "example" { cluster_id = "cluster-example" engine = "redis" @@ -61,7 +61,7 @@ resource "aws_elasticache_cluster" "example" { These inherit their settings from the replication group. -```hcl +```terraform resource "aws_elasticache_cluster" "replica" { cluster_id = "cluster-example" replication_group_id = aws_elasticache_replication_group.example.id diff --git a/website/docs/r/elasticache_global_replication_group.html.markdown b/website/docs/r/elasticache_global_replication_group.html.markdown index 39faedad4aaf..8a8962b94415 100644 --- a/website/docs/r/elasticache_global_replication_group.html.markdown +++ b/website/docs/r/elasticache_global_replication_group.html.markdown @@ -16,7 +16,7 @@ Provides an ElastiCache Global Replication Group resource, which manages replica The global replication group depends on the primary group existing. Secondary replication groups depend on the global replication group. Terraform dependency management will handle this transparently using resource value references. -```hcl +```terraform resource "aws_elasticache_global_replication_group" "example" { global_replication_group_id_suffix = "example" primary_replication_group_id = aws_elasticache_replication_group.primary.id diff --git a/website/docs/r/elasticache_parameter_group.html.markdown b/website/docs/r/elasticache_parameter_group.html.markdown index f72e1db235dc..d3a2effb7f29 100644 --- a/website/docs/r/elasticache_parameter_group.html.markdown +++ b/website/docs/r/elasticache_parameter_group.html.markdown @@ -14,7 +14,7 @@ Provides an ElastiCache parameter group resource. ## Example Usage -```hcl +```terraform resource "aws_elasticache_parameter_group" "default" { name = "cache-params" family = "redis2.8" diff --git a/website/docs/r/elasticache_replication_group.html.markdown b/website/docs/r/elasticache_replication_group.html.markdown index 334557e5b3d7..a441a29b8a5c 100644 --- a/website/docs/r/elasticache_replication_group.html.markdown +++ b/website/docs/r/elasticache_replication_group.html.markdown @@ -35,7 +35,7 @@ for more information. To create a single shard primary with single read replica: -```hcl +```terraform resource "aws_elasticache_replication_group" "example" { automatic_failover_enabled = true availability_zones = ["us-west-2a", "us-west-2b"] @@ -53,7 +53,7 @@ You have two options for adjusting the number of replicas: * Adjusting `number_cache_clusters` directly. This will attempt to automatically add or remove replicas, but provides no granular control (e.g. preferred availability zone, cache cluster ID) for the added or removed replicas. This also currently expects cache cluster IDs in the form of `replication_group_id-00#`. * Otherwise for fine grained control of the underlying cache clusters, they can be added or removed with the [`aws_elasticache_cluster` resource](/docs/providers/aws/r/elasticache_cluster.html) and its `replication_group_id` attribute. In this situation, you will need to utilize the [lifecycle configuration block](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html) with `ignore_changes` to prevent perpetual differences during Terraform plan with the `number_cache_cluster` attribute. -```hcl +```terraform resource "aws_elasticache_replication_group" "example" { automatic_failover_enabled = true availability_zones = ["us-west-2a", "us-west-2b"] @@ -81,7 +81,7 @@ resource "aws_elasticache_cluster" "replica" { To create two shards with a primary and a single read replica each: -```hcl +```terraform resource "aws_elasticache_replication_group" "baz" { replication_group_id = "tf-redis-cluster" replication_group_description = "test description" @@ -107,7 +107,7 @@ for full details on using Replication Groups. A Global Replication Group can have one one two secondary Replication Groups in different regions. These are added to an existing Global Replication Group. -```hcl +```terraform resource "aws_elasticache_replication_group" "secondary" { replication_group_id = "example-secondary" replication_group_description = "secondary replication group" @@ -143,10 +143,10 @@ The following arguments are supported: * `replication_group_id` – (Required) The replication group identifier. This parameter is stored as a lowercase string. * `replication_group_description` – (Required) A user-created description for the replication group. -* ``global_replication_group_id` - (Optional) The ID of the global replication group to which this replication group should belong. If this parameter is specified, the replication group is added to the specified global replication group as a secondary replication group; otherwise, the replication group is not part of any global replication group. +* `global_replication_group_id` - (Optional) The ID of the global replication group to which this replication group should belong. If this parameter is specified, the replication group is added to the specified global replication group as a secondary replication group; otherwise, the replication group is not part of any global replication group. * `number_cache_clusters` - (Optional) The number of cache clusters (primary and replicas) this replication group will have. If Multi-AZ is enabled, the value of this parameter must be at least 2. Updates will occur before other modifications. One of `number_cache_clusters` or `cluster_mode` is required. * `node_type` - (Optional) The instance class to be used. See AWS documentation for information on [supported node types](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/CacheNodes.SupportedTypes.html) and [guidance on selecting node types](https://docs.aws.amazon.com/AmazonElastiCache/latest/red-ug/nodes-select-size.html). Required unless `global_replication_group_id` is set. Cannot be set if `global_replication_group_id` is set. -* `automatic_failover_enabled` - (Optional) Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails. If true, Multi-AZ is enabled for this replication group. If false, Multi-AZ is disabled for this replication group. Must be enabled for Redis (cluster mode enabled) replication groups. Defaults to `false`. +* `automatic_failover_enabled` - (Optional) Specifies whether a read-only replica will be automatically promoted to read/write primary if the existing primary fails. If enabled, `number_cache_clusters` must be greater than 1. Must be enabled for Redis (cluster mode enabled) replication groups. Defaults to `false`. * `multi_az_enabled` - (Optional) Specifies whether to enable Multi-AZ Support for the replication group. If `true`, `automatic_failover_enabled` must also be enabled. Defaults to `false`. * `auto_minor_version_upgrade` - (Optional) Specifies whether a minor engine upgrades will be applied automatically to the underlying Cache Cluster instances during the maintenance window. This parameter is currently not supported by the AWS API. Defaults to `true`. * `availability_zones` - (Optional) A list of EC2 availability zones in which the replication group's cache clusters will be created. The order of the availability zones in the list is not important. diff --git a/website/docs/r/elasticache_security_group.html.markdown b/website/docs/r/elasticache_security_group.html.markdown index 906d0b80cbf3..f3f208b7c705 100644 --- a/website/docs/r/elasticache_security_group.html.markdown +++ b/website/docs/r/elasticache_security_group.html.markdown @@ -17,7 +17,7 @@ ElastiCache cluster **outside** of a VPC. If you are using a VPC, see the ## Example Usage -```hcl +```terraform resource "aws_security_group" "bar" { name = "security-group" } diff --git a/website/docs/r/elasticache_subnet_group.html.markdown b/website/docs/r/elasticache_subnet_group.html.markdown index 6d405dc0bf3a..4f36a0065a95 100644 --- a/website/docs/r/elasticache_subnet_group.html.markdown +++ b/website/docs/r/elasticache_subnet_group.html.markdown @@ -16,7 +16,7 @@ ElastiCache cluster **inside** of a VPC. If you are on EC2 Classic, see the ## Example Usage -```hcl +```terraform resource "aws_vpc" "foo" { cidr_block = "10.0.0.0/16" diff --git a/website/docs/r/elasticsearch_domain.html.markdown b/website/docs/r/elasticsearch_domain.html.markdown index b8cdc88a62aa..6eac002a8bcf 100644 --- a/website/docs/r/elasticsearch_domain.html.markdown +++ b/website/docs/r/elasticsearch_domain.html.markdown @@ -14,7 +14,7 @@ Manages an AWS Elasticsearch Domain. ### Basic Usage -```hcl +```terraform resource "aws_elasticsearch_domain" "example" { domain_name = "example" elasticsearch_version = "1.5" @@ -37,7 +37,7 @@ resource "aws_elasticsearch_domain" "example" { -> See also: [`aws_elasticsearch_domain_policy` resource](/docs/providers/aws/r/elasticsearch_domain_policy.html) -```hcl +```terraform variable "domain" { default = "tf-test" } @@ -72,7 +72,7 @@ POLICY ### Log Publishing to CloudWatch Logs -```hcl +```terraform resource "aws_cloudwatch_log_group" "example" { name = "example" } @@ -113,7 +113,7 @@ resource "aws_elasticsearch_domain" "example" { ### VPC based ES -```hcl +```terraform variable "vpc" {} variable "domain" { diff --git a/website/docs/r/elasticsearch_domain_policy.html.markdown b/website/docs/r/elasticsearch_domain_policy.html.markdown index 94872e959d24..5e975c91f406 100644 --- a/website/docs/r/elasticsearch_domain_policy.html.markdown +++ b/website/docs/r/elasticsearch_domain_policy.html.markdown @@ -12,7 +12,7 @@ Allows setting policy to an Elasticsearch domain while referencing domain attrib ## Example Usage -```hcl +```terraform resource "aws_elasticsearch_domain" "example" { domain_name = "tf-test" elasticsearch_version = "2.3" @@ -46,3 +46,7 @@ The following arguments are supported: * `domain_name` - (Required) Name of the domain. * `access_policies` - (Optional) IAM policy document specifying the access policies for the domain + +## Attributes Reference + +No additional attributes are exported. diff --git a/website/docs/r/elastictranscoder_pipeline.html.markdown b/website/docs/r/elastictranscoder_pipeline.html.markdown index ab5238b5a3da..644e80358d09 100644 --- a/website/docs/r/elastictranscoder_pipeline.html.markdown +++ b/website/docs/r/elastictranscoder_pipeline.html.markdown @@ -12,7 +12,7 @@ Provides an Elastic Transcoder pipeline resource. ## Example Usage -```hcl +```terraform resource "aws_elastictranscoder_pipeline" "bar" { input_bucket = aws_s3_bucket.input_bucket.bucket name = "aws_elastictranscoder_pipeline_tf_test_" diff --git a/website/docs/r/elastictranscoder_preset.html.markdown b/website/docs/r/elastictranscoder_preset.html.markdown index d5e3592982ca..3831fb27b59e 100644 --- a/website/docs/r/elastictranscoder_preset.html.markdown +++ b/website/docs/r/elastictranscoder_preset.html.markdown @@ -12,7 +12,7 @@ Provides an Elastic Transcoder preset resource. ## Example Usage -```hcl +```terraform resource "aws_elastictranscoder_preset" "bar" { container = "mp4" description = "Sample Preset" @@ -159,6 +159,12 @@ The `video_codec_options` map supports the following: * `ChromaSubsampling` - The sampling pattern for the chroma (color) channels of the output video. Valid values are `yuv420p` and `yuv422p`. * `LoopCount` - The number of times you want the output gif to loop (Gif only) +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `arn` - Amazon Resource Name (ARN) of the Elastic Transcoder Preset. + ## Import Elastic Transcoder presets can be imported using the `id`, e.g. diff --git a/website/docs/r/elb.html.markdown b/website/docs/r/elb.html.markdown index 1bd7d163ec76..12b5843cd4d2 100644 --- a/website/docs/r/elb.html.markdown +++ b/website/docs/r/elb.html.markdown @@ -21,7 +21,7 @@ conflict and will overwrite attachments. ## Example Usage -```hcl +```terraform # Create a new load balancer resource "aws_elb" "bar" { name = "foobar-terraform-elb" diff --git a/website/docs/r/elb_attachment.html.markdown b/website/docs/r/elb_attachment.html.markdown index 1f3754a62285..4822fb466253 100644 --- a/website/docs/r/elb_attachment.html.markdown +++ b/website/docs/r/elb_attachment.html.markdown @@ -19,7 +19,7 @@ conflict and will overwrite attachments. ## Example Usage -```hcl +```terraform # Create a new load balancer attachment resource "aws_elb_attachment" "baz" { elb = aws_elb.bar.id @@ -33,3 +33,7 @@ The following arguments are supported: * `elb` - (Required) The name of the ELB. * `instance` - (Required) Instance ID to place in the ELB pool. + +## Attributes Reference + +No additional attributes are exported. diff --git a/website/docs/r/emr_cluster.html.markdown b/website/docs/r/emr_cluster.html.markdown index 9f33d1193d9a..65c9ee04bc60 100644 --- a/website/docs/r/emr_cluster.html.markdown +++ b/website/docs/r/emr_cluster.html.markdown @@ -16,7 +16,7 @@ To configure [Instance Groups](https://docs.aws.amazon.com/emr/latest/Management ## Example Usage -```hcl +```terraform resource "aws_emr_cluster" "cluster" { name = "emr-test-arn" release_label = "emr-4.6.0" @@ -148,7 +148,7 @@ example Terraform configuration at the bottom of this page. ## Instance Fleet -```hcl +```terraform resource "aws_emr_cluster" "example" { # ... other configuration ... master_instance_fleet { @@ -245,7 +245,7 @@ is implemented as a step. It is highly recommended to utilize the [lifecycle configuration block](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html) with `ignore_changes` if other steps are being managed outside of Terraform. -```hcl +```terraform resource "aws_emr_cluster" "example" { # ... other configuration ... @@ -270,7 +270,7 @@ resource "aws_emr_cluster" "example" { Available in EMR version 5.23.0 and later, an EMR Cluster can be launched with three master nodes for high availability. Additional information about this functionality and its requirements can be found in the [EMR Management Guide](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-plan-ha.html). -```hcl +```terraform # This configuration is for illustrative purposes and highlights # only relevant configurations for working with this functionality. @@ -340,7 +340,7 @@ The following arguments are supported: ~> **NOTE on configurations_json:** If the `Configurations` value is empty then you should skip the `Configurations` field instead of providing empty list as value `"Configurations": []`. -```hcl +```terraform resource "aws_emr_cluster" "cluster" { # ... other configuration ... @@ -543,7 +543,7 @@ In addition to all arguments above, the following attributes are exported: boot an example EMR Cluster. It is not meant to display best practices. Please use at your own risk. -```hcl +```terraform resource "aws_emr_cluster" "cluster" { name = "emr-test-arn" release_label = "emr-4.6.0" @@ -852,7 +852,7 @@ $ terraform import aws_emr_cluster.cluster j-123456ABCDEF Since the API does not return the actual values for Kerberos configurations, environments with those Terraform configurations will need to use the [`lifecycle` configuration block `ignore_changes` argument](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) available to all Terraform resources to prevent perpetual differences, e.g. -```hcl +```terraform resource "aws_emr_cluster" "example" { # ... other configuration ... diff --git a/website/docs/r/emr_instance_fleet.html.markdown b/website/docs/r/emr_instance_fleet.html.markdown index 8c3837ce9413..8ab5c5a9d59a 100644 --- a/website/docs/r/emr_instance_fleet.html.markdown +++ b/website/docs/r/emr_instance_fleet.html.markdown @@ -6,7 +6,7 @@ description: |- Provides an Elastic MapReduce Cluster Instance Fleet --- -# aws_emr_instance_fleet +# Resource: aws_emr_instance_fleet Provides an Elastic MapReduce Cluster Instance Fleet configuration. See [Amazon Elastic MapReduce Documentation](https://aws.amazon.com/documentation/emr/) for more information. @@ -17,7 +17,7 @@ Terraform will resize any Instance Fleet to zero when destroying the resource. ## Example Usage -```hcl +```terraform resource "aws_emr_instance_fleet" "task" { cluster_id = aws_emr_cluster.cluster.id instance_type_configs { diff --git a/website/docs/r/emr_instance_group.html.markdown b/website/docs/r/emr_instance_group.html.markdown index 00fea7fe5288..63942124b48f 100644 --- a/website/docs/r/emr_instance_group.html.markdown +++ b/website/docs/r/emr_instance_group.html.markdown @@ -17,7 +17,7 @@ Terraform will resize any Instance Group to zero when destroying the resource. ## Example Usage -```hcl +```terraform resource "aws_emr_instance_group" "task" { cluster_id = aws_emr_cluster.tf-test-cluster.id instance_count = 1 @@ -40,7 +40,7 @@ The following arguments are supported: * `autoscaling_policy` - (Optional) The autoscaling policy document. This is a JSON formatted string. See [EMR Auto Scaling](https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-automatic-scaling.html) * `configurations_json` - (Optional) A JSON string for supplying list of configurations specific to the EMR instance group. Note that this can only be changed when using EMR release 5.21 or later. -```hcl +```terraform resource "aws_emr_instance_group" "task" { # ... other configuration ... diff --git a/website/docs/r/emr_managed_scaling_policy.html.markdown b/website/docs/r/emr_managed_scaling_policy.html.markdown index 1a850997792b..76318897b998 100644 --- a/website/docs/r/emr_managed_scaling_policy.html.markdown +++ b/website/docs/r/emr_managed_scaling_policy.html.markdown @@ -12,7 +12,7 @@ Provides a Managed Scaling policy for EMR Cluster. With Amazon EMR versions 5.30 ## Example Usage -```hcl +```terraform resource "aws_emr_cluster" "sample" { name = "emr-sample-cluster" release_label = "emr-5.30.0" @@ -54,6 +54,10 @@ The following arguments are supported: * `maximum_ondemand_capacity_units` - (Optional) The upper boundary of On-Demand EC2 units. It is measured through VCPU cores or instances for instance groups and measured through units for instance fleets. The On-Demand units are not allowed to scale beyond this boundary. The parameter is used to split capacity allocation between On-Demand and Spot instances. * `maximum_core_capacity_units` - (Optional) The upper boundary of EC2 units for core node type in a cluster. It is measured through VCPU cores or instances for instance groups and measured through units for instance fleets. The core units are not allowed to scale beyond this boundary. The parameter is used to split capacity allocation between core and task nodes. +## Attributes Reference + +No additional attributes are exported. + ## Import EMR Managed Scaling Policies can be imported via the EMR Cluster identifier, e.g. diff --git a/website/docs/r/emr_security_configuration.html.markdown b/website/docs/r/emr_security_configuration.html.markdown index 07796e7d57de..e5707e057123 100644 --- a/website/docs/r/emr_security_configuration.html.markdown +++ b/website/docs/r/emr_security_configuration.html.markdown @@ -12,7 +12,7 @@ Provides a resource to manage AWS EMR Security Configurations ## Example Usage -```hcl +```terraform resource "aws_emr_security_configuration" "foo" { name = "emrsc_other" diff --git a/website/docs/r/flow_log.html.markdown b/website/docs/r/flow_log.html.markdown index d57ad90c52f9..66cd90381ef6 100644 --- a/website/docs/r/flow_log.html.markdown +++ b/website/docs/r/flow_log.html.markdown @@ -15,7 +15,7 @@ interface, subnet, or VPC. Logs are sent to a CloudWatch Log Group or a S3 Bucke ### CloudWatch Logging -```hcl +```terraform resource "aws_flow_log" "example" { iam_role_arn = aws_iam_role.example.arn log_destination = aws_cloudwatch_log_group.example.arn @@ -74,7 +74,7 @@ EOF ### S3 Logging -```hcl +```terraform resource "aws_flow_log" "example" { log_destination = aws_s3_bucket.example.arn log_destination_type = "s3" diff --git a/website/docs/r/fms_admin_account.html.markdown b/website/docs/r/fms_admin_account.html.markdown index 3635ce2b10e0..4644aa33da42 100644 --- a/website/docs/r/fms_admin_account.html.markdown +++ b/website/docs/r/fms_admin_account.html.markdown @@ -12,7 +12,7 @@ Provides a resource to associate/disassociate an AWS Firewall Manager administra ## Example Usage -```hcl +```terraform resource "aws_fms_admin_account" "example" {} ``` diff --git a/website/docs/r/fms_policy.html.markdown b/website/docs/r/fms_policy.html.markdown index 1edea10b9c81..d2a6d162fa36 100644 --- a/website/docs/r/fms_policy.html.markdown +++ b/website/docs/r/fms_policy.html.markdown @@ -12,7 +12,7 @@ Provides a resource to create an AWS Firewall Manager policy. You need to be usi ## Example Usage -```hcl +```terraform resource "aws_fms_policy" "example" { name = "FMS-Policy-Example" exclude_resource_tags = false @@ -72,7 +72,7 @@ The following arguments are supported: * `managed_service_data` (Optional) Details about the service that are specific to the service type, in JSON format. For service type `SHIELD_ADVANCED`, this is an empty string. Examples depending on `type` can be found in the [AWS Firewall Manager SecurityServicePolicyData API Reference](https://docs.aws.amazon.com/fms/2018-01-01/APIReference/API_SecurityServicePolicyData.html). * `type` - (Required, Forces new resource) The service that the policy is using to protect the resources. Valid values are `WAFV2`, `WAF`, `SHIELD_ADVANCED`, `SECURITY_GROUPS_COMMON`, `SECURITY_GROUPS_CONTENT_AUDIT`, and `SECURITY_GROUPS_USAGE_AUDIT`. -## Attribute Reference +## Attributes Reference In addition to all arguments above, the following attributes are exported: diff --git a/website/docs/r/fsx_lustre_file_system.html.markdown b/website/docs/r/fsx_lustre_file_system.html.markdown index 2e1ed2bca23e..13184b01580f 100644 --- a/website/docs/r/fsx_lustre_file_system.html.markdown +++ b/website/docs/r/fsx_lustre_file_system.html.markdown @@ -12,7 +12,7 @@ Manages a FSx Lustre File System. See the [FSx Lustre Guide](https://docs.aws.am ## Example Usage -```hcl +```terraform resource "aws_fsx_lustre_file_system" "example" { import_path = "s3://${aws_s3_bucket.example.bucket}" storage_capacity = 1200 @@ -72,7 +72,7 @@ $ terraform import aws_fsx_lustre_file_system.example fs-543ab12b1ca672f33 Certain resource arguments, like `security_group_ids`, do not have a FSx API method for reading the information after creation. If the argument is set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use [`ignore_changes`](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to hide the difference, e.g. -```hcl +```terraform resource "aws_fsx_lustre_file_system" "example" { # ... other configuration ... security_group_ids = [aws_security_group.example.id] diff --git a/website/docs/r/fsx_windows_file_system.html.markdown b/website/docs/r/fsx_windows_file_system.html.markdown index 9a9ccce83cc4..9a6c3ad95e63 100644 --- a/website/docs/r/fsx_windows_file_system.html.markdown +++ b/website/docs/r/fsx_windows_file_system.html.markdown @@ -18,7 +18,7 @@ Manages a FSx Windows File System. See the [FSx Windows Guide](https://docs.aws. Additional information for using AWS Directory Service with Windows File Systems can be found in the [FSx Windows Guide](https://docs.aws.amazon.com/fsx/latest/WindowsGuide/fsx-aws-managed-ad.html). -```hcl +```terraform resource "aws_fsx_windows_file_system" "example" { active_directory_id = aws_directory_service_directory.example.id kms_key_id = aws_kms_key.example.arn @@ -32,7 +32,7 @@ resource "aws_fsx_windows_file_system" "example" { Additional information for using AWS Directory Service with Windows File Systems can be found in the [FSx Windows Guide](https://docs.aws.amazon.com/fsx/latest/WindowsGuide/self-managed-AD.html). -```hcl +```terraform resource "aws_fsx_windows_file_system" "example" { kms_key_id = aws_kms_key.example.arn storage_capacity = 300 @@ -112,7 +112,7 @@ $ terraform import aws_fsx_windows_file_system.example fs-543ab12b1ca672f33 Certain resource arguments, like `security_group_ids` and the `self_managed_active_directory` configuation block `password`, do not have a FSx API method for reading the information after creation. If these arguments are set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use [`ignore_changes`](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to hide the difference, e.g. -```hcl +```terraform resource "aws_fsx_windows_file_system" "example" { # ... other configuration ... diff --git a/website/docs/r/gamelift_alias.html.markdown b/website/docs/r/gamelift_alias.html.markdown index f5caecc050a7..e54779145cad 100644 --- a/website/docs/r/gamelift_alias.html.markdown +++ b/website/docs/r/gamelift_alias.html.markdown @@ -12,7 +12,7 @@ Provides a Gamelift Alias resource. ## Example Usage -```hcl +```terraform resource "aws_gamelift_alias" "example" { name = "example-alias" description = "Example Description" diff --git a/website/docs/r/gamelift_build.html.markdown b/website/docs/r/gamelift_build.html.markdown index bf0c05be7d65..2c704c016652 100644 --- a/website/docs/r/gamelift_build.html.markdown +++ b/website/docs/r/gamelift_build.html.markdown @@ -12,7 +12,7 @@ Provides an Gamelift Build resource. ## Example Usage -```hcl +```terraform resource "aws_gamelift_build" "test" { name = "example-build" operating_system = "WINDOWS_2012" diff --git a/website/docs/r/gamelift_fleet.html.markdown b/website/docs/r/gamelift_fleet.html.markdown index d8b85441a160..22ac6cc34e6b 100644 --- a/website/docs/r/gamelift_fleet.html.markdown +++ b/website/docs/r/gamelift_fleet.html.markdown @@ -12,7 +12,7 @@ Provides a Gamelift Fleet resource. ## Example Usage -```hcl +```terraform resource "aws_gamelift_fleet" "example" { build_id = aws_gamelift_build.example.id ec2_instance_type = "t2.micro" diff --git a/website/docs/r/gamelift_game_session_queue.html.markdown b/website/docs/r/gamelift_game_session_queue.html.markdown index 5a66afe5368b..f2baaae43443 100644 --- a/website/docs/r/gamelift_game_session_queue.html.markdown +++ b/website/docs/r/gamelift_game_session_queue.html.markdown @@ -12,7 +12,7 @@ Provides an Gamelift Game Session Queue resource. ## Example Usage -```hcl +```terraform resource "aws_gamelift_game_session_queue" "test" { name = "example-session-queue" diff --git a/website/docs/r/glacier_vault.html.markdown b/website/docs/r/glacier_vault.html.markdown index 0c8cf19d966e..909819669553 100644 --- a/website/docs/r/glacier_vault.html.markdown +++ b/website/docs/r/glacier_vault.html.markdown @@ -14,7 +14,7 @@ Provides a Glacier Vault Resource. You can refer to the [Glacier Developer Guide ## Example Usage -```hcl +```terraform resource "aws_sns_topic" "aws_sns_topic" { name = "glacier-sns-topic" } diff --git a/website/docs/r/glacier_vault_lock.html.markdown b/website/docs/r/glacier_vault_lock.html.markdown index 929d32370aea..240cd1a4ffa6 100644 --- a/website/docs/r/glacier_vault_lock.html.markdown +++ b/website/docs/r/glacier_vault_lock.html.markdown @@ -18,7 +18,7 @@ Manages a Glacier Vault Lock. You can refer to the [Glacier Developer Guide](htt ### Testing Glacier Vault Lock Policy -```hcl +```terraform resource "aws_glacier_vault" "example" { name = "example" } @@ -46,7 +46,7 @@ resource "aws_glacier_vault_lock" "example" { ### Permanently Applying Glacier Vault Lock Policy -```hcl +```terraform resource "aws_glacier_vault_lock" "example" { complete_lock = true policy = data.aws_iam_policy_document.example.json diff --git a/website/docs/r/globalaccelerator_accelerator.markdown b/website/docs/r/globalaccelerator_accelerator.markdown index 3e5b4a851136..664978eff953 100644 --- a/website/docs/r/globalaccelerator_accelerator.markdown +++ b/website/docs/r/globalaccelerator_accelerator.markdown @@ -12,7 +12,7 @@ Creates a Global Accelerator accelerator. ## Example Usage -```hcl +```terraform resource "aws_globalaccelerator_accelerator" "example" { name = "Example" ip_address_type = "IPV4" diff --git a/website/docs/r/globalaccelerator_endpoint_group.html.markdown b/website/docs/r/globalaccelerator_endpoint_group.html.markdown index d4bbc011aa86..18de65748c72 100644 --- a/website/docs/r/globalaccelerator_endpoint_group.html.markdown +++ b/website/docs/r/globalaccelerator_endpoint_group.html.markdown @@ -12,7 +12,7 @@ Provides a Global Accelerator endpoint group. ## Example Usage -```hcl +```terraform resource "aws_globalaccelerator_endpoint_group" "example" { listener_arn = aws_globalaccelerator_listener.example.id @@ -58,6 +58,8 @@ In addition to all arguments above, the following attributes are exported: * `id` - The Amazon Resource Name (ARN) of the endpoint group. * `arn` - The Amazon Resource Name (ARN) of the endpoint group. +## Timeouts + `aws_globalaccelerator_endpoint_group` provides the following [Timeouts](https://www.terraform.io/docs/configuration/blocks/resources/syntax.html#operation-timeouts) configuration options: diff --git a/website/docs/r/globalaccelerator_listener.markdown b/website/docs/r/globalaccelerator_listener.markdown index 24b3580c9860..e225364b3675 100644 --- a/website/docs/r/globalaccelerator_listener.markdown +++ b/website/docs/r/globalaccelerator_listener.markdown @@ -12,7 +12,7 @@ Provides a Global Accelerator listener. ## Example Usage -```hcl +```terraform resource "aws_globalaccelerator_accelerator" "example" { name = "Example" ip_address_type = "IPV4" @@ -57,6 +57,8 @@ In addition to all arguments above, the following attributes are exported: * `id` - The Amazon Resource Name (ARN) of the listener. +## Timeouts + `aws_globalaccelerator_listener` provides the following [Timeouts](https://www.terraform.io/docs/configuration/blocks/resources/syntax.html#operation-timeouts) configuration options: diff --git a/website/docs/r/glue_catalog_database.html.markdown b/website/docs/r/glue_catalog_database.html.markdown index 2d967d7587a4..57e6f1a8a8ff 100644 --- a/website/docs/r/glue_catalog_database.html.markdown +++ b/website/docs/r/glue_catalog_database.html.markdown @@ -12,7 +12,7 @@ Provides a Glue Catalog Database Resource. You can refer to the [Glue Developer ## Example Usage -```hcl +```terraform resource "aws_glue_catalog_database" "aws_glue_catalog_database" { name = "MyCatalogDatabase" } diff --git a/website/docs/r/glue_catalog_table.html.markdown b/website/docs/r/glue_catalog_table.html.markdown index 42f0e11c846b..59c9ea5fc510 100644 --- a/website/docs/r/glue_catalog_table.html.markdown +++ b/website/docs/r/glue_catalog_table.html.markdown @@ -14,7 +14,7 @@ Provides a Glue Catalog Table Resource. You can refer to the [Glue Developer Gui ### Basic Table -```hcl +```terraform resource "aws_glue_catalog_table" "aws_glue_catalog_table" { name = "MyCatalogTable" database_name = "MyCatalogDatabase" @@ -23,7 +23,7 @@ resource "aws_glue_catalog_table" "aws_glue_catalog_table" { ### Parquet Table for Athena -```hcl +```terraform resource "aws_glue_catalog_table" "aws_glue_catalog_table" { name = "MyCatalogTable" database_name = "MyCatalogDatabase" diff --git a/website/docs/r/glue_classifier.html.markdown b/website/docs/r/glue_classifier.html.markdown index 783ffce26f91..79356c80f846 100644 --- a/website/docs/r/glue_classifier.html.markdown +++ b/website/docs/r/glue_classifier.html.markdown @@ -16,7 +16,7 @@ Provides a Glue Classifier resource. ### Csv Classifier -```hcl +```terraform resource "aws_glue_classifier" "example" { name = "example" @@ -33,7 +33,7 @@ resource "aws_glue_classifier" "example" { ### Grok Classifier -```hcl +```terraform resource "aws_glue_classifier" "example" { name = "example" @@ -46,7 +46,7 @@ resource "aws_glue_classifier" "example" { ### JSON Classifier -```hcl +```terraform resource "aws_glue_classifier" "example" { name = "example" @@ -58,7 +58,7 @@ resource "aws_glue_classifier" "example" { ### XML Classifier -```hcl +```terraform resource "aws_glue_classifier" "example" { name = "example" diff --git a/website/docs/r/glue_connection.html.markdown b/website/docs/r/glue_connection.html.markdown index 27f7dcb61010..51544bb7b7e1 100644 --- a/website/docs/r/glue_connection.html.markdown +++ b/website/docs/r/glue_connection.html.markdown @@ -14,7 +14,7 @@ Provides a Glue Connection resource. ### Non-VPC Connection -```hcl +```terraform resource "aws_glue_connection" "example" { connection_properties = { JDBC_CONNECTION_URL = "jdbc:mysql://example.com/exampledatabase" @@ -30,7 +30,7 @@ resource "aws_glue_connection" "example" { For more information, see the [AWS Documentation](https://docs.aws.amazon.com/glue/latest/dg/populate-add-connection.html#connection-JDBC-VPC). -```hcl +```terraform resource "aws_glue_connection" "example" { connection_properties = { JDBC_CONNECTION_URL = "jdbc:mysql://${aws_rds_cluster.example.endpoint}/exampledatabase" diff --git a/website/docs/r/glue_crawler.html.markdown b/website/docs/r/glue_crawler.html.markdown index cd6dba5b0fa2..c893c5da349e 100644 --- a/website/docs/r/glue_crawler.html.markdown +++ b/website/docs/r/glue_crawler.html.markdown @@ -14,7 +14,7 @@ Manages a Glue Crawler. More information can be found in the [AWS Glue Developer ### DynamoDB Target Example -```hcl +```terraform resource "aws_glue_crawler" "example" { database_name = aws_glue_catalog_database.example.name name = "example" @@ -28,7 +28,7 @@ resource "aws_glue_crawler" "example" { ### JDBC Target Example -```hcl +```terraform resource "aws_glue_crawler" "example" { database_name = aws_glue_catalog_database.example.name name = "example" @@ -43,7 +43,7 @@ resource "aws_glue_crawler" "example" { ### S3 Target Example -```hcl +```terraform resource "aws_glue_crawler" "example" { database_name = aws_glue_catalog_database.example.name name = "example" @@ -58,7 +58,7 @@ resource "aws_glue_crawler" "example" { ### Catalog Target Example -```hcl +```terraform resource "aws_glue_crawler" "example" { database_name = aws_glue_catalog_database.example.name name = "example" @@ -86,7 +86,7 @@ EOF ### MongoDB Target Example -```hcl +```terraform resource "aws_glue_crawler" "example" { database_name = aws_glue_catalog_database.example.name name = "example" @@ -101,7 +101,7 @@ resource "aws_glue_crawler" "example" { ### Configuration Settings Example -```hcl +```terraform resource "aws_glue_crawler" "events_crawler" { database_name = aws_glue_catalog_database.glue_database.name schedule = "cron(0 1 * * ? *)" diff --git a/website/docs/r/glue_data_catalog_encryption_settings.html.markdown b/website/docs/r/glue_data_catalog_encryption_settings.html.markdown index 61679560f077..c9a751d180b1 100644 --- a/website/docs/r/glue_data_catalog_encryption_settings.html.markdown +++ b/website/docs/r/glue_data_catalog_encryption_settings.html.markdown @@ -12,7 +12,7 @@ Provides a Glue Data Catalog Encryption Settings resource. ## Example Usage -```hcl +```terraform resource "aws_glue_data_catalog_encryption_settings" "example" { data_catalog_encryption_settings { connection_password_encryption { diff --git a/website/docs/r/glue_dev_endpoint.markdown b/website/docs/r/glue_dev_endpoint.markdown index 9ae314e235c6..dc3ab6ddd1c4 100644 --- a/website/docs/r/glue_dev_endpoint.markdown +++ b/website/docs/r/glue_dev_endpoint.markdown @@ -6,7 +6,7 @@ description: |- Provides a Glue Development Endpoint resource. --- -# aws_glue_dev_endpoint +# Resource: aws_glue_dev_endpoint Provides a Glue Development Endpoint resource. @@ -14,7 +14,7 @@ Provides a Glue Development Endpoint resource. Basic usage: -```hcl +```terraform resource "aws_glue_dev_endpoint" "example" { name = "foo" role_arn = aws_iam_role.example.arn diff --git a/website/docs/r/glue_job.html.markdown b/website/docs/r/glue_job.html.markdown index 80282051c950..1d4a0ea4c57d 100644 --- a/website/docs/r/glue_job.html.markdown +++ b/website/docs/r/glue_job.html.markdown @@ -16,7 +16,7 @@ Provides a Glue Job resource. ### Python Job -```hcl +```terraform resource "aws_glue_job" "example" { name = "example" role_arn = aws_iam_role.example.arn @@ -29,7 +29,7 @@ resource "aws_glue_job" "example" { ### Scala Job -```hcl +```terraform resource "aws_glue_job" "example" { name = "example" role_arn = aws_iam_role.example.arn @@ -46,7 +46,7 @@ resource "aws_glue_job" "example" { ### Enabling CloudWatch Logs and Metrics -```hcl +```terraform resource "aws_cloudwatch_log_group" "example" { name = "example" retention_in_days = 14 diff --git a/website/docs/r/glue_ml_transform.html.markdown b/website/docs/r/glue_ml_transform.html.markdown index 8ce6de0f13a0..28ce617dc306 100644 --- a/website/docs/r/glue_ml_transform.html.markdown +++ b/website/docs/r/glue_ml_transform.html.markdown @@ -12,7 +12,7 @@ Provides a Glue ML Transform resource. ## Example Usage -```hcl +```terraform resource "aws_glue_ml_transform" "test" { name = "example" role_arn = aws_iam_role.test.arn diff --git a/website/docs/r/glue_partition.html.markdown b/website/docs/r/glue_partition.html.markdown index dbc4631df333..bcfa175da957 100644 --- a/website/docs/r/glue_partition.html.markdown +++ b/website/docs/r/glue_partition.html.markdown @@ -12,7 +12,7 @@ Provides a Glue Partition Resource. ## Example Usage -```hcl +```terraform resource "aws_glue_partition" "example" { database_name = "some-database" table_name = "some-table" diff --git a/website/docs/r/glue_registry.html.markdown b/website/docs/r/glue_registry.html.markdown index 37db026e62b6..cee7a2acc1fc 100644 --- a/website/docs/r/glue_registry.html.markdown +++ b/website/docs/r/glue_registry.html.markdown @@ -12,7 +12,7 @@ Provides a Glue Registry resource. ## Example Usage -```hcl +```terraform resource "aws_glue_registry" "example" { registry_name = "example" } diff --git a/website/docs/r/glue_resource_policy.html.markdown b/website/docs/r/glue_resource_policy.html.markdown index 40da2d552a66..ca5f5c7970ac 100644 --- a/website/docs/r/glue_resource_policy.html.markdown +++ b/website/docs/r/glue_resource_policy.html.markdown @@ -13,7 +13,7 @@ Provides a Glue resource policy. Only one can exist per region. ## Example Usage -```hcl +```terraform data "aws_caller_identity" "current" {} data "aws_partition" "current" {} @@ -44,6 +44,9 @@ The following arguments are supported: * `policy` – (Required) The policy to be applied to the aws glue data catalog. +## Attributes Reference + +No additional attributes are exported. ## Import diff --git a/website/docs/r/glue_schema.html.markdown b/website/docs/r/glue_schema.html.markdown index f2f53fb1ec61..3e2980d1b073 100644 --- a/website/docs/r/glue_schema.html.markdown +++ b/website/docs/r/glue_schema.html.markdown @@ -12,7 +12,7 @@ Provides a Glue Schema resource. ## Example Usage -```hcl +```terraform resource "aws_glue_schema" "example" { schema_name = "example" registry_arn = aws_glue_registry.test.arn diff --git a/website/docs/r/glue_security_configuration.html.markdown b/website/docs/r/glue_security_configuration.html.markdown index 25b900eb7a0c..3b4ad087fd25 100644 --- a/website/docs/r/glue_security_configuration.html.markdown +++ b/website/docs/r/glue_security_configuration.html.markdown @@ -12,7 +12,7 @@ Manages a Glue Security Configuration. ## Example Usage -```hcl +```terraform resource "aws_glue_security_configuration" "example" { name = "example" diff --git a/website/docs/r/glue_trigger.html.markdown b/website/docs/r/glue_trigger.html.markdown index fe690475ca0f..a958546c182f 100644 --- a/website/docs/r/glue_trigger.html.markdown +++ b/website/docs/r/glue_trigger.html.markdown @@ -14,7 +14,7 @@ Manages a Glue Trigger resource. ### Conditional Trigger -```hcl +```terraform resource "aws_glue_trigger" "example" { name = "example" type = "CONDITIONAL" @@ -34,7 +34,7 @@ resource "aws_glue_trigger" "example" { ### On-Demand Trigger -```hcl +```terraform resource "aws_glue_trigger" "example" { name = "example" type = "ON_DEMAND" @@ -47,7 +47,7 @@ resource "aws_glue_trigger" "example" { ### Scheduled Trigger -```hcl +```terraform resource "aws_glue_trigger" "example" { name = "example" schedule = "cron(15 12 * * ? *)" @@ -63,7 +63,7 @@ resource "aws_glue_trigger" "example" { **Note:** Triggers can have both a crawler action and a crawler condition, just no example provided. -```hcl +```terraform resource "aws_glue_trigger" "example" { name = "example" type = "CONDITIONAL" @@ -85,7 +85,7 @@ resource "aws_glue_trigger" "example" { **Note:** Triggers can have both a crawler action and a crawler condition, just no example provided. -```hcl +```terraform resource "aws_glue_trigger" "example" { name = "example" type = "CONDITIONAL" diff --git a/website/docs/r/glue_user_defined_function.html.markdown b/website/docs/r/glue_user_defined_function.html.markdown index 3421a45ded74..8f0eda3addb3 100644 --- a/website/docs/r/glue_user_defined_function.html.markdown +++ b/website/docs/r/glue_user_defined_function.html.markdown @@ -12,7 +12,7 @@ Provides a Glue User Defined Function Resource. ## Example Usage -```hcl +```terraform resource "aws_glue_catalog_database" "example" { name = "my_database" } diff --git a/website/docs/r/glue_workflow.html.markdown b/website/docs/r/glue_workflow.html.markdown index 9be2664fb67e..31f3bad7c101 100644 --- a/website/docs/r/glue_workflow.html.markdown +++ b/website/docs/r/glue_workflow.html.markdown @@ -14,7 +14,7 @@ See the example below for creating a graph with four nodes (two triggers and two ## Example Usage -```hcl +```terraform resource "aws_glue_workflow" "example" { name = "example" } diff --git a/website/docs/r/guardduty_detector.html.markdown b/website/docs/r/guardduty_detector.html.markdown index 1719ebc0fe51..38a7b8953c5f 100644 --- a/website/docs/r/guardduty_detector.html.markdown +++ b/website/docs/r/guardduty_detector.html.markdown @@ -14,7 +14,7 @@ Provides a resource to manage a GuardDuty detector. ## Example Usage -```hcl +```terraform resource "aws_guardduty_detector" "MyDetector" { enable = true } diff --git a/website/docs/r/guardduty_filter.html.markdown b/website/docs/r/guardduty_filter.html.markdown index df58c4f6c87c..0e4f16a4a3f7 100644 --- a/website/docs/r/guardduty_filter.html.markdown +++ b/website/docs/r/guardduty_filter.html.markdown @@ -12,7 +12,7 @@ Provides a resource to manage a GuardDuty filter. ## Example Usage -```hcl +```terraform resource "aws_guardduty_filter" "MyFilter" { name = "MyFilter" action = "ARCHIVE" diff --git a/website/docs/r/guardduty_invite_accepter.html.markdown b/website/docs/r/guardduty_invite_accepter.html.markdown index 4314fdc5eff8..6edcae469e63 100644 --- a/website/docs/r/guardduty_invite_accepter.html.markdown +++ b/website/docs/r/guardduty_invite_accepter.html.markdown @@ -12,7 +12,7 @@ Provides a resource to accept a pending GuardDuty invite on creation, ensure the ## Example Usage -```hcl +```terraform provider "aws" { alias = "primary" } diff --git a/website/docs/r/guardduty_ipset.html.markdown b/website/docs/r/guardduty_ipset.html.markdown index 5a780152cd24..41871694f82d 100644 --- a/website/docs/r/guardduty_ipset.html.markdown +++ b/website/docs/r/guardduty_ipset.html.markdown @@ -13,7 +13,7 @@ Provides a resource to manage a GuardDuty IPSet. ## Example Usage -```hcl +```terraform resource "aws_guardduty_ipset" "example" { activate = true detector_id = aws_guardduty_detector.primary.id diff --git a/website/docs/r/guardduty_member.html.markdown b/website/docs/r/guardduty_member.html.markdown index 7b692071b36a..15c80445d337 100644 --- a/website/docs/r/guardduty_member.html.markdown +++ b/website/docs/r/guardduty_member.html.markdown @@ -12,7 +12,7 @@ Provides a resource to manage a GuardDuty member. To accept invitations in membe ## Example Usage -```hcl +```terraform resource "aws_guardduty_detector" "primary" { enable = true } diff --git a/website/docs/r/guardduty_organization_admin_account.html.markdown b/website/docs/r/guardduty_organization_admin_account.html.markdown index 0868654fd0f6..100cd30312e0 100644 --- a/website/docs/r/guardduty_organization_admin_account.html.markdown +++ b/website/docs/r/guardduty_organization_admin_account.html.markdown @@ -12,7 +12,7 @@ Manages a GuardDuty Organization Admin Account. The AWS account utilizing this r ## Example Usage -```hcl +```terraform resource "aws_organizations_organization" "example" { aws_service_access_principals = ["guardduty.amazonaws.com"] feature_set = "ALL" diff --git a/website/docs/r/guardduty_organization_configuration.html.markdown b/website/docs/r/guardduty_organization_configuration.html.markdown index 25e4b4232996..b972f04cddb3 100644 --- a/website/docs/r/guardduty_organization_configuration.html.markdown +++ b/website/docs/r/guardduty_organization_configuration.html.markdown @@ -14,7 +14,7 @@ Manages the GuardDuty Organization Configuration in the current AWS Region. The ## Example Usage -```hcl +```terraform resource "aws_guardduty_detector" "example" { enable = true } diff --git a/website/docs/r/guardduty_publishing_destination.html.markdown b/website/docs/r/guardduty_publishing_destination.html.markdown index 24ba172f752c..a6f3a7984e6b 100644 --- a/website/docs/r/guardduty_publishing_destination.html.markdown +++ b/website/docs/r/guardduty_publishing_destination.html.markdown @@ -11,7 +11,7 @@ Provides a resource to manage a GuardDuty PublishingDestination. Requires an exi ## Example Usage -```hcl +```terraform data "aws_caller_identity" "current" {} data "aws_region" "current" {} diff --git a/website/docs/r/guardduty_threatintelset.html.markdown b/website/docs/r/guardduty_threatintelset.html.markdown index e9d0a13607b1..4988c08e79f7 100644 --- a/website/docs/r/guardduty_threatintelset.html.markdown +++ b/website/docs/r/guardduty_threatintelset.html.markdown @@ -13,7 +13,7 @@ Provides a resource to manage a GuardDuty ThreatIntelSet. ## Example Usage -```hcl +```terraform resource "aws_guardduty_detector" "primary" { enable = true } diff --git a/website/docs/r/iam_access_key.html.markdown b/website/docs/r/iam_access_key.html.markdown index 32f83bf5009c..221d074640fe 100644 --- a/website/docs/r/iam_access_key.html.markdown +++ b/website/docs/r/iam_access_key.html.markdown @@ -12,7 +12,7 @@ Provides an IAM access key. This is a set of credentials that allow API requests ## Example Usage -```hcl +```terraform resource "aws_iam_access_key" "lb" { user = aws_iam_user.lb.name pgp_key = "keybase:some_person_that_exists" @@ -48,7 +48,7 @@ output "secret" { } ``` -```hcl +```terraform resource "aws_iam_user" "test" { name = "test" path = "/test/" diff --git a/website/docs/r/iam_account_alias.html.markdown b/website/docs/r/iam_account_alias.html.markdown index 4bf6c0c5f187..d6f3228cb77a 100644 --- a/website/docs/r/iam_account_alias.html.markdown +++ b/website/docs/r/iam_account_alias.html.markdown @@ -14,7 +14,7 @@ Manages the account alias for the AWS Account. ## Example Usage -```hcl +```terraform resource "aws_iam_account_alias" "alias" { account_alias = "my-account-alias" } @@ -26,6 +26,10 @@ The following arguments are supported: * `account_alias` - (Required) The account alias +## Attributes Reference + +No additional attributes are exported. + ## Import The current Account Alias can be imported using the `account_alias`, e.g. diff --git a/website/docs/r/iam_account_password_policy.html.markdown b/website/docs/r/iam_account_password_policy.html.markdown index c3de2f31adc8..9278474d9c01 100644 --- a/website/docs/r/iam_account_password_policy.html.markdown +++ b/website/docs/r/iam_account_password_policy.html.markdown @@ -16,7 +16,7 @@ in the official AWS docs. ## Example Usage -```hcl +```terraform resource "aws_iam_account_password_policy" "strict" { minimum_password_length = 8 require_lowercase_characters = true diff --git a/website/docs/r/iam_group.html.markdown b/website/docs/r/iam_group.html.markdown index d6e723d091a9..c6699756d76f 100644 --- a/website/docs/r/iam_group.html.markdown +++ b/website/docs/r/iam_group.html.markdown @@ -12,7 +12,7 @@ Provides an IAM group. ## Example Usage -```hcl +```terraform resource "aws_iam_group" "developers" { name = "developers" path = "/users/" diff --git a/website/docs/r/iam_group_membership.html.markdown b/website/docs/r/iam_group_membership.html.markdown index b57769b417fd..03c6f99c7433 100644 --- a/website/docs/r/iam_group_membership.html.markdown +++ b/website/docs/r/iam_group_membership.html.markdown @@ -19,7 +19,7 @@ more information on managing IAM Groups or IAM Users, see [IAM Groups][1] or ## Example Usage -```hcl +```terraform resource "aws_iam_group_membership" "team" { name = "tf-testing-group-membership" diff --git a/website/docs/r/iam_group_policy.html.markdown b/website/docs/r/iam_group_policy.html.markdown index b5bd77a1c168..ff94f229c982 100644 --- a/website/docs/r/iam_group_policy.html.markdown +++ b/website/docs/r/iam_group_policy.html.markdown @@ -12,7 +12,7 @@ Provides an IAM policy attached to a group. ## Example Usage -```hcl +```terraform resource "aws_iam_group_policy" "my_developer_policy" { name = "my_developer_policy" group = aws_iam_group.my_developers.name diff --git a/website/docs/r/iam_group_policy_attachment.markdown b/website/docs/r/iam_group_policy_attachment.markdown index 2a3284a0b399..5cc0ff1a263e 100644 --- a/website/docs/r/iam_group_policy_attachment.markdown +++ b/website/docs/r/iam_group_policy_attachment.markdown @@ -14,7 +14,7 @@ Attaches a Managed IAM Policy to an IAM group ## Example Usage -```hcl +```terraform resource "aws_iam_group" "group" { name = "test-group" } @@ -38,6 +38,10 @@ The following arguments are supported: * `group` (Required) - The group the policy should be applied to * `policy_arn` (Required) - The ARN of the policy you want to apply +## Attributes Reference + +No additional attributes are exported. + ## Import IAM group policy attachments can be imported using the group name and policy arn separated by `/`. diff --git a/website/docs/r/iam_instance_profile.html.markdown b/website/docs/r/iam_instance_profile.html.markdown index 5a97590858b1..064d859600f0 100644 --- a/website/docs/r/iam_instance_profile.html.markdown +++ b/website/docs/r/iam_instance_profile.html.markdown @@ -12,7 +12,7 @@ Provides an IAM instance profile. ## Example Usage -```hcl +```terraform resource "aws_iam_instance_profile" "test_profile" { name = "test_profile" role = aws_iam_role.role.name @@ -48,10 +48,11 @@ The following arguments are optional: * `name_prefix` - (Optional, Forces new resource) Creates a unique name beginning with the specified prefix. Conflicts with `name`. * `path` - (Optional, default "/") Path to the instance profile. For more information about paths, see [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) in the IAM User Guide. Can be a string of characters consisting of either a forward slash (`/`) by itself or a string that must begin and end with forward slashes. Can include any ASCII character from the ! (\u0021) through the DEL character (\u007F), including most punctuation characters, digits, and upper and lowercase letters. * `role` - (Optional) Name of the role to add to the profile. +* `tags` - (Optional) Map of resource tags for the IAM Instance Profile. ## Attributes Reference -In addition to the arguments above, the following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `arn` - ARN assigned by AWS to the instance profile. * `create_date` - Creation timestamp of the instance profile. diff --git a/website/docs/r/iam_openid_connect_provider.html.markdown b/website/docs/r/iam_openid_connect_provider.html.markdown index 1e7989ca21cc..720dd94a7931 100644 --- a/website/docs/r/iam_openid_connect_provider.html.markdown +++ b/website/docs/r/iam_openid_connect_provider.html.markdown @@ -12,7 +12,7 @@ Provides an IAM OpenID Connect provider. ## Example Usage -```hcl +```terraform resource "aws_iam_openid_connect_provider" "default" { url = "https://accounts.google.com" @@ -31,6 +31,7 @@ The following arguments are supported: * `url` - (Required) The URL of the identity provider. Corresponds to the _iss_ claim. * `client_id_list` - (Required) A list of client IDs (also known as audiences). When a mobile or web app registers with an OpenID Connect provider, they establish a value that identifies the application. (This is the value that's sent as the client_id parameter on OAuth requests.) * `thumbprint_list` - (Required) A list of server certificate thumbprints for the OpenID Connect (OIDC) identity provider's server certificate(s). +* `tags` - (Optional) Map of resource tags for the IAM OIDC provider. ## Attributes Reference diff --git a/website/docs/r/iam_policy.html.markdown b/website/docs/r/iam_policy.html.markdown index 0c55fc6ae502..c541ed680bfb 100644 --- a/website/docs/r/iam_policy.html.markdown +++ b/website/docs/r/iam_policy.html.markdown @@ -12,7 +12,7 @@ Provides an IAM policy. ## Example Usage -```hcl +```terraform resource "aws_iam_policy" "policy" { name = "test_policy" path = "/" @@ -45,17 +45,19 @@ The following arguments are supported: * `path` - (Optional, default "/") Path in which to create the policy. See [IAM Identifiers](https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html) for more information. * `policy` - (Required) The policy document. This is a JSON formatted string. For more information about building AWS IAM policy documents with Terraform, see the [AWS IAM Policy Document Guide](https://learn.hashicorp.com/terraform/aws/iam-policy) +* `tags` - (Optional) Map of resource tags for the IAM Policy ## Attributes Reference In addition to all arguments above, the following attributes are exported: -* `id` - The policy's ID. +* `id` - The ARN assigned by AWS to this policy. * `arn` - The ARN assigned by AWS to this policy. * `description` - The description of the policy. * `name` - The name of the policy. * `path` - The path of the policy in IAM. * `policy` - The policy document. +* `policy_id` - The policy's ID. ## Import diff --git a/website/docs/r/iam_policy_attachment.html.markdown b/website/docs/r/iam_policy_attachment.html.markdown index 0a0b588ea098..71a0f02e56b5 100644 --- a/website/docs/r/iam_policy_attachment.html.markdown +++ b/website/docs/r/iam_policy_attachment.html.markdown @@ -18,7 +18,7 @@ Attaches a Managed IAM Policy to user(s), role(s), and/or group(s) ## Example Usage -```hcl +```terraform resource "aws_iam_user" "user" { name = "test-user" } diff --git a/website/docs/r/iam_role.html.markdown b/website/docs/r/iam_role.html.markdown index 9ac2eea8719a..98342b3e2d44 100644 --- a/website/docs/r/iam_role.html.markdown +++ b/website/docs/r/iam_role.html.markdown @@ -18,7 +18,7 @@ Provides an IAM role. ### Basic Example -```hcl +```terraform resource "aws_iam_role" "test_role" { name = "test_role" @@ -46,7 +46,7 @@ resource "aws_iam_role" "test_role" { ### Example of Using Data Source for Assume Role Policy -```hcl +```terraform data "aws_iam_policy_document" "instance-assume-role-policy" { statement { actions = ["sts:AssumeRole"] @@ -69,7 +69,7 @@ resource "aws_iam_role" "instance" { This example creates an IAM role with two inline IAM policies. If someone adds another inline policy out-of-band, on the next apply, Terraform will remove that policy. If someone deletes these policies out-of-band, Terraform will recreate them. -```hcl +```terraform resource "aws_iam_role" "example" { name = "yak_role" assume_role_policy = data.aws_iam_policy_document.instance_assume_role_policy.json # (not shown) @@ -108,7 +108,7 @@ data "aws_iam_policy_document" "inline_policy" { This example creates an IAM role with what appears to be empty IAM `inline_policy` argument instead of using `inline_policy` as a configuration block. The result is that if someone were to add an inline policy out-of-band, on the next apply, Terraform will remove that policy. -```hcl +```terraform resource "aws_iam_role" "example" { name = "yak_role" assume_role_policy = data.aws_iam_policy_document.instance_assume_role_policy.json # (not shown) @@ -121,7 +121,7 @@ resource "aws_iam_role" "example" { This example creates an IAM role and attaches two managed IAM policies. If someone attaches another managed policy out-of-band, on the next apply, Terraform will detach that policy. If someone detaches these policies out-of-band, Terraform will attach them again. -```hcl +```terraform resource "aws_iam_role" "example" { name = "yak_role" assume_role_policy = data.aws_iam_policy_document.instance_assume_role_policy.json # (not shown) @@ -163,7 +163,7 @@ resource "aws_iam_policy" "policy_two" { This example creates an IAM role with an empty `managed_policy_arns` argument. If someone attaches a policy out-of-band, on the next apply, Terraform will detach that policy. -```hcl +```terraform resource "aws_iam_role" "example" { name = "yak_role" assume_role_policy = data.aws_iam_policy_document.instance_assume_role_policy.json # (not shown) @@ -201,7 +201,7 @@ This configuration block supports the following: ## Attributes Reference -In addition to the arguments above, the following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `arn` - Amazon Resource Name (ARN) specifying the role. * `create_date` - Creation date of the IAM role. diff --git a/website/docs/r/iam_role_policy.html.markdown b/website/docs/r/iam_role_policy.html.markdown index 1bec734bebac..601f35e91ea8 100644 --- a/website/docs/r/iam_role_policy.html.markdown +++ b/website/docs/r/iam_role_policy.html.markdown @@ -14,7 +14,7 @@ Provides an IAM role inline policy. ## Example Usage -```hcl +```terraform resource "aws_iam_role_policy" "test_policy" { name = "test_policy" role = aws_iam_role.test_role.id diff --git a/website/docs/r/iam_role_policy_attachment.markdown b/website/docs/r/iam_role_policy_attachment.markdown index 030909c12634..bdb50b64d37b 100644 --- a/website/docs/r/iam_role_policy_attachment.markdown +++ b/website/docs/r/iam_role_policy_attachment.markdown @@ -16,7 +16,7 @@ Attaches a Managed IAM Policy to an IAM role ## Example Usage -```hcl +```terraform resource "aws_iam_role" "role" { name = "test-role" @@ -70,6 +70,10 @@ The following arguments are supported: * `role` (Required) - The name of the IAM role to which the policy should be applied * `policy_arn` (Required) - The ARN of the policy you want to apply +## Attributes Reference + +No additional attributes are exported. + ## Import IAM role policy attachments can be imported using the role name and policy arn separated by `/`. diff --git a/website/docs/r/iam_saml_provider.html.markdown b/website/docs/r/iam_saml_provider.html.markdown index 373bc0e4ccb5..568f9276ba54 100644 --- a/website/docs/r/iam_saml_provider.html.markdown +++ b/website/docs/r/iam_saml_provider.html.markdown @@ -12,7 +12,7 @@ Provides an IAM SAML provider. ## Example Usage -```hcl +```terraform resource "aws_iam_saml_provider" "default" { name = "myprovider" saml_metadata_document = file("saml-metadata.xml") @@ -25,6 +25,7 @@ The following arguments are supported: * `name` - (Required) The name of the provider to create. * `saml_metadata_document` - (Required) An XML document generated by an identity provider that supports SAML 2.0. +* `tags` - (Optional) Map of resource tags for the IAM SAML provider. ## Attributes Reference diff --git a/website/docs/r/iam_server_certificate.html.markdown b/website/docs/r/iam_server_certificate.html.markdown index e6ed655fcfa9..15d6d9c9474b 100644 --- a/website/docs/r/iam_server_certificate.html.markdown +++ b/website/docs/r/iam_server_certificate.html.markdown @@ -26,7 +26,7 @@ Certificates][2] in AWS Documentation. **Using certs on file:** -```hcl +```terraform resource "aws_iam_server_certificate" "test_cert" { name = "some_test_cert" certificate_body = file("self-ca-cert.pem") @@ -36,7 +36,7 @@ resource "aws_iam_server_certificate" "test_cert" { **Example with cert in-line:** -```hcl +```terraform resource "aws_iam_server_certificate" "test_cert_alt" { name = "alt_test_cert" @@ -63,7 +63,7 @@ recommended you utilize the `name_prefix` attribute and enable the to create a new, updated `aws_iam_server_certificate` resource and replace it in dependant resources before attempting to destroy the old version. -```hcl +```terraform resource "aws_iam_server_certificate" "test_cert" { name_prefix = "example-cert" certificate_body = file("self-ca-cert.pem") @@ -107,6 +107,7 @@ The following arguments are supported: included, it defaults to a slash (/). If this certificate is for use with AWS CloudFront, the path must be in format `/cloudfront/your_path_here`. See [IAM Identifiers][1] for more details on IAM Paths. +* `tags` - (Optional) Map of resource tags for the server certificate. ~> **NOTE:** AWS performs behind-the-scenes modifications to some certificate files if they do not adhere to a specific format. These modifications will result in terraform forever believing that it needs to update the resources since the local and AWS file contents will not match after theses modifications occur. In order to prevent this from happening you must ensure that all your PEM-encoded files use UNIX line-breaks and that `certificate_body` contains only one certificate. All other certificates should go in `certificate_chain`. It is common for some Certificate Authorities to issue certificate files that have DOS line-breaks and that are actually multiple certificates concatenated together in order to form a full certificate chain. @@ -114,9 +115,11 @@ The following arguments are supported: In addition to all arguments above, the following attributes are exported: +* `arn` - The Amazon Resource Name (ARN) specifying the server certificate. +* `expiration` - Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) on which the certificate is set to expire. * `id` - The unique Server Certificate name * `name` - The name of the Server Certificate -* `arn` - The Amazon Resource Name (ARN) specifying the server certificate. +* `upload_date` - Date and time in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) when the server certificate was uploaded. ## Import diff --git a/website/docs/r/iam_service_linked_role.html.markdown b/website/docs/r/iam_service_linked_role.html.markdown index b83ea17a36ce..d1fc8f1f7647 100644 --- a/website/docs/r/iam_service_linked_role.html.markdown +++ b/website/docs/r/iam_service_linked_role.html.markdown @@ -12,7 +12,7 @@ Provides an [IAM service-linked role](https://docs.aws.amazon.com/IAM/latest/Use ## Example Usage -```hcl +```terraform resource "aws_iam_service_linked_role" "elasticbeanstalk" { aws_service_name = "elasticbeanstalk.amazonaws.com" } diff --git a/website/docs/r/iam_user.html.markdown b/website/docs/r/iam_user.html.markdown index a650f17bba07..dbeeb5027ed8 100644 --- a/website/docs/r/iam_user.html.markdown +++ b/website/docs/r/iam_user.html.markdown @@ -14,7 +14,7 @@ Provides an IAM user. ## Example Usage -```hcl +```terraform resource "aws_iam_user" "lb" { name = "loadbalancer" path = "/system/" diff --git a/website/docs/r/iam_user_group_membership.html.markdown b/website/docs/r/iam_user_group_membership.html.markdown index 5c412cc61b02..7c6be0129e86 100644 --- a/website/docs/r/iam_user_group_membership.html.markdown +++ b/website/docs/r/iam_user_group_membership.html.markdown @@ -16,9 +16,9 @@ groups. To exclusively manage the users in a group, see the [`aws_iam_group_membership` resource][3]. -## Example usage +## Example Usage -```hcl +```terraform resource "aws_iam_user_group_membership" "example1" { user = aws_iam_user.user1.name @@ -62,8 +62,7 @@ The following arguments are supported: ## Attributes Reference -* `user` - The name of the IAM User -* `groups` - The list of IAM Groups +No additional attributes are exported. [1]: /docs/providers/aws/r/iam_group.html [2]: /docs/providers/aws/r/iam_user.html diff --git a/website/docs/r/iam_user_login_profile.html.markdown b/website/docs/r/iam_user_login_profile.html.markdown index 9749630b7333..efcbf126728b 100644 --- a/website/docs/r/iam_user_login_profile.html.markdown +++ b/website/docs/r/iam_user_login_profile.html.markdown @@ -14,7 +14,7 @@ Manages an IAM User Login Profile with limited support for password creation dur ## Example Usage -```hcl +```terraform resource "aws_iam_user" "example" { name = "example" path = "/" @@ -60,7 +60,7 @@ $ terraform import aws_iam_user_login_profile.example myusername Since Terraform has no method to read the PGP or password information during import, use the [Terraform resource `lifecycle` configuration block `ignore_changes` argument](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to ignore them unless password recreation is desired. e.g. -```hcl +```terraform resource "aws_iam_user_login_profile" "example" { # ... other configuration ... diff --git a/website/docs/r/iam_user_policy.html.markdown b/website/docs/r/iam_user_policy.html.markdown index e9e3efde3cdf..f0cce0bee5f8 100644 --- a/website/docs/r/iam_user_policy.html.markdown +++ b/website/docs/r/iam_user_policy.html.markdown @@ -12,7 +12,7 @@ Provides an IAM policy attached to a user. ## Example Usage -```hcl +```terraform resource "aws_iam_user_policy" "lb_ro" { name = "test" user = aws_iam_user.lb.name diff --git a/website/docs/r/iam_user_policy_attachment.markdown b/website/docs/r/iam_user_policy_attachment.markdown index 94311090719e..7b01c1734e69 100644 --- a/website/docs/r/iam_user_policy_attachment.markdown +++ b/website/docs/r/iam_user_policy_attachment.markdown @@ -14,7 +14,7 @@ Attaches a Managed IAM Policy to an IAM user ## Example Usage -```hcl +```terraform resource "aws_iam_user" "user" { name = "test-user" } @@ -38,6 +38,10 @@ The following arguments are supported: * `user` (Required) - The user the policy should be applied to * `policy_arn` (Required) - The ARN of the policy you want to apply +## Attributes Reference + +No additional attributes are exported. + ## Import IAM user policy attachments can be imported using the user name and policy arn separated by `/`. diff --git a/website/docs/r/iam_user_ssh_key.html.markdown b/website/docs/r/iam_user_ssh_key.html.markdown index 4bbdaa4debcd..bb408407ea2c 100644 --- a/website/docs/r/iam_user_ssh_key.html.markdown +++ b/website/docs/r/iam_user_ssh_key.html.markdown @@ -12,7 +12,7 @@ Uploads an SSH public key and associates it with the specified IAM user. ## Example Usage -```hcl +```terraform resource "aws_iam_user" "user" { name = "test-user" path = "/" diff --git a/website/docs/r/imagebuilder_component.html.markdown b/website/docs/r/imagebuilder_component.html.markdown index 0f164dc33ab4..6d64d61074e6 100644 --- a/website/docs/r/imagebuilder_component.html.markdown +++ b/website/docs/r/imagebuilder_component.html.markdown @@ -14,7 +14,7 @@ Manages an Image Builder Component. ### Inline Data Document -```hcl +```terraform resource "aws_imagebuilder_component" "example" { data = yamlencode({ phases = [{ @@ -38,7 +38,7 @@ resource "aws_imagebuilder_component" "example" { ### URI Document -```hcl +```terraform resource "aws_imagebuilder_component" "example" { name = "example" platform = "Linux" diff --git a/website/docs/r/imagebuilder_distribution_configuration.html.markdown b/website/docs/r/imagebuilder_distribution_configuration.html.markdown index cef5821aeb7f..b9b91eb45561 100644 --- a/website/docs/r/imagebuilder_distribution_configuration.html.markdown +++ b/website/docs/r/imagebuilder_distribution_configuration.html.markdown @@ -12,7 +12,7 @@ Manages an Image Builder Distribution Configuration. ## Example Usage -```hcl +```terraform resource "aws_imagebuilder_distribution_configuration" "example" { name = "example" diff --git a/website/docs/r/imagebuilder_image.html.markdown b/website/docs/r/imagebuilder_image.html.markdown index ec753e624ca4..3c3ce2f51606 100644 --- a/website/docs/r/imagebuilder_image.html.markdown +++ b/website/docs/r/imagebuilder_image.html.markdown @@ -12,7 +12,7 @@ Manages an Image Builder Image. ## Example Usage -```hcl +```terraform resource "aws_imagebuilder_image" "example" { distribution_configuration_arn = aws_imagebuilder_distribution_configuration.example.arn image_recipe_arn = aws_imagebuilder_image_recipe.example.arn diff --git a/website/docs/r/imagebuilder_image_pipeline.html.markdown b/website/docs/r/imagebuilder_image_pipeline.html.markdown index 40ae24f76afd..28f914c541aa 100644 --- a/website/docs/r/imagebuilder_image_pipeline.html.markdown +++ b/website/docs/r/imagebuilder_image_pipeline.html.markdown @@ -12,7 +12,7 @@ Manages an Image Builder Image Pipeline. ## Example Usage -```hcl +```terraform resource "aws_imagebuilder_image_pipeline" "example" { image_recipe_arn = aws_imagebuilder_image_recipe.example.arn infrastructure_configuration_arn = aws_imagebuilder_infrastructure_configuration.example.arn diff --git a/website/docs/r/imagebuilder_image_recipe.html.markdown b/website/docs/r/imagebuilder_image_recipe.html.markdown index 82f402dec051..7a380d72f400 100644 --- a/website/docs/r/imagebuilder_image_recipe.html.markdown +++ b/website/docs/r/imagebuilder_image_recipe.html.markdown @@ -12,7 +12,7 @@ Manages an Image Builder Image Recipe. ## Example Usage -```hcl +```terraform resource "aws_imagebuilder_image_recipe" "example" { block_device_mapping { device_name = "/dev/xvdb" diff --git a/website/docs/r/imagebuilder_infrastructure_configuration.html.markdown b/website/docs/r/imagebuilder_infrastructure_configuration.html.markdown index b83cdf3979e9..7929936ddff1 100644 --- a/website/docs/r/imagebuilder_infrastructure_configuration.html.markdown +++ b/website/docs/r/imagebuilder_infrastructure_configuration.html.markdown @@ -12,7 +12,7 @@ Manages an Image Builder Infrastructure Configuration. ## Example Usage -```hcl +```terraform resource "aws_imagebuilder_infrastructure_configuration" "example" { description = "example description" instance_profile_name = aws_iam_instance_profile.example.name diff --git a/website/docs/r/inspector_assessment_target.html.markdown b/website/docs/r/inspector_assessment_target.html.markdown index 599836b6c13c..10072cb2735e 100644 --- a/website/docs/r/inspector_assessment_target.html.markdown +++ b/website/docs/r/inspector_assessment_target.html.markdown @@ -12,7 +12,7 @@ Provides a Inspector assessment target ## Example Usage -```hcl +```terraform resource "aws_inspector_resource_group" "bar" { tags = { Name = "foo" diff --git a/website/docs/r/inspector_assessment_template.html.markdown b/website/docs/r/inspector_assessment_template.html.markdown index eb904b6254dc..84e94dc39f35 100644 --- a/website/docs/r/inspector_assessment_template.html.markdown +++ b/website/docs/r/inspector_assessment_template.html.markdown @@ -12,7 +12,7 @@ Provides a Inspector assessment template ## Example Usage -```hcl +```terraform resource "aws_inspector_assessment_template" "example" { name = "example" target_arn = aws_inspector_assessment_target.example.arn diff --git a/website/docs/r/inspector_resource_group.html.markdown b/website/docs/r/inspector_resource_group.html.markdown index 0497e2239df1..a1169fcbc2ee 100644 --- a/website/docs/r/inspector_resource_group.html.markdown +++ b/website/docs/r/inspector_resource_group.html.markdown @@ -12,7 +12,7 @@ Provides an Amazon Inspector resource group resource. ## Example Usage -```hcl +```terraform resource "aws_inspector_resource_group" "example" { tags = { Name = "foo" diff --git a/website/docs/r/instance.html.markdown b/website/docs/r/instance.html.markdown index 0a3d37c92d62..debd8e97b5cd 100644 --- a/website/docs/r/instance.html.markdown +++ b/website/docs/r/instance.html.markdown @@ -14,7 +14,7 @@ Provides an EC2 instance resource. This allows instances to be created, updated, ### Basic Example Using AMI Lookup -```hcl +```terraform data "aws_ami" "ubuntu" { most_recent = true @@ -43,7 +43,7 @@ resource "aws_instance" "web" { ### Network and Credit Specification Example -```hcl +```terraform resource "aws_vpc" "my_vpc" { cidr_block = "172.16.0.0/16" @@ -121,18 +121,18 @@ The following arguments are supported: * `root_block_device` - (Optional) Configuration block to customize details about the root block device of the instance. See [Block Devices](#ebs-ephemeral-and-root-block-devices) below for details. When accessing this as an attribute reference, it is a list containing one object. * `secondary_private_ips` - (Optional) A list of secondary private IPv4 addresses to assign to the instance's primary network interface (eth0) in a VPC. Can only be assigned to the primary network interface (eth0) attached at instance creation, not a pre-existing network interface i.e. referenced in a `network_interface` block. Refer to the [Elastic network interfaces documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-eni.html#AvailableIpPerENI) to see the maximum number of private IP addresses allowed per instance type. * `security_groups` - (Optional, EC2-Classic and default VPC only) A list of security group names (EC2-Classic) or IDs (default VPC) to associate with. + +-> **NOTE:** If you are creating Instances in a VPC, use `vpc_security_group_ids` instead. + * `source_dest_check` - (Optional) Controls if traffic is routed to the instance when the destination address does not match the instance. Used for NAT or VPNs. Defaults true. * `subnet_id` - (Optional) VPC Subnet ID to launch in. * `tags` - (Optional) A map of tags to assign to the resource. Note that these tags apply to the instance and not block storage devices. * `tenancy` - (Optional) Tenancy of the instance (if the instance is running in a VPC). An instance with a tenancy of dedicated runs on single-tenant hardware. The host tenancy is not supported for the import-instance command. * `user_data` - (Optional) User data to provide when launching the instance. Do not pass gzip-compressed data via this argument; see `user_data_base64` instead. * `user_data_base64` - (Optional) Can be used instead of `user_data` to pass base64-encoded binary data directly. Use this instead of `user_data` whenever the value is not a valid UTF-8 string. For example, gzip-encoded user data must be base64-encoded and passed via this argument to avoid corruption. - -~> **NOTE:** Do not use `volume_tags` if you plan to manage block device tags outside the `aws_instance` configuration, such as using `tags` in an [`aws_ebs_volume`](/docs/providers/aws/r/ebs_volume.html) resource attached via [`aws_volume_attachment`](/docs/providers/aws/r/volume_attachment.html). Doing so will result in resource cycling and inconsistent behavior. - * `volume_tags` - (Optional) A map of tags to assign, at instance-creation time, to root and EBS volumes. --> **NOTE:** If you are creating Instances in a VPC, use `vpc_security_group_ids` instead. +~> **NOTE:** Do not use `volume_tags` if you plan to manage block device tags outside the `aws_instance` configuration, such as using `tags` in an [`aws_ebs_volume`](/docs/providers/aws/r/ebs_volume.html) resource attached via [`aws_volume_attachment`](/docs/providers/aws/r/volume_attachment.html). Doing so will result in resource cycling and inconsistent behavior. * `vpc_security_group_ids` - (Optional, VPC only) A list of security group IDs to associate with. diff --git a/website/docs/r/internet_gateway.html.markdown b/website/docs/r/internet_gateway.html.markdown index 37cf931a6b76..aa8babb9e2b4 100644 --- a/website/docs/r/internet_gateway.html.markdown +++ b/website/docs/r/internet_gateway.html.markdown @@ -12,7 +12,7 @@ Provides a resource to create a VPC Internet Gateway. ## Example Usage -```hcl +```terraform resource "aws_internet_gateway" "gw" { vpc_id = aws_vpc.main.id @@ -31,7 +31,7 @@ The following arguments are supported: -> **Note:** It's recommended to denote that the AWS Instance or Elastic IP depends on the Internet Gateway. For example: -```hcl +```terraform resource "aws_internet_gateway" "gw" { vpc_id = aws_vpc.main.id } diff --git a/website/docs/r/iot_certificate.html.markdown b/website/docs/r/iot_certificate.html.markdown index 9b0c98b4308a..347a88f53801 100644 --- a/website/docs/r/iot_certificate.html.markdown +++ b/website/docs/r/iot_certificate.html.markdown @@ -14,7 +14,7 @@ Creates and manages an AWS IoT certificate. ### With CSR -```hcl +```terraform resource "aws_iot_certificate" "cert" { csr = file("/my/csr.pem") active = true @@ -23,7 +23,7 @@ resource "aws_iot_certificate" "cert" { ### Without CSR -```hcl +```terraform resource "aws_iot_certificate" "cert" { active = true } diff --git a/website/docs/r/iot_policy.html.markdown b/website/docs/r/iot_policy.html.markdown index 3ed14ddb5fef..204d30dd8197 100644 --- a/website/docs/r/iot_policy.html.markdown +++ b/website/docs/r/iot_policy.html.markdown @@ -12,7 +12,7 @@ Provides an IoT policy. ## Example Usage -```hcl +```terraform resource "aws_iot_policy" "pubsub" { name = "PubSubToAnyTopic" diff --git a/website/docs/r/iot_policy_attachment.html.markdown b/website/docs/r/iot_policy_attachment.html.markdown index f176e918fe18..2525aad65f7f 100644 --- a/website/docs/r/iot_policy_attachment.html.markdown +++ b/website/docs/r/iot_policy_attachment.html.markdown @@ -12,7 +12,7 @@ Provides an IoT policy attachment. ## Example Usage -```hcl +```terraform resource "aws_iot_policy" "pubsub" { name = "PubSubToAnyTopic" @@ -49,3 +49,7 @@ The following arguments are supported: * `policy` - (Required) The name of the policy to attach. * `target` - (Required) The identity to which the policy is attached. + +## Attributes Reference + +No additional attributes are exported. diff --git a/website/docs/r/iot_role_alias.html.markdown b/website/docs/r/iot_role_alias.html.markdown index 8b2a9f2ea725..bfa76d53ea8b 100644 --- a/website/docs/r/iot_role_alias.html.markdown +++ b/website/docs/r/iot_role_alias.html.markdown @@ -12,7 +12,7 @@ Provides an IoT role alias. ## Example Usage -```hcl +```terraform resource "aws_iam_role" "role" { name = "dynamodb-access-role" diff --git a/website/docs/r/iot_thing.html.markdown b/website/docs/r/iot_thing.html.markdown index 29e6263910a5..e31555e6d281 100644 --- a/website/docs/r/iot_thing.html.markdown +++ b/website/docs/r/iot_thing.html.markdown @@ -12,7 +12,7 @@ Creates and manages an AWS IoT Thing. ## Example Usage -```hcl +```terraform resource "aws_iot_thing" "example" { name = "example" diff --git a/website/docs/r/iot_thing_principal_attachment.html.markdown b/website/docs/r/iot_thing_principal_attachment.html.markdown index c3a592f19852..1007f25e7334 100644 --- a/website/docs/r/iot_thing_principal_attachment.html.markdown +++ b/website/docs/r/iot_thing_principal_attachment.html.markdown @@ -12,7 +12,7 @@ Attaches Principal to AWS IoT Thing. ## Example Usage -```hcl +```terraform resource "aws_iot_thing" "example" { name = "example" } @@ -32,3 +32,7 @@ resource "aws_iot_thing_principal_attachment" "att" { * `principal` - (Required) The AWS IoT Certificate ARN or Amazon Cognito Identity ID. * `thing` - (Required) The name of the thing. + +## Attributes Reference + +No additional attributes are exported. diff --git a/website/docs/r/iot_thing_type.html.markdown b/website/docs/r/iot_thing_type.html.markdown index 8d7065b0f731..d11aa4cac451 100644 --- a/website/docs/r/iot_thing_type.html.markdown +++ b/website/docs/r/iot_thing_type.html.markdown @@ -12,7 +12,7 @@ Creates and manages an AWS IoT Thing Type. ## Example Usage -```hcl +```terraform resource "aws_iot_thing_type" "foo" { name = "my_iot_thing" } diff --git a/website/docs/r/iot_topic_rule.html.markdown b/website/docs/r/iot_topic_rule.html.markdown index 221d63ecd0db..d17e2e4584ec 100644 --- a/website/docs/r/iot_topic_rule.html.markdown +++ b/website/docs/r/iot_topic_rule.html.markdown @@ -10,7 +10,7 @@ description: |- ## Example Usage -```hcl +```terraform resource "aws_iot_topic_rule" "rule" { name = "MyRule" description = "Example rule" diff --git a/website/docs/r/key_pair.html.markdown b/website/docs/r/key_pair.html.markdown index ba170c3f255a..19d367e62add 100644 --- a/website/docs/r/key_pair.html.markdown +++ b/website/docs/r/key_pair.html.markdown @@ -20,7 +20,7 @@ When importing an existing key pair the public key material may be in any format ## Example Usage -```hcl +```terraform resource "aws_key_pair" "deployer" { key_name = "deployer-key" public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQD3F6tyPEFEzV0LX3X8BsXdMsQz1x2cEikKDEY0aIj41qgxMCP/iteneqXSIFZBp5vizPvaoIR3Um9xK7PGoW8giupGn+EPuxIA4cDM4vzOqOkiMPhz5XK0whEjkVzTo4+S0puvDZuwIsdiW9mxhJc7tgBNL0cYlWSYVkz4G/fslNfRPW5mYAM49f4fhtxPb5ok4Q2Lg9dPKVHO/Bgeu5woMc7RY0p1ej6D4CKFE6lymSDJpW0YHX/wqE9+cfEauh7xZcG0q9t2ta6F6fmX0agvpFyZo8aFbXeUBr7osSCJNgvavWbM/06niWrOvYX2xwWdhXmXSrbX8ZbabVohBK41 email@example.com" diff --git a/website/docs/r/kinesis_analytics_application.html.markdown b/website/docs/r/kinesis_analytics_application.html.markdown index 0ae26ed8bbba..7a1db0dd4d51 100644 --- a/website/docs/r/kinesis_analytics_application.html.markdown +++ b/website/docs/r/kinesis_analytics_application.html.markdown @@ -19,7 +19,7 @@ For more details, see the [Amazon Kinesis Analytics Documentation][1]. ### Kinesis Stream Input -```hcl +```terraform resource "aws_kinesis_stream" "test_stream" { name = "terraform-kinesis-test" shard_count = 1 @@ -63,7 +63,7 @@ resource "aws_kinesis_analytics_application" "test_application" { ### Starting An Application -```hcl +```terraform resource "aws_cloudwatch_log_group" "example" { name = "analytics" } diff --git a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown index 513f605b8be2..9c30063bc2ef 100644 --- a/website/docs/r/kinesis_firehose_delivery_stream.html.markdown +++ b/website/docs/r/kinesis_firehose_delivery_stream.html.markdown @@ -16,7 +16,7 @@ For more details, see the [Amazon Kinesis Firehose Documentation][1]. ### Extended S3 Destination -```hcl +```terraform resource "aws_kinesis_firehose_delivery_stream" "extended_s3_stream" { name = "terraform-kinesis-firehose-extended-s3-test-stream" destination = "extended_s3" @@ -96,7 +96,7 @@ resource "aws_lambda_function" "lambda_processor" { ### S3 Destination -```hcl +```terraform resource "aws_s3_bucket" "bucket" { bucket = "tf-test-bucket" acl = "private" @@ -135,7 +135,7 @@ resource "aws_kinesis_firehose_delivery_stream" "test_stream" { ### Redshift Destination -```hcl +```terraform resource "aws_redshift_cluster" "test_cluster" { cluster_identifier = "tf-redshift-cluster" database_name = "test" @@ -180,7 +180,7 @@ resource "aws_kinesis_firehose_delivery_stream" "test_stream" { ### Elasticsearch Destination -```hcl +```terraform resource "aws_elasticsearch_domain" "test_cluster" { domain_name = "firehose-es-test" } @@ -221,7 +221,7 @@ resource "aws_kinesis_firehose_delivery_stream" "test_stream" { ### Elasticsearch Destination With VPC -```hcl +```terraform resource "aws_elasticsearch_domain" "test_cluster" { domain_name = "es-test" @@ -306,7 +306,7 @@ resource "aws_kinesis_firehose_delivery_stream" "test" { ### Splunk Destination -```hcl +```terraform resource "aws_kinesis_firehose_delivery_stream" "test_stream" { name = "terraform-kinesis-firehose-test-stream" destination = "splunk" @@ -331,7 +331,7 @@ resource "aws_kinesis_firehose_delivery_stream" "test_stream" { ### HTTP Endpoint (e.g. New Relic) Destination -```hcl +```terraform resource "aws_kinesis_firehose_delivery_stream" "test_stream" { name = "terraform-kinesis-firehose-test-stream" destination = "http_endpoint" @@ -522,7 +522,7 @@ The `vpc_config` object supports the following: Example: -```hcl +```terraform resource "aws_kinesis_firehose_delivery_stream" "example" { # ... other configuration ... extended_s3_configuration { diff --git a/website/docs/r/kinesis_stream.html.markdown b/website/docs/r/kinesis_stream.html.markdown index 5492ca9e2719..c5a987c3b0ac 100644 --- a/website/docs/r/kinesis_stream.html.markdown +++ b/website/docs/r/kinesis_stream.html.markdown @@ -15,7 +15,7 @@ For more details, see the [Amazon Kinesis Documentation][1]. ## Example Usage -```hcl +```terraform resource "aws_kinesis_stream" "test_stream" { name = "terraform-kinesis-test" shard_count = 1 diff --git a/website/docs/r/kinesis_stream_consumer.html.markdown b/website/docs/r/kinesis_stream_consumer.html.markdown new file mode 100644 index 000000000000..7eea290a8af3 --- /dev/null +++ b/website/docs/r/kinesis_stream_consumer.html.markdown @@ -0,0 +1,54 @@ +--- +subcategory: "Kinesis" +layout: "aws" +page_title: "AWS: aws_kinesis_stream_consumer" +description: |- + Manages a Kinesis Stream Consumer. +--- + +# Resource: aws_kinesis_stream_consumer + +Provides a resource to manage a Kinesis Stream Consumer. + +-> **Note:** You can register up to 20 consumers per stream. A given consumer can only be registered with one stream at a time. + +For more details, see the [Amazon Kinesis Stream Consumer Documentation][1]. + +## Example Usage + +```terraform +resource "aws_kinesis_stream" "example" { + name = "example-stream" + shard_count = 1 +} + +resource "aws_kinesis_stream_consumer" "example" { + name = "example-consumer" + stream_arn = aws_kinesis_stream.example.arn +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required, Forces new resource) Name of the stream consumer. +* `stream_arn` – (Required, Forces new resource) Amazon Resource Name (ARN) of the data stream the consumer is registered with. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `arn` - Amazon Resource Name (ARN) of the stream consumer. +* `creation_timestamp` - Approximate timestamp in [RFC3339 format](https://tools.ietf.org/html/rfc3339#section-5.8) of when the stream consumer was created. +* `id` - Amazon Resource Name (ARN) of the stream consumer. + +## Import + +Kinesis Stream Consumers can be imported using the Amazon Resource Name (ARN) e.g. + +``` +$ terraform import aws_kinesis_stream_consumer.example arn:aws:kinesis:us-west-2:123456789012:stream/example/consumer/example:1616044553 +``` + +[1]: https://docs.aws.amazon.com/streams/latest/dev/amazon-kinesis-consumers.html \ No newline at end of file diff --git a/website/docs/r/kinesis_video_stream.html.markdown b/website/docs/r/kinesis_video_stream.html.markdown index 9b72933eed17..6b8ab49a474b 100644 --- a/website/docs/r/kinesis_video_stream.html.markdown +++ b/website/docs/r/kinesis_video_stream.html.markdown @@ -14,7 +14,7 @@ For more details, see the [Amazon Kinesis Documentation][1]. ## Example Usage -```hcl +```terraform resource "aws_kinesis_video_stream" "default" { name = "terraform-kinesis-video-stream" data_retention_in_hours = 1 diff --git a/website/docs/r/kinesisanalyticsv2_application.html.markdown b/website/docs/r/kinesisanalyticsv2_application.html.markdown index 475822245174..b1b681b351a5 100644 --- a/website/docs/r/kinesisanalyticsv2_application.html.markdown +++ b/website/docs/r/kinesisanalyticsv2_application.html.markdown @@ -17,7 +17,7 @@ This resource can be used to manage both Kinesis Data Analytics for SQL applicat ### Apache Flink Application -```hcl +```terraform resource "aws_s3_bucket" "example" { bucket = "example-flink-application" } @@ -92,7 +92,7 @@ resource "aws_kinesisanalyticsv2_application" "example" { ### SQL Application -```hcl +```terraform resource "aws_cloudwatch_log_group" "example" { name = "example-sql-application" } @@ -215,7 +215,7 @@ resource "aws_kinesisanalyticsv2_application" "example" { ### VPC Configuration -```hcl +```terraform resource "aws_s3_bucket" "example" { bucket = "example-flink-application" } diff --git a/website/docs/r/kms_alias.html.markdown b/website/docs/r/kms_alias.html.markdown index cacfe076163a..f0b6caa7b8a1 100644 --- a/website/docs/r/kms_alias.html.markdown +++ b/website/docs/r/kms_alias.html.markdown @@ -14,7 +14,7 @@ the [account limits](http://docs.aws.amazon.com/kms/latest/developerguide/limits ## Example Usage -```hcl +```terraform resource "aws_kms_key" "a" {} resource "aws_kms_alias" "a" { diff --git a/website/docs/r/kms_ciphertext.html.markdown b/website/docs/r/kms_ciphertext.html.markdown index cf629172a574..2ca7a0a7a9f3 100644 --- a/website/docs/r/kms_ciphertext.html.markdown +++ b/website/docs/r/kms_ciphertext.html.markdown @@ -18,7 +18,7 @@ the [`aws_kms_ciphertext` data source](/docs/providers/aws/d/kms_ciphertext.html ## Example Usage -```hcl +```terraform resource "aws_kms_key" "oauth_config" { description = "oauth config" is_enabled = true diff --git a/website/docs/r/kms_external_key.html.markdown b/website/docs/r/kms_external_key.html.markdown index 60f09b2fa37c..09a67c12f9ea 100644 --- a/website/docs/r/kms_external_key.html.markdown +++ b/website/docs/r/kms_external_key.html.markdown @@ -14,7 +14,7 @@ Manages a KMS Customer Master Key that uses external key material. To instead ma ## Example Usage -```hcl +```terraform resource "aws_kms_external_key" "example" { description = "KMS EXTERNAL for AMI encryption" } diff --git a/website/docs/r/kms_grant.html.markdown b/website/docs/r/kms_grant.html.markdown index 0bd88804e00e..7ba68559ac42 100644 --- a/website/docs/r/kms_grant.html.markdown +++ b/website/docs/r/kms_grant.html.markdown @@ -12,7 +12,7 @@ Provides a resource-based access control mechanism for a KMS customer master key ## Example Usage -```hcl +```terraform resource "aws_kms_key" "a" {} resource "aws_iam_role" "a" { diff --git a/website/docs/r/kms_key.html.markdown b/website/docs/r/kms_key.html.markdown index cc36982aee74..e8ecb387136f 100644 --- a/website/docs/r/kms_key.html.markdown +++ b/website/docs/r/kms_key.html.markdown @@ -12,7 +12,7 @@ Provides a KMS customer master key. ## Example Usage -```hcl +```terraform resource "aws_kms_key" "a" { description = "KMS key 1" deletion_window_in_days = 10 diff --git a/website/docs/r/lakeformation_data_lake_settings.html.markdown b/website/docs/r/lakeformation_data_lake_settings.html.markdown index 768efe4400d7..6a6b60e3b9e3 100644 --- a/website/docs/r/lakeformation_data_lake_settings.html.markdown +++ b/website/docs/r/lakeformation_data_lake_settings.html.markdown @@ -16,7 +16,7 @@ Manages Lake Formation principals designated as data lake administrators and lis ### Data Lake Admins -```hcl +```terraform resource "aws_lakeformation_data_lake_settings" "example" { admins = [aws_iam_user.test.arn, aws_iam_role.test.arn] } @@ -24,7 +24,7 @@ resource "aws_lakeformation_data_lake_settings" "example" { ### Create Default Permissions -```hcl +```terraform resource "aws_lakeformation_data_lake_settings" "example" { admins = [aws_iam_user.test.arn, aws_iam_role.test.arn] @@ -68,4 +68,4 @@ The following arguments are optional: ## Attributes Reference -In addition to all arguments above, no attributes are exported. +No additional attributes are exported. diff --git a/website/docs/r/lakeformation_permissions.html.markdown b/website/docs/r/lakeformation_permissions.html.markdown index 610761119f53..d6ba68aa1aa5 100644 --- a/website/docs/r/lakeformation_permissions.html.markdown +++ b/website/docs/r/lakeformation_permissions.html.markdown @@ -16,7 +16,7 @@ Grants permissions to the principal to access metadata in the Data Catalog and d ### Grant Permissions For A Lake Formation S3 Resource -```hcl +```terraform resource "aws_lakeformation_permissions" "test" { principal = aws_iam_role.workflow_role.arn permissions = ["ALL"] @@ -29,7 +29,7 @@ resource "aws_lakeformation_permissions" "test" { ### Grant Permissions For A Glue Catalog Database -```hcl +```terraform resource "aws_lakeformation_permissions" "test" { role = aws_iam_role.workflow_role.arn permissions = ["CREATE_TABLE", "ALTER", "DROP"] @@ -114,4 +114,4 @@ The following arguments are optional: ## Attributes Reference -In addition to the above arguments, no attributes are exported. +No additional attributes are exported. diff --git a/website/docs/r/lakeformation_resource.html.markdown b/website/docs/r/lakeformation_resource.html.markdown index 27eb12fc6dcc..a6bb36c22a0f 100644 --- a/website/docs/r/lakeformation_resource.html.markdown +++ b/website/docs/r/lakeformation_resource.html.markdown @@ -14,7 +14,7 @@ Choose a role that has read/write access to the chosen Amazon S3 path or use the ## Example Usage -```hcl +```terraform data "aws_s3_bucket" "example" { bucket = "an-example-bucket" } diff --git a/website/docs/r/lambda_alias.html.markdown b/website/docs/r/lambda_alias.html.markdown index 81da6e39a70e..7a3b4379cf3e 100644 --- a/website/docs/r/lambda_alias.html.markdown +++ b/website/docs/r/lambda_alias.html.markdown @@ -15,7 +15,7 @@ For information about function aliases, see [CreateAlias][2] and [AliasRoutingCo ## Example Usage -```hcl +```terraform resource "aws_lambda_alias" "test_lambda_alias" { name = "my_alias" description = "a sample description" diff --git a/website/docs/r/lambda_code_signing_config.html.markdown b/website/docs/r/lambda_code_signing_config.html.markdown index 1fd8e01073f0..5f45a27116a1 100644 --- a/website/docs/r/lambda_code_signing_config.html.markdown +++ b/website/docs/r/lambda_code_signing_config.html.markdown @@ -14,7 +14,7 @@ For information about Lambda code signing configurations and how to use them, se ## Example Usage -```hcl +```terraform resource "aws_lambda_code_signing_config" "new_csc" { allowed_publishers { signing_profile_version_arns = [ @@ -45,9 +45,10 @@ The `policies` block supports the following argument: * `untrusted_artifact_on_deployment` - (Required) Code signing configuration policy for deployment validation failure. If you set the policy to Enforce, Lambda blocks the deployment request if code-signing validation checks fail. If you set the policy to Warn, Lambda allows the deployment and creates a CloudWatch log. Valid values: `Warn`, `Enforce`. Default value: `Warn`. - ## Attributes Reference +In addition to all arguments above, the following attributes are exported: + * `arn` - The Amazon Resource Name (ARN) of the code signing configuration. * `config_id` - Unique identifier for the code signing configuration. * `last_modified` - The date and time that the code signing configuration was last modified. diff --git a/website/docs/r/lambda_event_source_mapping.html.markdown b/website/docs/r/lambda_event_source_mapping.html.markdown index 3a273ef51324..829b70abf6fd 100644 --- a/website/docs/r/lambda_event_source_mapping.html.markdown +++ b/website/docs/r/lambda_event_source_mapping.html.markdown @@ -17,7 +17,7 @@ For information about event source mappings, see [CreateEventSourceMapping][2] i ### DynamoDB -```hcl +```terraform resource "aws_lambda_event_source_mapping" "example" { event_source_arn = aws_dynamodb_table.example.stream_arn function_name = aws_lambda_function.example.arn @@ -27,7 +27,7 @@ resource "aws_lambda_event_source_mapping" "example" { ### Kinesis -```hcl +```terraform resource "aws_lambda_event_source_mapping" "example" { event_source_arn = aws_kinesis_stream.example.arn function_name = aws_lambda_function.example.arn @@ -37,7 +37,7 @@ resource "aws_lambda_event_source_mapping" "example" { ### Managed Streaming for Kafka (MSK) -```hcl +```terraform resource "aws_lambda_event_source_mapping" "example" { event_source_arn = aws_msk_cluster.example.arn function_name = aws_lambda_function.example.arn @@ -48,7 +48,7 @@ resource "aws_lambda_event_source_mapping" "example" { ### SQS -```hcl +```terraform resource "aws_lambda_event_source_mapping" "example" { event_source_arn = aws_sqs_queue.sqs_queue_test.arn function_name = aws_lambda_function.example.arn diff --git a/website/docs/r/lambda_function.html.markdown b/website/docs/r/lambda_function.html.markdown index 13bd67569b9f..16c79638246c 100644 --- a/website/docs/r/lambda_function.html.markdown +++ b/website/docs/r/lambda_function.html.markdown @@ -22,7 +22,7 @@ For a detailed example of setting up Lambda and API Gateway, see [Serverless App ### Basic Example -```hcl +```terraform resource "aws_iam_role" "iam_for_lambda" { name = "iam_for_lambda" @@ -68,7 +68,7 @@ resource "aws_lambda_function" "test_lambda" { ~> **NOTE:** The `aws_lambda_layer_version` attribute values for `arn` and `layer_arn` were swapped in version 2.0.0 of the Terraform AWS Provider. For version 1.x, use `layer_arn` references. For version 2.x, use `arn` references. -```hcl +```terraform resource "aws_lambda_layer_version" "example" { # ... other configuration ... } @@ -83,7 +83,7 @@ resource "aws_lambda_function" "example" { Lambda File Systems allow you to connect an Amazon Elastic File System (EFS) file system to a Lambda function to share data across function invocations, access existing data including large files, and save function state. -```hcl +```terraform # A lambda function connected to an EFS file system resource "aws_lambda_function" "example" { # ... other configuration ... @@ -145,7 +145,7 @@ resource "aws_efs_access_point" "access_point_for_lambda" { For more information about CloudWatch Logs for Lambda, see the [Lambda User Guide](https://docs.aws.amazon.com/lambda/latest/dg/monitoring-functions-logs.html). -```hcl +```terraform variable "lambda_function_name" { default = "lambda_function_name" } @@ -279,7 +279,7 @@ For network connectivity to AWS resources in a VPC, specify a list of security g ## Attributes Reference -In addition to arguments above, the following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `arn` - Amazon Resource Name (ARN) identifying your Lambda Function. * `invoke_arn` - ARN to be used for invoking Lambda Function from API Gateway - to be used in [`aws_api_gateway_integration`](/docs/providers/aws/r/api_gateway_integration.html)'s `uri`. diff --git a/website/docs/r/lambda_function_event_invoke_config.html.markdown b/website/docs/r/lambda_function_event_invoke_config.html.markdown index 38d368c23c02..749148361b3a 100644 --- a/website/docs/r/lambda_function_event_invoke_config.html.markdown +++ b/website/docs/r/lambda_function_event_invoke_config.html.markdown @@ -16,7 +16,7 @@ Manages an asynchronous invocation configuration for a Lambda Function or Alias. ~> **NOTE:** Ensure the Lambda Function IAM Role has necessary permissions for the destination, such as `sqs:SendMessage` or `sns:Publish`, otherwise the API will return a generic `InvalidParameterValueException: The destination ARN arn:PARTITION:SERVICE:REGION:ACCOUNT:RESOURCE is invalid.` error. -```hcl +```terraform resource "aws_lambda_function_event_invoke_config" "example" { function_name = aws_lambda_alias.example.function_name @@ -34,7 +34,7 @@ resource "aws_lambda_function_event_invoke_config" "example" { ### Error Handling Configuration -```hcl +```terraform resource "aws_lambda_function_event_invoke_config" "example" { function_name = aws_lambda_alias.example.function_name maximum_event_age_in_seconds = 60 @@ -44,7 +44,7 @@ resource "aws_lambda_function_event_invoke_config" "example" { ### Configuration for Alias Name -```hcl +```terraform resource "aws_lambda_function_event_invoke_config" "example" { function_name = aws_lambda_alias.example.function_name qualifier = aws_lambda_alias.example.name @@ -55,7 +55,7 @@ resource "aws_lambda_function_event_invoke_config" "example" { ### Configuration for Function Latest Unpublished Version -```hcl +```terraform resource "aws_lambda_function_event_invoke_config" "example" { function_name = aws_lambda_function.example.function_name qualifier = "$LATEST" @@ -66,7 +66,7 @@ resource "aws_lambda_function_event_invoke_config" "example" { ### Configuration for Function Published Version -```hcl +```terraform resource "aws_lambda_function_event_invoke_config" "example" { function_name = aws_lambda_function.example.function_name qualifier = aws_lambda_function.example.version diff --git a/website/docs/r/lambda_layer_version.html.markdown b/website/docs/r/lambda_layer_version.html.markdown index 93b9df8f3b1b..5737c9327fa2 100644 --- a/website/docs/r/lambda_layer_version.html.markdown +++ b/website/docs/r/lambda_layer_version.html.markdown @@ -14,7 +14,7 @@ For information about Lambda Layers and how to use them, see [AWS Lambda Layers] ## Example Usage -```hcl +```terraform resource "aws_lambda_layer_version" "lambda_layer" { filename = "lambda_layer_payload.zip" layer_name = "lambda_layer_name" diff --git a/website/docs/r/lambda_permission.html.markdown b/website/docs/r/lambda_permission.html.markdown index 7fa3f7741e73..7329d771dc9c 100644 --- a/website/docs/r/lambda_permission.html.markdown +++ b/website/docs/r/lambda_permission.html.markdown @@ -12,7 +12,7 @@ Gives an external source (like a CloudWatch Event Rule, SNS, or S3) permission t ## Example Usage -```hcl +```terraform resource "aws_lambda_permission" "allow_cloudwatch" { statement_id = "AllowExecutionFromCloudWatch" action = "lambda:InvokeFunction" @@ -60,7 +60,7 @@ resource "aws_iam_role" "iam_for_lambda" { ## Usage with SNS -```hcl +```terraform resource "aws_lambda_permission" "with_sns" { statement_id = "AllowExecutionFromSNS" action = "lambda:InvokeFunction" @@ -110,7 +110,7 @@ resource "aws_iam_role" "default" { ## Specify Lambda permissions for API Gateway REST API -```hcl +```terraform resource "aws_api_gateway_rest_api" "MyDemoAPI" { name = "MyDemoAPI" description = "This is my API for demonstration purposes" @@ -130,7 +130,7 @@ resource "aws_lambda_permission" "lambda_permission" { ## Usage with CloudWatch log group -```hcl +```terraform resource "aws_lambda_permission" "logging" { action = "lambda:InvokeFunction" function_name = aws_lambda_function.logging.function_name @@ -198,6 +198,10 @@ EOF [1]: https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-an-aws-lambda-function.html#use-aws-cli [2]: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-control-access-using-iam-policies-to-invoke-api.html +## Attributes Reference + +No additional attributes are exported. + ## Import Lambda permission statements can be imported using function_name/statement_id, with an optional qualifier, e.g. diff --git a/website/docs/r/lambda_provisioned_concurrency_config.html.markdown b/website/docs/r/lambda_provisioned_concurrency_config.html.markdown index 4399028be0e2..4e0300f6d270 100644 --- a/website/docs/r/lambda_provisioned_concurrency_config.html.markdown +++ b/website/docs/r/lambda_provisioned_concurrency_config.html.markdown @@ -14,7 +14,7 @@ Manages a Lambda Provisioned Concurrency Configuration. ### Alias Name -```hcl +```terraform resource "aws_lambda_provisioned_concurrency_config" "example" { function_name = aws_lambda_alias.example.function_name provisioned_concurrent_executions = 1 @@ -24,7 +24,7 @@ resource "aws_lambda_provisioned_concurrency_config" "example" { ### Function Version -```hcl +```terraform resource "aws_lambda_provisioned_concurrency_config" "example" { function_name = aws_lambda_function.example.function_name provisioned_concurrent_executions = 1 diff --git a/website/docs/r/launch_configuration.html.markdown b/website/docs/r/launch_configuration.html.markdown index dd5395a8d431..f99ce052dbaa 100644 --- a/website/docs/r/launch_configuration.html.markdown +++ b/website/docs/r/launch_configuration.html.markdown @@ -12,7 +12,7 @@ Provides a resource to create a new launch configuration, used for autoscaling g ## Example Usage -```hcl +```terraform data "aws_ami" "ubuntu" { most_recent = true @@ -46,7 +46,7 @@ it's recommended to specify `create_before_destroy` in a [lifecycle][2] block. Either omit the Launch Configuration `name` attribute, or specify a partial name with `name_prefix`. Example: -```hcl +```terraform data "aws_ami" "ubuntu" { most_recent = true @@ -98,7 +98,7 @@ reserve your instances at this price. See the [AWS Spot Instance documentation](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html) for more information or how to launch [Spot Instances][3] with Terraform. -```hcl +```terraform data "aws_ami" "ubuntu" { most_recent = true diff --git a/website/docs/r/launch_template.html.markdown b/website/docs/r/launch_template.html.markdown index 32346c46e1f5..9db6c7b34967 100644 --- a/website/docs/r/launch_template.html.markdown +++ b/website/docs/r/launch_template.html.markdown @@ -12,7 +12,7 @@ Provides an EC2 launch template resource. Can be used to create instances or aut ## Example Usage -```hcl +```terraform resource "aws_launch_template" "foo" { name = "foo" diff --git a/website/docs/r/lb.html.markdown b/website/docs/r/lb.html.markdown index 0a0573ff792f..d8580464027c 100644 --- a/website/docs/r/lb.html.markdown +++ b/website/docs/r/lb.html.markdown @@ -16,7 +16,7 @@ Provides a Load Balancer resource. ### Application Load Balancer -```hcl +```terraform resource "aws_lb" "test" { name = "test-lb-tf" internal = false @@ -40,7 +40,7 @@ resource "aws_lb" "test" { ### Network Load Balancer -```hcl +```terraform resource "aws_lb" "test" { name = "test-lb-tf" internal = false @@ -57,7 +57,7 @@ resource "aws_lb" "test" { ### Specifying Elastic IPs -```hcl +```terraform resource "aws_lb" "example" { name = "example" load_balancer_type = "network" @@ -76,7 +76,7 @@ resource "aws_lb" "example" { ### Specifying private IP addresses for an internal-facing load balancer -```hcl +```terraform resource "aws_lb" "example" { name = "example" load_balancer_type = "network" diff --git a/website/docs/r/lb_cookie_stickiness_policy.html.markdown b/website/docs/r/lb_cookie_stickiness_policy.html.markdown index 2ebc3ecf4f5b..0234f7d5e832 100644 --- a/website/docs/r/lb_cookie_stickiness_policy.html.markdown +++ b/website/docs/r/lb_cookie_stickiness_policy.html.markdown @@ -12,7 +12,7 @@ Provides a load balancer cookie stickiness policy, which allows an ELB to contro ## Example Usage -```hcl +```terraform resource "aws_elb" "lb" { name = "test-lb" availability_zones = ["us-east-1a"] diff --git a/website/docs/r/lb_listener.html.markdown b/website/docs/r/lb_listener.html.markdown index e34be1304f06..2f233100f49e 100644 --- a/website/docs/r/lb_listener.html.markdown +++ b/website/docs/r/lb_listener.html.markdown @@ -16,7 +16,7 @@ Provides a Load Balancer Listener resource. ### Forward Action -```hcl +```terraform resource "aws_lb" "front_end" { # ... } @@ -41,7 +41,7 @@ resource "aws_lb_listener" "front_end" { ### Redirect Action -```hcl +```terraform resource "aws_lb" "front_end" { # ... } @@ -65,7 +65,7 @@ resource "aws_lb_listener" "front_end" { ### Fixed-response Action -```hcl +```terraform resource "aws_lb" "front_end" { # ... } @@ -89,7 +89,7 @@ resource "aws_lb_listener" "front_end" { ### Authenticate-cognito Action -```hcl +```terraform resource "aws_lb" "front_end" { # ... } @@ -134,7 +134,7 @@ resource "aws_lb_listener" "front_end" { ### Authenticate-oidc Action -```hcl +```terraform resource "aws_lb" "front_end" { # ... } @@ -170,7 +170,7 @@ resource "aws_lb_listener" "front_end" { ### Gateway Load Balancer Listener -```hcl +```terraform resource "aws_lb" "example" { load_balancer_type = "gateway" name = "example" diff --git a/website/docs/r/lb_listener_certificate.html.markdown b/website/docs/r/lb_listener_certificate.html.markdown index e3c9babf4594..84f16b97ae3f 100644 --- a/website/docs/r/lb_listener_certificate.html.markdown +++ b/website/docs/r/lb_listener_certificate.html.markdown @@ -16,7 +16,7 @@ This resource is for additional certificates and does not replace the default ce ## Example Usage -```hcl +```terraform resource "aws_acm_certificate" "example" { # ... } diff --git a/website/docs/r/lb_listener_rule.html.markdown b/website/docs/r/lb_listener_rule.html.markdown index c43a82d264d7..602ac379627e 100644 --- a/website/docs/r/lb_listener_rule.html.markdown +++ b/website/docs/r/lb_listener_rule.html.markdown @@ -14,7 +14,7 @@ Provides a Load Balancer Listener Rule resource. ## Example Usage -```hcl +```terraform resource "aws_lb" "front_end" { # ... } diff --git a/website/docs/r/lb_ssl_negotiation_policy.html.markdown b/website/docs/r/lb_ssl_negotiation_policy.html.markdown index 57a71859bfbf..c1100d656f4c 100644 --- a/website/docs/r/lb_ssl_negotiation_policy.html.markdown +++ b/website/docs/r/lb_ssl_negotiation_policy.html.markdown @@ -12,7 +12,7 @@ Provides a load balancer SSL negotiation policy, which allows an ELB to control ## Example Usage -```hcl +```terraform resource "aws_elb" "lb" { name = "test-lb" availability_zones = ["us-east-1a"] diff --git a/website/docs/r/lb_target_group.html.markdown b/website/docs/r/lb_target_group.html.markdown index d7ead675b570..027497f92843 100644 --- a/website/docs/r/lb_target_group.html.markdown +++ b/website/docs/r/lb_target_group.html.markdown @@ -16,7 +16,7 @@ Provides a Target Group resource for use with Load Balancer resources. ### Instance Target Group -```hcl +```terraform resource "aws_lb_target_group" "test" { name = "tf-example-lb-tg" port = 80 @@ -31,7 +31,7 @@ resource "aws_vpc" "main" { ### IP Target Group -```hcl +```terraform resource "aws_lb_target_group" "ip-example" { name = "tf-example-lb-tg" port = 80 @@ -47,7 +47,7 @@ resource "aws_vpc" "main" { ### Lambda Target Group -```hcl +```terraform resource "aws_lb_target_group" "lambda-example" { name = "tf-example-lb-tg" target_type = "lambda" diff --git a/website/docs/r/lb_target_group_attachment.html.markdown b/website/docs/r/lb_target_group_attachment.html.markdown index f47c65904969..1af3a61c71f5 100644 --- a/website/docs/r/lb_target_group_attachment.html.markdown +++ b/website/docs/r/lb_target_group_attachment.html.markdown @@ -15,7 +15,7 @@ Provides the ability to register instances and containers with an Application Lo ## Example Usage -```hcl +```terraform resource "aws_lb_target_group_attachment" "test" { target_group_arn = aws_lb_target_group.test.arn target_id = aws_instance.test.id @@ -33,7 +33,7 @@ resource "aws_instance" "test" { ## Usage with lambda -```hcl +```terraform resource "aws_lambda_permission" "with_lb" { statement_id = "AllowExecutionFromlb" action = "lambda:InvokeFunction" diff --git a/website/docs/r/lex_bot.html.markdown b/website/docs/r/lex_bot.html.markdown index a3e0cb99499b..ec65a4d2ac1d 100644 --- a/website/docs/r/lex_bot.html.markdown +++ b/website/docs/r/lex_bot.html.markdown @@ -13,7 +13,7 @@ Provides an Amazon Lex Bot resource. For more information see ## Example Usage -```hcl +```terraform resource "aws_lex_bot" "order_flowers_bot" { abort_statement { message { diff --git a/website/docs/r/lex_bot_alias.html.markdown b/website/docs/r/lex_bot_alias.html.markdown index 9a4cc1052f73..7e809cad91f9 100644 --- a/website/docs/r/lex_bot_alias.html.markdown +++ b/website/docs/r/lex_bot_alias.html.markdown @@ -13,7 +13,7 @@ Provides an Amazon Lex Bot Alias resource. For more information see ## Example Usage -```hcl +```terraform resource "aws_lex_bot_alias" "order_flowers_prod" { bot_name = "OrderFlowers" bot_version = "1" diff --git a/website/docs/r/lex_intent.html.markdown b/website/docs/r/lex_intent.html.markdown index eb233e43c921..07732ca168cf 100644 --- a/website/docs/r/lex_intent.html.markdown +++ b/website/docs/r/lex_intent.html.markdown @@ -13,7 +13,7 @@ Provides an Amazon Lex Intent resource. For more information see ## Example Usage -```hcl +```terraform resource "aws_lex_intent" "order_flowers_intent" { confirmation_prompt { max_attempts = 2 diff --git a/website/docs/r/lex_slot_type.html.markdown b/website/docs/r/lex_slot_type.html.markdown index 877c2a904e9e..8f7e2d0b14ea 100644 --- a/website/docs/r/lex_slot_type.html.markdown +++ b/website/docs/r/lex_slot_type.html.markdown @@ -13,7 +13,7 @@ Provides an Amazon Lex Slot Type resource. For more information see ## Example Usage -```hcl +```terraform resource "aws_lex_slot_type" "flower_types" { create_version = true description = "Types of flowers to order" diff --git a/website/docs/r/licensemanager_association.markdown b/website/docs/r/licensemanager_association.markdown index 720df0a343e9..bceb4cdf5a35 100644 --- a/website/docs/r/licensemanager_association.markdown +++ b/website/docs/r/licensemanager_association.markdown @@ -14,7 +14,7 @@ Provides a License Manager association. ## Example Usage -```hcl +```terraform data "aws_ami" "example" { most_recent = true owners = ["amazon"] diff --git a/website/docs/r/licensemanager_license_configuration.markdown b/website/docs/r/licensemanager_license_configuration.markdown index e7b3162bffe7..14a73ac4a812 100644 --- a/website/docs/r/licensemanager_license_configuration.markdown +++ b/website/docs/r/licensemanager_license_configuration.markdown @@ -14,7 +14,7 @@ Provides a License Manager license configuration resource. ## Example Usage -```hcl +```terraform resource "aws_licensemanager_license_configuration" "example" { name = "Example" description = "Example" diff --git a/website/docs/r/lightsail_domain.html.markdown b/website/docs/r/lightsail_domain.html.markdown index 027c3168c003..12753d6d68d6 100644 --- a/website/docs/r/lightsail_domain.html.markdown +++ b/website/docs/r/lightsail_domain.html.markdown @@ -16,9 +16,9 @@ this parameter to manage the DNS records for that domain. ~> **Note:** Lightsail is currently only supported in a limited number of AWS Regions, please see ["Regions and Availability Zones in Amazon Lightsail"](https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail) for more details -## Example Usage, creating a new domain +## Example Usage -```hcl +```terraform resource "aws_lightsail_domain" "domain_test" { domain_name = "mydomain.com" } diff --git a/website/docs/r/lightsail_instance.html.markdown b/website/docs/r/lightsail_instance.html.markdown index 7c15aafe52de..8367f33e75b0 100644 --- a/website/docs/r/lightsail_instance.html.markdown +++ b/website/docs/r/lightsail_instance.html.markdown @@ -16,7 +16,7 @@ for more information. ## Example Usage -```hcl +```terraform # Create a new GitLab Lightsail Instance resource "aws_lightsail_instance" "gitlab_test" { name = "custom_gitlab" diff --git a/website/docs/r/lightsail_instance_public_ports.html.markdown b/website/docs/r/lightsail_instance_public_ports.html.markdown new file mode 100644 index 000000000000..3e9b98ce0f6c --- /dev/null +++ b/website/docs/r/lightsail_instance_public_ports.html.markdown @@ -0,0 +1,61 @@ +--- +subcategory: "Lightsail" +layout: "aws" +page_title: "AWS: aws_lightsail_instance_public_ports" +description: |- + Provides an Lightsail Instance +--- + +# Resource: aws_lightsail_instance_public_ports + +Opens ports for a specific Amazon Lightsail instance, and specifies the IP addresses allowed to connect to the instance through the ports, and the protocol. + +-> See [What is Amazon Lightsail?](https://lightsail.aws.amazon.com/ls/docs/getting-started/article/what-is-amazon-lightsail) for more information. + +~> **Note:** Lightsail is currently only supported in a limited number of AWS Regions, please see ["Regions and Availability Zones in Amazon Lightsail"](https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail) for more details. + +## Example Usage + +```terraform +resource "aws_lightsail_instance" "test" { + name = "yak_sail" + availability_zone = data.aws_availability_zones.available.names[0] + blueprint_id = "amazon_linux" + bundle_id = "nano_1_0" +} + +resource "aws_lightsail_instance_public_ports" "test" { + instance_name = aws_lightsail_instance.test.name + + port_info { + protocol = "tcp" + from_port = 80 + to_port = 80 + } +} +``` + +## Argument Reference + +The following arguments are required: + +* `instance_name` - (Required) Name of the Lightsail Instance. +* `port_info` - (Required) Configuration block with port information. AWS closes all currently open ports that are not included in the `port_info`. Detailed below. + +### port_info + +The following arguments are required: + +* `from_port` - (Required) First port in a range of open ports on an instance. +* `protocol` - (Required) IP protocol name. Valid values are `tcp`, `all`, `udp`, and `icmp`. +* `to_port` - (Required) Last port in a range of open ports on an instance. + +The following arguments are optional: + +* `cidrs` - (Optional) Set of CIDR blocks. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. diff --git a/website/docs/r/lightsail_key_pair.html.markdown b/website/docs/r/lightsail_key_pair.html.markdown index 7f5e8c02f37c..936e0ebb01e3 100644 --- a/website/docs/r/lightsail_key_pair.html.markdown +++ b/website/docs/r/lightsail_key_pair.html.markdown @@ -14,27 +14,29 @@ Lightsail. ~> **Note:** Lightsail is currently only supported in a limited number of AWS Regions, please see ["Regions and Availability Zones in Amazon Lightsail"](https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail) for more details -## Example Usage, creating a new Key Pair +## Example Usage -```hcl +### Create New Key Pair + +```terraform # Create a new Lightsail Key Pair resource "aws_lightsail_key_pair" "lg_key_pair" { name = "lg_key_pair" } ``` -## Create new Key Pair, encrypting the private key with a PGP Key +### Create New Key Pair with PGP Encrypted Private Key -```hcl +```terraform resource "aws_lightsail_key_pair" "lg_key_pair" { name = "lg_key_pair" pgp_key = "keybase:keybaseusername" } ``` -## Import an existing public key +### Existing Public Key Import -```hcl +```terraform resource "aws_lightsail_key_pair" "lg_key_pair" { name = "importing" public_key = file("~/.ssh/id_rsa.pub") diff --git a/website/docs/r/lightsail_static_ip.html.markdown b/website/docs/r/lightsail_static_ip.html.markdown index f1c7d137e4be..b29f9ae463ee 100644 --- a/website/docs/r/lightsail_static_ip.html.markdown +++ b/website/docs/r/lightsail_static_ip.html.markdown @@ -14,7 +14,7 @@ Allocates a static IP address. ## Example Usage -```hcl +```terraform resource "aws_lightsail_static_ip" "test" { name = "example" } diff --git a/website/docs/r/lightsail_static_ip_attachment.html.markdown b/website/docs/r/lightsail_static_ip_attachment.html.markdown index 5eec81ceb916..aa032456920a 100644 --- a/website/docs/r/lightsail_static_ip_attachment.html.markdown +++ b/website/docs/r/lightsail_static_ip_attachment.html.markdown @@ -14,7 +14,7 @@ Provides a static IP address attachment - relationship between a Lightsail stati ## Example Usage -```hcl +```terraform resource "aws_lightsail_static_ip_attachment" "test" { static_ip_name = aws_lightsail_static_ip.test.id instance_name = aws_lightsail_instance.test.id diff --git a/website/docs/r/load_balancer_backend_server_policy.html.markdown b/website/docs/r/load_balancer_backend_server_policy.html.markdown index 63961e2fd374..04617496674b 100644 --- a/website/docs/r/load_balancer_backend_server_policy.html.markdown +++ b/website/docs/r/load_balancer_backend_server_policy.html.markdown @@ -13,7 +13,7 @@ Attaches a load balancer policy to an ELB backend server. ## Example Usage -```hcl +```terraform resource "aws_elb" "wu-tang" { name = "wu-tang" availability_zones = ["us-east-1a"] @@ -36,6 +36,8 @@ resource "aws_load_balancer_policy" "wu-tang-ca-pubkey-policy" { policy_name = "wu-tang-ca-pubkey-policy" policy_type_name = "PublicKeyPolicyType" + # The public key of a CA certificate file can be extracted with: + # $ cat wu-tang-ca.pem | openssl x509 -pubkey -noout | grep -v '\-\-\-\-' | tr -d '\n' > wu-tang-pubkey policy_attribute { name = "PublicKey" value = file("wu-tang-pubkey") @@ -63,14 +65,6 @@ resource "aws_load_balancer_backend_server_policy" "wu-tang-backend-auth-policie } ``` -Where the file `pubkey` in the current directory contains only the _public key_ of the certificate. - -```shell -cat wu-tang-ca.pem | openssl x509 -pubkey -noout | grep -v '\-\-\-\-' | tr -d '\n' > wu-tang-pubkey -``` - -This example shows how to enable backend authentication for an ELB as well as customize the TLS settings. - ## Argument Reference The following arguments are supported: diff --git a/website/docs/r/load_balancer_listener_policy.html.markdown b/website/docs/r/load_balancer_listener_policy.html.markdown index 05ebc11ad052..75ac35700f46 100644 --- a/website/docs/r/load_balancer_listener_policy.html.markdown +++ b/website/docs/r/load_balancer_listener_policy.html.markdown @@ -11,9 +11,11 @@ description: |- Attaches a load balancer policy to an ELB Listener. -## Example Usage for Custom Policy +## Example Usage -```hcl +### Custom Policy + +```terraform resource "aws_elb" "wu-tang" { name = "wu-tang" availability_zones = ["us-east-1a"] @@ -59,9 +61,9 @@ resource "aws_load_balancer_listener_policy" "wu-tang-listener-policies-443" { This example shows how to customize the TLS settings of an HTTPS listener. -## Example Usage for AWS Predefined Security Policy +### AWS Predefined Security Policy -```hcl +```terraform resource "aws_elb" "wu-tang" { name = "wu-tang" availability_zones = ["us-east-1a"] diff --git a/website/docs/r/load_balancer_policy.html.markdown b/website/docs/r/load_balancer_policy.html.markdown index 8bf1b8fb7669..4ee26f1527f6 100644 --- a/website/docs/r/load_balancer_policy.html.markdown +++ b/website/docs/r/load_balancer_policy.html.markdown @@ -12,7 +12,7 @@ Provides a load balancer policy, which can be attached to an ELB listener or bac ## Example Usage -```hcl +```terraform resource "aws_elb" "wu-tang" { name = "wu-tang" availability_zones = ["us-east-1a"] @@ -35,6 +35,8 @@ resource "aws_load_balancer_policy" "wu-tang-ca-pubkey-policy" { policy_name = "wu-tang-ca-pubkey-policy" policy_type_name = "PublicKeyPolicyType" + # The public key of a CA certificate file can be extracted with: + # $ cat wu-tang-ca.pem | openssl x509 -pubkey -noout | grep -v '\-\-\-\-' | tr -d '\n' > wu-tang-pubkey policy_attribute { name = "PublicKey" value = file("wu-tang-pubkey") @@ -98,14 +100,6 @@ resource "aws_load_balancer_listener_policy" "wu-tang-listener-policies-443" { } ``` -Where the file `pubkey` in the current directory contains only the _public key_ of the certificate. - -```shell -cat wu-tang-ca.pem | openssl x509 -pubkey -noout | grep -v '\-\-\-\-' | tr -d '\n' > wu-tang-pubkey -``` - -This example shows how to enable backend authentication for an ELB as well as customize the TLS settings. - ## Argument Reference The following arguments are supported: diff --git a/website/docs/r/macie_member_account_association.html.markdown b/website/docs/r/macie_member_account_association.html.markdown index 237c727fbe50..b22b4ea39853 100644 --- a/website/docs/r/macie_member_account_association.html.markdown +++ b/website/docs/r/macie_member_account_association.html.markdown @@ -16,7 +16,7 @@ Associates an AWS account with Amazon Macie as a member account. ## Example Usage -```hcl +```terraform resource "aws_macie_member_account_association" "example" { member_account_id = "123456789012" } diff --git a/website/docs/r/macie_s3_bucket_association.html.markdown b/website/docs/r/macie_s3_bucket_association.html.markdown index ed0bb6f2e443..513ad15d4cb8 100644 --- a/website/docs/r/macie_s3_bucket_association.html.markdown +++ b/website/docs/r/macie_s3_bucket_association.html.markdown @@ -16,7 +16,7 @@ Associates an S3 resource with Amazon Macie for monitoring and data classificati ## Example Usage -```hcl +```terraform resource "aws_macie_s3_bucket_association" "example" { bucket_name = "tf-macie-example" prefix = "data" diff --git a/website/docs/r/main_route_table_association.html.markdown b/website/docs/r/main_route_table_association.html.markdown index 9e011728705f..fbe52a4ae521 100644 --- a/website/docs/r/main_route_table_association.html.markdown +++ b/website/docs/r/main_route_table_association.html.markdown @@ -12,7 +12,7 @@ Provides a resource for managing the main routing table of a VPC. ## Example Usage -```hcl +```terraform resource "aws_main_route_table_association" "a" { vpc_id = aws_vpc.foo.id route_table_id = aws_route_table.bar.id diff --git a/website/docs/r/media_convert_queue.html.markdown b/website/docs/r/media_convert_queue.html.markdown index 33b7af582486..c3c58703e11d 100644 --- a/website/docs/r/media_convert_queue.html.markdown +++ b/website/docs/r/media_convert_queue.html.markdown @@ -12,7 +12,7 @@ Provides an AWS Elemental MediaConvert Queue. ## Example Usage -```hcl +```terraform resource "aws_media_convert_queue" "test" { name = "tf-test-queue" } diff --git a/website/docs/r/media_package_channel.html.markdown b/website/docs/r/media_package_channel.html.markdown index 4910ea7ed6a2..f0ef3f5b32c9 100644 --- a/website/docs/r/media_package_channel.html.markdown +++ b/website/docs/r/media_package_channel.html.markdown @@ -12,7 +12,7 @@ Provides an AWS Elemental MediaPackage Channel. ## Example Usage -```hcl +```terraform resource "aws_media_package_channel" "kittens" { channel_id = "kitten-channel" description = "A channel dedicated to amusing videos of kittens." diff --git a/website/docs/r/media_store_container.html.markdown b/website/docs/r/media_store_container.html.markdown index 8f14be6ef54b..c906c88a7d64 100644 --- a/website/docs/r/media_store_container.html.markdown +++ b/website/docs/r/media_store_container.html.markdown @@ -12,7 +12,7 @@ Provides a MediaStore Container. ## Example Usage -```hcl +```terraform resource "aws_media_store_container" "example" { name = "example" } diff --git a/website/docs/r/media_store_container_policy.html.markdown b/website/docs/r/media_store_container_policy.html.markdown index 1476c77b5a05..ea04d851cd1b 100644 --- a/website/docs/r/media_store_container_policy.html.markdown +++ b/website/docs/r/media_store_container_policy.html.markdown @@ -12,7 +12,7 @@ Provides a MediaStore Container Policy. ## Example Usage -```hcl +```terraform data "aws_region" "current" {} data "aws_caller_identity" "current" {} @@ -49,6 +49,10 @@ The following arguments are supported: * `container_name` - (Required) The name of the container. * `policy` - (Required) The contents of the policy. For more information about building AWS IAM policy documents with Terraform, see the [AWS IAM Policy Document Guide](https://learn.hashicorp.com/terraform/aws/iam-policy). +## Attributes Reference + +No additional attributes are exported. + ## Import MediaStore Container Policy can be imported using the MediaStore Container Name, e.g. diff --git a/website/docs/r/mq_broker.html.markdown b/website/docs/r/mq_broker.html.markdown index 7da2cbb79088..1a22f2050e14 100644 --- a/website/docs/r/mq_broker.html.markdown +++ b/website/docs/r/mq_broker.html.markdown @@ -23,7 +23,7 @@ Provides an Amazon MQ broker resource. This resources also manages users for the ### Basic Example -```hcl +```terraform resource "aws_mq_broker" "example" { broker_name = "example" @@ -48,7 +48,7 @@ resource "aws_mq_broker" "example" { This example shows the use of EBS storage for high-throughput optimized performance. -```hcl +```terraform resource "aws_mq_broker" "example" { broker_name = "example" diff --git a/website/docs/r/mq_configuration.html.markdown b/website/docs/r/mq_configuration.html.markdown index 6ed381ed29d2..26a17bd6782a 100644 --- a/website/docs/r/mq_configuration.html.markdown +++ b/website/docs/r/mq_configuration.html.markdown @@ -14,7 +14,7 @@ For more information on Amazon MQ, see [Amazon MQ documentation](https://docs.aw ## Example Usage -```hcl +```terraform resource "aws_mq_configuration" "example" { description = "Example Configuration" name = "example" @@ -36,24 +36,26 @@ DATA ## Argument Reference -The following arguments are supported: +The following arguments are required: -* `data` - (Required) The broker configuration in XML format. - See [official docs](https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/amazon-mq-broker-configuration-parameters.html) - for supported parameters and format of the XML. -* `description` - (Optional) The description of the configuration. -* `engine_type` - (Required) The type of broker engine. -* `engine_version` - (Required) The version of the broker engine. -* `name` - (Required) The name of the configuration -* `tags` - (Optional) A map of tags to assign to the resource. +* `data` - (Required) Broker configuration in XML format. See [official docs](https://docs.aws.amazon.com/amazon-mq/latest/developer-guide/amazon-mq-broker-configuration-parameters.html) for supported parameters and format of the XML. +* `engine_type` - (Required) Type of broker engine. Valid values are `ActiveMQ` and `RabbitMQ`. +* `engine_version` - (Required) Version of the broker engine. +* `name` - (Required) Name of the configuration. + +The following arguments are optional: + +* `authentication_strategy` - (Optional) Authentication strategy associated with the configuration. Valid values are `simple` and `ldap`. `ldap` is not supported for `engine_type` `RabbitMQ`. +* `description` - (Optional) Description of the configuration. +* `tags` - (Optional) Map of tags to assign to the resource. ## Attributes Reference In addition to all arguments above, the following attributes are exported: -* `id` - The unique ID that Amazon MQ generates for the configuration. -* `arn` - The ARN of the configuration. -* `latest_revision` - The latest revision of the configuration. +* `arn` - ARN of the configuration. +* `id` - Unique ID that Amazon MQ generates for the configuration. +* `latest_revision` - Latest revision of the configuration. ## Import diff --git a/website/docs/r/msk_cluster.html.markdown b/website/docs/r/msk_cluster.html.markdown index 4a6412de92c8..02a22c944837 100644 --- a/website/docs/r/msk_cluster.html.markdown +++ b/website/docs/r/msk_cluster.html.markdown @@ -12,7 +12,7 @@ Manages AWS Managed Streaming for Kafka cluster ## Example Usage -```hcl +```terraform resource "aws_vpc" "vpc" { cidr_block = "192.168.0.0/22" } diff --git a/website/docs/r/msk_configuration.html.markdown b/website/docs/r/msk_configuration.html.markdown index 227c36c24802..bdd5b1ef8003 100644 --- a/website/docs/r/msk_configuration.html.markdown +++ b/website/docs/r/msk_configuration.html.markdown @@ -12,7 +12,7 @@ Manages an Amazon Managed Streaming for Kafka configuration. More information ca ## Example Usage -```hcl +```terraform resource "aws_msk_configuration" "example" { kafka_versions = ["2.1.0"] name = "example" diff --git a/website/docs/r/msk_scram_secret_association.html.markdown b/website/docs/r/msk_scram_secret_association.html.markdown index 017fc5b6be9e..c7b9b613e948 100644 --- a/website/docs/r/msk_scram_secret_association.html.markdown +++ b/website/docs/r/msk_scram_secret_association.html.markdown @@ -22,7 +22,7 @@ resource](/docs/providers/aws/r/secretsmanager_secret_policy.html) as shown belo ## Example Usage -```hcl +```terraform resource "aws_msk_scram_secret_association" "example" { cluster_arn = aws_msk_cluster.example.arn secret_arn_list = [aws_secretsmanager_secret.example.arn] diff --git a/website/docs/r/nat_gateway.html.markdown b/website/docs/r/nat_gateway.html.markdown index 68cb1bb603ff..62743dcfefd9 100644 --- a/website/docs/r/nat_gateway.html.markdown +++ b/website/docs/r/nat_gateway.html.markdown @@ -12,7 +12,7 @@ Provides a resource to create a VPC NAT Gateway. ## Example Usage -```hcl +```terraform resource "aws_nat_gateway" "gw" { allocation_id = aws_eip.nat.id subnet_id = aws_subnet.example.id @@ -21,7 +21,7 @@ resource "aws_nat_gateway" "gw" { Usage with tags: -```hcl +```terraform resource "aws_nat_gateway" "gw" { allocation_id = aws_eip.nat.id subnet_id = aws_subnet.example.id @@ -42,7 +42,7 @@ The following arguments are supported: -> **Note:** It's recommended to denote that the NAT Gateway depends on the Internet Gateway for the VPC in which the NAT Gateway's subnet is located. For example: -```hcl +```terraform resource "aws_internet_gateway" "gw" { vpc_id = aws_vpc.main.id } diff --git a/website/docs/r/neptune_cluster.html.markdown b/website/docs/r/neptune_cluster.html.markdown index 74a1c75bd55b..4df015fb5649 100644 --- a/website/docs/r/neptune_cluster.html.markdown +++ b/website/docs/r/neptune_cluster.html.markdown @@ -20,7 +20,7 @@ phase because a modification has not yet taken place. You can use the ## Example Usage -```hcl +```terraform resource "aws_neptune_cluster" "default" { cluster_identifier = "neptune-cluster-demo" engine = "neptune" diff --git a/website/docs/r/neptune_cluster_instance.html.markdown b/website/docs/r/neptune_cluster_instance.html.markdown index d59fdbe3767b..f090be4f6612 100644 --- a/website/docs/r/neptune_cluster_instance.html.markdown +++ b/website/docs/r/neptune_cluster_instance.html.markdown @@ -18,7 +18,7 @@ meta-parameter to make multiple instances and join them all to the same Neptune The following example will create a neptune cluster with two neptune instances(one writer and one reader). -```hcl +```terraform resource "aws_neptune_cluster" "default" { cluster_identifier = "neptune-cluster-demo" engine = "neptune" diff --git a/website/docs/r/neptune_cluster_parameter_group.html.markdown b/website/docs/r/neptune_cluster_parameter_group.html.markdown index 5d61ecce4b84..022f167d6915 100644 --- a/website/docs/r/neptune_cluster_parameter_group.html.markdown +++ b/website/docs/r/neptune_cluster_parameter_group.html.markdown @@ -12,7 +12,7 @@ Manages a Neptune Cluster Parameter Group ## Example Usage -```hcl +```terraform resource "aws_neptune_cluster_parameter_group" "example" { family = "neptune1" name = "example" diff --git a/website/docs/r/neptune_cluster_snapshot.html.markdown b/website/docs/r/neptune_cluster_snapshot.html.markdown index 3160e963badb..071cd91c2b3f 100644 --- a/website/docs/r/neptune_cluster_snapshot.html.markdown +++ b/website/docs/r/neptune_cluster_snapshot.html.markdown @@ -12,7 +12,7 @@ Manages a Neptune database cluster snapshot. ## Example Usage -```hcl +```terraform resource "aws_neptune_cluster_snapshot" "example" { db_cluster_identifier = aws_neptune_cluster.example.id db_cluster_snapshot_identifier = "resourcetestsnapshot1234" diff --git a/website/docs/r/neptune_event_subscription.html.markdown b/website/docs/r/neptune_event_subscription.html.markdown index 9ac8afb4be80..b61d923d1524 100644 --- a/website/docs/r/neptune_event_subscription.html.markdown +++ b/website/docs/r/neptune_event_subscription.html.markdown @@ -10,7 +10,7 @@ description: |- ## Example Usage -```hcl +```terraform resource "aws_neptune_cluster" "default" { cluster_identifier = "neptune-cluster-demo" engine = "neptune" @@ -73,9 +73,9 @@ The following arguments are supported: * `source_type` - (Optional) The type of source that will be generating the events. Valid options are `db-instance`, `db-security-group`, `db-parameter-group`, `db-snapshot`, `db-cluster` or `db-cluster-snapshot`. If not set, all sources will be subscribed to. * `tags` - (Optional) A map of tags to assign to the resource. -## Attributes +## Attributes Reference -The following additional atttributes are provided: +In addition to all arguments above, the following attributes are exported: * `id` - The name of the Neptune event notification subscription. * `arn` - The Amazon Resource Name of the Neptune event notification subscription. diff --git a/website/docs/r/neptune_parameter_group.html.markdown b/website/docs/r/neptune_parameter_group.html.markdown index fbc21d165093..37856a425c7f 100644 --- a/website/docs/r/neptune_parameter_group.html.markdown +++ b/website/docs/r/neptune_parameter_group.html.markdown @@ -12,7 +12,7 @@ Manages a Neptune Parameter Group ## Example Usage -```hcl +```terraform resource "aws_neptune_parameter_group" "example" { family = "neptune1" name = "example" diff --git a/website/docs/r/neptune_subnet_group.html.markdown b/website/docs/r/neptune_subnet_group.html.markdown index 84a337f96fb2..00c0e67f94c4 100644 --- a/website/docs/r/neptune_subnet_group.html.markdown +++ b/website/docs/r/neptune_subnet_group.html.markdown @@ -12,7 +12,7 @@ Provides an Neptune subnet group resource. ## Example Usage -```hcl +```terraform resource "aws_neptune_subnet_group" "default" { name = "main" subnet_ids = [aws_subnet.frontend.id, aws_subnet.backend.id] diff --git a/website/docs/r/network_acl.html.markdown b/website/docs/r/network_acl.html.markdown index 12180b46bb29..610ae509eb74 100644 --- a/website/docs/r/network_acl.html.markdown +++ b/website/docs/r/network_acl.html.markdown @@ -19,7 +19,7 @@ a conflict of rule settings and will overwrite rules. ## Example Usage -```hcl +```terraform resource "aws_network_acl" "main" { vpc_id = aws_vpc.main.id diff --git a/website/docs/r/network_acl_rule.html.markdown b/website/docs/r/network_acl_rule.html.markdown index 982d9e6255e5..d9c510b3d5ab 100644 --- a/website/docs/r/network_acl_rule.html.markdown +++ b/website/docs/r/network_acl_rule.html.markdown @@ -18,7 +18,7 @@ a conflict of rule settings and will overwrite rules. ## Example Usage -```hcl +```terraform resource "aws_network_acl" "bar" { vpc_id = aws_vpc.foo.id } diff --git a/website/docs/r/network_interface.markdown b/website/docs/r/network_interface.markdown index df298d2c741e..88833a245f1a 100644 --- a/website/docs/r/network_interface.markdown +++ b/website/docs/r/network_interface.markdown @@ -12,7 +12,7 @@ Provides an Elastic network interface (ENI) resource. ## Example Usage -```hcl +```terraform resource "aws_network_interface" "test" { subnet_id = aws_subnet.public_a.id private_ips = ["10.0.0.50"] diff --git a/website/docs/r/network_interface_attachment.html.markdown b/website/docs/r/network_interface_attachment.html.markdown index 9ab1fdb0cb6d..ca160e394978 100644 --- a/website/docs/r/network_interface_attachment.html.markdown +++ b/website/docs/r/network_interface_attachment.html.markdown @@ -12,7 +12,7 @@ Attach an Elastic network interface (ENI) resource with EC2 instance. ## Example Usage -```hcl +```terraform resource "aws_network_interface_attachment" "test" { instance_id = aws_instance.test.id network_interface_id = aws_network_interface.test.id diff --git a/website/docs/r/network_interface_sg_attachment.html.markdown b/website/docs/r/network_interface_sg_attachment.html.markdown index c3a16e2f6373..e565f07b24fa 100644 --- a/website/docs/r/network_interface_sg_attachment.html.markdown +++ b/website/docs/r/network_interface_sg_attachment.html.markdown @@ -30,7 +30,7 @@ by `instance`) in the default security group, creating a security group primary network interface via the `aws_network_interface_sg_attachment` resource, named `sg_attachment`: -```hcl +```terraform data "aws_ami" "ami" { most_recent = true @@ -67,7 +67,7 @@ In this example, `instance` is provided by the `aws_instance` data source, fetching an external instance, possibly not managed by Terraform. `sg_attachment` then attaches to the output instance's `network_interface_id`: -```hcl +```terraform data "aws_instance" "instance" { instance_id = "i-1234567890abcdef0" } @@ -89,6 +89,6 @@ resource "aws_network_interface_sg_attachment" "sg_attachment" { * `security_group_id` - (Required) The ID of the security group. * `network_interface_id` - (Required) The ID of the network interface to attach to. -## Output Reference +## Attributes Reference -There are no outputs for this resource. +No additional attributes are exported. diff --git a/website/docs/r/networkfirewall_firewall.html.markdown b/website/docs/r/networkfirewall_firewall.html.markdown index ca93fdabb73d..3fff8cc13297 100644 --- a/website/docs/r/networkfirewall_firewall.html.markdown +++ b/website/docs/r/networkfirewall_firewall.html.markdown @@ -12,7 +12,7 @@ Provides an AWS Network Firewall Firewall Resource ## Example Usage -```hcl +```terraform resource "aws_networkfirewall_firewall" "example" { name = "example" firewall_policy_arn = aws_networkfirewall_firewall_policy.example.arn diff --git a/website/docs/r/networkfirewall_firewall_policy.html.markdown b/website/docs/r/networkfirewall_firewall_policy.html.markdown index ce8bb98fa3d0..90bea139528e 100644 --- a/website/docs/r/networkfirewall_firewall_policy.html.markdown +++ b/website/docs/r/networkfirewall_firewall_policy.html.markdown @@ -12,7 +12,7 @@ Provides an AWS Network Firewall Firewall Policy Resource ## Example Usage -```hcl +```terraform resource "aws_networkfirewall_firewall_policy" "example" { name = "example" @@ -34,7 +34,7 @@ resource "aws_networkfirewall_firewall_policy" "example" { ## Policy with a Custom Action for Stateless Inspection -```hcl +```terraform resource "aws_networkfirewall_firewall_policy" "test" { name = "example" diff --git a/website/docs/r/networkfirewall_logging_configuration.html.markdown b/website/docs/r/networkfirewall_logging_configuration.html.markdown index 84d2fcbe1488..44b5d9f4d712 100644 --- a/website/docs/r/networkfirewall_logging_configuration.html.markdown +++ b/website/docs/r/networkfirewall_logging_configuration.html.markdown @@ -14,7 +14,7 @@ Provides an AWS Network Firewall Logging Configuration Resource ### Logging to S3 -```hcl +```terraform resource "aws_networkfirewall_logging_configuration" "example" { firewall_arn = aws_networkfirewall_firewall.example.arn logging_configuration { @@ -32,7 +32,7 @@ resource "aws_networkfirewall_logging_configuration" "example" { ### Logging to CloudWatch -```hcl +```terraform resource "aws_networkfirewall_logging_configuration" "example" { firewall_arn = aws_networkfirewall_firewall.example.arn logging_configuration { @@ -49,7 +49,7 @@ resource "aws_networkfirewall_logging_configuration" "example" { ### Logging to Kinesis Data Firehose -```hcl +```terraform resource "aws_networkfirewall_logging_configuration" "example" { firewall_arn = aws_networkfirewall_firewall.example.arn logging_configuration { diff --git a/website/docs/r/networkfirewall_resource_policy.html.markdown b/website/docs/r/networkfirewall_resource_policy.html.markdown index e4efd9999658..7dd4c7dacbf6 100644 --- a/website/docs/r/networkfirewall_resource_policy.html.markdown +++ b/website/docs/r/networkfirewall_resource_policy.html.markdown @@ -14,7 +14,7 @@ Provides an AWS Network Firewall Resource Policy Resource for a rule group or fi ### For a Firewall Policy resource -```hcl +```terraform resource "aws_networkfirewall_resource_policy" "example" { resource_arn = aws_networkfirewall_firewall_policy.example.arn # policy's Action element must include all of the following operations @@ -39,7 +39,7 @@ resource "aws_networkfirewall_resource_policy" "example" { ### For a Rule Group resource -```hcl +```terraform resource "aws_networkfirewall_resource_policy" "example" { resource_arn = aws_networkfirewall_rule_group.example.arn # policy's Action element must include all of the following operations @@ -69,9 +69,9 @@ The following arguments are supported: * `resource_arn` - (Required, Forces new resource) The Amazon Resource Name (ARN) of the rule group or firewall policy. -## Attribute Reference +## Attributes Reference -In addition to all arguments above, the following attribute is exported: +In addition to all arguments above, the following attributes are exported: * `id` - The Amazon Resource Name (ARN) of the rule group or firewall policy associated with the resource policy. diff --git a/website/docs/r/networkfirewall_rule_group.html.markdown b/website/docs/r/networkfirewall_rule_group.html.markdown index ab078a5923fe..ba0c1f74ace1 100644 --- a/website/docs/r/networkfirewall_rule_group.html.markdown +++ b/website/docs/r/networkfirewall_rule_group.html.markdown @@ -14,7 +14,7 @@ Provides an AWS Network Firewall Rule Group Resource ### Stateful Inspection for denying access to a domain -```hcl +```terraform resource "aws_networkfirewall_rule_group" "example" { capacity = 100 name = "example" @@ -38,7 +38,7 @@ resource "aws_networkfirewall_rule_group" "example" { ### Stateful Inspection for permitting packets from a source IP address -```hcl +```terraform resource "aws_networkfirewall_rule_group" "example" { capacity = 50 description = "Permits http traffic from source" @@ -78,7 +78,7 @@ locals { ### Stateful Inspection for blocking packets from going to an intended destination -```hcl +```terraform resource "aws_networkfirewall_rule_group" "example" { capacity = 100 name = "example" @@ -111,7 +111,7 @@ resource "aws_networkfirewall_rule_group" "example" { ### Stateful Inspection from rules specifications defined in Suricata flat format -```hcl +```terraform resource "aws_networkfirewall_rule_group" "example" { capacity = 100 name = "example" @@ -127,7 +127,7 @@ resource "aws_networkfirewall_rule_group" "example" { ### Stateless Inspection with a Custom Action -```hcl +```terraform resource "aws_networkfirewall_rule_group" "example" { description = "Stateless Rate Limiting Rule" capacity = 100 diff --git a/website/docs/r/opsworks_application.html.markdown b/website/docs/r/opsworks_application.html.markdown index aa3e4efb8c10..ea42ff62f0ee 100644 --- a/website/docs/r/opsworks_application.html.markdown +++ b/website/docs/r/opsworks_application.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks application resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_application" "foo-app" { name = "foobar application" short_name = "foobar" diff --git a/website/docs/r/opsworks_custom_layer.html.markdown b/website/docs/r/opsworks_custom_layer.html.markdown index dbb46258c577..d54be4e1f346 100644 --- a/website/docs/r/opsworks_custom_layer.html.markdown +++ b/website/docs/r/opsworks_custom_layer.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks custom layer resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_custom_layer" "custlayer" { name = "My Awesome Custom Layer" short_name = "awesome" diff --git a/website/docs/r/opsworks_ganglia_layer.html.markdown b/website/docs/r/opsworks_ganglia_layer.html.markdown index 830269d2322f..458500badda1 100644 --- a/website/docs/r/opsworks_ganglia_layer.html.markdown +++ b/website/docs/r/opsworks_ganglia_layer.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks Ganglia layer resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_ganglia_layer" "monitor" { stack_id = aws_opsworks_stack.main.id password = "foobarbaz" diff --git a/website/docs/r/opsworks_haproxy_layer.html.markdown b/website/docs/r/opsworks_haproxy_layer.html.markdown index 157c8ded061d..814f7ddaa3fd 100644 --- a/website/docs/r/opsworks_haproxy_layer.html.markdown +++ b/website/docs/r/opsworks_haproxy_layer.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks haproxy layer resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_haproxy_layer" "lb" { stack_id = aws_opsworks_stack.main.id stats_password = "foobarbaz" diff --git a/website/docs/r/opsworks_instance.html.markdown b/website/docs/r/opsworks_instance.html.markdown index 61d22039baa4..b1482fe2949e 100644 --- a/website/docs/r/opsworks_instance.html.markdown +++ b/website/docs/r/opsworks_instance.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks instance resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_instance" "my-instance" { stack_id = aws_opsworks_stack.main.id diff --git a/website/docs/r/opsworks_java_app_layer.html.markdown b/website/docs/r/opsworks_java_app_layer.html.markdown index 358ab3bc2ab6..e457571c07d0 100644 --- a/website/docs/r/opsworks_java_app_layer.html.markdown +++ b/website/docs/r/opsworks_java_app_layer.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks Java application layer resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_java_app_layer" "app" { stack_id = aws_opsworks_stack.main.id } diff --git a/website/docs/r/opsworks_memcached_layer.html.markdown b/website/docs/r/opsworks_memcached_layer.html.markdown index 9ef7e654005e..57e11fa6b79d 100644 --- a/website/docs/r/opsworks_memcached_layer.html.markdown +++ b/website/docs/r/opsworks_memcached_layer.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks memcached layer resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_memcached_layer" "cache" { stack_id = aws_opsworks_stack.main.id } diff --git a/website/docs/r/opsworks_mysql_layer.html.markdown b/website/docs/r/opsworks_mysql_layer.html.markdown index f8f7ccd4df30..c5ae74fcfb85 100644 --- a/website/docs/r/opsworks_mysql_layer.html.markdown +++ b/website/docs/r/opsworks_mysql_layer.html.markdown @@ -15,7 +15,7 @@ Provides an OpsWorks MySQL layer resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_mysql_layer" "db" { stack_id = aws_opsworks_stack.main.id } diff --git a/website/docs/r/opsworks_nodejs_app_layer.html.markdown b/website/docs/r/opsworks_nodejs_app_layer.html.markdown index 763dd909dcd8..ae9bf9bbb8a9 100644 --- a/website/docs/r/opsworks_nodejs_app_layer.html.markdown +++ b/website/docs/r/opsworks_nodejs_app_layer.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks NodeJS application layer resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_nodejs_app_layer" "app" { stack_id = aws_opsworks_stack.main.id } diff --git a/website/docs/r/opsworks_permission.html.markdown b/website/docs/r/opsworks_permission.html.markdown index e44fddf6a3bb..5f25da27ef6a 100644 --- a/website/docs/r/opsworks_permission.html.markdown +++ b/website/docs/r/opsworks_permission.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks permission resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_permission" "my_stack_permission" { allow_ssh = true allow_sudo = true diff --git a/website/docs/r/opsworks_php_app_layer.html.markdown b/website/docs/r/opsworks_php_app_layer.html.markdown index bc97b8b8c644..9ff708edab7f 100644 --- a/website/docs/r/opsworks_php_app_layer.html.markdown +++ b/website/docs/r/opsworks_php_app_layer.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks PHP application layer resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_php_app_layer" "app" { stack_id = aws_opsworks_stack.main.id } diff --git a/website/docs/r/opsworks_rails_app_layer.html.markdown b/website/docs/r/opsworks_rails_app_layer.html.markdown index e6e25a68a94b..45d9986d9677 100644 --- a/website/docs/r/opsworks_rails_app_layer.html.markdown +++ b/website/docs/r/opsworks_rails_app_layer.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks Ruby on Rails application layer resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_rails_app_layer" "app" { stack_id = aws_opsworks_stack.main.id } diff --git a/website/docs/r/opsworks_rds_db_instance.html.markdown b/website/docs/r/opsworks_rds_db_instance.html.markdown index b2a9d9e2ba70..5f97e4681d39 100644 --- a/website/docs/r/opsworks_rds_db_instance.html.markdown +++ b/website/docs/r/opsworks_rds_db_instance.html.markdown @@ -15,7 +15,7 @@ Provides an OpsWorks RDS DB Instance resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_rds_db_instance" "my_instance" { stack_id = aws_opsworks_stack.my_stack.id rds_db_instance_arn = aws_db_instance.my_instance.arn diff --git a/website/docs/r/opsworks_stack.html.markdown b/website/docs/r/opsworks_stack.html.markdown index ff7811f15f9e..d3f7b5e1d3ff 100644 --- a/website/docs/r/opsworks_stack.html.markdown +++ b/website/docs/r/opsworks_stack.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks stack resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_stack" "main" { name = "awesome-stack" region = "us-west-1" diff --git a/website/docs/r/opsworks_static_web_layer.html.markdown b/website/docs/r/opsworks_static_web_layer.html.markdown index b2bf8ea99d79..69ec33839031 100644 --- a/website/docs/r/opsworks_static_web_layer.html.markdown +++ b/website/docs/r/opsworks_static_web_layer.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks static web server layer resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_static_web_layer" "web" { stack_id = aws_opsworks_stack.main.id } diff --git a/website/docs/r/opsworks_user_profile.html.markdown b/website/docs/r/opsworks_user_profile.html.markdown index a573d53cbaa8..2e8172cd04a6 100644 --- a/website/docs/r/opsworks_user_profile.html.markdown +++ b/website/docs/r/opsworks_user_profile.html.markdown @@ -12,7 +12,7 @@ Provides an OpsWorks User Profile resource. ## Example Usage -```hcl +```terraform resource "aws_opsworks_user_profile" "my_profile" { user_arn = aws_iam_user.user.arn ssh_username = "my_user" diff --git a/website/docs/r/organizations_account.html.markdown b/website/docs/r/organizations_account.html.markdown index cc7edd977128..64923978fed3 100644 --- a/website/docs/r/organizations_account.html.markdown +++ b/website/docs/r/organizations_account.html.markdown @@ -16,7 +16,7 @@ Provides a resource to create a member account in the current organization. ## Example Usage -```hcl +```terraform resource "aws_organizations_account" "account" { name = "my_new_account" email = "john@doe.org" @@ -51,7 +51,7 @@ $ terraform import aws_organizations_account.my_org 111111111111 Certain resource arguments, like `role_name`, do not have an Organizations API method for reading the information after account creation. If the argument is set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use [`ignore_changes`](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to hide the difference, e.g. -```hcl +```terraform resource "aws_organizations_account" "account" { name = "my_new_account" email = "john@doe.org" diff --git a/website/docs/r/organizations_organization.html.markdown b/website/docs/r/organizations_organization.html.markdown index 3a02b3b5b5fb..6793b3d9ebe3 100644 --- a/website/docs/r/organizations_organization.html.markdown +++ b/website/docs/r/organizations_organization.html.markdown @@ -14,7 +14,7 @@ Provides a resource to create an organization. ## Example Usage -```hcl +```terraform resource "aws_organizations_organization" "org" { aws_service_access_principals = [ "cloudtrail.amazonaws.com", diff --git a/website/docs/r/organizations_organizational_unit.html.markdown b/website/docs/r/organizations_organizational_unit.html.markdown index 39acb76ef7e5..97f2d222258f 100644 --- a/website/docs/r/organizations_organizational_unit.html.markdown +++ b/website/docs/r/organizations_organizational_unit.html.markdown @@ -12,7 +12,7 @@ Provides a resource to create an organizational unit. ## Example Usage -```hcl +```terraform resource "aws_organizations_organizational_unit" "example" { name = "example" parent_id = aws_organizations_organization.example.roots[0].id diff --git a/website/docs/r/organizations_policy.html.markdown b/website/docs/r/organizations_policy.html.markdown index 284c98a1b417..8ed34e750adf 100644 --- a/website/docs/r/organizations_policy.html.markdown +++ b/website/docs/r/organizations_policy.html.markdown @@ -12,7 +12,7 @@ Provides a resource to manage an [AWS Organizations policy](https://docs.aws.ama ## Example Usage -```hcl +```terraform resource "aws_organizations_policy" "example" { name = "example" diff --git a/website/docs/r/organizations_policy_attachment.html.markdown b/website/docs/r/organizations_policy_attachment.html.markdown index 7fb9d761a93e..d3fd7ca44990 100644 --- a/website/docs/r/organizations_policy_attachment.html.markdown +++ b/website/docs/r/organizations_policy_attachment.html.markdown @@ -14,7 +14,7 @@ Provides a resource to attach an AWS Organizations policy to an organization acc ### Organization Account -```hcl +```terraform resource "aws_organizations_policy_attachment" "account" { policy_id = aws_organizations_policy.example.id target_id = "123456789012" @@ -23,7 +23,7 @@ resource "aws_organizations_policy_attachment" "account" { ### Organization Root -```hcl +```terraform resource "aws_organizations_policy_attachment" "root" { policy_id = aws_organizations_policy.example.id target_id = aws_organizations_organization.example.roots[0].id @@ -32,7 +32,7 @@ resource "aws_organizations_policy_attachment" "root" { ### Organization Unit -```hcl +```terraform resource "aws_organizations_policy_attachment" "unit" { policy_id = aws_organizations_policy.example.id target_id = aws_organizations_organizational_unit.example.id @@ -46,6 +46,10 @@ The following arguments are supported: * `policy_id` - (Required) The unique identifier (ID) of the policy that you want to attach to the target. * `target_id` - (Required) The unique identifier (ID) of the root, organizational unit, or account number that you want to attach the policy to. +## Attributes Reference + +No additional attributes are exported. + ## Import `aws_organizations_policy_attachment` can be imported by using the target ID and policy ID, e.g. with an account target diff --git a/website/docs/r/pinpoint_adm_channel.markdown b/website/docs/r/pinpoint_adm_channel.markdown index c3de242a3746..c7dfe7b354a8 100644 --- a/website/docs/r/pinpoint_adm_channel.markdown +++ b/website/docs/r/pinpoint_adm_channel.markdown @@ -16,7 +16,7 @@ Provides a Pinpoint ADM (Amazon Device Messaging) Channel resource. ## Example Usage -```hcl +```terraform resource "aws_pinpoint_app" "app" {} resource "aws_pinpoint_adm_channel" "channel" { @@ -37,6 +37,10 @@ The following arguments are supported: * `client_secret` - (Required) Client Secret (part of OAuth Credentials) obtained via Amazon Developer Account. * `enabled` - (Optional) Specifies whether to enable the channel. Defaults to `true`. +## Attributes Reference + +No additional attributes are exported. + ## Import Pinpoint ADM Channel can be imported using the `application-id`, e.g. diff --git a/website/docs/r/pinpoint_apns_channel.markdown b/website/docs/r/pinpoint_apns_channel.markdown index 63c37c1a3a11..dd809cf855b8 100644 --- a/website/docs/r/pinpoint_apns_channel.markdown +++ b/website/docs/r/pinpoint_apns_channel.markdown @@ -15,7 +15,7 @@ Provides a Pinpoint APNs Channel resource. ## Example Usage -```hcl +```terraform resource "aws_pinpoint_apns_channel" "apns" { application_id = aws_pinpoint_app.app.application_id @@ -52,6 +52,10 @@ If you choose to use __Key credentials__ you will have to provide: * `token_key` - (Required) The `.p8` file that you download from your Apple developer account when you create an authentication key. * `token_key_id` - (Required) The ID assigned to your signing key. To find this value, choose Certificates, IDs & Profiles, and choose your key in the Keys section. +## Attributes Reference + +No additional attributes are exported. + ## Import Pinpoint APNs Channel can be imported using the `application-id`, e.g. diff --git a/website/docs/r/pinpoint_apns_sandbox_channel.markdown b/website/docs/r/pinpoint_apns_sandbox_channel.markdown index e960514236d2..afb52dc4c67b 100644 --- a/website/docs/r/pinpoint_apns_sandbox_channel.markdown +++ b/website/docs/r/pinpoint_apns_sandbox_channel.markdown @@ -15,7 +15,7 @@ Provides a Pinpoint APNs Sandbox Channel resource. ## Example Usage -```hcl +```terraform resource "aws_pinpoint_apns_sandbox_channel" "apns_sandbox" { application_id = aws_pinpoint_app.app.application_id @@ -52,6 +52,10 @@ If you choose to use __Key credentials__ you will have to provide: * `token_key` - (Required) The `.p8` file that you download from your Apple developer account when you create an authentication key. * `token_key_id` - (Required) The ID assigned to your signing key. To find this value, choose Certificates, IDs & Profiles, and choose your key in the Keys section. +## Attributes Reference + +No additional attributes are exported. + ## Import Pinpoint APNs Sandbox Channel can be imported using the `application-id`, e.g. diff --git a/website/docs/r/pinpoint_apns_voip_channel.markdown b/website/docs/r/pinpoint_apns_voip_channel.markdown index f4ad7f4c2d60..bbfd5f49be3f 100644 --- a/website/docs/r/pinpoint_apns_voip_channel.markdown +++ b/website/docs/r/pinpoint_apns_voip_channel.markdown @@ -15,7 +15,7 @@ Provides a Pinpoint APNs VoIP Channel resource. ## Example Usage -```hcl +```terraform resource "aws_pinpoint_apns_voip_channel" "apns_voip" { application_id = aws_pinpoint_app.app.application_id @@ -52,6 +52,10 @@ If you choose to use __Key credentials__ you will have to provide: * `token_key` - (Required) The `.p8` file that you download from your Apple developer account when you create an authentication key. * `token_key_id` - (Required) The ID assigned to your signing key. To find this value, choose Certificates, IDs & Profiles, and choose your key in the Keys section. +## Attributes Reference + +No additional attributes are exported. + ## Import Pinpoint APNs VoIP Channel can be imported using the `application-id`, e.g. diff --git a/website/docs/r/pinpoint_apns_voip_sandbox_channel.markdown b/website/docs/r/pinpoint_apns_voip_sandbox_channel.markdown index 16a6da761930..c6b45c0b64ac 100644 --- a/website/docs/r/pinpoint_apns_voip_sandbox_channel.markdown +++ b/website/docs/r/pinpoint_apns_voip_sandbox_channel.markdown @@ -15,7 +15,7 @@ Provides a Pinpoint APNs VoIP Sandbox Channel resource. ## Example Usage -```hcl +```terraform resource "aws_pinpoint_apns_voip_sandbox_channel" "apns_voip_sandbox" { application_id = aws_pinpoint_app.app.application_id @@ -52,6 +52,10 @@ If you choose to use __Key credentials__ you will have to provide: * `token_key` - (Required) The `.p8` file that you download from your Apple developer account when you create an authentication key. * `token_key_id` - (Required) The ID assigned to your signing key. To find this value, choose Certificates, IDs & Profiles, and choose your key in the Keys section. +## Attributes Reference + +No additional attributes are exported. + ## Import Pinpoint APNs VoIP Sandbox Channel can be imported using the `application-id`, e.g. diff --git a/website/docs/r/pinpoint_app.markdown b/website/docs/r/pinpoint_app.markdown index 969205f58dea..3be04d6dbb13 100644 --- a/website/docs/r/pinpoint_app.markdown +++ b/website/docs/r/pinpoint_app.markdown @@ -12,7 +12,7 @@ Provides a Pinpoint App resource. ## Example Usage -```hcl +```terraform resource "aws_pinpoint_app" "example" { name = "test-app" diff --git a/website/docs/r/pinpoint_baidu_channel.markdown b/website/docs/r/pinpoint_baidu_channel.markdown index cbe3767c6471..c97299ba5bb7 100644 --- a/website/docs/r/pinpoint_baidu_channel.markdown +++ b/website/docs/r/pinpoint_baidu_channel.markdown @@ -16,7 +16,7 @@ Provides a Pinpoint Baidu Channel resource. ## Example Usage -```hcl +```terraform resource "aws_pinpoint_app" "app" {} resource "aws_pinpoint_baidu_channel" "channel" { @@ -36,6 +36,10 @@ The following arguments are supported: * `api_key` - (Required) Platform credential API key from Baidu. * `secret_key` - (Required) Platform credential Secret key from Baidu. +## Attributes Reference + +No additional attributes are exported. + ## Import Pinpoint Baidu Channel can be imported using the `application-id`, e.g. diff --git a/website/docs/r/pinpoint_email_channel.markdown b/website/docs/r/pinpoint_email_channel.markdown index 3cc7404b2b89..a96011ea2336 100644 --- a/website/docs/r/pinpoint_email_channel.markdown +++ b/website/docs/r/pinpoint_email_channel.markdown @@ -12,7 +12,7 @@ Provides a Pinpoint Email Channel resource. ## Example Usage -```hcl +```terraform resource "aws_pinpoint_email_channel" "email" { application_id = aws_pinpoint_app.app.application_id from_address = "user@example.com" @@ -73,6 +73,7 @@ The following arguments are supported: * `application_id` - (Required) The application ID. * `enabled` - (Optional) Whether the channel is enabled or disabled. Defaults to `true`. +* `configuration_set` - (Optional) The ARN of the Amazon SES configuration set that you want to apply to messages that you send through the channel. * `from_address` - (Required) The email address used to send emails from. * `identity` - (Required) The ARN of an identity verified with SES. * `role_arn` - (Required) The ARN of an IAM Role used to submit events to Mobile Analytics' event ingestion service. diff --git a/website/docs/r/pinpoint_event_stream.markdown b/website/docs/r/pinpoint_event_stream.markdown index 740929f7dc8d..f8b918716954 100644 --- a/website/docs/r/pinpoint_event_stream.markdown +++ b/website/docs/r/pinpoint_event_stream.markdown @@ -12,7 +12,7 @@ Provides a Pinpoint Event Stream resource. ## Example Usage -```hcl +```terraform resource "aws_pinpoint_event_stream" "stream" { application_id = aws_pinpoint_app.app.application_id destination_stream_arn = aws_kinesis_stream.test_stream.arn @@ -75,6 +75,10 @@ The following arguments are supported: * `destination_stream_arn` - (Required) The Amazon Resource Name (ARN) of the Amazon Kinesis stream or Firehose delivery stream to which you want to publish events. * `role_arn` - (Required) The IAM role that authorizes Amazon Pinpoint to publish events to the stream in your account. +## Attributes Reference + +No additional attributes are exported. + ## Import Pinpoint Event Stream can be imported using the `application-id`, e.g. diff --git a/website/docs/r/pinpoint_gcm_channel.markdown b/website/docs/r/pinpoint_gcm_channel.markdown index 72adcda5205a..89681cfc681b 100644 --- a/website/docs/r/pinpoint_gcm_channel.markdown +++ b/website/docs/r/pinpoint_gcm_channel.markdown @@ -15,7 +15,7 @@ Provides a Pinpoint GCM Channel resource. ## Example Usage -```hcl +```terraform resource "aws_pinpoint_gcm_channel" "gcm" { application_id = aws_pinpoint_app.app.application_id api_key = "api_key" @@ -33,6 +33,10 @@ The following arguments are supported: * `api_key` - (Required) Platform credential API key from Google. * `enabled` - (Optional) Whether the channel is enabled or disabled. Defaults to `true`. +## Attributes Reference + +No additional attributes are exported. + ## Import Pinpoint GCM Channel can be imported using the `application-id`, e.g. diff --git a/website/docs/r/pinpoint_sms_channel.markdown b/website/docs/r/pinpoint_sms_channel.markdown index b7e3ea4efafc..b6a99c69c9b3 100644 --- a/website/docs/r/pinpoint_sms_channel.markdown +++ b/website/docs/r/pinpoint_sms_channel.markdown @@ -12,7 +12,7 @@ Provides a Pinpoint SMS Channel resource. ## Example Usage -```hcl +```terraform resource "aws_pinpoint_sms_channel" "sms" { application_id = aws_pinpoint_app.app.application_id } diff --git a/website/docs/r/placement_group.html.markdown b/website/docs/r/placement_group.html.markdown index 3c3380c05f38..495b73c28720 100644 --- a/website/docs/r/placement_group.html.markdown +++ b/website/docs/r/placement_group.html.markdown @@ -13,7 +13,7 @@ in [AWS Docs](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-grou ## Example Usage -```hcl +```terraform resource "aws_placement_group" "web" { name = "hunky-dory-pg" strategy = "cluster" diff --git a/website/docs/r/prometheus_workspace.html.markdown b/website/docs/r/prometheus_workspace.html.markdown index 79e16ddc98ff..1288aef852ec 100644 --- a/website/docs/r/prometheus_workspace.html.markdown +++ b/website/docs/r/prometheus_workspace.html.markdown @@ -14,7 +14,7 @@ Manages an Amazon Managed Service for Prometheus (AMP) Workspace. ## Example Usage -```hcl +```terraform resource "aws_prometheus_workspace" "demo" { alias = "prometheus-test" } diff --git a/website/docs/r/proxy_protocol_policy.html.markdown b/website/docs/r/proxy_protocol_policy.html.markdown index 45b6828ccec7..b38a2c6e3bd8 100644 --- a/website/docs/r/proxy_protocol_policy.html.markdown +++ b/website/docs/r/proxy_protocol_policy.html.markdown @@ -12,7 +12,7 @@ Provides a proxy protocol policy, which allows an ELB to carry a client connecti ## Example Usage -```hcl +```terraform resource "aws_elb" "lb" { name = "test-lb" availability_zones = ["us-east-1a"] diff --git a/website/docs/r/qldb_ledger.html.markdown b/website/docs/r/qldb_ledger.html.markdown index c5c92da4a788..8ed920a68378 100644 --- a/website/docs/r/qldb_ledger.html.markdown +++ b/website/docs/r/qldb_ledger.html.markdown @@ -14,7 +14,7 @@ Provides an AWS Quantum Ledger Database (QLDB) resource ## Example Usage -```hcl +```terraform resource "aws_qldb_ledger" "sample-ledger" { name = "sample-ledger" } diff --git a/website/docs/r/quicksight_group.html.markdown b/website/docs/r/quicksight_group.html.markdown index 580d65854861..f3b9cc8bc83b 100644 --- a/website/docs/r/quicksight_group.html.markdown +++ b/website/docs/r/quicksight_group.html.markdown @@ -12,7 +12,7 @@ Resource for managing QuickSight Group ## Example Usage -```hcl +```terraform resource "aws_quicksight_group" "example" { group_name = "tf-example" } diff --git a/website/docs/r/quicksight_user.html.markdown b/website/docs/r/quicksight_user.html.markdown index 60a2e4e6b3f4..117a4134e771 100644 --- a/website/docs/r/quicksight_user.html.markdown +++ b/website/docs/r/quicksight_user.html.markdown @@ -12,7 +12,7 @@ Resource for managing QuickSight User ## Example Usage -```hcl +```terraform resource "aws_quicksight_user" "example" { user_name = "an-author" email = "author@example.com" @@ -37,7 +37,7 @@ The following arguments are supported: ## Attributes Reference -All above attributes except for `session_name` and `identity_type` are exported as well as: +In addition to all arguments above, the following attributes are exported: * `arn` - Amazon Resource Name (ARN) of the user diff --git a/website/docs/r/ram_principal_association.markdown b/website/docs/r/ram_principal_association.markdown index 1b36d4d30433..ff0633ff1d0b 100644 --- a/website/docs/r/ram_principal_association.markdown +++ b/website/docs/r/ram_principal_association.markdown @@ -24,7 +24,7 @@ When RAM Sharing with AWS Organizations is not enabled: ### AWS Account ID -```hcl +```terraform resource "aws_ram_resource_share" "example" { # ... other configuration ... allow_external_principals = true @@ -38,7 +38,7 @@ resource "aws_ram_principal_association" "example" { ### AWS Organization -```hcl +```terraform resource "aws_ram_principal_association" "example" { principal = aws_organizations_organization.example.arn resource_share_arn = aws_ram_resource_share.example.arn diff --git a/website/docs/r/ram_resource_association.html.markdown b/website/docs/r/ram_resource_association.html.markdown index 71c091630651..126428dbcb56 100644 --- a/website/docs/r/ram_resource_association.html.markdown +++ b/website/docs/r/ram_resource_association.html.markdown @@ -14,7 +14,7 @@ Manages a Resource Access Manager (RAM) Resource Association. ## Example Usage -```hcl +```terraform resource "aws_ram_resource_association" "example" { resource_arn = aws_subnet.example.arn resource_share_arn = aws_ram_resource_share.example.arn diff --git a/website/docs/r/ram_resource_share.markdown b/website/docs/r/ram_resource_share.markdown index 7eca5a62de1b..2e7c95021d65 100644 --- a/website/docs/r/ram_resource_share.markdown +++ b/website/docs/r/ram_resource_share.markdown @@ -12,7 +12,7 @@ Manages a Resource Access Manager (RAM) Resource Share. To associate principals ## Example Usage -```hcl +```terraform resource "aws_ram_resource_share" "example" { name = "example" allow_external_principals = true diff --git a/website/docs/r/ram_resource_share_accepter.markdown b/website/docs/r/ram_resource_share_accepter.markdown index d8895f7933f7..d89d797b2772 100644 --- a/website/docs/r/ram_resource_share_accepter.markdown +++ b/website/docs/r/ram_resource_share_accepter.markdown @@ -16,7 +16,7 @@ Manage accepting a Resource Access Manager (RAM) Resource Share invitation. From This configuration provides an example of using multiple Terraform AWS providers to configure two different AWS accounts. In the _sender_ account, the configuration creates a `aws_ram_resource_share` and uses a data source in the _receiver_ account to create a `aws_ram_principal_association` resource with the _receiver's_ account ID. In the _receiver_ account, the configuration accepts the invitation to share resources with the `aws_ram_resource_share_accepter`. -```hcl +```terraform provider "aws" { profile = "profile2" } diff --git a/website/docs/r/rds_cluster.html.markdown b/website/docs/r/rds_cluster.html.markdown index 165097e739ee..678a43c70b5e 100644 --- a/website/docs/r/rds_cluster.html.markdown +++ b/website/docs/r/rds_cluster.html.markdown @@ -32,7 +32,7 @@ for more information. ### Aurora MySQL 2.x (MySQL 5.7) -```hcl +```terraform resource "aws_rds_cluster" "default" { cluster_identifier = "aurora-cluster-demo" engine = "aurora-mysql" @@ -48,7 +48,7 @@ resource "aws_rds_cluster" "default" { ### Aurora MySQL 1.x (MySQL 5.6) -```hcl +```terraform resource "aws_rds_cluster" "default" { cluster_identifier = "aurora-cluster-demo" availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] @@ -62,7 +62,7 @@ resource "aws_rds_cluster" "default" { ### Aurora with PostgreSQL engine -```hcl +```terraform resource "aws_rds_cluster" "postgresql" { cluster_identifier = "aurora-cluster-demo" engine = "aurora-postgresql" @@ -79,7 +79,7 @@ resource "aws_rds_cluster" "postgresql" { -> More information about Aurora Multi-Master Clusters can be found in the [RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/AuroraUserGuide/aurora-multi-master.html). -```hcl +```terraform resource "aws_rds_cluster" "example" { cluster_identifier = "example" db_subnet_group_name = aws_db_subnet_group.example.name @@ -140,7 +140,7 @@ Full details on the core parameters and impacts are in the API Docs: [RestoreDBC ~> **NOTE:** RDS Aurora Serverless does not support loading data from S3, so its not possible to directly use `engine_mode` set to `serverless` with `s3_import`. -```hcl +```terraform resource "aws_rds_cluster" "db" { engine = "aurora" @@ -168,7 +168,7 @@ This will not recreate the resource if the S3 object changes in some way. It's o Example: -```hcl +```terraform resource "aws_rds_cluster" "example-clone" { # ... other configuration ... @@ -192,7 +192,7 @@ resource "aws_rds_cluster" "example-clone" { Example: -```hcl +```terraform resource "aws_rds_cluster" "example" { # ... other configuration ... diff --git a/website/docs/r/rds_cluster_endpoint.html.markdown b/website/docs/r/rds_cluster_endpoint.html.markdown index 5c1121fe1b89..dd9c5707527c 100644 --- a/website/docs/r/rds_cluster_endpoint.html.markdown +++ b/website/docs/r/rds_cluster_endpoint.html.markdown @@ -14,7 +14,7 @@ You can refer to the [User Guide][1]. ## Example Usage -```hcl +```terraform resource "aws_rds_cluster" "default" { cluster_identifier = "aurora-cluster-demo" availability_zones = ["us-west-2a", "us-west-2b", "us-west-2c"] diff --git a/website/docs/r/rds_cluster_instance.html.markdown b/website/docs/r/rds_cluster_instance.html.markdown index 0c81f2b7b256..02d14991bd70 100644 --- a/website/docs/r/rds_cluster_instance.html.markdown +++ b/website/docs/r/rds_cluster_instance.html.markdown @@ -25,7 +25,7 @@ For more information on Amazon Aurora, see [Aurora on Amazon RDS][2] in the Amaz ## Example Usage -```hcl +```terraform resource "aws_rds_cluster_instance" "cluster_instances" { count = 2 identifier = "aurora-cluster-demo-${count.index}" diff --git a/website/docs/r/rds_cluster_parameter_group.markdown b/website/docs/r/rds_cluster_parameter_group.markdown index d19afdc698c3..6e76b4bbcd81 100644 --- a/website/docs/r/rds_cluster_parameter_group.markdown +++ b/website/docs/r/rds_cluster_parameter_group.markdown @@ -15,7 +15,7 @@ Provides an RDS DB cluster parameter group resource. Documentation of the availa ## Example Usage -```hcl +```terraform resource "aws_rds_cluster_parameter_group" "default" { name = "rds-cluster-pg" family = "aurora5.6" diff --git a/website/docs/r/rds_global_cluster.html.markdown b/website/docs/r/rds_global_cluster.html.markdown index de76a8e43275..1dcf1ff03e51 100644 --- a/website/docs/r/rds_global_cluster.html.markdown +++ b/website/docs/r/rds_global_cluster.html.markdown @@ -16,7 +16,7 @@ More information about Aurora global databases can be found in the [Aurora User ### New Global Cluster -```hcl +```terraform provider "aws" { alias = "primary" region = "us-east-2" @@ -65,7 +65,7 @@ resource "aws_rds_cluster_instance" "secondary" { ### New Global Cluster From Existing DB Cluster -```hcl +```terraform resource "aws_rds_cluster" "example" { # ... other configuration ... @@ -123,7 +123,7 @@ Certain resource arguments, like `force_destroy`, only exist within Terraform. I Certain resource arguments, like `source_db_cluster_identifier`, do not have an API method for reading the information after creation. If the argument is set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use [`ignore_changes`](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to hide the difference, e.g. -```hcl +```terraform resource "aws_rds_global_cluster" "example" { # ... other configuration ... diff --git a/website/docs/r/redshift_cluster.html.markdown b/website/docs/r/redshift_cluster.html.markdown index e46ad1e46446..026510da8ab1 100644 --- a/website/docs/r/redshift_cluster.html.markdown +++ b/website/docs/r/redshift_cluster.html.markdown @@ -15,7 +15,7 @@ Provides a Redshift Cluster Resource. ## Example Usage -```hcl +```terraform resource "aws_redshift_cluster" "default" { cluster_identifier = "tf-redshift-cluster" database_name = "mydb" diff --git a/website/docs/r/redshift_event_subscription.html.markdown b/website/docs/r/redshift_event_subscription.html.markdown index 09dfa25f31bd..80e2fd5f0719 100644 --- a/website/docs/r/redshift_event_subscription.html.markdown +++ b/website/docs/r/redshift_event_subscription.html.markdown @@ -12,7 +12,7 @@ Provides a Redshift event subscription resource. ## Example Usage -```hcl +```terraform resource "aws_redshift_cluster" "default" { cluster_identifier = "default" database_name = "default" @@ -59,9 +59,9 @@ The following arguments are supported: * `enabled` - (Optional) A boolean flag to enable/disable the subscription. Defaults to true. * `tags` - (Optional) A map of tags to assign to the resource. -## Attributes +## Attributes Reference -The following additional atttributes are provided: +In addition to all arguments above, the following attributes are exported: * `arn` - Amazon Resource Name (ARN) of the Redshift event notification subscription * `id` - The name of the Redshift event notification subscription diff --git a/website/docs/r/redshift_parameter_group.html.markdown b/website/docs/r/redshift_parameter_group.html.markdown index 4b09c3fe3d59..bb32df9f8ba5 100644 --- a/website/docs/r/redshift_parameter_group.html.markdown +++ b/website/docs/r/redshift_parameter_group.html.markdown @@ -12,7 +12,7 @@ Provides a Redshift Cluster parameter group resource. ## Example Usage -```hcl +```terraform resource "aws_redshift_parameter_group" "bar" { name = "parameter-group-test-terraform" family = "redshift-1.0" diff --git a/website/docs/r/redshift_security_group.html.markdown b/website/docs/r/redshift_security_group.html.markdown index 869166489982..8c3ec47afee5 100644 --- a/website/docs/r/redshift_security_group.html.markdown +++ b/website/docs/r/redshift_security_group.html.markdown @@ -12,7 +12,7 @@ Creates a new Amazon Redshift security group. You use security groups to control ## Example Usage -```hcl +```terraform resource "aws_redshift_security_group" "default" { name = "redshift-sg" diff --git a/website/docs/r/redshift_snapshot_copy_grant.html.markdown b/website/docs/r/redshift_snapshot_copy_grant.html.markdown index 09a6242ea149..91cf613b9588 100644 --- a/website/docs/r/redshift_snapshot_copy_grant.html.markdown +++ b/website/docs/r/redshift_snapshot_copy_grant.html.markdown @@ -14,7 +14,7 @@ Note that the grant must exist in the destination region, and not in the region ## Example Usage -```hcl +```terraform resource "aws_redshift_snapshot_copy_grant" "test" { snapshot_copy_grant_name = "my-grant" } diff --git a/website/docs/r/redshift_snapshot_schedule.html.markdown b/website/docs/r/redshift_snapshot_schedule.html.markdown index fa5f0f23ae13..e69fdd14dde2 100644 --- a/website/docs/r/redshift_snapshot_schedule.html.markdown +++ b/website/docs/r/redshift_snapshot_schedule.html.markdown @@ -10,7 +10,7 @@ description: |- ## Example Usage -```hcl +```terraform resource "aws_redshift_snapshot_schedule" "default" { identifier = "tf-redshift-snapshot-schedule" definitions = [ @@ -31,6 +31,12 @@ identifier beginning with the specified prefix. Conflicts with `identifier`. * `force_destroy` - (Optional) Whether to destroy all associated clusters with this snapshot schedule on deletion. Must be enabled and applied before attempting deletion. * `tags` - (Optional) A map of tags to assign to the resource. +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `arn` - Amazon Resource Name (ARN) of the Redshift Snapshot Schedule. + ## Import Redshift Snapshot Schedule can be imported using the `identifier`, e.g. diff --git a/website/docs/r/redshift_snapshot_schedule_association.html.markdown b/website/docs/r/redshift_snapshot_schedule_association.html.markdown index 14b9c8b01945..952888df4d7b 100644 --- a/website/docs/r/redshift_snapshot_schedule_association.html.markdown +++ b/website/docs/r/redshift_snapshot_schedule_association.html.markdown @@ -10,7 +10,7 @@ description: |- ## Example Usage -```hcl +```terraform resource "aws_redshift_cluster" "default" { cluster_identifier = "tf-redshift-cluster" database_name = "mydb" @@ -40,6 +40,10 @@ The following arguments are supported: * `cluster_identifier` - (Required, Forces new resource) The cluster identifier. * `schedule_identifier` - (Required, Forces new resource) The snapshot schedule identifier. +## Attributes Reference + +No additional attributes are exported. + ## Import Redshift Snapshot Schedule Association can be imported using the `/`, e.g. diff --git a/website/docs/r/redshift_subnet_group.html.markdown b/website/docs/r/redshift_subnet_group.html.markdown index 930e47518822..1f42bd6db520 100644 --- a/website/docs/r/redshift_subnet_group.html.markdown +++ b/website/docs/r/redshift_subnet_group.html.markdown @@ -12,7 +12,7 @@ Creates a new Amazon Redshift subnet group. You must provide a list of one or mo ## Example Usage -```hcl +```terraform resource "aws_vpc" "foo" { cidr_block = "10.1.0.0/16" } diff --git a/website/docs/r/resourcegroups_group.html.markdown b/website/docs/r/resourcegroups_group.html.markdown index 5d81066ffbda..ed0fbfa8db44 100644 --- a/website/docs/r/resourcegroups_group.html.markdown +++ b/website/docs/r/resourcegroups_group.html.markdown @@ -12,7 +12,7 @@ Provides a Resource Group. ## Example Usage -```hcl +```terraform resource "aws_resourcegroups_group" "test" { name = "test-group" diff --git a/website/docs/r/route.html.markdown b/website/docs/r/route.html.markdown index 4dc66df7bb70..a3fab4fd1a91 100644 --- a/website/docs/r/route.html.markdown +++ b/website/docs/r/route.html.markdown @@ -16,9 +16,11 @@ defined in-line. At this time you cannot use a Route Table with in-line routes in conjunction with any Route resources. Doing so will cause a conflict of rule settings and will overwrite rules. +~> **NOTE on `gateway_id` attribute:** The AWS API is very forgiving with the resource ID passed in the `gateway_id` attribute. For example an `aws_route` resource can be created with an [`aws_nat_gateway`](nat_gateway.html) or [`aws_egress_only_internet_gateway`](egress_only_internet_gateway.html) ID specified for the `gateway_id` attribute. Specifying anything other than an [`aws_internet_gateway`](internet_gateway.html) or [`aws_vpn_gateway`](vpn_gateway.html) ID will lead to Terraform reporting a permanent diff between your configuration and recorded state, as the AWS API returns the more-specific attribute. If you are experiencing constant diffs with an `aws_route` resource, the first thing to check is that the correct attribute is being specified. + ## Example Usage -```hcl +```terraform resource "aws_route" "r" { route_table_id = "rtb-4fbb3ac4" destination_cidr_block = "10.0.1.0/22" @@ -29,7 +31,7 @@ resource "aws_route" "r" { ## Example IPv6 Usage -```hcl +```terraform resource "aws_vpc" "vpc" { cidr_block = "10.1.0.0/16" assign_generated_ipv6_cidr_block = true @@ -59,6 +61,7 @@ One of the following destination arguments must be supplied: One of the following target arguments must be supplied: +* `carrier_gateway_id` - (Optional) Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone. * `egress_only_gateway_id` - (Optional) Identifier of a VPC Egress Only Internet Gateway. * `gateway_id` - (Optional) Identifier of a VPC internet gateway or a virtual private gateway. * `instance_id` - (Optional) Identifier of an EC2 instance. diff --git a/website/docs/r/route53_delegation_set.html.markdown b/website/docs/r/route53_delegation_set.html.markdown index 1a405692bcb2..374524db6a5e 100644 --- a/website/docs/r/route53_delegation_set.html.markdown +++ b/website/docs/r/route53_delegation_set.html.markdown @@ -12,7 +12,7 @@ Provides a [Route53 Delegation Set](https://docs.aws.amazon.com/Route53/latest/A ## Example Usage -```hcl +```terraform resource "aws_route53_delegation_set" "main" { reference_name = "DynDNS" } diff --git a/website/docs/r/route53_health_check.html.markdown b/website/docs/r/route53_health_check.html.markdown index 78546e28ca8d..00e686bf9a0a 100644 --- a/website/docs/r/route53_health_check.html.markdown +++ b/website/docs/r/route53_health_check.html.markdown @@ -13,7 +13,7 @@ Provides a Route53 health check. ### Connectivity and HTTP Status Code Check -```hcl +```terraform resource "aws_route53_health_check" "example" { fqdn = "example.com" port = 80 @@ -30,7 +30,7 @@ resource "aws_route53_health_check" "example" { ### Connectivity and String Matching Check -```hcl +```terraform resource "aws_route53_health_check" "example" { failure_threshold = "5" fqdn = "example.com" @@ -44,7 +44,7 @@ resource "aws_route53_health_check" "example" { ### Aggregate Check -```hcl +```terraform resource "aws_route53_health_check" "parent" { type = "CALCULATED" child_health_threshold = 1 @@ -58,7 +58,7 @@ resource "aws_route53_health_check" "parent" { ### CloudWatch Alarm Check -```hcl +```terraform resource "aws_cloudwatch_metric_alarm" "foobar" { alarm_name = "terraform-test-foobar5" comparison_operator = "GreaterThanOrEqualToThreshold" diff --git a/website/docs/r/route53_hosted_zone_dnssec.html.markdown b/website/docs/r/route53_hosted_zone_dnssec.html.markdown index ae35fca4b0f4..17a6bc4eaf71 100644 --- a/website/docs/r/route53_hosted_zone_dnssec.html.markdown +++ b/website/docs/r/route53_hosted_zone_dnssec.html.markdown @@ -12,7 +12,7 @@ Manages Route 53 Hosted Zone Domain Name System Security Extensions (DNSSEC). Fo ## Example Usage -```hcl +```terraform provider "aws" { region = "us-east-1" } diff --git a/website/docs/r/route53_key_signing_key.html.markdown b/website/docs/r/route53_key_signing_key.html.markdown index c61c74063c4c..2f16effa4922 100644 --- a/website/docs/r/route53_key_signing_key.html.markdown +++ b/website/docs/r/route53_key_signing_key.html.markdown @@ -12,7 +12,7 @@ Manages a Route 53 Key Signing Key. To manage Domain Name System Security Extens ## Example Usage -```hcl +```terraform provider "aws" { region = "us-east-1" } diff --git a/website/docs/r/route53_query_log.html.markdown b/website/docs/r/route53_query_log.html.markdown index 9e20e531b842..e3c7c1ad46c4 100644 --- a/website/docs/r/route53_query_log.html.markdown +++ b/website/docs/r/route53_query_log.html.markdown @@ -18,7 +18,7 @@ See [Configuring Logging for DNS Queries](https://docs.aws.amazon.com/Route53/la ## Example Usage -```hcl +```terraform # Example CloudWatch log group in us-east-1 provider "aws" { diff --git a/website/docs/r/route53_record.html.markdown b/website/docs/r/route53_record.html.markdown index 5d0fd3eb5ca3..b65b1eba7081 100644 --- a/website/docs/r/route53_record.html.markdown +++ b/website/docs/r/route53_record.html.markdown @@ -14,7 +14,7 @@ Provides a Route53 record resource. ### Simple routing policy -```hcl +```terraform resource "aws_route53_record" "www" { zone_id = aws_route53_zone.primary.zone_id name = "www.example.com" @@ -27,7 +27,7 @@ resource "aws_route53_record" "www" { ### Weighted routing policy Other routing policies are configured similarly. See [AWS Route53 Developer Guide](https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html) for details. -```hcl +```terraform resource "aws_route53_record" "www-dev" { zone_id = aws_route53_zone.primary.zone_id name = "www" @@ -64,7 +64,7 @@ to understand differences between alias and non-alias records. TTL for all alias records is [60 seconds](https://aws.amazon.com/route53/faqs/#dns_failover_do_i_need_to_adjust), you cannot change this, therefore `ttl` has to be omitted in alias records. -```hcl +```terraform resource "aws_elb" "main" { name = "foobar-terraform-elb" availability_zones = ["us-east-1c"] @@ -94,7 +94,7 @@ resource "aws_route53_record" "www" { When creating Route 53 zones, the `NS` and `SOA` records for the zone are automatically created. Enabling the `allow_overwrite` argument will allow managing these records in a single Terraform run without the requirement for `terraform import`. -```hcl +```terraform resource "aws_route53_zone" "example" { name = "test.example.com" } diff --git a/website/docs/r/route53_resolver_dnssec_config.html.markdown b/website/docs/r/route53_resolver_dnssec_config.html.markdown index 326efa867f07..2dcf9ba1655a 100644 --- a/website/docs/r/route53_resolver_dnssec_config.html.markdown +++ b/website/docs/r/route53_resolver_dnssec_config.html.markdown @@ -12,7 +12,7 @@ Provides a Route 53 Resolver DNSSEC config resource. ## Example Usage -```hcl +```terraform resource "aws_vpc" "example" { cidr_block = "10.0.0.0/16" enable_dns_support = true diff --git a/website/docs/r/route53_resolver_endpoint.html.markdown b/website/docs/r/route53_resolver_endpoint.html.markdown index 5c6dd617aed7..850709354854 100644 --- a/website/docs/r/route53_resolver_endpoint.html.markdown +++ b/website/docs/r/route53_resolver_endpoint.html.markdown @@ -12,7 +12,7 @@ Provides a Route 53 Resolver endpoint resource. ## Example Usage -```hcl +```terraform resource "aws_route53_resolver_endpoint" "foo" { name = "foo" direction = "INBOUND" diff --git a/website/docs/r/route53_resolver_query_log_config.html.markdown b/website/docs/r/route53_resolver_query_log_config.html.markdown index 5070a4e58680..1c994e97490f 100644 --- a/website/docs/r/route53_resolver_query_log_config.html.markdown +++ b/website/docs/r/route53_resolver_query_log_config.html.markdown @@ -12,7 +12,7 @@ Provides a Route 53 Resolver query logging configuration resource. ## Example Usage -```hcl +```terraform resource "aws_route53_resolver_query_log_config" "example" { name = "example" destination_arn = aws_s3_bucket.example.arn diff --git a/website/docs/r/route53_resolver_query_log_config_association.html.markdown b/website/docs/r/route53_resolver_query_log_config_association.html.markdown index de8b338bc5e2..7a9cbc40e948 100644 --- a/website/docs/r/route53_resolver_query_log_config_association.html.markdown +++ b/website/docs/r/route53_resolver_query_log_config_association.html.markdown @@ -12,7 +12,7 @@ Provides a Route 53 Resolver query logging configuration association resource. ## Example Usage -```hcl +```terraform resource "aws_route53_resolver_query_log_config_association" "example" { resolver_query_log_config_id = aws_route53_resolver_query_log_config.example.id resource_id = aws_vpc.example.id diff --git a/website/docs/r/route53_resolver_rule.html.markdown b/website/docs/r/route53_resolver_rule.html.markdown index d5594f5db0d2..7da51bd4378c 100644 --- a/website/docs/r/route53_resolver_rule.html.markdown +++ b/website/docs/r/route53_resolver_rule.html.markdown @@ -14,7 +14,7 @@ Provides a Route53 Resolver rule. ### System rule -```hcl +```terraform resource "aws_route53_resolver_rule" "sys" { domain_name = "subdomain.example.com" rule_type = "SYSTEM" @@ -23,7 +23,7 @@ resource "aws_route53_resolver_rule" "sys" { ### Forward rule -```hcl +```terraform resource "aws_route53_resolver_rule" "fwd" { domain_name = "example.com" name = "example" diff --git a/website/docs/r/route53_resolver_rule_association.html.markdown b/website/docs/r/route53_resolver_rule_association.html.markdown index 3435b89e018d..67e118ddb615 100644 --- a/website/docs/r/route53_resolver_rule_association.html.markdown +++ b/website/docs/r/route53_resolver_rule_association.html.markdown @@ -12,7 +12,7 @@ Provides a Route53 Resolver rule association. ## Example Usage -```hcl +```terraform resource "aws_route53_resolver_rule_association" "example" { resolver_rule_id = aws_route53_resolver_rule.sys.id vpc_id = aws_vpc.foo.id diff --git a/website/docs/r/route53_vpc_association_authorization.html.markdown b/website/docs/r/route53_vpc_association_authorization.html.markdown index 9d3464325221..f762dd13255f 100644 --- a/website/docs/r/route53_vpc_association_authorization.html.markdown +++ b/website/docs/r/route53_vpc_association_authorization.html.markdown @@ -12,7 +12,7 @@ Authorizes a VPC in a peer account to be associated with a local Route53 Hosted ## Example Usage -```hcl +```terraform provider "aws" { } diff --git a/website/docs/r/route53_zone.html.markdown b/website/docs/r/route53_zone.html.markdown index 1b1e2690cf63..8f6b9ee48a95 100644 --- a/website/docs/r/route53_zone.html.markdown +++ b/website/docs/r/route53_zone.html.markdown @@ -14,7 +14,7 @@ Manages a Route53 Hosted Zone. For managing Domain Name System Security Extensio ### Public Zone -```hcl +```terraform resource "aws_route53_zone" "primary" { name = "example.com" } @@ -26,7 +26,7 @@ For use in subdomains, note that you need to create a `aws_route53_record` of type `NS` as well as the subdomain zone. -```hcl +```terraform resource "aws_route53_zone" "main" { name = "example.com" } @@ -54,7 +54,7 @@ resource "aws_route53_record" "dev-ns" { ~> **NOTE:** Private zones require at least one VPC association at all times. -```hcl +```terraform resource "aws_route53_zone" "private" { name = "example.com" diff --git a/website/docs/r/route53_zone_association.html.markdown b/website/docs/r/route53_zone_association.html.markdown index c39fef313eb0..b93039a8c3d9 100644 --- a/website/docs/r/route53_zone_association.html.markdown +++ b/website/docs/r/route53_zone_association.html.markdown @@ -16,7 +16,7 @@ Manages a Route53 Hosted Zone VPC association. VPC associations can only be made ## Example Usage -```hcl +```terraform resource "aws_vpc" "primary" { cidr_block = "10.6.0.0/16" enable_dns_hostnames = true diff --git a/website/docs/r/route_table.html.markdown b/website/docs/r/route_table.html.markdown index a3c4e945aa4a..db094952204c 100644 --- a/website/docs/r/route_table.html.markdown +++ b/website/docs/r/route_table.html.markdown @@ -31,22 +31,36 @@ the separate resource. ## Example Usage -```hcl -resource "aws_route_table" "r" { - vpc_id = aws_vpc.default.id +```terraform +resource "aws_route_table" "example" { + vpc_id = aws_vpc.example.id route { cidr_block = "10.0.1.0/24" - gateway_id = aws_internet_gateway.main.id + gateway_id = aws_internet_gateway.example.id } route { ipv6_cidr_block = "::/0" - egress_only_gateway_id = aws_egress_only_internet_gateway.foo.id + egress_only_gateway_id = aws_egress_only_internet_gateway.example.id } tags = { - Name = "main" + Name = "example" + } +} +``` + +To subsequently remove all managed routes: + +```terraform +resource "aws_route_table" "example" { + vpc_id = aws_vpc.example.id + + route = [] + + tags = { + Name = "example" } } ``` @@ -57,6 +71,7 @@ The following arguments are supported: * `vpc_id` - (Required) The VPC ID. * `route` - (Optional) A list of route objects. Their keys are documented below. This argument is processed in [attribute-as-blocks mode](https://www.terraform.io/docs/configuration/attr-as-blocks.html). +This means that omitting this argument is interpreted as ignoring any existing routes. To remove all managed routes an empty list should be specified. See the example above. * `tags` - (Optional) A map of tags to assign to the resource. * `propagating_vgws` - (Optional) A list of virtual gateways for propagation. @@ -69,11 +84,12 @@ One of the following destination arguments must be supplied: One of the following target arguments must be supplied: +* `carrier_gateway_id` - (Optional) Identifier of a carrier gateway. This attribute can only be used when the VPC contains a subnet which is associated with a Wavelength Zone. * `egress_only_gateway_id` - (Optional) Identifier of a VPC Egress Only Internet Gateway. * `gateway_id` - (Optional) Identifier of a VPC internet gateway or a virtual private gateway. * `instance_id` - (Optional) Identifier of an EC2 instance. -* `nat_gateway_id` - (Optional) Identifier of a VPC NAT gateway. * `local_gateway_id` - (Optional) Identifier of a Outpost local gateway. +* `nat_gateway_id` - (Optional) Identifier of a VPC NAT gateway. * `network_interface_id` - (Optional) Identifier of an EC2 network interface. * `transit_gateway_id` - (Optional) Identifier of an EC2 Transit Gateway. * `vpc_endpoint_id` - (Optional) Identifier of a VPC Endpoint. @@ -89,6 +105,7 @@ In addition to all arguments above, the following attributes are exported: attribute once the route resource is created. * `id` - The ID of the routing table. +* `arn` - The ARN of the route table. * `owner_id` - The ID of the AWS account that owns the route table. ## Import diff --git a/website/docs/r/route_table_association.html.markdown b/website/docs/r/route_table_association.html.markdown index ac6b1f27417a..47f0c4814094 100644 --- a/website/docs/r/route_table_association.html.markdown +++ b/website/docs/r/route_table_association.html.markdown @@ -13,14 +13,14 @@ internet gateway or virtual private gateway. ## Example Usage -```hcl +```terraform resource "aws_route_table_association" "a" { subnet_id = aws_subnet.foo.id route_table_id = aws_route_table.bar.id } ``` -```hcl +```terraform resource "aws_route_table_association" "b" { gateway_id = aws_internet_gateway.foo.id route_table_id = aws_route_table.bar.id diff --git a/website/docs/r/s3_access_point.html.markdown b/website/docs/r/s3_access_point.html.markdown index 555a222dcc4d..6bec98c99207 100644 --- a/website/docs/r/s3_access_point.html.markdown +++ b/website/docs/r/s3_access_point.html.markdown @@ -16,7 +16,7 @@ Provides a resource to manage an S3 Access Point. ### AWS Partition Bucket -```hcl +```terraform resource "aws_s3_bucket" "example" { bucket = "example" } @@ -29,7 +29,7 @@ resource "aws_s3_access_point" "example" { ### S3 on Outposts Bucket -```hcl +```terraform resource "aws_s3control_bucket" "example" { bucket = "example" } diff --git a/website/docs/r/s3_account_public_access_block.html.markdown b/website/docs/r/s3_account_public_access_block.html.markdown index 87c883b616f8..8e0065ca9ccd 100644 --- a/website/docs/r/s3_account_public_access_block.html.markdown +++ b/website/docs/r/s3_account_public_access_block.html.markdown @@ -16,7 +16,7 @@ Manages S3 account-level Public Access Block configuration. For more information ## Example Usage -```hcl +```terraform resource "aws_s3_account_public_access_block" "example" { block_public_acls = true block_public_policy = true diff --git a/website/docs/r/s3_bucket.html.markdown b/website/docs/r/s3_bucket.html.markdown index ae1f785c637d..b9e5a7dab681 100644 --- a/website/docs/r/s3_bucket.html.markdown +++ b/website/docs/r/s3_bucket.html.markdown @@ -16,7 +16,7 @@ Provides a S3 bucket resource. ### Private Bucket w/ Tags -```hcl +```terraform resource "aws_s3_bucket" "b" { bucket = "my-tf-test-bucket" acl = "private" @@ -30,7 +30,7 @@ resource "aws_s3_bucket" "b" { ### Static Website Hosting -```hcl +```terraform resource "aws_s3_bucket" "b" { bucket = "s3-website-test.hashicorp.com" acl = "public-read" @@ -56,7 +56,7 @@ EOF ### Using CORS -```hcl +```terraform resource "aws_s3_bucket" "b" { bucket = "s3-website-test.hashicorp.com" acl = "public-read" @@ -73,7 +73,7 @@ resource "aws_s3_bucket" "b" { ### Using versioning -```hcl +```terraform resource "aws_s3_bucket" "b" { bucket = "my-tf-test-bucket" acl = "private" @@ -86,7 +86,7 @@ resource "aws_s3_bucket" "b" { ### Enable Logging -```hcl +```terraform resource "aws_s3_bucket" "log_bucket" { bucket = "my-tf-log-bucket" acl = "log-delivery-write" @@ -105,7 +105,7 @@ resource "aws_s3_bucket" "b" { ### Using object lifecycle -```hcl +```terraform resource "aws_s3_bucket" "bucket" { bucket = "my-bucket" acl = "private" @@ -178,7 +178,7 @@ resource "aws_s3_bucket" "versioning_bucket" { ### Using replication configuration -```hcl +```terraform provider "aws" { region = "eu-west-1" } @@ -289,7 +289,7 @@ resource "aws_s3_bucket" "bucket" { ### Enable Default Server Side Encryption -```hcl +```terraform resource "aws_kms_key" "mykey" { description = "This key is used to encrypt bucket objects" deletion_window_in_days = 10 @@ -311,7 +311,7 @@ resource "aws_s3_bucket" "mybucket" { ### Using ACL policy grants -```hcl +```terraform data "aws_canonical_user_id" "current_user" {} resource "aws_s3_bucket" "bucket" { diff --git a/website/docs/r/s3_bucket_analytics_configuration.html.markdown b/website/docs/r/s3_bucket_analytics_configuration.html.markdown index efdf0a91938a..73ccb431c85a 100644 --- a/website/docs/r/s3_bucket_analytics_configuration.html.markdown +++ b/website/docs/r/s3_bucket_analytics_configuration.html.markdown @@ -14,7 +14,7 @@ Provides a S3 bucket [analytics configuration](https://docs.aws.amazon.com/Amazo ### Add analytics configuration for entire S3 bucket and export results to a second S3 bucket -```hcl +```terraform resource "aws_s3_bucket_analytics_configuration" "example-entire-bucket" { bucket = aws_s3_bucket.example.bucket name = "EntireBucket" @@ -41,7 +41,7 @@ resource "aws_s3_bucket" "analytics" { ### Add analytics configuration with S3 bucket object filter -```hcl +```terraform resource "aws_s3_bucket_analytics_configuration" "example-filtered" { bucket = aws_s3_bucket.example.bucket name = "ImportantBlueDocuments" @@ -95,6 +95,10 @@ The `s3_bucket_destination` configuration supports the following: * `format` - (Optional) The output format of exported analytics data. Allowed values: `CSV`. Default value: `CSV`. * `prefix` - (Optional) The prefix to append to exported analytics data. +## Attributes Reference + +No additional attributes are exported. + ## Import S3 bucket analytics configurations can be imported using `bucket:analytics`, e.g. diff --git a/website/docs/r/s3_bucket_inventory.html.markdown b/website/docs/r/s3_bucket_inventory.html.markdown index 59fabe61c660..288f4115d260 100644 --- a/website/docs/r/s3_bucket_inventory.html.markdown +++ b/website/docs/r/s3_bucket_inventory.html.markdown @@ -14,7 +14,7 @@ Provides a S3 bucket [inventory configuration](https://docs.aws.amazon.com/Amazo ### Add inventory configuration -```hcl +```terraform resource "aws_s3_bucket" "test" { bucket = "my-tf-test-bucket" } @@ -44,7 +44,7 @@ resource "aws_s3_bucket_inventory" "test" { ### Add inventory configuration with S3 bucket object prefix -```hcl +```terraform resource "aws_s3_bucket" "test" { bucket = "my-tf-test-bucket" } @@ -120,6 +120,10 @@ The `sse_kms` configuration supports the following: * `key_id` - (Required) The ARN of the KMS customer master key (CMK) used to encrypt the inventory file. +## Attributes Reference + +No additional attributes are exported. + ## Import S3 bucket inventory configurations can be imported using `bucket:inventory`, e.g. diff --git a/website/docs/r/s3_bucket_metric.html.markdown b/website/docs/r/s3_bucket_metric.html.markdown index ca638137ae07..6e5c7d6256d5 100644 --- a/website/docs/r/s3_bucket_metric.html.markdown +++ b/website/docs/r/s3_bucket_metric.html.markdown @@ -14,7 +14,7 @@ Provides a S3 bucket [metrics configuration](http://docs.aws.amazon.com/AmazonS3 ### Add metrics configuration for entire S3 bucket -```hcl +```terraform resource "aws_s3_bucket" "example" { bucket = "example" } @@ -27,7 +27,7 @@ resource "aws_s3_bucket_metric" "example-entire-bucket" { ### Add metrics configuration with S3 bucket object filter -```hcl +```terraform resource "aws_s3_bucket" "example" { bucket = "example" } @@ -62,6 +62,10 @@ The `filter` metric configuration supports the following: * `prefix` - (Optional) Object prefix for filtering (singular). * `tags` - (Optional) Object tags for filtering (up to 10). +## Attributes Reference + +No additional attributes are exported. + ## Import S3 bucket metric configurations can be imported using `bucket:metric`, e.g. diff --git a/website/docs/r/s3_bucket_notification.html.markdown b/website/docs/r/s3_bucket_notification.html.markdown index fb4b66d98334..e4ff22224e7d 100644 --- a/website/docs/r/s3_bucket_notification.html.markdown +++ b/website/docs/r/s3_bucket_notification.html.markdown @@ -16,7 +16,7 @@ Manages a S3 Bucket Notification Configuration. For additional information, see ### Add notification configuration to SNS Topic -```hcl +```terraform resource "aws_sns_topic" "topic" { name = "s3-event-notification-topic" @@ -53,7 +53,7 @@ resource "aws_s3_bucket_notification" "bucket_notification" { ### Add notification configuration to SQS Queue -```hcl +```terraform resource "aws_sqs_queue" "queue" { name = "s3-event-notification-queue" @@ -92,7 +92,7 @@ resource "aws_s3_bucket_notification" "bucket_notification" { ### Add notification configuration to Lambda Function -```hcl +```terraform resource "aws_iam_role" "iam_for_lambda" { name = "iam_for_lambda" @@ -148,7 +148,7 @@ resource "aws_s3_bucket_notification" "bucket_notification" { ### Trigger multiple Lambda functions -```hcl +```terraform resource "aws_iam_role" "iam_for_lambda" { name = "iam_for_lambda" @@ -229,7 +229,7 @@ resource "aws_s3_bucket_notification" "bucket_notification" { ### Add multiple notification configurations to SQS Queue -```hcl +```terraform resource "aws_sqs_queue" "queue" { name = "s3-event-notification-queue" @@ -329,6 +329,10 @@ The `lambda_function` notification configuration supports the following: * `filter_prefix` - (Optional) Specifies object key name prefix. * `filter_suffix` - (Optional) Specifies object key name suffix. +## Attributes Reference + +No additional attributes are exported. + ## Import S3 bucket notification can be imported using the `bucket`, e.g. diff --git a/website/docs/r/s3_bucket_object.html.markdown b/website/docs/r/s3_bucket_object.html.markdown index fd7bb5090d20..8d0698a43a11 100644 --- a/website/docs/r/s3_bucket_object.html.markdown +++ b/website/docs/r/s3_bucket_object.html.markdown @@ -14,7 +14,7 @@ Provides a S3 bucket object resource. ### Uploading a file to a bucket -```hcl +```terraform resource "aws_s3_bucket_object" "object" { bucket = "your_bucket_name" key = "new_object_key" @@ -29,7 +29,7 @@ resource "aws_s3_bucket_object" "object" { ### Encrypting with KMS Key -```hcl +```terraform resource "aws_kms_key" "examplekms" { description = "KMS key 1" deletion_window_in_days = 7 @@ -50,7 +50,7 @@ resource "aws_s3_bucket_object" "examplebucket_object" { ### Server Side Encryption with S3 Default Master Key -```hcl +```terraform resource "aws_s3_bucket" "examplebucket" { bucket = "examplebuckettftest" acl = "private" @@ -66,7 +66,7 @@ resource "aws_s3_bucket_object" "examplebucket_object" { ### Server Side Encryption with AWS-Managed Key -```hcl +```terraform resource "aws_s3_bucket" "examplebucket" { bucket = "examplebuckettftest" acl = "private" @@ -82,7 +82,7 @@ resource "aws_s3_bucket_object" "examplebucket_object" { ### S3 Object Lock -```hcl +```terraform resource "aws_s3_bucket" "examplebucket" { bucket = "examplebuckettftest" acl = "private" diff --git a/website/docs/r/s3_bucket_ownership_controls.html.markdown b/website/docs/r/s3_bucket_ownership_controls.html.markdown index 40ea8eceb549..381026776536 100644 --- a/website/docs/r/s3_bucket_ownership_controls.html.markdown +++ b/website/docs/r/s3_bucket_ownership_controls.html.markdown @@ -12,7 +12,7 @@ Provides a resource to manage S3 Bucket Ownership Controls. For more information ## Example Usage -```hcl +```terraform resource "aws_s3_bucket" "example" { bucket = "example" } diff --git a/website/docs/r/s3_bucket_policy.html.markdown b/website/docs/r/s3_bucket_policy.html.markdown index 8c7931910f82..425917b025e7 100644 --- a/website/docs/r/s3_bucket_policy.html.markdown +++ b/website/docs/r/s3_bucket_policy.html.markdown @@ -14,7 +14,7 @@ Attaches a policy to an S3 bucket resource. ### Basic Usage -```hcl +```terraform resource "aws_s3_bucket" "b" { bucket = "my-tf-test-bucket" } @@ -55,6 +55,9 @@ The following arguments are supported: * `bucket` - (Required) The name of the bucket to which to apply the policy. * `policy` - (Required) The text of the policy. For more information about building AWS IAM policy documents with Terraform, see the [AWS IAM Policy Document Guide](https://learn.hashicorp.com/terraform/aws/iam-policy). Note: Bucket policies are limited to 20 KB in size. +## Attributes Reference + +No additional attributes are exported. ## Import diff --git a/website/docs/r/s3_bucket_public_access_block.html.markdown b/website/docs/r/s3_bucket_public_access_block.html.markdown index e6311ee50460..d40aceb16cef 100644 --- a/website/docs/r/s3_bucket_public_access_block.html.markdown +++ b/website/docs/r/s3_bucket_public_access_block.html.markdown @@ -12,7 +12,7 @@ Manages S3 bucket-level Public Access Block configuration. For more information ## Example Usage -```hcl +```terraform resource "aws_s3_bucket" "example" { bucket = "example" } diff --git a/website/docs/r/s3_object_copy.html.markdown b/website/docs/r/s3_object_copy.html.markdown index bc92efe0c475..76b05e18ee51 100644 --- a/website/docs/r/s3_object_copy.html.markdown +++ b/website/docs/r/s3_object_copy.html.markdown @@ -12,7 +12,7 @@ Provides a resource for copying an S3 object. ## Example Usage -```hcl +```terraform resource "aws_s3_object_copy" "test" { bucket = "destination_bucket" key = "destination_key" @@ -91,7 +91,7 @@ This configuration block has the following optional arguments (one of the three ## Attributes Reference -The following attributes are exported +In addition to all arguments above, the following attributes are exported: * `etag` - The ETag generated for the object (an MD5 sum of the object content). For plaintext objects or objects encrypted with an AWS-managed key, the hash is an MD5 digest of the object data. For objects encrypted with a KMS key or objects created by either the Multipart Upload or Part Copy operation, the hash is not an MD5 digest, regardless of the method of encryption. More information on possible values can be found on [Common Response Headers](https://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html). * `expiration` - If the object expiration is configured, this attribute will be set. diff --git a/website/docs/r/s3control_bucket.html.markdown b/website/docs/r/s3control_bucket.html.markdown index d71da2ce72bd..874cf7790109 100644 --- a/website/docs/r/s3control_bucket.html.markdown +++ b/website/docs/r/s3control_bucket.html.markdown @@ -14,7 +14,7 @@ Provides a resource to manage an S3 Control Bucket. ## Example Usage -```hcl +```terraform resource "aws_s3control_bucket" "example" { bucket = "example" outpost_id = data.aws_outposts_outpost.example.id diff --git a/website/docs/r/s3control_bucket_lifecycle_configuration.html.markdown b/website/docs/r/s3control_bucket_lifecycle_configuration.html.markdown index 0cc5533f1099..304392dc66b6 100644 --- a/website/docs/r/s3control_bucket_lifecycle_configuration.html.markdown +++ b/website/docs/r/s3control_bucket_lifecycle_configuration.html.markdown @@ -16,7 +16,7 @@ Provides a resource to manage an S3 Control Bucket Lifecycle Configuration. ## Example Usage -```hcl +```terraform resource "aws_s3control_bucket_lifecycle_configuration" "example" { bucket = aws_s3control_bucket.example.arn diff --git a/website/docs/r/s3control_bucket_policy.html.markdown b/website/docs/r/s3control_bucket_policy.html.markdown index 8fc4ffe5fc36..b3e90c62786b 100644 --- a/website/docs/r/s3control_bucket_policy.html.markdown +++ b/website/docs/r/s3control_bucket_policy.html.markdown @@ -14,7 +14,7 @@ Provides a resource to manage an S3 Control Bucket Policy. ## Example Usage -```hcl +```terraform resource "aws_s3control_bucket_policy" "example" { bucket = aws_s3control_bucket.example.arn policy = jsonencode({ diff --git a/website/docs/r/s3outposts_endpoint.html.markdown b/website/docs/r/s3outposts_endpoint.html.markdown index f447eff3cefb..c1837a159157 100644 --- a/website/docs/r/s3outposts_endpoint.html.markdown +++ b/website/docs/r/s3outposts_endpoint.html.markdown @@ -12,7 +12,7 @@ Provides a resource to manage an S3 Outposts Endpoint. ## Example Usage -```hcl +```terraform resource "aws_s3outposts_endpoint" "example" { outpost_id = data.aws_outposts_outpost.example.id security_group_id = aws_security_group.example.id diff --git a/website/docs/r/sagemaker_app.html.markdown b/website/docs/r/sagemaker_app.html.markdown index 8da790af8897..c14b69bb1d8c 100644 --- a/website/docs/r/sagemaker_app.html.markdown +++ b/website/docs/r/sagemaker_app.html.markdown @@ -14,7 +14,7 @@ Provides a Sagemaker App resource. ### Basic usage -```hcl +```terraform resource "aws_sagemaker_app" "example" { domain_id = aws_sagemaker_domain.example.id user_profile_name = aws_sagemaker_user_profile.example.user_profile_name @@ -42,12 +42,11 @@ The following arguments are supported: ## Attributes Reference -The following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `id` - The Amazon Resource Name (ARN) of the app. * `arn` - The Amazon Resource Name (ARN) of the app. - ## Import Sagemaker Code Apps can be imported using the `id`, e.g. diff --git a/website/docs/r/sagemaker_app_image_config.html.markdown b/website/docs/r/sagemaker_app_image_config.html.markdown index e6fc28163f46..a90519d1af0d 100644 --- a/website/docs/r/sagemaker_app_image_config.html.markdown +++ b/website/docs/r/sagemaker_app_image_config.html.markdown @@ -14,7 +14,7 @@ Provides a Sagemaker App Image Config resource. ### Basic usage -```hcl +```terraform resource "aws_sagemaker_app_image_config" "test" { app_image_config_name = "example" @@ -28,7 +28,7 @@ resource "aws_sagemaker_app_image_config" "test" { ### Default File System Config -```hcl +```terraform resource "aws_sagemaker_app_image_config" "test" { app_image_config_name = "example" diff --git a/website/docs/r/sagemaker_code_repository.html.markdown b/website/docs/r/sagemaker_code_repository.html.markdown index 70f5db89881c..09a0e758c479 100644 --- a/website/docs/r/sagemaker_code_repository.html.markdown +++ b/website/docs/r/sagemaker_code_repository.html.markdown @@ -14,7 +14,7 @@ Provides a Sagemaker Code Repository resource. ### Basic usage -```hcl +```terraform resource "aws_sagemaker_code_repository" "example" { code_repository_name = "example" @@ -26,7 +26,7 @@ resource "aws_sagemaker_code_repository" "example" { ### Example with Secret -```hcl +```terraform resource "aws_secretsmanager_secret" "example" { name = "example" } diff --git a/website/docs/r/sagemaker_domain.html.markdown b/website/docs/r/sagemaker_domain.html.markdown index 1e663fb07eae..86c55cfc21ed 100644 --- a/website/docs/r/sagemaker_domain.html.markdown +++ b/website/docs/r/sagemaker_domain.html.markdown @@ -14,7 +14,7 @@ Provides a Sagemaker Domain resource. ### Basic usage -```hcl +```terraform resource "aws_sagemaker_domain" "example" { domain_name = "example" auth_mode = "IAM" @@ -46,7 +46,7 @@ data "aws_iam_policy_document" "example" { ### Using Custom Images -```hcl +```terraform resource "aws_sagemaker_image" "test" { image_name = "example" role_arn = aws_iam_role.test.arn @@ -140,7 +140,7 @@ The following arguments are supported: ## Attributes Reference -The following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `id` - The ID of the Domain. * `arn` - The Amazon Resource Name (ARN) assigned by AWS to this Domain. @@ -148,7 +148,6 @@ The following attributes are exported: * `single_sign_on_managed_application_instance_id` - The SSO managed application instance ID. * `home_efs_file_system_id` - The ID of the Amazon Elastic File System (EFS) managed by this Domain. - ## Import Sagemaker Code Domains can be imported using the `id`, e.g. diff --git a/website/docs/r/sagemaker_endpoint.html.markdown b/website/docs/r/sagemaker_endpoint.html.markdown index d5c802393446..4b43829e82cd 100644 --- a/website/docs/r/sagemaker_endpoint.html.markdown +++ b/website/docs/r/sagemaker_endpoint.html.markdown @@ -14,7 +14,7 @@ Provides a SageMaker Endpoint resource. Basic usage: -```hcl +```terraform resource "aws_sagemaker_endpoint" "e" { name = "my-endpoint" endpoint_config_name = aws_sagemaker_endpoint_configuration.ec.name diff --git a/website/docs/r/sagemaker_endpoint_configuration.html.markdown b/website/docs/r/sagemaker_endpoint_configuration.html.markdown index 82f9315448ca..e4d95b18db81 100644 --- a/website/docs/r/sagemaker_endpoint_configuration.html.markdown +++ b/website/docs/r/sagemaker_endpoint_configuration.html.markdown @@ -15,7 +15,7 @@ Provides a SageMaker endpoint configuration resource. Basic usage: -```hcl +```terraform resource "aws_sagemaker_endpoint_configuration" "ec" { name = "my-endpoint-config" diff --git a/website/docs/r/sagemaker_feature_group.html.markdown b/website/docs/r/sagemaker_feature_group.html.markdown index e27c72bef4bf..3913eb6475ab 100644 --- a/website/docs/r/sagemaker_feature_group.html.markdown +++ b/website/docs/r/sagemaker_feature_group.html.markdown @@ -14,7 +14,7 @@ Provides a SageMaker Feature Group resource. Basic usage: -```hcl +```terraform resource "aws_sagemaker_feature_group" "example" { feature_group_name = "example" record_identifier_feature_name = "example" diff --git a/website/docs/r/sagemaker_image.html.markdown b/website/docs/r/sagemaker_image.html.markdown index ebe5416cee10..283fdef6225d 100644 --- a/website/docs/r/sagemaker_image.html.markdown +++ b/website/docs/r/sagemaker_image.html.markdown @@ -14,7 +14,7 @@ Provides a Sagemaker Image resource. ### Basic usage -```hcl +```terraform resource "aws_sagemaker_image" "example" { image_name = "example" role_arn = aws_iam_role.test.arn @@ -33,7 +33,7 @@ The following arguments are supported: ## Attributes Reference -The following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `id` - The name of the Image. * `arn` - The Amazon Resource Name (ARN) assigned by AWS to this Image. diff --git a/website/docs/r/sagemaker_image_version.html.markdown b/website/docs/r/sagemaker_image_version.html.markdown index ad86e2fac40c..ee732e31864c 100644 --- a/website/docs/r/sagemaker_image_version.html.markdown +++ b/website/docs/r/sagemaker_image_version.html.markdown @@ -14,7 +14,7 @@ Provides a Sagemaker Image Version resource. ### Basic usage -```hcl +```terraform resource "aws_sagemaker_image_version" "test" { image_name = aws_sagemaker_image.test.id base_image = "012345678912.dkr.ecr.us-west-2.amazonaws.com/image:latest" @@ -30,7 +30,7 @@ The following arguments are supported: ## Attributes Reference -The following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `id` - The name of the Image. * `arn` - The Amazon Resource Name (ARN) assigned by AWS to this Image Version. diff --git a/website/docs/r/sagemaker_model.html.markdown b/website/docs/r/sagemaker_model.html.markdown index aaaa1d3468ef..b34405d565dc 100644 --- a/website/docs/r/sagemaker_model.html.markdown +++ b/website/docs/r/sagemaker_model.html.markdown @@ -14,7 +14,7 @@ Provides a SageMaker model resource. Basic usage: -```hcl +```terraform resource "aws_sagemaker_model" "example" { name = "my-model" execution_role_arn = aws_iam_role.example.arn diff --git a/website/docs/r/sagemaker_model_package_group.html.markdown b/website/docs/r/sagemaker_model_package_group.html.markdown index d5346652e3ee..db0b4b35446c 100644 --- a/website/docs/r/sagemaker_model_package_group.html.markdown +++ b/website/docs/r/sagemaker_model_package_group.html.markdown @@ -14,7 +14,7 @@ Provides a Sagemaker Model Package Group resource. ### Basic usage -```hcl +```terraform resource "aws_sagemaker_model_package_group" "example" { model_package_group_name = "example" } @@ -30,7 +30,7 @@ The following arguments are supported: ## Attributes Reference -The following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `id` - The name of the Model Package Group. * `arn` - The Amazon Resource Name (ARN) assigned by AWS to this Model Package Group. diff --git a/website/docs/r/sagemaker_notebook_instance.html.markdown b/website/docs/r/sagemaker_notebook_instance.html.markdown index f42db4b3553c..1f9e7586a8bb 100644 --- a/website/docs/r/sagemaker_notebook_instance.html.markdown +++ b/website/docs/r/sagemaker_notebook_instance.html.markdown @@ -14,7 +14,7 @@ Provides a Sagemaker Notebook Instance resource. ### Basic usage -```hcl +```terraform resource "aws_sagemaker_notebook_instance" "ni" { name = "my-notebook-instance" role_arn = aws_iam_role.role.arn @@ -28,7 +28,7 @@ resource "aws_sagemaker_notebook_instance" "ni" { ### Code repository usage -```hcl +```terraform resource "aws_sagemaker_code_repository" "example" { code_repository_name = "my-notebook-instance-code-repo" diff --git a/website/docs/r/sagemaker_notebook_instance_lifecycle_configuration.html.markdown b/website/docs/r/sagemaker_notebook_instance_lifecycle_configuration.html.markdown index 54bd3ec3b825..99e989d9e201 100644 --- a/website/docs/r/sagemaker_notebook_instance_lifecycle_configuration.html.markdown +++ b/website/docs/r/sagemaker_notebook_instance_lifecycle_configuration.html.markdown @@ -14,7 +14,7 @@ Provides a lifecycle configuration for SageMaker Notebook Instances. Usage: -```hcl +```terraform resource "aws_sagemaker_notebook_instance_lifecycle_configuration" "lc" { name = "foo" on_create = base64encode("echo foo") diff --git a/website/docs/r/sagemaker_user_profile.html.markdown b/website/docs/r/sagemaker_user_profile.html.markdown index fe8d26dfed35..151f329db136 100644 --- a/website/docs/r/sagemaker_user_profile.html.markdown +++ b/website/docs/r/sagemaker_user_profile.html.markdown @@ -14,7 +14,7 @@ Provides a Sagemaker User Profile resource. ### Basic usage -```hcl +```terraform resource "aws_sagemaker_user_profile" "example" { domain_id = aws_sagemaker_domain.test.id user_profile_name = "example" @@ -73,13 +73,12 @@ The following arguments are supported: ## Attributes Reference -The following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `id` - The user profile Amazon Resource Name (ARN). * `arn` - The user profile Amazon Resource Name (ARN). * `home_efs_file_system_uid` - The ID of the user's profile in the Amazon Elastic File System (EFS) volume. - ## Import Sagemaker Code User Profiles can be imported using the `arn`, e.g. diff --git a/website/docs/r/secretsmanager_secret.html.markdown b/website/docs/r/secretsmanager_secret.html.markdown index ffe5d4ef638a..24ef93f62ec9 100644 --- a/website/docs/r/secretsmanager_secret.html.markdown +++ b/website/docs/r/secretsmanager_secret.html.markdown @@ -14,7 +14,7 @@ Provides a resource to manage AWS Secrets Manager secret metadata. To manage sec ### Basic -```hcl +```terraform resource "aws_secretsmanager_secret" "example" { name = "example" } @@ -28,7 +28,7 @@ To enable automatic secret rotation, the Secrets Manager service requires usage ~> **NOTE:** If you cancel a rotation that is in progress (by removing the `rotation` configuration), it can leave the VersionStage labels in an unexpected state. Depending on what step of the rotation was in progress, you might need to remove the staging label AWSPENDING from the partially created version, specified by the SecretVersionId response value. You should also evaluate the partially rotated new version to see if it should be deleted, which you can do by removing all staging labels from the new version's VersionStage field. -```hcl +```terraform resource "aws_secretsmanager_secret" "rotation-example" { name = "rotation-example" rotation_lambda_arn = aws_lambda_function.example.arn diff --git a/website/docs/r/secretsmanager_secret_policy.html.markdown b/website/docs/r/secretsmanager_secret_policy.html.markdown index 5416eeb09c27..df8c35d91b83 100644 --- a/website/docs/r/secretsmanager_secret_policy.html.markdown +++ b/website/docs/r/secretsmanager_secret_policy.html.markdown @@ -14,7 +14,7 @@ Provides a resource to manage AWS Secrets Manager secret policy. ### Basic -```hcl +```terraform resource "aws_secretsmanager_secret" "example" { name = "example" } @@ -49,7 +49,9 @@ The following arguments are supported: * `policy` - (Required) A valid JSON document representing a [resource policy](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_resource-based-policies.html). For more information about building AWS IAM policy documents with Terraform, see the [AWS IAM Policy Document Guide](https://learn.hashicorp.com/terraform/aws/iam-policy). * `block_public_policy` - (Optional) Makes an optional API call to Zelkova to validate the Resource Policy to prevent broad access to your secret. -## Attribute Reference +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: * `id` - Amazon Resource Name (ARN) of the secret. diff --git a/website/docs/r/secretsmanager_secret_rotation.html.markdown b/website/docs/r/secretsmanager_secret_rotation.html.markdown index 8acf22eb7fe4..307966364dd9 100644 --- a/website/docs/r/secretsmanager_secret_rotation.html.markdown +++ b/website/docs/r/secretsmanager_secret_rotation.html.markdown @@ -14,7 +14,7 @@ Provides a resource to manage AWS Secrets Manager secret rotation. To manage a s ### Basic -```hcl +```terraform resource "aws_secretsmanager_secret_rotation" "example" { secret_id = aws_secretsmanager_secret.example.id rotation_lambda_arn = aws_lambda_function.example.arn diff --git a/website/docs/r/secretsmanager_secret_version.html.markdown b/website/docs/r/secretsmanager_secret_version.html.markdown index 7629aac1759a..5728740522a2 100644 --- a/website/docs/r/secretsmanager_secret_version.html.markdown +++ b/website/docs/r/secretsmanager_secret_version.html.markdown @@ -16,7 +16,7 @@ Provides a resource to manage AWS Secrets Manager secret version including its s ### Simple String Value -```hcl +```terraform resource "aws_secretsmanager_secret_version" "example" { secret_id = aws_secretsmanager_secret.example.id secret_string = "example-string-to-protect" @@ -27,7 +27,7 @@ resource "aws_secretsmanager_secret_version" "example" { Secrets Manager also accepts key-value pairs in JSON. -```hcl +```terraform # The map here can come from other supported configurations # like locals, resource attribute, map() built-in, etc. variable "example" { @@ -47,7 +47,7 @@ resource "aws_secretsmanager_secret_version" "example" { Reading key-value pairs from JSON back into a native Terraform map can be accomplished in Terraform 0.12 and later with the [`jsondecode()` function](https://www.terraform.io/docs/configuration/functions/jsondecode.html): -```hcl +```terraform output "example" { value = jsondecode(aws_secretsmanager_secret_version.example.secret_string)["key1"] } diff --git a/website/docs/r/security_group.html.markdown b/website/docs/r/security_group.html.markdown index ca5d2b4f02f5..725cd6042645 100644 --- a/website/docs/r/security_group.html.markdown +++ b/website/docs/r/security_group.html.markdown @@ -25,7 +25,7 @@ a conflict of rule settings and will overwrite rules. Basic usage -```hcl +```terraform resource "aws_security_group" "allow_tls" { name = "allow_tls" description = "Allow TLS inbound traffic" @@ -116,7 +116,7 @@ specifically re-create it if you desire that rule. We feel this leads to fewer surprises in terms of controlling your egress rules. If you desire this rule to be in place, you can use this `egress` block: -```hcl +```terraform resource "aws_security_group" "example" { # ... other configuration ... @@ -136,7 +136,7 @@ Prefix Lists are either managed by AWS internally, or created by the customer us AWS are associated with a prefix list name, or service name, that is linked to a specific region. Prefix list IDs are exported on VPC Endpoints, so you can use this format: -```hcl +```terraform resource "aws_security_group" "example" { # ... other configuration ... @@ -174,7 +174,7 @@ In addition to all arguments above, the following attributes are exported: configuration options: - `create` - (Default `10m`) How long to wait for a security group to be created. -- `delete` - (Default `10m`) How long to retry on `DependencyViolation` errors during security group deletion from lingering ENIs left by certain AWS services such as Elastic Load Balancing. NOTE: Lambda ENIs can take up to 45 minutes to delete, which is not affected by changing this customizable timeout (in version 2.31.0 and later of the Terraform AWS Provider) unless it is increased above 45 minutes. +- `delete` - (Default `15m`) How long to retry on `DependencyViolation` errors during security group deletion from lingering ENIs left by certain AWS services such as Elastic Load Balancing. NOTE: Lambda ENIs can take up to 45 minutes to delete, which is not affected by changing this customizable timeout (in version 2.31.0 and later of the Terraform AWS Provider) unless it is increased above 45 minutes. ## Import diff --git a/website/docs/r/security_group_rule.html.markdown b/website/docs/r/security_group_rule.html.markdown index 9b1c0b249157..4d55b905311c 100644 --- a/website/docs/r/security_group_rule.html.markdown +++ b/website/docs/r/security_group_rule.html.markdown @@ -26,7 +26,7 @@ a conflict of rule settings and will overwrite rules. Basic usage -```hcl +```terraform resource "aws_security_group_rule" "example" { type = "ingress" from_port = 0 @@ -64,7 +64,7 @@ AWS are associated with a prefix list name, or service name, that is linked to a Prefix list IDs are exported on VPC Endpoints, so you can use this format: -```hcl +```terraform resource "aws_security_group_rule" "allow_all" { type = "egress" to_port = 0 diff --git a/website/docs/r/securityhub_account.markdown b/website/docs/r/securityhub_account.markdown index 04dcb09ad74e..05bdb1e9c717 100644 --- a/website/docs/r/securityhub_account.markdown +++ b/website/docs/r/securityhub_account.markdown @@ -14,7 +14,7 @@ Enables Security Hub for this AWS account. ## Example Usage -```hcl +```terraform resource "aws_securityhub_account" "example" {} ``` diff --git a/website/docs/r/securityhub_action_target.html.markdown b/website/docs/r/securityhub_action_target.html.markdown index 91420616ef42..3205e11ad875 100644 --- a/website/docs/r/securityhub_action_target.html.markdown +++ b/website/docs/r/securityhub_action_target.html.markdown @@ -12,7 +12,7 @@ Creates Security Hub custom action. ## Example Usage -```hcl +```terraform resource "aws_securityhub_account" "example" {} resource "aws_securityhub_action_target" "example" { diff --git a/website/docs/r/securityhub_invite_accepter.markdown b/website/docs/r/securityhub_invite_accepter.markdown index fac4506ebfb1..caec73c47327 100644 --- a/website/docs/r/securityhub_invite_accepter.markdown +++ b/website/docs/r/securityhub_invite_accepter.markdown @@ -6,7 +6,7 @@ description: |- Accepts a Security Hub invitation. --- -# aws_securityhub_invite_accepter +# Resource: aws_securityhub_invite_accepter -> **Note:** AWS accounts can only be associated with a single Security Hub master account. Destroying this resource will disassociate the member account from the master account. @@ -14,7 +14,7 @@ Accepts a Security Hub invitation. ## Example Usage -```hcl +```terraform resource "aws_securityhub_account" "example" {} resource "aws_securityhub_member" "example" { @@ -42,7 +42,7 @@ The following arguments are supported: ## Attributes Reference -The following attributes are exported in addition to the arguments listed above: +In addition to all arguments above, the following attributes are exported: * `invitation_id` - The ID of the invitation. @@ -51,5 +51,5 @@ The following attributes are exported in addition to the arguments listed above: Security Hub invite acceptance can be imported using the account ID, e.g. ``` -$ terraform import aws_securityhub_invite_acceptor.example 123456789012 +$ terraform import aws_securityhub_invite_accepter.example 123456789012 ``` \ No newline at end of file diff --git a/website/docs/r/securityhub_member.markdown b/website/docs/r/securityhub_member.markdown index d3b6a67d1435..4531108e15f7 100644 --- a/website/docs/r/securityhub_member.markdown +++ b/website/docs/r/securityhub_member.markdown @@ -12,7 +12,7 @@ Provides a Security Hub member resource. ## Example Usage -```hcl +```terraform resource "aws_securityhub_account" "example" {} resource "aws_securityhub_member" "example" { diff --git a/website/docs/r/securityhub_organization_admin_account.html.markdown b/website/docs/r/securityhub_organization_admin_account.html.markdown index 54760557bf3c..3941c489671f 100644 --- a/website/docs/r/securityhub_organization_admin_account.html.markdown +++ b/website/docs/r/securityhub_organization_admin_account.html.markdown @@ -12,7 +12,7 @@ Manages a Security Hub administrator account for an organization. The AWS accoun ## Example Usage -```hcl +```terraform resource "aws_organizations_organization" "example" { aws_service_access_principals = ["securityhub.amazonaws.com"] feature_set = "ALL" diff --git a/website/docs/r/securityhub_product_subscription.markdown b/website/docs/r/securityhub_product_subscription.markdown index 690968ea602d..ffe2f719e8dd 100644 --- a/website/docs/r/securityhub_product_subscription.markdown +++ b/website/docs/r/securityhub_product_subscription.markdown @@ -12,7 +12,7 @@ Subscribes to a Security Hub product. ## Example Usage -```hcl +```terraform resource "aws_securityhub_account" "example" {} data "aws_region" "current" {} diff --git a/website/docs/r/securityhub_standards_subscription.markdown b/website/docs/r/securityhub_standards_subscription.markdown index b988765a57e5..6bd11f7030e1 100644 --- a/website/docs/r/securityhub_standards_subscription.markdown +++ b/website/docs/r/securityhub_standards_subscription.markdown @@ -12,7 +12,7 @@ Subscribes to a Security Hub standard. ## Example Usage -```hcl +```terraform resource "aws_securityhub_account" "example" {} resource "aws_securityhub_standards_subscription" "cis" { diff --git a/website/docs/r/serverlessapplicationrepository_cloudformation_stack.html.markdown b/website/docs/r/serverlessapplicationrepository_cloudformation_stack.html.markdown index ea5a0c644a3e..305fcdf0fa77 100644 --- a/website/docs/r/serverlessapplicationrepository_cloudformation_stack.html.markdown +++ b/website/docs/r/serverlessapplicationrepository_cloudformation_stack.html.markdown @@ -12,7 +12,7 @@ Deploys an Application CloudFormation Stack from the Serverless Application Repo ## Example Usage -```hcl +```terraform resource "aws_serverlessapplicationrepository_cloudformation_stack" "postgres-rotator" { name = "postgres-rotator" application_id = "arn:aws:serverlessrepo:us-east-1:297356227824:applications/SecretsManagerRDSPostgreSQLRotationSingleUser" diff --git a/website/docs/r/service_discovery_http_namespace.html.markdown b/website/docs/r/service_discovery_http_namespace.html.markdown index 4c2969d46fd1..1fdd7cfa3140 100644 --- a/website/docs/r/service_discovery_http_namespace.html.markdown +++ b/website/docs/r/service_discovery_http_namespace.html.markdown @@ -11,7 +11,7 @@ description: |- ## Example Usage -```hcl +```terraform resource "aws_service_discovery_http_namespace" "example" { name = "development" description = "example" diff --git a/website/docs/r/service_discovery_private_dns_namespace.html.markdown b/website/docs/r/service_discovery_private_dns_namespace.html.markdown index 0a5cfa5d6721..3f486a7a9e9a 100644 --- a/website/docs/r/service_discovery_private_dns_namespace.html.markdown +++ b/website/docs/r/service_discovery_private_dns_namespace.html.markdown @@ -12,7 +12,7 @@ Provides a Service Discovery Private DNS Namespace resource. ## Example Usage -```hcl +```terraform resource "aws_vpc" "example" { cidr_block = "10.0.0.0/16" } diff --git a/website/docs/r/service_discovery_public_dns_namespace.html.markdown b/website/docs/r/service_discovery_public_dns_namespace.html.markdown index ad8f78a83ee4..b07af9b837aa 100644 --- a/website/docs/r/service_discovery_public_dns_namespace.html.markdown +++ b/website/docs/r/service_discovery_public_dns_namespace.html.markdown @@ -12,7 +12,7 @@ Provides a Service Discovery Public DNS Namespace resource. ## Example Usage -```hcl +```terraform resource "aws_service_discovery_public_dns_namespace" "example" { name = "hoge.example.com" description = "example" diff --git a/website/docs/r/service_discovery_service.html.markdown b/website/docs/r/service_discovery_service.html.markdown index 6b691cde263b..a892e4e8e701 100644 --- a/website/docs/r/service_discovery_service.html.markdown +++ b/website/docs/r/service_discovery_service.html.markdown @@ -12,7 +12,7 @@ Provides a Service Discovery Service resource. ## Example Usage -```hcl +```terraform resource "aws_vpc" "example" { cidr_block = "10.0.0.0/16" enable_dns_support = true @@ -45,7 +45,7 @@ resource "aws_service_discovery_service" "example" { } ``` -```hcl +```terraform resource "aws_service_discovery_public_dns_namespace" "example" { name = "example.terraform.com" description = "example" diff --git a/website/docs/r/servicecatalog_portfolio.html.markdown b/website/docs/r/servicecatalog_portfolio.html.markdown index 2667385ea6d8..3793a73a8f4b 100644 --- a/website/docs/r/servicecatalog_portfolio.html.markdown +++ b/website/docs/r/servicecatalog_portfolio.html.markdown @@ -12,7 +12,7 @@ Provides a resource to create a Service Catalog Portfolio. ## Example Usage -```hcl +```terraform resource "aws_servicecatalog_portfolio" "portfolio" { name = "My App Portfolio" description = "List of my organizations apps" diff --git a/website/docs/r/servicequotas_service_quota.html.markdown b/website/docs/r/servicequotas_service_quota.html.markdown index 6979f5730108..97208d1f13e2 100644 --- a/website/docs/r/servicequotas_service_quota.html.markdown +++ b/website/docs/r/servicequotas_service_quota.html.markdown @@ -12,7 +12,7 @@ Manages an individual Service Quota. ## Example Usage -```hcl +```terraform resource "aws_servicequotas_service_quota" "example" { quota_code = "L-F678F1CE" service_code = "vpc" diff --git a/website/docs/r/ses_active_receipt_rule_set.html.markdown b/website/docs/r/ses_active_receipt_rule_set.html.markdown index 23fb50b536cb..d085c5abe197 100644 --- a/website/docs/r/ses_active_receipt_rule_set.html.markdown +++ b/website/docs/r/ses_active_receipt_rule_set.html.markdown @@ -12,7 +12,7 @@ Provides a resource to designate the active SES receipt rule set ## Example Usage -```hcl +```terraform resource "aws_ses_active_receipt_rule_set" "main" { rule_set_name = "primary-rules" } @@ -26,7 +26,7 @@ The following arguments are supported: ## Attributes Reference -In addition to the arguments, which are exported, the following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `id` - The SES receipt rule set name. * `arn` - The SES receipt rule set ARN. diff --git a/website/docs/r/ses_configuration_set.html.markdown b/website/docs/r/ses_configuration_set.html.markdown index a45c051a980c..510aa53929f1 100644 --- a/website/docs/r/ses_configuration_set.html.markdown +++ b/website/docs/r/ses_configuration_set.html.markdown @@ -12,7 +12,7 @@ Provides an SES configuration set resource. ## Example Usage -```hcl +```terraform resource "aws_ses_configuration_set" "test" { name = "some-configuration-set-test" } @@ -20,7 +20,7 @@ resource "aws_ses_configuration_set" "test" { ### Require TLS Connections -```hcl +```terraform resource "aws_ses_configuration_set" "test" { name = "some-configuration-set-test" @@ -46,7 +46,7 @@ The following argument is optional: ## Attributes Reference -In addition to the arguments, which are exported, the following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `arn` - SES configuration set ARN. * `id` - SES configuration set name. diff --git a/website/docs/r/ses_domain_dkim.html.markdown b/website/docs/r/ses_domain_dkim.html.markdown index 5dd856438dd0..9a2a9202453a 100644 --- a/website/docs/r/ses_domain_dkim.html.markdown +++ b/website/docs/r/ses_domain_dkim.html.markdown @@ -31,7 +31,7 @@ In addition to all arguments above, the following attributes are exported: ## Example Usage -```hcl +```terraform resource "aws_ses_domain_identity" "example" { domain = "example.com" } diff --git a/website/docs/r/ses_domain_identity.html.markdown b/website/docs/r/ses_domain_identity.html.markdown index 23c7d6af2048..7185ac9d8fe1 100644 --- a/website/docs/r/ses_domain_identity.html.markdown +++ b/website/docs/r/ses_domain_identity.html.markdown @@ -32,7 +32,7 @@ In addition to all arguments above, the following attributes are exported: ## Example Usage -```hcl +```terraform resource "aws_ses_domain_identity" "example" { domain = "example.com" } diff --git a/website/docs/r/ses_domain_identity_verification.html.markdown b/website/docs/r/ses_domain_identity_verification.html.markdown index 2edfa29a94c2..d61954ab12ab 100644 --- a/website/docs/r/ses_domain_identity_verification.html.markdown +++ b/website/docs/r/ses_domain_identity_verification.html.markdown @@ -18,7 +18,7 @@ deploy the required DNS verification records, and wait for verification to compl ## Example Usage -```hcl +```terraform resource "aws_ses_domain_identity" "example" { domain = "example.com" } diff --git a/website/docs/r/ses_domain_mail_from.html.markdown b/website/docs/r/ses_domain_mail_from.html.markdown index a951fa546f94..455480b337b6 100644 --- a/website/docs/r/ses_domain_mail_from.html.markdown +++ b/website/docs/r/ses_domain_mail_from.html.markdown @@ -14,7 +14,7 @@ Provides an SES domain MAIL FROM resource. ## Example Usage -```hcl +```terraform resource "aws_ses_domain_mail_from" "example" { domain = aws_ses_domain_identity.example.domain mail_from_domain = "bounce.${aws_ses_domain_identity.example.domain}" diff --git a/website/docs/r/ses_email_identity.html.markdown b/website/docs/r/ses_email_identity.html.markdown index 59f543f6ba5f..e200389321a2 100644 --- a/website/docs/r/ses_email_identity.html.markdown +++ b/website/docs/r/ses_email_identity.html.markdown @@ -24,7 +24,7 @@ In addition to all arguments above, the following attributes are exported: ## Example Usage -```hcl +```terraform resource "aws_ses_email_identity" "example" { email = "email@example.com" } diff --git a/website/docs/r/ses_event_destination.html.markdown b/website/docs/r/ses_event_destination.html.markdown index 82c5f76d52eb..4a535761a2aa 100644 --- a/website/docs/r/ses_event_destination.html.markdown +++ b/website/docs/r/ses_event_destination.html.markdown @@ -14,7 +14,7 @@ Provides an SES event destination ### CloudWatch Destination -```hcl +```terraform resource "aws_ses_event_destination" "cloudwatch" { name = "event-destination-cloudwatch" configuration_set_name = aws_ses_configuration_set.example.name @@ -31,7 +31,7 @@ resource "aws_ses_event_destination" "cloudwatch" { ### Kinesis Destination -```hcl +```terraform resource "aws_ses_event_destination" "kinesis" { name = "event-destination-kinesis" configuration_set_name = aws_ses_configuration_set.example.name @@ -47,7 +47,7 @@ resource "aws_ses_event_destination" "kinesis" { ### SNS Destination -```hcl +```terraform resource "aws_ses_event_destination" "sns" { name = "event-destination-sns" configuration_set_name = aws_ses_configuration_set.example.name @@ -91,7 +91,7 @@ The following arguments are supported: ## Attributes Reference -In addition to the arguments, which are exported, the following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `id` - The SES event destination name. * `arn` - The SES event destination ARN. diff --git a/website/docs/r/ses_identity_notification_topic.markdown b/website/docs/r/ses_identity_notification_topic.markdown index 6148b6d66493..93dcfddbbd8e 100644 --- a/website/docs/r/ses_identity_notification_topic.markdown +++ b/website/docs/r/ses_identity_notification_topic.markdown @@ -12,7 +12,7 @@ Resource for managing SES Identity Notification Topics ## Example Usage -```hcl +```terraform resource "aws_ses_identity_notification_topic" "test" { topic_arn = aws_sns_topic.example.arn notification_type = "Bounce" @@ -30,19 +30,13 @@ The following arguments are supported: * `identity` - (Required) The identity for which the Amazon SNS topic will be set. You can specify an identity by using its name or by using its Amazon Resource Name (ARN). * `include_original_headers` - (Optional) Whether SES should include original email headers in SNS notifications of this type. *false* by default. -## Import - -Identity Notification Topics can be imported using ID of the record. The ID is made up as IDENTITY|TYPE where IDENTITY is the SES Identity and TYPE is the Notification Type. - -e.g. +## Attributes Reference -``` -example.com|Bounce -``` +No additional attributes are exported. -In this example, `example.com` is the SES Identity and `Bounce` is the Notification Type. +## Import -To import the ID above, it would look as follows: +Identity Notification Topics can be imported using ID of the record. The ID is made up as IDENTITY|TYPE where IDENTITY is the SES Identity and TYPE is the Notification Type. ``` $ terraform import aws_ses_identity_notification_topic.test 'example.com|Bounce' diff --git a/website/docs/r/ses_identity_policy.html.markdown b/website/docs/r/ses_identity_policy.html.markdown index 0318eef21a68..5ddc7cc42120 100644 --- a/website/docs/r/ses_identity_policy.html.markdown +++ b/website/docs/r/ses_identity_policy.html.markdown @@ -12,7 +12,7 @@ Manages a SES Identity Policy. More information about SES Sending Authorization ## Example Usage -```hcl +```terraform resource "aws_ses_domain_identity" "example" { domain = "example.com" } @@ -44,6 +44,10 @@ The following arguments are supported: * `name` - (Required) Name of the policy. * `policy` - (Required) JSON string of the policy. For more information about building AWS IAM policy documents with Terraform, see the [AWS IAM Policy Document Guide](https://learn.hashicorp.com/terraform/aws/iam-policy). +## Attributes Reference + +No additional attributes are exported. + ## Import SES Identity Policies can be imported using the identity and policy name, separated by a pipe character (`|`), e.g. diff --git a/website/docs/r/ses_receipt_filter.html.markdown b/website/docs/r/ses_receipt_filter.html.markdown index eff58d99bd26..67db104c3669 100644 --- a/website/docs/r/ses_receipt_filter.html.markdown +++ b/website/docs/r/ses_receipt_filter.html.markdown @@ -12,7 +12,7 @@ Provides an SES receipt filter resource ## Example Usage -```hcl +```terraform resource "aws_ses_receipt_filter" "filter" { name = "block-spammer" cidr = "10.10.10.10" diff --git a/website/docs/r/ses_receipt_rule.html.markdown b/website/docs/r/ses_receipt_rule.html.markdown index 62257fcd93b3..28c9158009e8 100644 --- a/website/docs/r/ses_receipt_rule.html.markdown +++ b/website/docs/r/ses_receipt_rule.html.markdown @@ -12,7 +12,7 @@ Provides an SES receipt rule resource ## Example Usage -```hcl +```terraform # Add a header to the email and store it in S3 resource "aws_ses_receipt_rule" "store" { name = "store" @@ -102,7 +102,7 @@ WorkMail actions support the following: ## Attributes Reference -In addition to the arguments, which are exported, the following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `id` - The SES receipt rule name. * `arn` - The SES receipt rule ARN. diff --git a/website/docs/r/ses_receipt_rule_set.html.markdown b/website/docs/r/ses_receipt_rule_set.html.markdown index 9d16f0ffd520..372cf37e16c2 100644 --- a/website/docs/r/ses_receipt_rule_set.html.markdown +++ b/website/docs/r/ses_receipt_rule_set.html.markdown @@ -12,7 +12,7 @@ Provides an SES receipt rule set resource. ## Example Usage -```hcl +```terraform resource "aws_ses_receipt_rule_set" "main" { rule_set_name = "primary-rules" } @@ -26,7 +26,7 @@ The following arguments are supported: ## Attributes Reference -In addition to the arguments, which are exported, the following attributes are exported: +In addition to all arguments above, the following attributes are exported: * `arn` - SES receipt rule set ARN. * `id` - SES receipt rule set name. diff --git a/website/docs/r/ses_template.html.markdown b/website/docs/r/ses_template.html.markdown index fda424bb7a5d..9bb632bb2936 100644 --- a/website/docs/r/ses_template.html.markdown +++ b/website/docs/r/ses_template.html.markdown @@ -12,7 +12,7 @@ Provides a resource to create a SES template. ## Example Usage -```hcl +```terraform resource "aws_ses_template" "MyTemplate" { name = "MyTemplate" subject = "Greetings, {{name}}!" diff --git a/website/docs/r/sfn_activity.html.markdown b/website/docs/r/sfn_activity.html.markdown index d7dce685273a..7521043d8848 100644 --- a/website/docs/r/sfn_activity.html.markdown +++ b/website/docs/r/sfn_activity.html.markdown @@ -12,7 +12,7 @@ Provides a Step Function Activity resource ## Example Usage -```hcl +```terraform resource "aws_sfn_activity" "sfn_activity" { name = "my-activity" } diff --git a/website/docs/r/sfn_state_machine.html.markdown b/website/docs/r/sfn_state_machine.html.markdown index 496dd69e1771..785560813f64 100644 --- a/website/docs/r/sfn_state_machine.html.markdown +++ b/website/docs/r/sfn_state_machine.html.markdown @@ -13,7 +13,7 @@ Provides a Step Function State Machine resource ## Example Usage ### Basic (Standard Workflow) -```hcl +```terraform # ... resource "aws_sfn_state_machine" "sfn_state_machine" { @@ -38,7 +38,7 @@ EOF ### Basic (Express Workflow) -```hcl +```terraform # ... resource "aws_sfn_state_machine" "sfn_state_machine" { @@ -66,7 +66,7 @@ EOF ~> *NOTE:* See the [AWS Step Functions Developer Guide](https://docs.aws.amazon.com/step-functions/latest/dg/welcome.html) for more information about enabling Step Function logging. -```hcl +```terraform # ... resource "aws_sfn_state_machine" "sfn_state_machine" { diff --git a/website/docs/r/shield_protection.html.markdown b/website/docs/r/shield_protection.html.markdown index 0e65a55fea3e..23ce5a50381d 100644 --- a/website/docs/r/shield_protection.html.markdown +++ b/website/docs/r/shield_protection.html.markdown @@ -15,7 +15,7 @@ The resource can be an Amazon CloudFront distribution, Elastic Load Balancing lo ### Create protection -```hcl +```terraform data "aws_availability_zones" "available" {} data "aws_region" "current" {} data "aws_caller_identity" "current" {} diff --git a/website/docs/r/signer_signing_job.html.markdown b/website/docs/r/signer_signing_job.html.markdown index 4883693936f7..2df4d4d83e59 100644 --- a/website/docs/r/signer_signing_job.html.markdown +++ b/website/docs/r/signer_signing_job.html.markdown @@ -12,7 +12,7 @@ Creates a Signer Signing Job. ## Example Usage -```hcl +```terraform resource "aws_signer_signing_profile" "test_sp" { platform_id = "AWSLambda-SHA384-ECDSA" } diff --git a/website/docs/r/signer_signing_profile.html.markdown b/website/docs/r/signer_signing_profile.html.markdown index 7fb0e97b48be..2dc50bef461d 100644 --- a/website/docs/r/signer_signing_profile.html.markdown +++ b/website/docs/r/signer_signing_profile.html.markdown @@ -12,7 +12,7 @@ Creates a Signer Signing Profile. A signing profile contains information about t ## Example Usage -```hcl +```terraform resource "aws_signer_signing_profile" "test_sp" { platform_id = "AWSLambda-SHA384-ECDSA" } diff --git a/website/docs/r/signer_signing_profile_permission.html.markdown b/website/docs/r/signer_signing_profile_permission.html.markdown index 636f5290678e..f6c5a337574b 100644 --- a/website/docs/r/signer_signing_profile_permission.html.markdown +++ b/website/docs/r/signer_signing_profile_permission.html.markdown @@ -12,7 +12,7 @@ Creates a Signer Signing Profile Permission. That is, a cross-account permission ## Example Usage -```hcl +```terraform resource "aws_signer_signing_profile" "prod_sp" { platform_id = "AWSLambda-SHA384-ECDSA" name_prefix = "prod_sp_" @@ -59,6 +59,10 @@ resource "aws_signer_signing_profile_permission" "sp_permission_3" { * `statement_id` - (Optional) A unique statement identifier. By default generated by Terraform. * `statement_id_prefix` - (Optional) A statement identifier prefix. Terraform will generate a unique suffix. Conflicts with `statement_id`. +## Attributes Reference + +No additional attributes are exported. + ## Import Signer signing profile permission statements can be imported using profile_name/statement_id, e.g. diff --git a/website/docs/r/simpledb_domain.html.markdown b/website/docs/r/simpledb_domain.html.markdown index d6f77045254c..fea4d6b4c0dc 100644 --- a/website/docs/r/simpledb_domain.html.markdown +++ b/website/docs/r/simpledb_domain.html.markdown @@ -12,7 +12,7 @@ Provides a SimpleDB domain resource ## Example Usage -```hcl +```terraform resource "aws_simpledb_domain" "users" { name = "users" } diff --git a/website/docs/r/snapshot_create_volume_permission.html.markdown b/website/docs/r/snapshot_create_volume_permission.html.markdown index c28f34a47fed..efeb621c730e 100644 --- a/website/docs/r/snapshot_create_volume_permission.html.markdown +++ b/website/docs/r/snapshot_create_volume_permission.html.markdown @@ -12,7 +12,7 @@ Adds permission to create volumes off of a given EBS Snapshot. ## Example Usage -```hcl +```terraform resource "aws_snapshot_create_volume_permission" "example_perm" { snapshot_id = aws_ebs_snapshot.example_snapshot.id account_id = "12345678" diff --git a/website/docs/r/sns_platform_application.html.markdown b/website/docs/r/sns_platform_application.html.markdown index 1e56811002e7..480f1f38785d 100644 --- a/website/docs/r/sns_platform_application.html.markdown +++ b/website/docs/r/sns_platform_application.html.markdown @@ -14,7 +14,7 @@ Provides an SNS platform application resource ### Apple Push Notification Service (APNS) -```hcl +```terraform resource "aws_sns_platform_application" "apns_application" { name = "apns_application" platform = "APNS" @@ -25,7 +25,7 @@ resource "aws_sns_platform_application" "apns_application" { ### Google Cloud Messaging (GCM) -```hcl +```terraform resource "aws_sns_platform_application" "gcm_application" { name = "gcm_application" platform = "GCM" diff --git a/website/docs/r/sns_sms_preferences.html.markdown b/website/docs/r/sns_sms_preferences.html.markdown index dd3efead6f06..d7c3642fec28 100644 --- a/website/docs/r/sns_sms_preferences.html.markdown +++ b/website/docs/r/sns_sms_preferences.html.markdown @@ -12,7 +12,7 @@ Provides a way to set SNS SMS preferences. ## Example Usage -```hcl +```terraform resource "aws_sns_sms_preferences" "update_sms_prefs" {} ``` @@ -26,3 +26,7 @@ The following arguments are supported: * `default_sender_id` - (Optional) A string, such as your business brand, that is displayed as the sender on the receiving device. * `default_sms_type` - (Optional) The type of SMS message that you will send by default. Possible values are: Promotional, Transactional * `usage_report_s3_bucket` - (Optional) The name of the Amazon S3 bucket to receive daily SMS usage reports from Amazon SNS. + +## Attributes Reference + +No additional attributes are exported. diff --git a/website/docs/r/sns_topic.html.markdown b/website/docs/r/sns_topic.html.markdown index 3b86c8518e40..fff6102b39c6 100644 --- a/website/docs/r/sns_topic.html.markdown +++ b/website/docs/r/sns_topic.html.markdown @@ -12,7 +12,7 @@ Provides an SNS topic resource ## Example Usage -```hcl +```terraform resource "aws_sns_topic" "user_updates" { name = "user-updates-topic" } @@ -47,7 +47,7 @@ EOF ## Example with Server-side encryption (SSE) -```hcl +```terraform resource "aws_sns_topic" "user_updates" { name = "user-updates-topic" kms_master_key_id = "alias/aws/sns" diff --git a/website/docs/r/sns_topic_policy.html.markdown b/website/docs/r/sns_topic_policy.html.markdown index 99a35c9fb660..5434f81dfec0 100644 --- a/website/docs/r/sns_topic_policy.html.markdown +++ b/website/docs/r/sns_topic_policy.html.markdown @@ -14,7 +14,7 @@ Provides an SNS topic policy resource ## Example Usage -```hcl +```terraform resource "aws_sns_topic" "test" { name = "my-topic-with-policy" } @@ -73,6 +73,10 @@ The following arguments are supported: * `arn` - (Required) The ARN of the SNS topic * `policy` - (Required) The fully-formed AWS policy as JSON. For more information about building AWS IAM policy documents with Terraform, see the [AWS IAM Policy Document Guide](https://learn.hashicorp.com/terraform/aws/iam-policy). +## Attributes Reference + +No additional attributes are exported. + ## Import SNS Topic Policy can be imported using the topic ARN, e.g. diff --git a/website/docs/r/sns_topic_subscription.html.markdown b/website/docs/r/sns_topic_subscription.html.markdown index 46d17ced8b5a..2904dbbb6176 100644 --- a/website/docs/r/sns_topic_subscription.html.markdown +++ b/website/docs/r/sns_topic_subscription.html.markdown @@ -24,7 +24,7 @@ Provides a resource for subscribing to SNS topics. Requires that an SNS topic ex You can directly supply a topic and ARN by hand in the `topic_arn` property along with the queue ARN: -```hcl +```terraform resource "aws_sns_topic_subscription" "user_updates_sqs_target" { topic_arn = "arn:aws:sns:us-west-2:432981146916:user-updates-topic" protocol = "sqs" @@ -34,7 +34,7 @@ resource "aws_sns_topic_subscription" "user_updates_sqs_target" { Alternatively you can use the ARN properties of a managed SNS topic and SQS queue: -```hcl +```terraform resource "aws_sns_topic" "user_updates" { name = "user-updates-topic" } @@ -52,7 +52,7 @@ resource "aws_sns_topic_subscription" "user_updates_sqs_target" { You can subscribe SNS topics to SQS queues in different Amazon accounts and regions: -```hcl +```terraform variable "sns" { default = { account-id = "111111111111" diff --git a/website/docs/r/spot_datafeed_subscription.html.markdown b/website/docs/r/spot_datafeed_subscription.html.markdown index 9723e35329a8..37f22eca8637 100644 --- a/website/docs/r/spot_datafeed_subscription.html.markdown +++ b/website/docs/r/spot_datafeed_subscription.html.markdown @@ -15,7 +15,7 @@ This data feed is sent to an Amazon S3 bucket that you specify when you subscrib ## Example Usage -```hcl +```terraform resource "aws_s3_bucket" "default" { bucket = "tf-spot-datafeed" } @@ -31,6 +31,10 @@ resource "aws_spot_datafeed_subscription" "default" { * `bucket` - (Required) The Amazon S3 bucket in which to store the Spot instance data feed. * `prefix` - (Optional) Path of folder inside bucket to place spot pricing data. +## Attributes Reference + +No additional attributes are exported. + ## Import A Spot Datafeed Subscription can be imported using the word `spot-datafeed-subscription`, e.g. diff --git a/website/docs/r/spot_fleet_request.html.markdown b/website/docs/r/spot_fleet_request.html.markdown index d57ed06fe106..4491f0bcf632 100644 --- a/website/docs/r/spot_fleet_request.html.markdown +++ b/website/docs/r/spot_fleet_request.html.markdown @@ -15,7 +15,7 @@ instances to be requested on the Spot market. ### Using launch specifications -```hcl +```terraform # Request a Spot fleet resource "aws_spot_fleet_request" "cheap_compute" { iam_fleet_role = "arn:aws:iam::12345678:role/spot-fleet" @@ -56,7 +56,7 @@ resource "aws_spot_fleet_request" "cheap_compute" { ### Using launch templates -```hcl +```terraform resource "aws_launch_template" "foo" { name = "launch-template" image_id = "ami-516b9131" @@ -86,7 +86,7 @@ launch configuration block. If you want to specify multiple values, then separat ### Using multiple launch specifications -```hcl +```terraform resource "aws_spot_fleet_request" "foo" { iam_fleet_role = "arn:aws:iam::12345678:role/spot-fleet" spot_price = "0.005" @@ -112,7 +112,7 @@ resource "aws_spot_fleet_request" "foo" { ### Using multiple launch configurations -```hcl +```terraform data "aws_subnet_ids" "example" { vpc_id = var.vpc_id } diff --git a/website/docs/r/spot_instance_request.html.markdown b/website/docs/r/spot_instance_request.html.markdown index e351cd33e04d..3f8d0dc0279e 100644 --- a/website/docs/r/spot_instance_request.html.markdown +++ b/website/docs/r/spot_instance_request.html.markdown @@ -34,7 +34,7 @@ for more information. ## Example Usage -```hcl +```terraform # Request a spot instance at $0.03 resource "aws_spot_instance_request" "cheap_worker" { ami = "ami-1234" diff --git a/website/docs/r/sqs_queue.html.markdown b/website/docs/r/sqs_queue.html.markdown index 3a02eb8bbfbd..19b3cc0cc99c 100644 --- a/website/docs/r/sqs_queue.html.markdown +++ b/website/docs/r/sqs_queue.html.markdown @@ -10,7 +10,7 @@ description: |- ## Example Usage -```hcl +```terraform resource "aws_sqs_queue" "terraform_queue" { name = "terraform-example-queue" delay_seconds = 90 @@ -30,7 +30,7 @@ resource "aws_sqs_queue" "terraform_queue" { ## FIFO queue -```hcl +```terraform resource "aws_sqs_queue" "terraform_queue" { name = "terraform-example-queue.fifo" fifo_queue = true @@ -40,7 +40,7 @@ resource "aws_sqs_queue" "terraform_queue" { ## Server-side encryption (SSE) -```hcl +```terraform resource "aws_sqs_queue" "terraform_queue" { name = "terraform-example-queue" kms_master_key_id = "alias/aws/sqs" diff --git a/website/docs/r/sqs_queue_policy.html.markdown b/website/docs/r/sqs_queue_policy.html.markdown index e7367343cf7a..96b1d56a467d 100644 --- a/website/docs/r/sqs_queue_policy.html.markdown +++ b/website/docs/r/sqs_queue_policy.html.markdown @@ -13,7 +13,7 @@ while referencing ARN of the queue within the policy. ## Example Usage -```hcl +```terraform resource "aws_sqs_queue" "q" { name = "examplequeue" } @@ -51,6 +51,10 @@ The following arguments are supported: * `queue_url` - (Required) The URL of the SQS Queue to which to attach the policy * `policy` - (Required) The JSON policy for the SQS queue. For more information about building AWS IAM policy documents with Terraform, see the [AWS IAM Policy Document Guide](https://learn.hashicorp.com/terraform/aws/iam-policy). +## Attributes Reference + +No additional attributes are exported. + ## Import SQS Queue Policies can be imported using the queue URL, e.g. diff --git a/website/docs/r/ssm_activation.html.markdown b/website/docs/r/ssm_activation.html.markdown index 2c573a33932c..3f6c4beecf7d 100644 --- a/website/docs/r/ssm_activation.html.markdown +++ b/website/docs/r/ssm_activation.html.markdown @@ -12,7 +12,7 @@ Registers an on-premises server or virtual machine with Amazon EC2 so that it ca ## Example Usage -```hcl +```terraform resource "aws_iam_role" "test_role" { name = "test_role" diff --git a/website/docs/r/ssm_association.html.markdown b/website/docs/r/ssm_association.html.markdown index 8d6d88ed9f91..6d19447fca25 100644 --- a/website/docs/r/ssm_association.html.markdown +++ b/website/docs/r/ssm_association.html.markdown @@ -12,7 +12,7 @@ Associates an SSM Document to an instance or EC2 tag. ## Example Usage -```hcl +```terraform resource "aws_ssm_association" "example" { name = aws_ssm_document.example.name diff --git a/website/docs/r/ssm_document.html.markdown b/website/docs/r/ssm_document.html.markdown index f55e96d6c35f..70d15345cda6 100644 --- a/website/docs/r/ssm_document.html.markdown +++ b/website/docs/r/ssm_document.html.markdown @@ -16,7 +16,7 @@ schema version you must recreate the resource. ## Example Usage -```hcl +```terraform resource "aws_ssm_document" "foo" { name = "test_document" document_type = "Command" @@ -105,7 +105,7 @@ $ terraform import aws_ssm_document.example example The `attachments_source` argument does not have an SSM API method for reading the attachment information detail after creation. If the argument is set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use [`ignore_changes`](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to hide the difference, e.g. -```hcl +```terraform resource "aws_ssm_document" "test" { name = "test_document" document_type = "Package" diff --git a/website/docs/r/ssm_maintenance_window.html.markdown b/website/docs/r/ssm_maintenance_window.html.markdown index 41c0bee37949..f443c3ded7b5 100644 --- a/website/docs/r/ssm_maintenance_window.html.markdown +++ b/website/docs/r/ssm_maintenance_window.html.markdown @@ -12,7 +12,7 @@ Provides an SSM Maintenance Window resource ## Example Usage -```hcl +```terraform resource "aws_ssm_maintenance_window" "production" { name = "maintenance-window-application" schedule = "cron(0 16 ? * TUE *)" diff --git a/website/docs/r/ssm_maintenance_window_target.html.markdown b/website/docs/r/ssm_maintenance_window_target.html.markdown index dce46031e6ba..2b5692475c8a 100644 --- a/website/docs/r/ssm_maintenance_window_target.html.markdown +++ b/website/docs/r/ssm_maintenance_window_target.html.markdown @@ -10,9 +10,11 @@ description: |- Provides an SSM Maintenance Window Target resource -## Instance Target Example Usage +## Example Usage -```hcl +### Instance Target + +```terraform resource "aws_ssm_maintenance_window" "window" { name = "maintenance-window-webapp" schedule = "cron(0 16 ? * TUE *)" @@ -33,9 +35,9 @@ resource "aws_ssm_maintenance_window_target" "target1" { } ``` -## Resource Group Target Example Usage +### Resource Group Target -```hcl +```terraform resource "aws_ssm_maintenance_window" "window" { name = "maintenance-window-webapp" schedule = "cron(0 16 ? * TUE *)" diff --git a/website/docs/r/ssm_maintenance_window_task.html.markdown b/website/docs/r/ssm_maintenance_window_task.html.markdown index b733fbbf8c83..05b7a2b8c49c 100644 --- a/website/docs/r/ssm_maintenance_window_task.html.markdown +++ b/website/docs/r/ssm_maintenance_window_task.html.markdown @@ -14,7 +14,7 @@ Provides an SSM Maintenance Window Task resource ### Automation Tasks -```hcl +```terraform resource "aws_ssm_maintenance_window_task" "example" { max_concurrency = 2 max_errors = 1 @@ -43,7 +43,7 @@ resource "aws_ssm_maintenance_window_task" "example" { ### Lambda Tasks -```hcl +```terraform resource "aws_ssm_maintenance_window_task" "example" { max_concurrency = 2 max_errors = 1 @@ -68,7 +68,7 @@ resource "aws_ssm_maintenance_window_task" "example" { ### Run Command Tasks -```hcl +```terraform resource "aws_ssm_maintenance_window_task" "example" { max_concurrency = 2 max_errors = 1 @@ -106,7 +106,7 @@ resource "aws_ssm_maintenance_window_task" "example" { ### Step Function Tasks -```hcl +```terraform resource "aws_ssm_maintenance_window_task" "example" { max_concurrency = 2 max_errors = 1 diff --git a/website/docs/r/ssm_parameter.html.markdown b/website/docs/r/ssm_parameter.html.markdown index a97415e3fd8a..e22540694a74 100644 --- a/website/docs/r/ssm_parameter.html.markdown +++ b/website/docs/r/ssm_parameter.html.markdown @@ -14,7 +14,7 @@ Provides an SSM Parameter resource. To store a basic string parameter: -```hcl +```terraform resource "aws_ssm_parameter" "foo" { name = "foo" type = "String" @@ -24,7 +24,7 @@ resource "aws_ssm_parameter" "foo" { To store an encrypted string using the default SSM KMS key: -```hcl +```terraform resource "aws_db_instance" "default" { allocated_storage = 10 storage_type = "gp2" @@ -61,7 +61,7 @@ The following arguments are supported: * `type` - (Required) The type of the parameter. Valid types are `String`, `StringList` and `SecureString`. * `value` - (Required) The value of the parameter. * `description` - (Optional) The description of the parameter. -* `tier` - (Optional) The tier of the parameter. If not specified, will default to `Standard`. Valid tiers are `Standard` and `Advanced`. For more information on parameter tiers, see the [AWS SSM Parameter tier comparison and guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-advanced-parameters.html). +* `tier` - (Optional) The tier of the parameter. If not specified, will default to `Standard`. Valid tiers are `Standard`, `Advanced`, and `Intelligent-Tiering`. For more information on parameter tiers, see the [AWS SSM Parameter tier comparison and guide](https://docs.aws.amazon.com/systems-manager/latest/userguide/parameter-store-advanced-parameters.html). * `key_id` - (Optional) The KMS key id or arn for encrypting a SecureString. * `overwrite` - (Optional) Overwrite an existing parameter. If not specified, will default to `false` if the resource has not been created by terraform to avoid overwrite of existing resource and will default to `true` otherwise (terraform lifecycle rules should then be used to manage the update behavior). * `allowed_pattern` - (Optional) A regular expression used to validate the parameter value. diff --git a/website/docs/r/ssm_patch_baseline.html.markdown b/website/docs/r/ssm_patch_baseline.html.markdown index d48135b0e365..ded4b2a9ed20 100644 --- a/website/docs/r/ssm_patch_baseline.html.markdown +++ b/website/docs/r/ssm_patch_baseline.html.markdown @@ -18,7 +18,7 @@ of them is specified. Basic usage using `approved_patches` only -```hcl +```terraform resource "aws_ssm_patch_baseline" "production" { name = "patch-baseline" approved_patches = ["KB123456"] @@ -27,7 +27,7 @@ resource "aws_ssm_patch_baseline" "production" { Advanced usage, specifying patch filters -```hcl +```terraform resource "aws_ssm_patch_baseline" "production" { name = "patch-baseline" description = "Patch Baseline Description" @@ -82,7 +82,7 @@ resource "aws_ssm_patch_baseline" "production" { Advanced usage, specifying Microsoft application and Windows patch rules -```hcl +```terraform resource "aws_ssm_patch_baseline" "windows_os_apps" { name = "WindowsOSAndMicrosoftApps" description = "Patch both Windows and Microsoft apps" @@ -121,7 +121,7 @@ resource "aws_ssm_patch_baseline" "windows_os_apps" { Advanced usage, specifying alternate patch source repository -```hcl +```terraform resource "aws_ssm_patch_baseline" "al_2017_09" { name = "Amazon-Linux-2017.09" description = "My patch repository for Amazon Linux 2017.09" diff --git a/website/docs/r/ssm_patch_group.html.markdown b/website/docs/r/ssm_patch_group.html.markdown index 8010e68be559..68ab843b688e 100644 --- a/website/docs/r/ssm_patch_group.html.markdown +++ b/website/docs/r/ssm_patch_group.html.markdown @@ -12,7 +12,7 @@ Provides an SSM Patch Group resource ## Example Usage -```hcl +```terraform resource "aws_ssm_patch_baseline" "production" { name = "patch-baseline" approved_patches = ["KB123456"] @@ -35,4 +35,4 @@ The following arguments are supported: In addition to all arguments above, the following attributes are exported: -* `id` - The ID of the patch baseline. +* `id` - The name of the patch group and ID of the patch baseline separated by a comma (`,`). diff --git a/website/docs/r/ssm_resource_data_sync.html.markdown b/website/docs/r/ssm_resource_data_sync.html.markdown index 61a98af53104..a251c136aba3 100644 --- a/website/docs/r/ssm_resource_data_sync.html.markdown +++ b/website/docs/r/ssm_resource_data_sync.html.markdown @@ -12,7 +12,7 @@ Provides a SSM resource data sync. ## Example Usage -```hcl +```terraform resource "aws_s3_bucket" "hoge" { bucket = "tf-test-bucket-1234" } @@ -79,6 +79,10 @@ The following arguments are supported: * `prefix` - (Optional) Prefix for the bucket. * `sync_format` - (Optional) A supported sync format. Only JsonSerDe is currently supported. Defaults to JsonSerDe. +## Attributes Reference + +No additional attributes are exported. + ## Import SSM resource data sync can be imported using the `name`, e.g. diff --git a/website/docs/r/ssoadmin_account_assignment.html.markdown b/website/docs/r/ssoadmin_account_assignment.html.markdown index d3fe71644667..6ad791922d6d 100644 --- a/website/docs/r/ssoadmin_account_assignment.html.markdown +++ b/website/docs/r/ssoadmin_account_assignment.html.markdown @@ -12,7 +12,7 @@ Provides a Single Sign-On (SSO) Account Assignment resource ## Example Usage -```hcl +```terraform data "aws_ssoadmin_instances" "example" {} data "aws_ssoadmin_permission_set" "example" { @@ -52,7 +52,7 @@ The following arguments are supported: * `target_id` - (Required, Forces new resource) An AWS account identifier, typically a 10-12 digit string. * `target_type` - (Optional, Forces new resource) The entity type for which the assignment will be created. Valid values: `AWS_ACCOUNT`. -## Attribute Reference +## Attributes Reference In addition to all arguments above, the following attributes are exported: diff --git a/website/docs/r/ssoadmin_managed_policy_attachment.html.markdown b/website/docs/r/ssoadmin_managed_policy_attachment.html.markdown index b3ec1aff7e95..29441ce68445 100644 --- a/website/docs/r/ssoadmin_managed_policy_attachment.html.markdown +++ b/website/docs/r/ssoadmin_managed_policy_attachment.html.markdown @@ -14,7 +14,7 @@ Provides an IAM managed policy for a Single Sign-On (SSO) Permission Set resourc ## Example Usage -```hcl +```terraform data "aws_ssoadmin_instances" "example" {} resource "aws_ssoadmin_permission_set" "example" { @@ -37,7 +37,7 @@ The following arguments are supported: * `managed_policy_arn` - (Required, Forces new resource) The IAM managed policy Amazon Resource Name (ARN) to be attached to the Permission Set. * `permission_set_arn` - (Required, Forces new resource) The Amazon Resource Name (ARN) of the Permission Set. -## Attribute Reference +## Attributes Reference In addition to all arguments above, the following attributes are exported: diff --git a/website/docs/r/ssoadmin_permission_set.html.markdown b/website/docs/r/ssoadmin_permission_set.html.markdown index d54c562738af..39197cde9418 100644 --- a/website/docs/r/ssoadmin_permission_set.html.markdown +++ b/website/docs/r/ssoadmin_permission_set.html.markdown @@ -14,7 +14,7 @@ Provides a Single Sign-On (SSO) Permission Set resource ## Example Usage -```hcl +```terraform data "aws_ssoadmin_instances" "example" {} resource "aws_ssoadmin_permission_set" "example" { @@ -37,7 +37,7 @@ The following arguments are supported: * `session_duration` - (Optional) The length of time that the application user sessions are valid in the ISO-8601 standard. Default: `PT1H`. * `tags` - (Optional) Key-value map of resource tags. -## Attribute Reference +## Attributes Reference In addition to all arguments above, the following attributes are exported: diff --git a/website/docs/r/ssoadmin_permission_set_inline_policy.html.markdown b/website/docs/r/ssoadmin_permission_set_inline_policy.html.markdown index 422871b77ed4..c3e8e2558f03 100644 --- a/website/docs/r/ssoadmin_permission_set_inline_policy.html.markdown +++ b/website/docs/r/ssoadmin_permission_set_inline_policy.html.markdown @@ -15,7 +15,7 @@ Creating or updating this resource will automatically [Provision the Permission ## Example Usage -```hcl +```terraform data "aws_ssoadmin_instances" "example" {} resource "aws_ssoadmin_permission_set" "example" { @@ -53,7 +53,7 @@ The following arguments are supported: * `instance_arn` - (Required, Forces new resource) The Amazon Resource Name (ARN) of the SSO Instance under which the operation will be executed. * `permission_set_arn` - (Required, Forces new resource) The Amazon Resource Name (ARN) of the Permission Set. -## Attribute Reference +## Attributes Reference In addition to all arguments above, the following attributes are exported: diff --git a/website/docs/r/storagegateway_cache.html.markdown b/website/docs/r/storagegateway_cache.html.markdown index 09d739257840..d40ef8b2cf20 100644 --- a/website/docs/r/storagegateway_cache.html.markdown +++ b/website/docs/r/storagegateway_cache.html.markdown @@ -14,7 +14,7 @@ Manages an AWS Storage Gateway cache. ## Example Usage -```hcl +```terraform resource "aws_storagegateway_cache" "example" { disk_id = data.aws_storagegateway_local_disk.example.id gateway_arn = aws_storagegateway_gateway.example.arn diff --git a/website/docs/r/storagegateway_cached_iscsi_volume.html.markdown b/website/docs/r/storagegateway_cached_iscsi_volume.html.markdown index c9cf49eebe73..88b2dc7c82ac 100644 --- a/website/docs/r/storagegateway_cached_iscsi_volume.html.markdown +++ b/website/docs/r/storagegateway_cached_iscsi_volume.html.markdown @@ -20,7 +20,7 @@ Manages an AWS Storage Gateway cached iSCSI volume. ### Create Empty Cached iSCSI Volume -```hcl +```terraform resource "aws_storagegateway_cached_iscsi_volume" "example" { gateway_arn = aws_storagegateway_cache.example.gateway_arn network_interface_id = aws_instance.example.private_ip @@ -31,7 +31,7 @@ resource "aws_storagegateway_cached_iscsi_volume" "example" { ### Create Cached iSCSI Volume From Snapshot -```hcl +```terraform resource "aws_storagegateway_cached_iscsi_volume" "example" { gateway_arn = aws_storagegateway_cache.example.gateway_arn network_interface_id = aws_instance.example.private_ip @@ -43,7 +43,7 @@ resource "aws_storagegateway_cached_iscsi_volume" "example" { ### Create Cached iSCSI Volume From Source Volume -```hcl +```terraform resource "aws_storagegateway_cached_iscsi_volume" "example" { gateway_arn = aws_storagegateway_cache.example.gateway_arn network_interface_id = aws_instance.example.private_ip diff --git a/website/docs/r/storagegateway_gateway.html.markdown b/website/docs/r/storagegateway_gateway.html.markdown index c07f62bf937c..7ed9bbcf4596 100644 --- a/website/docs/r/storagegateway_gateway.html.markdown +++ b/website/docs/r/storagegateway_gateway.html.markdown @@ -16,7 +16,7 @@ Manages an AWS Storage Gateway file, tape, or volume gateway in the provider reg ### File Gateway -```hcl +```terraform resource "aws_storagegateway_gateway" "example" { gateway_ip_address = "1.2.3.4" gateway_name = "example" @@ -27,7 +27,7 @@ resource "aws_storagegateway_gateway" "example" { ### Tape Gateway -```hcl +```terraform resource "aws_storagegateway_gateway" "example" { gateway_ip_address = "1.2.3.4" gateway_name = "example" @@ -40,7 +40,7 @@ resource "aws_storagegateway_gateway" "example" { ### Volume Gateway (Cached) -```hcl +```terraform resource "aws_storagegateway_gateway" "example" { gateway_ip_address = "1.2.3.4" gateway_name = "example" @@ -51,7 +51,7 @@ resource "aws_storagegateway_gateway" "example" { ### Volume Gateway (Stored) -```hcl +```terraform resource "aws_storagegateway_gateway" "example" { gateway_ip_address = "1.2.3.4" gateway_name = "example" @@ -79,6 +79,7 @@ The following arguments are supported: * `smb_active_directory_settings` - (Optional) Nested argument with Active Directory domain join information for Server Message Block (SMB) file shares. Only valid for `FILE_S3` gateway type. Must be set before creating `ActiveDirectory` authentication SMB file shares. More details below. * `smb_guest_password` - (Optional) Guest password for Server Message Block (SMB) file shares. Only valid for `FILE_S3` gateway type. Must be set before creating `GuestAccess` authentication SMB file shares. Terraform can only detect drift of the existence of a guest password, not its actual value from the gateway. Terraform can however update the password with changing the argument. * `smb_security_strategy` - (Optional) Specifies the type of security strategy. Valid values are: `ClientSpecified`, `MandatorySigning`, and `MandatoryEncryption`. See [Setting a Security Level for Your Gateway](https://docs.aws.amazon.com/storagegateway/latest/userguide/managing-gateway-file.html#security-strategy) for more information. +* `smb_file_share_visibility` - (Optional) Specifies whether the shares on this gateway appear when listing shares. * `tape_drive_type` - (Optional) Type of tape drive to use for tape gateway. Terraform cannot detect drift of this argument. Valid values: `IBM-ULT3580-TD5`. * `tags` - (Optional) Key-value map of resource tags @@ -130,7 +131,7 @@ $ terraform import aws_storagegateway_gateway.example arn:aws:storagegateway:us- Certain resource arguments, like `gateway_ip_address` do not have a Storage Gateway API method for reading the information after creation, either omit the argument from the Terraform configuration or use [`ignore_changes`](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to hide the difference, e.g. -```hcl +```terraform resource "aws_storagegateway_gateway" "example" { # ... other configuration ... diff --git a/website/docs/r/storagegateway_nfs_file_share.html.markdown b/website/docs/r/storagegateway_nfs_file_share.html.markdown index deebc12898a0..b15471641c94 100644 --- a/website/docs/r/storagegateway_nfs_file_share.html.markdown +++ b/website/docs/r/storagegateway_nfs_file_share.html.markdown @@ -12,7 +12,7 @@ Manages an AWS Storage Gateway NFS File Share. ## Example Usage -```hcl +```terraform resource "aws_storagegateway_nfs_file_share" "example" { client_list = ["0.0.0.0/0"] gateway_arn = aws_storagegateway_gateway.example.arn diff --git a/website/docs/r/storagegateway_smb_file_share.html.markdown b/website/docs/r/storagegateway_smb_file_share.html.markdown index cd4256f8a2f8..89933687463d 100644 --- a/website/docs/r/storagegateway_smb_file_share.html.markdown +++ b/website/docs/r/storagegateway_smb_file_share.html.markdown @@ -16,7 +16,7 @@ Manages an AWS Storage Gateway SMB File Share. ~> **NOTE:** The gateway must have already joined the Active Directory domain prior to SMB file share creation. e.g. via "SMB Settings" in the AWS Storage Gateway console or `smb_active_directory_settings` in the [`aws_storagegateway_gateway` resource](/docs/providers/aws/r/storagegateway_gateway.html). -```hcl +```terraform resource "aws_storagegateway_smb_file_share" "example" { authentication = "ActiveDirectory" gateway_arn = aws_storagegateway_gateway.example.arn @@ -29,7 +29,7 @@ resource "aws_storagegateway_smb_file_share" "example" { ~> **NOTE:** The gateway must have already had the SMB guest password set prior to SMB file share creation. e.g. via "SMB Settings" in the AWS Storage Gateway console or `smb_guest_password` in the [`aws_storagegateway_gateway` resource](/docs/providers/aws/r/storagegateway_gateway.html). -```hcl +```terraform resource "aws_storagegateway_smb_file_share" "example" { authentication = "GuestAccess" gateway_arn = aws_storagegateway_gateway.example.arn diff --git a/website/docs/r/storagegateway_stored_iscsi_volume.html.markdown b/website/docs/r/storagegateway_stored_iscsi_volume.html.markdown index 4d7bd72e1c24..8d4e31444633 100644 --- a/website/docs/r/storagegateway_stored_iscsi_volume.html.markdown +++ b/website/docs/r/storagegateway_stored_iscsi_volume.html.markdown @@ -16,7 +16,7 @@ Manages an AWS Storage Gateway stored iSCSI volume. ### Create Empty Stored iSCSI Volume -```hcl +```terraform resource "aws_storagegateway_stored_iscsi_volume" "example" { gateway_arn = aws_storagegateway_cache.example.gateway_arn network_interface_id = aws_instance.example.private_ip @@ -28,7 +28,7 @@ resource "aws_storagegateway_stored_iscsi_volume" "example" { ### Create Stored iSCSI Volume From Snapshot -```hcl +```terraform resource "aws_storagegateway_stored_iscsi_volume" "example" { gateway_arn = aws_storagegateway_cache.example.gateway_arn network_interface_id = aws_instance.example.private_ip @@ -75,5 +75,5 @@ In addition to all arguments above, the following attributes are exported: `aws_storagegateway_stored_iscsi_volume` can be imported by using the volume Amazon Resource Name (ARN), e.g. ``` -$ terraform import aws_storagegateway_cache.example arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678/volume/vol-12345678 +$ terraform import aws_storagegateway_stored_iscsi_volume.example arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678/volume/vol-12345678 ``` diff --git a/website/docs/r/storagegateway_tape_pool.html.markdown b/website/docs/r/storagegateway_tape_pool.html.markdown index f67ba25b168a..6b6055abf93d 100644 --- a/website/docs/r/storagegateway_tape_pool.html.markdown +++ b/website/docs/r/storagegateway_tape_pool.html.markdown @@ -12,7 +12,7 @@ Manages an AWS Storage Gateway Tape Pool. ## Example Usage -```hcl +```terraform resource "aws_storagegateway_tape_pool" "example" { pool_name = "example" storage_class = "GLACIER" @@ -29,7 +29,7 @@ The following arguments are supported: * `retention_lock_time_in_days` - (Optional) Tape retention lock time is set in days. Tape retention lock can be enabled for up to 100 years (36,500 days). Default value is 0. * `tags` - (Optional) Key-value map of resource tags -## Attribute Reference +## Attributes Reference In addition to all arguments above, the following attributes are exported: diff --git a/website/docs/r/storagegateway_upload_buffer.html.markdown b/website/docs/r/storagegateway_upload_buffer.html.markdown index 9c313682bf1c..c3f1dc4f2236 100644 --- a/website/docs/r/storagegateway_upload_buffer.html.markdown +++ b/website/docs/r/storagegateway_upload_buffer.html.markdown @@ -14,7 +14,28 @@ Manages an AWS Storage Gateway upload buffer. ## Example Usage -```hcl +### Cached and VTL Gateway Type + +```terraform +data "aws_storagegateway_local_disk" "test" { + disk_node = aws_volume_attachment.test.device_name + gateway_arn = aws_storagegateway_gateway.test.arn +} + +resource "aws_storagegateway_upload_buffer" "test" { + disk_path = data.aws_storagegateway_local_disk.test.disk_path + gateway_arn = aws_storagegateway_gateway.test.arn +} +``` + +### Stored Gateway Type + +```terraform +data "aws_storagegateway_local_disk" "test" { + disk_node = aws_volume_attachment.test.device_name + gateway_arn = aws_storagegateway_gateway.test.arn +} + resource "aws_storagegateway_upload_buffer" "example" { disk_id = data.aws_storagegateway_local_disk.example.id gateway_arn = aws_storagegateway_gateway.example.arn @@ -25,7 +46,8 @@ resource "aws_storagegateway_upload_buffer" "example" { The following arguments are supported: -* `disk_id` - (Required) Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`. +* `disk_id` - (Optional) Local disk identifier. For example, `pci-0000:03:00.0-scsi-0:0:0:0`. +* `disk_path` - (Optional) Local disk path. For example, `/dev/nvme1n1`. * `gateway_arn` - (Required) The Amazon Resource Name (ARN) of the gateway. ## Attributes Reference diff --git a/website/docs/r/storagegateway_working_storage.html.markdown b/website/docs/r/storagegateway_working_storage.html.markdown index 63882bc25e63..e41b11fab7ad 100644 --- a/website/docs/r/storagegateway_working_storage.html.markdown +++ b/website/docs/r/storagegateway_working_storage.html.markdown @@ -14,7 +14,7 @@ Manages an AWS Storage Gateway working storage. ## Example Usage -```hcl +```terraform resource "aws_storagegateway_working_storage" "example" { disk_id = data.aws_storagegateway_local_disk.example.id gateway_arn = aws_storagegateway_gateway.example.arn diff --git a/website/docs/r/subnet.html.markdown b/website/docs/r/subnet.html.markdown index 3c1d0e9b2137..7b33b5aa5439 100644 --- a/website/docs/r/subnet.html.markdown +++ b/website/docs/r/subnet.html.markdown @@ -16,7 +16,7 @@ Provides an VPC subnet resource. ### Basic Usage -```hcl +```terraform resource "aws_subnet" "main" { vpc_id = aws_vpc.main.id cidr_block = "10.0.1.0/24" @@ -32,7 +32,7 @@ resource "aws_subnet" "main" { When managing subnets in one of a VPC's secondary CIDR blocks created using a [`aws_vpc_ipv4_cidr_block_association`](vpc_ipv4_cidr_block_association.html) resource, it is recommended to reference that resource's `vpc_id` attribute to ensure correct dependency ordering. -```hcl +```terraform resource "aws_vpc_ipv4_cidr_block_association" "secondary_cidr" { vpc_id = aws_vpc.main.id cidr_block = "172.2.0.0/16" @@ -63,7 +63,7 @@ The following arguments are supported: that network interfaces created in the specified subnet should be assigned an IPv6 address. Default is `false` * `vpc_id` - (Required) The VPC ID. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](https://www.terraform.io/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -73,6 +73,7 @@ In addition to all arguments above, the following attributes are exported: * `arn` - The ARN of the subnet. * `ipv6_cidr_block_association_id` - The association ID for the IPv6 CIDR block. * `owner_id` - The ID of the AWS account that owns the subnet. +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://www.terraform.io/docs/providers/aws/index.html#default_tags-configuration-block). ## Timeouts diff --git a/website/docs/r/swf_domain.html.markdown b/website/docs/r/swf_domain.html.markdown index ef1ba6b720ec..54ff506f2b90 100644 --- a/website/docs/r/swf_domain.html.markdown +++ b/website/docs/r/swf_domain.html.markdown @@ -14,7 +14,7 @@ Provides an SWF Domain resource. To register a basic SWF domain: -```hcl +```terraform resource "aws_swf_domain" "foo" { name = "foo" description = "Terraform SWF Domain" diff --git a/website/docs/r/synthetics_canary.html.markdown b/website/docs/r/synthetics_canary.html.markdown index 745322205fe4..afce6ab4484a 100644 --- a/website/docs/r/synthetics_canary.html.markdown +++ b/website/docs/r/synthetics_canary.html.markdown @@ -14,7 +14,7 @@ Provides a Synthetics Canary resource. ## Example Usage -```hcl +```terraform resource "aws_synthetics_canary" "some" { name = "some-canary" artifact_s3_location = "s3://some-bucket/" diff --git a/website/docs/r/transfer_server.html.markdown b/website/docs/r/transfer_server.html.markdown index 550a3175e465..1667d6f31e0a 100644 --- a/website/docs/r/transfer_server.html.markdown +++ b/website/docs/r/transfer_server.html.markdown @@ -10,8 +10,9 @@ description: |- Provides a AWS Transfer Server resource. +## Example Usage -```hcl +```terraform resource "aws_transfer_server" "example" { identity_provider_type = "SERVICE_MANAGED" logging_role = aws_iam_role.example.arn diff --git a/website/docs/r/transfer_ssh_key.html.markdown b/website/docs/r/transfer_ssh_key.html.markdown index d0ac0f7d7e3e..b53777d30652 100644 --- a/website/docs/r/transfer_ssh_key.html.markdown +++ b/website/docs/r/transfer_ssh_key.html.markdown @@ -10,8 +10,9 @@ description: |- Provides a AWS Transfer User SSH Key resource. +## Example Usage -```hcl +```terraform resource "aws_transfer_ssh_key" "example" { server_id = aws_transfer_server.example.id user_name = aws_transfer_user.example.user_name @@ -85,6 +86,10 @@ The following arguments are supported: * `user_name` - (Requirement) The name of the user account that is assigned to one or more servers. * `body` - (Requirement) The public key portion of an SSH key pair. +## Attributes Reference + +No additional attributes are exported. + ## Import Transfer SSH Public Key can be imported using the `server_id` and `user_name` and `ssh_public_key_id` separated by `/`. diff --git a/website/docs/r/transfer_user.html.markdown b/website/docs/r/transfer_user.html.markdown index e5c12663b746..96782817d7f5 100644 --- a/website/docs/r/transfer_user.html.markdown +++ b/website/docs/r/transfer_user.html.markdown @@ -10,8 +10,9 @@ description: |- Provides a AWS Transfer User resource. Managing SSH keys can be accomplished with the [`aws_transfer_ssh_key` resource](/docs/providers/aws/r/transfer_ssh_key.html). +## Example Usage -```hcl +```terraform resource "aws_transfer_server" "foo" { identity_provider_type = "SERVICE_MANAGED" diff --git a/website/docs/r/volume_attachment.html.markdown b/website/docs/r/volume_attachment.html.markdown index 918b9de79d11..193e60707233 100644 --- a/website/docs/r/volume_attachment.html.markdown +++ b/website/docs/r/volume_attachment.html.markdown @@ -15,7 +15,7 @@ detach volumes from AWS Instances. ## Example Usage -```hcl +```terraform resource "aws_volume_attachment" "ebs_att" { device_name = "/dev/sdh" volume_id = aws_ebs_volume.example.id diff --git a/website/docs/r/vpc.html.markdown b/website/docs/r/vpc.html.markdown index 53f9f6dba53a..0451ee117744 100644 --- a/website/docs/r/vpc.html.markdown +++ b/website/docs/r/vpc.html.markdown @@ -14,7 +14,7 @@ Provides a VPC resource. Basic usage: -```hcl +```terraform resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" } @@ -22,7 +22,7 @@ resource "aws_vpc" "main" { Basic usage with tags: -```hcl +```terraform resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" instance_tenancy = "default" @@ -50,7 +50,7 @@ The following arguments are supported: * `assign_generated_ipv6_cidr_block` - (Optional) Requests an Amazon-provided IPv6 CIDR block with a /56 prefix length for the VPC. You cannot specify the range of IP addresses, or the size of the CIDR block. Default is `false`. -* `tags` - (Optional) A map of tags to assign to the resource. +* `tags` - (Optional) A map of tags to assign to the resource. If configured with a provider [`default_tags` configuration block](https://www.terraform.io/docs/providers/aws/index.html#default_tags-configuration-block) present, tags with matching keys will overwrite those defined at the provider-level. ## Attributes Reference @@ -72,7 +72,7 @@ In addition to all arguments above, the following attributes are exported: * `ipv6_association_id` - The association ID for the IPv6 CIDR block. * `ipv6_cidr_block` - The IPv6 CIDR block. * `owner_id` - The ID of the AWS account that owns the VPC. - +* `tags_all` - A map of tags assigned to the resource, including those inherited from the provider [`default_tags` configuration block](https://www.terraform.io/docs/providers/aws/index.html#default_tags-configuration-block). [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html diff --git a/website/docs/r/vpc_dhcp_options.html.markdown b/website/docs/r/vpc_dhcp_options.html.markdown index bf36af819a99..e95063633af8 100644 --- a/website/docs/r/vpc_dhcp_options.html.markdown +++ b/website/docs/r/vpc_dhcp_options.html.markdown @@ -14,7 +14,7 @@ Provides a VPC DHCP Options resource. Basic usage: -```hcl +```terraform resource "aws_vpc_dhcp_options" "dns_resolver" { domain_name_servers = ["8.8.8.8", "8.8.4.4"] } @@ -22,7 +22,7 @@ resource "aws_vpc_dhcp_options" "dns_resolver" { Full usage: -```hcl +```terraform resource "aws_vpc_dhcp_options" "foo" { domain_name = "service.consul" domain_name_servers = ["127.0.0.1", "10.0.0.2"] diff --git a/website/docs/r/vpc_dhcp_options_association.html.markdown b/website/docs/r/vpc_dhcp_options_association.html.markdown index a77932755bc5..2779035acbf7 100644 --- a/website/docs/r/vpc_dhcp_options_association.html.markdown +++ b/website/docs/r/vpc_dhcp_options_association.html.markdown @@ -12,7 +12,7 @@ Provides a VPC DHCP Options Association resource. ## Example Usage -```hcl +```terraform resource "aws_vpc_dhcp_options_association" "dns_resolver" { vpc_id = aws_vpc.foo.id dhcp_options_id = aws_vpc_dhcp_options.foo.id diff --git a/website/docs/r/vpc_endpoint.html.markdown b/website/docs/r/vpc_endpoint.html.markdown index 3a82dbd7e6bc..f107efee5fc0 100644 --- a/website/docs/r/vpc_endpoint.html.markdown +++ b/website/docs/r/vpc_endpoint.html.markdown @@ -21,7 +21,7 @@ Doing so will cause a conflict of associations and will overwrite the associatio ### Basic -```hcl +```terraform resource "aws_vpc_endpoint" "s3" { vpc_id = aws_vpc.main.id service_name = "com.amazonaws.us-west-2.s3" @@ -30,7 +30,7 @@ resource "aws_vpc_endpoint" "s3" { ### Basic w/ Tags -```hcl +```terraform resource "aws_vpc_endpoint" "s3" { vpc_id = aws_vpc.main.id service_name = "com.amazonaws.us-west-2.s3" @@ -43,7 +43,7 @@ resource "aws_vpc_endpoint" "s3" { ### Interface Endpoint Type -```hcl +```terraform resource "aws_vpc_endpoint" "ec2" { vpc_id = aws_vpc.main.id service_name = "com.amazonaws.us-west-2.ec2" @@ -59,7 +59,7 @@ resource "aws_vpc_endpoint" "ec2" { ### Gateway Load Balancer Endpoint Type -```hcl +```terraform data "aws_caller_identity" "current" {} resource "aws_vpc_endpoint_service" "example" { @@ -78,7 +78,7 @@ resource "aws_vpc_endpoint" "example" { ### Non-AWS Service -```hcl +```terraform resource "aws_vpc_endpoint" "ptfe_service" { vpc_id = var.vpc_id service_name = var.ptfe_service diff --git a/website/docs/r/vpc_endpoint_connection_notification.html.markdown b/website/docs/r/vpc_endpoint_connection_notification.html.markdown index 96292bdb839f..0cbe474f6c5c 100644 --- a/website/docs/r/vpc_endpoint_connection_notification.html.markdown +++ b/website/docs/r/vpc_endpoint_connection_notification.html.markdown @@ -13,7 +13,7 @@ Connection notifications notify subscribers of VPC Endpoint events. ## Example Usage -```hcl +```terraform resource "aws_sns_topic" "topic" { name = "vpce-notification-topic" diff --git a/website/docs/r/vpc_endpoint_route_table_association.html.markdown b/website/docs/r/vpc_endpoint_route_table_association.html.markdown index 5e7a45695fd6..2094e6a2133c 100644 --- a/website/docs/r/vpc_endpoint_route_table_association.html.markdown +++ b/website/docs/r/vpc_endpoint_route_table_association.html.markdown @@ -12,7 +12,7 @@ Manages a VPC Endpoint Route Table Association ## Example Usage -```hcl +```terraform resource "aws_vpc_endpoint_route_table_association" "example" { route_table_id = aws_route_table.example.id vpc_endpoint_id = aws_vpc_endpoint.example.id diff --git a/website/docs/r/vpc_endpoint_service.html.markdown b/website/docs/r/vpc_endpoint_service.html.markdown index b9291fb8541e..31c6511c7a58 100644 --- a/website/docs/r/vpc_endpoint_service.html.markdown +++ b/website/docs/r/vpc_endpoint_service.html.markdown @@ -21,7 +21,7 @@ and will overwrite the association. ### Network Load Balancers -```hcl +```terraform resource "aws_vpc_endpoint_service" "example" { acceptance_required = false network_load_balancer_arns = [aws_lb.example.arn] @@ -30,7 +30,7 @@ resource "aws_vpc_endpoint_service" "example" { ### Gateway Load Balancers -```hcl +```terraform resource "aws_vpc_endpoint_service" "example" { acceptance_required = false gateway_load_balancer_arns = [aws_lb.example.arn] diff --git a/website/docs/r/vpc_endpoint_service_allowed_principal.html.markdown b/website/docs/r/vpc_endpoint_service_allowed_principal.html.markdown index 3f398df634aa..a3fd43f3e2d9 100644 --- a/website/docs/r/vpc_endpoint_service_allowed_principal.html.markdown +++ b/website/docs/r/vpc_endpoint_service_allowed_principal.html.markdown @@ -20,7 +20,7 @@ and will overwrite the association. Basic usage: -```hcl +```terraform data "aws_caller_identity" "current" {} resource "aws_vpc_endpoint_service_allowed_principal" "allow_me_to_foo" { diff --git a/website/docs/r/vpc_endpoint_subnet_association.html.markdown b/website/docs/r/vpc_endpoint_subnet_association.html.markdown index 783e3e038c64..59adfedf7ab3 100644 --- a/website/docs/r/vpc_endpoint_subnet_association.html.markdown +++ b/website/docs/r/vpc_endpoint_subnet_association.html.markdown @@ -20,7 +20,7 @@ Association resource. Doing so will cause a conflict of associations and will ov Basic usage: -```hcl +```terraform resource "aws_vpc_endpoint_subnet_association" "sn_ec2" { vpc_endpoint_id = aws_vpc_endpoint.ec2.id subnet_id = aws_subnet.sn.id diff --git a/website/docs/r/vpc_ipv4_cidr_block_association.html.markdown b/website/docs/r/vpc_ipv4_cidr_block_association.html.markdown index 0435df8c7077..e61e8100c0c3 100644 --- a/website/docs/r/vpc_ipv4_cidr_block_association.html.markdown +++ b/website/docs/r/vpc_ipv4_cidr_block_association.html.markdown @@ -15,7 +15,7 @@ The `aws_vpc_ipv4_cidr_block_association` resource allows further IPv4 CIDR bloc ## Example Usage -```hcl +```terraform resource "aws_vpc" "main" { cidr_block = "10.0.0.0/16" } diff --git a/website/docs/r/vpc_peering_connection.html.markdown b/website/docs/r/vpc_peering_connection.html.markdown index 56bbb88ba5a6..842b1685735f 100644 --- a/website/docs/r/vpc_peering_connection.html.markdown +++ b/website/docs/r/vpc_peering_connection.html.markdown @@ -24,7 +24,7 @@ connection and use the `aws_vpc_peering_connection_accepter` resource to manage ## Example Usage -```hcl +```terraform resource "aws_vpc_peering_connection" "foo" { peer_owner_id = var.peer_owner_id peer_vpc_id = aws_vpc.bar.id @@ -34,7 +34,7 @@ resource "aws_vpc_peering_connection" "foo" { Basic usage with connection options: -```hcl +```terraform resource "aws_vpc_peering_connection" "foo" { peer_owner_id = var.peer_owner_id peer_vpc_id = aws_vpc.bar.id @@ -52,7 +52,7 @@ resource "aws_vpc_peering_connection" "foo" { Basic usage with tags: -```hcl +```terraform resource "aws_vpc_peering_connection" "foo" { peer_owner_id = var.peer_owner_id peer_vpc_id = aws_vpc.bar.id @@ -76,7 +76,7 @@ resource "aws_vpc" "bar" { Basic usage with region: -```hcl +```terraform resource "aws_vpc_peering_connection" "foo" { peer_owner_id = var.peer_owner_id peer_vpc_id = aws_vpc.bar.id @@ -109,22 +109,18 @@ The following arguments are supported: * `peer_vpc_id` - (Required) The ID of the VPC with which you are creating the VPC Peering Connection. * `vpc_id` - (Required) The ID of the requester VPC. * `auto_accept` - (Optional) Accept the peering (both VPCs need to be in the same AWS account). -* `peer_region` - (Optional) The region of the accepter VPC of the [VPC Peering Connection]. `auto_accept` must be `false`, +* `peer_region` - (Optional) The region of the accepter VPC of the VPC Peering Connection. `auto_accept` must be `false`, and use the `aws_vpc_peering_connection_accepter` to manage the accepter side. -* `accepter` (Optional) - An optional configuration block that allows for [VPC Peering Connection] -(https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options to be set for the VPC that accepts +* `accepter` (Optional) - An optional configuration block that allows for [VPC Peering Connection](https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options to be set for the VPC that accepts the peering connection (a maximum of one). -* `requester` (Optional) - A optional configuration block that allows for [VPC Peering Connection] -(https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options to be set for the VPC that requests +* `requester` (Optional) - A optional configuration block that allows for [VPC Peering Connection](https://docs.aws.amazon.com/vpc/latest/peering/what-is-vpc-peering.html) options to be set for the VPC that requests the peering connection (a maximum of one). * `tags` - (Optional) A map of tags to assign to the resource. #### Accepter and Requester Arguments -> **Note:** When enabled, the DNS resolution feature requires that VPCs participating in the peering -must have support for the DNS hostnames enabled. This can be done using the [`enable_dns_hostnames`] -(vpc.html#enable_dns_hostnames) attribute in the [`aws_vpc`](vpc.html) resource. See [Using DNS with Your VPC] -(http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-dns.html) user guide for more information. +must have support for the DNS hostnames enabled. This can be done using the [`enable_dns_hostnames`](vpc.html#enable_dns_hostnames) attribute in the [`aws_vpc`](vpc.html) resource. See [Using DNS with Your VPC](http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-dns.html) user guide for more information. * `allow_remote_vpc_dns_resolution` - (Optional) Allow a local VPC to resolve public DNS hostnames to private IP addresses when queried from instances in the peer VPC. This is diff --git a/website/docs/r/vpc_peering_connection_accepter.html.markdown b/website/docs/r/vpc_peering_connection_accepter.html.markdown index e80165ce49b4..930e21f4556b 100644 --- a/website/docs/r/vpc_peering_connection_accepter.html.markdown +++ b/website/docs/r/vpc_peering_connection_accepter.html.markdown @@ -19,7 +19,7 @@ connection into management. ## Example Usage -```hcl +```terraform provider "aws" { region = "us-east-1" @@ -89,7 +89,7 @@ from your statefile and management, **but will not destroy the VPC Peering Conne ## Attributes Reference -All of the argument attributes except `auto_accept` are also exported as result attributes. +In addition to all arguments above, the following attributes are exported: * `id` - The ID of the VPC Peering Connection. * `accept_status` - The status of the VPC Peering Connection request. @@ -127,7 +127,7 @@ $ terraform import aws_vpc_peering_connection_accepter.example pcx-12345678 Certain resource arguments, like `auto_accept`, do not have an EC2 API method for reading the information after peering connection creation. If the argument is set in the Terraform configuration on an imported resource, Terraform will always show a difference. To workaround this behavior, either omit the argument from the Terraform configuration or use [`ignore_changes`](https://www.terraform.io/docs/configuration/meta-arguments/lifecycle.html#ignore_changes) to hide the difference, e.g. -```hcl +```terraform resource "aws_vpc_peering_connection_accepter" "example" { # ... other configuration ... diff --git a/website/docs/r/vpc_peering_connection_options.html.markdown b/website/docs/r/vpc_peering_connection_options.html.markdown index ce5a9a463f1a..25f73cd6b42a 100644 --- a/website/docs/r/vpc_peering_connection_options.html.markdown +++ b/website/docs/r/vpc_peering_connection_options.html.markdown @@ -19,9 +19,11 @@ Using a VPC Peering Connection Options resource decouples management of the conn management of the VPC Peering Connection and allows options to be set correctly in cross-region and cross-account scenarios. -Basic usage: +## Example Usage -```hcl +### Basic Usage + +```terraform resource "aws_vpc" "foo" { cidr_block = "10.0.0.0/16" } @@ -50,9 +52,9 @@ resource "aws_vpc_peering_connection_options" "foo" { } ``` -Basic cross-account usage: +### Cross-Account Usage -```hcl +```terraform provider "aws" { alias = "requester" diff --git a/website/docs/r/vpn_connection.html.markdown b/website/docs/r/vpn_connection.html.markdown index 3b7edab99477..de95eb47287b 100644 --- a/website/docs/r/vpn_connection.html.markdown +++ b/website/docs/r/vpn_connection.html.markdown @@ -20,7 +20,7 @@ Manages an EC2 VPN connection. These objects can be connected to customer gatewa ### EC2 Transit Gateway -```hcl +```terraform resource "aws_ec2_transit_gateway" "example" {} resource "aws_customer_gateway" "example" { @@ -38,7 +38,7 @@ resource "aws_vpn_connection" "example" { ### Virtual Private Gateway -```hcl +```terraform resource "aws_vpc" "vpc" { cidr_block = "10.0.0.0/16" } diff --git a/website/docs/r/vpn_connection_route.html.markdown b/website/docs/r/vpn_connection_route.html.markdown index 24b3d823a15c..e8ea0a83348d 100644 --- a/website/docs/r/vpn_connection_route.html.markdown +++ b/website/docs/r/vpn_connection_route.html.markdown @@ -12,7 +12,7 @@ Provides a static route between a VPN connection and a customer gateway. ## Example Usage -```hcl +```terraform resource "aws_vpc" "vpc" { cidr_block = "10.0.0.0/16" } diff --git a/website/docs/r/vpn_gateway.html.markdown b/website/docs/r/vpn_gateway.html.markdown index 6d2fd5a5f4b7..b2c3547668d7 100644 --- a/website/docs/r/vpn_gateway.html.markdown +++ b/website/docs/r/vpn_gateway.html.markdown @@ -12,7 +12,7 @@ Provides a resource to create a VPC VPN Gateway. ## Example Usage -```hcl +```terraform resource "aws_vpn_gateway" "vpn_gw" { vpc_id = aws_vpc.main.id diff --git a/website/docs/r/vpn_gateway_attachment.html.markdown b/website/docs/r/vpn_gateway_attachment.html.markdown index a5263c3dea05..6c88b45d41f2 100644 --- a/website/docs/r/vpn_gateway_attachment.html.markdown +++ b/website/docs/r/vpn_gateway_attachment.html.markdown @@ -17,7 +17,7 @@ to an existing VPC by setting the [`vpc_id`](vpn_gateway.html#vpc_id) attribute ## Example Usage -```hcl +```terraform resource "aws_vpc" "network" { cidr_block = "10.0.0.0/16" } diff --git a/website/docs/r/vpn_gateway_route_propagation.html.markdown b/website/docs/r/vpn_gateway_route_propagation.html.markdown index 8eefa0460826..24400a3ee5fd 100644 --- a/website/docs/r/vpn_gateway_route_propagation.html.markdown +++ b/website/docs/r/vpn_gateway_route_propagation.html.markdown @@ -16,7 +16,7 @@ propagation not explicitly listed in its value will be removed. ## Example Usage -```hcl +```terraform resource "aws_vpn_gateway_route_propagation" "example" { vpn_gateway_id = aws_vpn_gateway.example.id route_table_id = aws_route_table.example.id @@ -32,4 +32,4 @@ The following arguments are required: ## Attributes Reference -This resource does not export any additional attributes. +No additional attributes are exported. diff --git a/website/docs/r/waf_byte_match_set.html.markdown b/website/docs/r/waf_byte_match_set.html.markdown index ee9296887bc5..456d60f40c0c 100644 --- a/website/docs/r/waf_byte_match_set.html.markdown +++ b/website/docs/r/waf_byte_match_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Byte Match Set Resource ## Example Usage -```hcl +```terraform resource "aws_waf_byte_match_set" "byte_set" { name = "tf_waf_byte_match_set" diff --git a/website/docs/r/waf_geo_match_set.html.markdown b/website/docs/r/waf_geo_match_set.html.markdown index 05c2e31fa12c..f50fef5e7e68 100644 --- a/website/docs/r/waf_geo_match_set.html.markdown +++ b/website/docs/r/waf_geo_match_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Geo Match Set Resource ## Example Usage -```hcl +```terraform resource "aws_waf_geo_match_set" "geo_match_set" { name = "geo_match_set" diff --git a/website/docs/r/waf_ipset.html.markdown b/website/docs/r/waf_ipset.html.markdown index 5f0d8f31b839..960ab8068b80 100644 --- a/website/docs/r/waf_ipset.html.markdown +++ b/website/docs/r/waf_ipset.html.markdown @@ -12,7 +12,7 @@ Provides a WAF IPSet Resource ## Example Usage -```hcl +```terraform resource "aws_waf_ipset" "ipset" { name = "tfIPSet" diff --git a/website/docs/r/waf_rate_based_rule.html.markdown b/website/docs/r/waf_rate_based_rule.html.markdown index 108cce9b2a38..ffe086df5fdc 100644 --- a/website/docs/r/waf_rate_based_rule.html.markdown +++ b/website/docs/r/waf_rate_based_rule.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Rate Based Rule Resource ## Example Usage -```hcl +```terraform resource "aws_waf_ipset" "ipset" { name = "tfIPSet" diff --git a/website/docs/r/waf_regex_match_set.html.markdown b/website/docs/r/waf_regex_match_set.html.markdown index 7daf76c54b24..2d944525bab6 100644 --- a/website/docs/r/waf_regex_match_set.html.markdown +++ b/website/docs/r/waf_regex_match_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Regex Match Set Resource ## Example Usage -```hcl +```terraform resource "aws_waf_regex_match_set" "example" { name = "example" diff --git a/website/docs/r/waf_regex_pattern_set.html.markdown b/website/docs/r/waf_regex_pattern_set.html.markdown index 4b41feb3117a..b70e01e21ee1 100644 --- a/website/docs/r/waf_regex_pattern_set.html.markdown +++ b/website/docs/r/waf_regex_pattern_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Regex Pattern Set Resource ## Example Usage -```hcl +```terraform resource "aws_waf_regex_pattern_set" "example" { name = "tf_waf_regex_pattern_set" regex_pattern_strings = ["one", "two"] diff --git a/website/docs/r/waf_rule.html.markdown b/website/docs/r/waf_rule.html.markdown index 8015a6badf1b..08b22cc49b92 100644 --- a/website/docs/r/waf_rule.html.markdown +++ b/website/docs/r/waf_rule.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Rule Resource ## Example Usage -```hcl +```terraform resource "aws_waf_ipset" "ipset" { name = "tfIPSet" diff --git a/website/docs/r/waf_rule_group.html.markdown b/website/docs/r/waf_rule_group.html.markdown index bdd479cff190..b31b3d70e8ae 100644 --- a/website/docs/r/waf_rule_group.html.markdown +++ b/website/docs/r/waf_rule_group.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Rule Group Resource ## Example Usage -```hcl +```terraform resource "aws_waf_rule" "example" { name = "example" metric_name = "example" diff --git a/website/docs/r/waf_size_constraint_set.html.markdown b/website/docs/r/waf_size_constraint_set.html.markdown index 7f71fa827e3d..967d80b16982 100644 --- a/website/docs/r/waf_size_constraint_set.html.markdown +++ b/website/docs/r/waf_size_constraint_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Size Constraint Set Resource ## Example Usage -```hcl +```terraform resource "aws_waf_size_constraint_set" "size_constraint_set" { name = "tfsize_constraints" diff --git a/website/docs/r/waf_sql_injection_match_set.html.markdown b/website/docs/r/waf_sql_injection_match_set.html.markdown index 08da2041fb7b..5f15be5a86b6 100644 --- a/website/docs/r/waf_sql_injection_match_set.html.markdown +++ b/website/docs/r/waf_sql_injection_match_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF SQL Injection Match Set Resource ## Example Usage -```hcl +```terraform resource "aws_waf_sql_injection_match_set" "sql_injection_match_set" { name = "tf-sql_injection_match_set" diff --git a/website/docs/r/waf_web_acl.html.markdown b/website/docs/r/waf_web_acl.html.markdown index bfc344c00039..0baf09d5e3e2 100644 --- a/website/docs/r/waf_web_acl.html.markdown +++ b/website/docs/r/waf_web_acl.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Web ACL Resource ## Example Usage -```hcl +```terraform resource "aws_waf_ipset" "ipset" { name = "tfIPSet" @@ -62,7 +62,7 @@ resource "aws_waf_web_acl" "waf_acl" { ~> *NOTE:* The Kinesis Firehose Delivery Stream name must begin with `aws-waf-logs-` and be located in `us-east-1` region. See the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/logging.html) for more information about enabling WAF logging. -```hcl +```terraform resource "aws_waf_web_acl" "example" { # ... other configuration ... logging_configuration { diff --git a/website/docs/r/waf_xss_match_set.html.markdown b/website/docs/r/waf_xss_match_set.html.markdown index 099e52af6840..53ae21926f1b 100644 --- a/website/docs/r/waf_xss_match_set.html.markdown +++ b/website/docs/r/waf_xss_match_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF XSS Match Set Resource ## Example Usage -```hcl +```terraform resource "aws_waf_xss_match_set" "xss_match_set" { name = "xss_match_set" diff --git a/website/docs/r/wafregional_byte_match_set.html.markdown b/website/docs/r/wafregional_byte_match_set.html.markdown index 7385dca8d0f3..4d95e16a0c3b 100644 --- a/website/docs/r/wafregional_byte_match_set.html.markdown +++ b/website/docs/r/wafregional_byte_match_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Regional Byte Match Set Resource for use with Application Load Ba ## Example Usage -```hcl +```terraform resource "aws_wafregional_byte_match_set" "byte_set" { name = "tf_waf_byte_match_set" diff --git a/website/docs/r/wafregional_geo_match_set.html.markdown b/website/docs/r/wafregional_geo_match_set.html.markdown index 372c49cdfbb8..bb74aa5d228c 100644 --- a/website/docs/r/wafregional_geo_match_set.html.markdown +++ b/website/docs/r/wafregional_geo_match_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Regional Geo Match Set Resource ## Example Usage -```hcl +```terraform resource "aws_wafregional_geo_match_set" "geo_match_set" { name = "geo_match_set" diff --git a/website/docs/r/wafregional_ipset.html.markdown b/website/docs/r/wafregional_ipset.html.markdown index ec2735d7d6f0..a045292b6ca3 100644 --- a/website/docs/r/wafregional_ipset.html.markdown +++ b/website/docs/r/wafregional_ipset.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Regional IPSet Resource for use with Application Load Balancer. ## Example Usage -```hcl +```terraform resource "aws_wafregional_ipset" "ipset" { name = "tfIPSet" diff --git a/website/docs/r/wafregional_rate_based_rule.html.markdown b/website/docs/r/wafregional_rate_based_rule.html.markdown index 3b7a2d456026..b50f80c30eae 100644 --- a/website/docs/r/wafregional_rate_based_rule.html.markdown +++ b/website/docs/r/wafregional_rate_based_rule.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Rate Based Rule Resource ## Example Usage -```hcl +```terraform resource "aws_wafregional_ipset" "ipset" { name = "tfIPSet" diff --git a/website/docs/r/wafregional_regex_match_set.html.markdown b/website/docs/r/wafregional_regex_match_set.html.markdown index a62da853921e..a7153fd94aa6 100644 --- a/website/docs/r/wafregional_regex_match_set.html.markdown +++ b/website/docs/r/wafregional_regex_match_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Regional Regex Match Set Resource ## Example Usage -```hcl +```terraform resource "aws_wafregional_regex_match_set" "example" { name = "example" diff --git a/website/docs/r/wafregional_regex_pattern_set.html.markdown b/website/docs/r/wafregional_regex_pattern_set.html.markdown index b1074dd779c2..3c7e79d2f066 100644 --- a/website/docs/r/wafregional_regex_pattern_set.html.markdown +++ b/website/docs/r/wafregional_regex_pattern_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Regional Regex Pattern Set Resource ## Example Usage -```hcl +```terraform resource "aws_wafregional_regex_pattern_set" "example" { name = "example" regex_pattern_strings = ["one", "two"] diff --git a/website/docs/r/wafregional_rule.html.markdown b/website/docs/r/wafregional_rule.html.markdown index 524864e31c7b..41e712f4c2f4 100644 --- a/website/docs/r/wafregional_rule.html.markdown +++ b/website/docs/r/wafregional_rule.html.markdown @@ -12,7 +12,7 @@ Provides an WAF Regional Rule Resource for use with Application Load Balancer. ## Example Usage -```hcl +```terraform resource "aws_wafregional_ipset" "ipset" { name = "tfIPSet" diff --git a/website/docs/r/wafregional_rule_group.html.markdown b/website/docs/r/wafregional_rule_group.html.markdown index 0f0966dad455..181665b1b08f 100644 --- a/website/docs/r/wafregional_rule_group.html.markdown +++ b/website/docs/r/wafregional_rule_group.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Regional Rule Group Resource ## Example Usage -```hcl +```terraform resource "aws_wafregional_rule" "example" { name = "example" metric_name = "example" diff --git a/website/docs/r/wafregional_size_constraint_set.html.markdown b/website/docs/r/wafregional_size_constraint_set.html.markdown index aa4bc596e35c..c7558c2954d5 100644 --- a/website/docs/r/wafregional_size_constraint_set.html.markdown +++ b/website/docs/r/wafregional_size_constraint_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Regional Size Constraint Set Resource for use with Application Lo ## Example Usage -```hcl +```terraform resource "aws_wafregional_size_constraint_set" "size_constraint_set" { name = "tfsize_constraints" diff --git a/website/docs/r/wafregional_sql_injection_match_set.html.markdown b/website/docs/r/wafregional_sql_injection_match_set.html.markdown index 6780264e456a..7978425c8006 100644 --- a/website/docs/r/wafregional_sql_injection_match_set.html.markdown +++ b/website/docs/r/wafregional_sql_injection_match_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Regional SQL Injection Match Set Resource for use with Applicatio ## Example Usage -```hcl +```terraform resource "aws_wafregional_sql_injection_match_set" "sql_injection_match_set" { name = "tf-sql_injection_match_set" diff --git a/website/docs/r/wafregional_web_acl.html.markdown b/website/docs/r/wafregional_web_acl.html.markdown index 9aa7fb02fc5a..6d33d16ae35a 100644 --- a/website/docs/r/wafregional_web_acl.html.markdown +++ b/website/docs/r/wafregional_web_acl.html.markdown @@ -14,7 +14,7 @@ Provides a WAF Regional Web ACL Resource for use with Application Load Balancer. ### Regular Rule -```hcl +```terraform resource "aws_wafregional_ipset" "ipset" { name = "tfIPSet" @@ -57,7 +57,7 @@ resource "aws_wafregional_web_acl" "wafacl" { ### Group Rule -```hcl +```terraform resource "aws_wafregional_web_acl" "example" { name = "example" metric_name = "example" @@ -82,7 +82,7 @@ resource "aws_wafregional_web_acl" "example" { ~> *NOTE:* The Kinesis Firehose Delivery Stream name must begin with `aws-waf-logs-`. See the [AWS WAF Developer Guide](https://docs.aws.amazon.com/waf/latest/developerguide/logging.html) for more information about enabling WAF logging. -```hcl +```terraform resource "aws_wafregional_web_acl" "example" { # ... other configuration ... diff --git a/website/docs/r/wafregional_web_acl_association.html.markdown b/website/docs/r/wafregional_web_acl_association.html.markdown index 383ae77c4353..b7f106c2b9a6 100644 --- a/website/docs/r/wafregional_web_acl_association.html.markdown +++ b/website/docs/r/wafregional_web_acl_association.html.markdown @@ -12,9 +12,11 @@ Manages an association with WAF Regional Web ACL. -> **Note:** An Application Load Balancer can only be associated with one WAF Regional WebACL. -## Application Load Balancer Association Example +## Example Usage -```hcl +### Application Load Balancer Association + +```terraform resource "aws_wafregional_ipset" "ipset" { name = "tfIPSet" @@ -82,9 +84,9 @@ resource "aws_wafregional_web_acl_association" "foo" { } ``` -## API Gateway Association Example +### API Gateway Association -```hcl +```terraform resource "aws_wafregional_ipset" "ipset" { name = "tfIPSet" diff --git a/website/docs/r/wafregional_xss_match_set.html.markdown b/website/docs/r/wafregional_xss_match_set.html.markdown index dc020e00abce..222e73fd3199 100644 --- a/website/docs/r/wafregional_xss_match_set.html.markdown +++ b/website/docs/r/wafregional_xss_match_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAF Regional XSS Match Set Resource for use with Application Load Bal ## Example Usage -```hcl +```terraform resource "aws_wafregional_xss_match_set" "xss_match_set" { name = "xss_match_set" diff --git a/website/docs/r/wafv2_ip_set.html.markdown b/website/docs/r/wafv2_ip_set.html.markdown index 10fa926bbe60..f0d46a50d835 100644 --- a/website/docs/r/wafv2_ip_set.html.markdown +++ b/website/docs/r/wafv2_ip_set.html.markdown @@ -12,7 +12,7 @@ Provides a WAFv2 IP Set Resource ## Example Usage -```hcl +```terraform resource "aws_wafv2_ip_set" "example" { name = "example" description = "Example IP set" diff --git a/website/docs/r/wafv2_regex_pattern_set.html.markdown b/website/docs/r/wafv2_regex_pattern_set.html.markdown index 02e643041a59..71d7aff53ca1 100644 --- a/website/docs/r/wafv2_regex_pattern_set.html.markdown +++ b/website/docs/r/wafv2_regex_pattern_set.html.markdown @@ -12,7 +12,7 @@ Provides an AWS WAFv2 Regex Pattern Set Resource ## Example Usage -```hcl +```terraform resource "aws_wafv2_regex_pattern_set" "example" { name = "example" description = "Example regex pattern set" diff --git a/website/docs/r/wafv2_rule_group.html.markdown b/website/docs/r/wafv2_rule_group.html.markdown index 26e43c860346..b10a5f7b0022 100644 --- a/website/docs/r/wafv2_rule_group.html.markdown +++ b/website/docs/r/wafv2_rule_group.html.markdown @@ -14,7 +14,7 @@ Creates a WAFv2 Rule Group resource. ### Simple -```hcl +```terraform resource "aws_wafv2_rule_group" "example" { name = "example-rule" scope = "REGIONAL" @@ -52,7 +52,7 @@ resource "aws_wafv2_rule_group" "example" { ### Complex -```hcl +```terraform resource "aws_wafv2_ip_set" "test" { name = "test" scope = "REGIONAL" @@ -307,7 +307,7 @@ Each `rule` supports the following arguments: The `action` block supports the following arguments: -~> **NOTE**: One of `allow`, `block`, or `count`, expressed as an empty configuration block `{}`, is required when specifying an `action` +~> **NOTE:** One of `allow`, `block`, or `count`, expressed as an empty configuration block `{}`, is required when specifying an `action` * `allow` - (Optional) Instructs AWS WAF to allow the web request. * `block` - (Optional) Instructs AWS WAF to block the web request. @@ -429,7 +429,8 @@ The part of a web request that you want AWS WAF to inspect. Include the single ` The `field_to_match` block supports the following arguments: -~> **NOTE**: An empty configuration block `{}` should be used when specifying `all_query_arguments`, `body`, `method`, or `query_string` attributes +~> **NOTE:** Only one of `all_query_arguments`, `body`, `method`, `query_string`, `single_header`, `single_query_argument`, or `uri_path` can be specified. +An empty configuration block `{}` should be used when specifying `all_query_arguments`, `body`, `method`, or `query_string` attributes. * `all_query_arguments` - (Optional) Inspect all query arguments. * `body` - (Optional) Inspect the request body, which immediately follows the request headers. diff --git a/website/docs/r/wafv2_web_acl.html.markdown b/website/docs/r/wafv2_web_acl.html.markdown index 170b9e59c549..2ce8e49de23f 100644 --- a/website/docs/r/wafv2_web_acl.html.markdown +++ b/website/docs/r/wafv2_web_acl.html.markdown @@ -17,7 +17,7 @@ This resource is based on `aws_wafv2_rule_group`, check the documentation of the ### Managed Rule -```hcl +```terraform resource "aws_wafv2_web_acl" "example" { name = "managed-rule-example" description = "Example of a managed rule." @@ -72,7 +72,7 @@ resource "aws_wafv2_web_acl" "example" { ### Rate Based -```hcl +```terraform resource "aws_wafv2_web_acl" "example" { name = "rate-based-example" description = "Example of a rate based statement." @@ -125,7 +125,7 @@ resource "aws_wafv2_web_acl" "example" { ### Rule Group Reference -```hcl +```terraform resource "aws_wafv2_rule_group" "example" { capacity = 10 name = "example-rule-group" @@ -267,14 +267,14 @@ The following arguments are supported: The `default_action` block supports the following arguments: -~> **NOTE**: One of `allow` or `block`, expressed as an empty configuration block `{}`, is required when specifying a `default_action` +~> **NOTE:** One of `allow` or `block`, expressed as an empty configuration block `{}`, is required when specifying a `default_action` * `allow` - (Optional) Specifies that AWS WAF should allow requests by default. * `block` - (Optional) Specifies that AWS WAF should block requests by default. ### Rules -~> **NOTE**: One of `action` or `override_action` is required when specifying a rule +~> **NOTE:** One of `action` or `override_action` is required when specifying a rule Each `rule` supports the following arguments: @@ -289,7 +289,7 @@ Each `rule` supports the following arguments: The `action` block supports the following arguments: -~> **NOTE**: One of `allow`, `block`, or `count`, expressed as an empty configuration block `{}`, is required when specifying an `action` +~> **NOTE:** One of `allow`, `block`, or `count`, expressed as an empty configuration block `{}`, is required when specifying an `action` * `allow` - (Optional) Instructs AWS WAF to allow the web request. Configure as an empty block `{}`. * `block` - (Optional) Instructs AWS WAF to block the web request. Configure as an empty block `{}`. @@ -299,7 +299,7 @@ The `action` block supports the following arguments: The `override_action` block supports the following arguments: -~> **NOTE**: One of `count` or `none`, expressed as an empty configuration block `{}`, is required when specifying an `override_action` +~> **NOTE:** One of `count` or `none`, expressed as an empty configuration block `{}`, is required when specifying an `override_action` * `count` - (Optional) Override the rule action setting to count (i.e. only count matches). Configured as an empty block `{}`. * `none` - (Optional) Don't override the rule action setting. Configured as an empty block `{}`. @@ -466,7 +466,8 @@ The part of a web request that you want AWS WAF to inspect. Include the single ` The `field_to_match` block supports the following arguments: -~> **NOTE**: An empty configuration block `{}` should be used when specifying `all_query_arguments`, `body`, `method`, `query_string`, or `uri_path` attributes +~> **NOTE:** Only one of `all_query_arguments`, `body`, `method`, `query_string`, `single_header`, `single_query_argument`, or `uri_path` can be specified. +An empty configuration block `{}` should be used when specifying `all_query_arguments`, `body`, `method`, or `query_string` attributes. * `all_query_arguments` - (Optional) Inspect all query arguments. * `body` - (Optional) Inspect the request body, which immediately follows the request headers. diff --git a/website/docs/r/wafv2_web_acl_association.html.markdown b/website/docs/r/wafv2_web_acl_association.html.markdown index 30be8046b3c2..fe82ebd6663b 100644 --- a/website/docs/r/wafv2_web_acl_association.html.markdown +++ b/website/docs/r/wafv2_web_acl_association.html.markdown @@ -17,7 +17,7 @@ Creates a WAFv2 Web ACL Association. ## Example Usage -```hcl +```terraform resource "aws_api_gateway_rest_api" "example" { body = jsonencode({ openapi = "3.0.1" @@ -89,6 +89,10 @@ The following arguments are supported: * `resource_arn` - (Required) The Amazon Resource Name (ARN) of the resource to associate with the web ACL. This must be an ARN of an Application Load Balancer or an Amazon API Gateway stage. * `web_acl_arn` - (Required) The Amazon Resource Name (ARN) of the Web ACL that you want to associate with the resource. +## Attributes Reference + +No additional attributes are exported. + ## Import WAFv2 Web ACL Association can be imported using `WEB_ACL_ARN,RESOURCE_ARN` e.g. diff --git a/website/docs/r/wafv2_web_acl_logging_configuration.html.markdown b/website/docs/r/wafv2_web_acl_logging_configuration.html.markdown index 2c2307a83bfa..3c183691ad73 100644 --- a/website/docs/r/wafv2_web_acl_logging_configuration.html.markdown +++ b/website/docs/r/wafv2_web_acl_logging_configuration.html.markdown @@ -16,7 +16,7 @@ Be sure to give the data firehose a name that starts with the prefix `aws-waf-lo ## Example Usage -```hcl +```terraform resource "aws_wafv2_web_acl_logging_configuration" "example" { log_destination_configs = [aws_kinesis_firehose_delivery_stream.example.arn] resource_arn = aws_wafv2_web_acl.example.arn @@ -38,13 +38,15 @@ The following arguments are supported: The `redacted_fields` block supports the following arguments: -* `all_query_arguments` - (Optional) Redact all query arguments. -* `body` - (Optional) Redact the request body, which immediately follows the request headers. -* `method` - (Optional) Redact the HTTP method. The method indicates the type of operation that the request is asking the origin to perform. -* `query_string` - (Optional) Redact the query string. This is the part of a URL that appears after a `?` character, if any. +~> **NOTE:** Only one of `method`, `query_string`, `single_header` or `uri_path` can be specified. + +* `all_query_arguments` - (Optional, **DEPRECATED**) Redact all query arguments. +* `body` - (Optional, **DEPRECATED**) Redact the request body, which immediately follows the request headers. +* `method` - (Optional) Redact the HTTP method. Must be specified as an empty configuration block `{}`. The method indicates the type of operation that the request is asking the origin to perform. +* `query_string` - (Optional) Redact the query string. Must be specified as an empty configuration block `{}`. This is the part of a URL that appears after a `?` character, if any. * `single_header` - (Optional) Redact a single header. See [Single Header](#single-header) below for details. -* `single_query_argument` - (Optional) Redact a single query argument. See [Single Query Argument](#single-query-argument) below for details. -* `uri_path` - (Optional) Redact the request URI path. This is the part of a web request that identifies a resource, for example, `/images/daily-ad.jpg`. +* `single_query_argument` - (Optional, **DEPRECATED**) Redact a single query argument. See [Single Query Argument](#single-query-argument) below for details. +* `uri_path` - (Optional) Redact the request URI path. Must be specified as an empty configuration block `{}`. This is the part of a web request that identifies a resource, for example, `/images/daily-ad.jpg`. ### Single Header @@ -54,7 +56,7 @@ The `single_header` block supports the following arguments: * `name` - (Optional) The name of the query header to redact. This setting must be provided as lower case characters. -### Single Query Argument +### Single Query Argument (**DEPRECATED**) Redact a single query argument. Provide the name of the query argument to redact, such as `UserName` or `SalesRegion` (provided as lowercase strings). @@ -74,3 +76,4 @@ WAFv2 Web ACL Logging Configurations can be imported using the WAFv2 Web ACL ARN ``` $ terraform import aws_wafv2_web_acl_logging_configuration.example arn:aws:wafv2:us-west-2:123456789012:regional/webacl/test-logs/a1b2c3d4-5678-90ab-cdef +``` diff --git a/website/docs/r/worklink_fleet.html.markdown b/website/docs/r/worklink_fleet.html.markdown index 88a40b57ef06..70aa0d411020 100644 --- a/website/docs/r/worklink_fleet.html.markdown +++ b/website/docs/r/worklink_fleet.html.markdown @@ -12,7 +12,7 @@ description: |- Basic usage: -```hcl +```terraform resource "aws_worklink_fleet" "example" { name = "terraform-example" } @@ -20,7 +20,7 @@ resource "aws_worklink_fleet" "example" { Network Configuration Usage: -```hcl +```terraform resource "aws_worklink_fleet" "example" { name = "terraform-example" @@ -34,7 +34,7 @@ resource "aws_worklink_fleet" "example" { Identity Provider Configuration Usage: -```hcl +```terraform resource "aws_worklink_fleet" "test" { name = "tf-worklink-fleet" diff --git a/website/docs/r/worklink_website_certificate_authority_association.html.markdown b/website/docs/r/worklink_website_certificate_authority_association.html.markdown index faf157b5a7d7..16ac310c02de 100644 --- a/website/docs/r/worklink_website_certificate_authority_association.html.markdown +++ b/website/docs/r/worklink_website_certificate_authority_association.html.markdown @@ -10,7 +10,7 @@ description: |- ## Example Usage -```hcl +```terraform resource "aws_worklink_fleet" "example" { name = "terraform-example" } diff --git a/website/docs/r/workspaces_directory.html.markdown b/website/docs/r/workspaces_directory.html.markdown index f9b523949d03..9e5c913c9329 100644 --- a/website/docs/r/workspaces_directory.html.markdown +++ b/website/docs/r/workspaces_directory.html.markdown @@ -14,7 +14,7 @@ Provides a WorkSpaces directory in AWS WorkSpaces Service. ## Example Usage -```hcl +```terraform resource "aws_workspaces_directory" "example" { directory_id = aws_directory_service_directory.example.id subnet_ids = [ @@ -128,7 +128,7 @@ resource "aws_subnet" "example_d" { ### IP Groups -```hcl +```terraform resource "aws_workspaces_directory" "example" { directory_id = aws_directory_service_directory.example.id @@ -142,7 +142,7 @@ resource "aws_workspaces_ip_group" "example" { } ``` -## Arguments Reference +## Argument Reference The following arguments are supported: diff --git a/website/docs/r/workspaces_ip_group.html.markdown b/website/docs/r/workspaces_ip_group.html.markdown index e15aebba92ec..3923da0c1bd0 100644 --- a/website/docs/r/workspaces_ip_group.html.markdown +++ b/website/docs/r/workspaces_ip_group.html.markdown @@ -12,7 +12,7 @@ Provides an IP access control group in AWS WorkSpaces Service ## Example Usage -```hcl +```terraform resource "aws_workspaces_ip_group" "contractors" { name = "Contractors" description = "Contractors IP access control group" diff --git a/website/docs/r/workspaces_workspace.html.markdown b/website/docs/r/workspaces_workspace.html.markdown index a62b266f4375..d39f28cd4cc8 100644 --- a/website/docs/r/workspaces_workspace.html.markdown +++ b/website/docs/r/workspaces_workspace.html.markdown @@ -14,7 +14,7 @@ Provides a workspace in [AWS Workspaces](https://docs.aws.amazon.com/workspaces/ ## Example Usage -```hcl +```terraform data "aws_workspaces_bundle" "value_windows_10" { bundle_id = "wsb-bh8rsxt14" # Value with Windows 10 (English) } diff --git a/website/docs/r/xray_encryption_config.html.markdown b/website/docs/r/xray_encryption_config.html.markdown index 758d578a84c9..6e566c283498 100644 --- a/website/docs/r/xray_encryption_config.html.markdown +++ b/website/docs/r/xray_encryption_config.html.markdown @@ -14,7 +14,7 @@ Creates and manages an AWS XRay Encryption Config. ## Example Usage -```hcl +```terraform resource "aws_xray_encryption_config" "example" { type = "NONE" } @@ -22,7 +22,7 @@ resource "aws_xray_encryption_config" "example" { ## Example Usage with KMS Key -```hcl +```terraform resource "aws_kms_key" "example" { description = "Some Key" deletion_window_in_days = 7 diff --git a/website/docs/r/xray_group.html.markdown b/website/docs/r/xray_group.html.markdown index 83844b545ace..4da5bd4f8bda 100644 --- a/website/docs/r/xray_group.html.markdown +++ b/website/docs/r/xray_group.html.markdown @@ -12,7 +12,7 @@ Creates and manages an AWS XRay Group. ## Example Usage -```hcl +```terraform resource "aws_xray_group" "example" { group_name = "example" filter_expression = "responsetime > 5" diff --git a/website/docs/r/xray_sampling_rule.html.markdown b/website/docs/r/xray_sampling_rule.html.markdown index f596f7bc296e..12fd88c38429 100644 --- a/website/docs/r/xray_sampling_rule.html.markdown +++ b/website/docs/r/xray_sampling_rule.html.markdown @@ -12,7 +12,7 @@ Creates and manages an AWS XRay Sampling Rule. ## Example Usage -```hcl +```terraform resource "aws_xray_sampling_rule" "example" { rule_name = "example" priority = 10000