Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Add resources for AWS Amplify #1

Closed
wants to merge 104 commits into from
Closed

[WIP] Add resources for AWS Amplify #1

wants to merge 104 commits into from

Conversation

k24d
Copy link
Owner

@k24d k24d commented Feb 2, 2020

This is an experimental implementation of AWS Amplify resources for terraform-provider-aws.

Available resources

  • aws_amplify_app (doc)
  • aws_amplify_backend_environment (doc)
  • aws_amplify_branch (doc)
  • aws_amplify_domain_association (doc)
  • aws_amplify_webhook (doc)

Guideline:
https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md

prabusah and others added 26 commits December 21, 2019 23:17
…ue_green_deployment_config` if it is not set
…source-buckets-sweeper

Updates test S3 bucket name to match sweeper patterns
Output from acceptance testing:

```
--- PASS: TestAccAWSCloudFormationStack_yaml (58.55s)
--- PASS: TestAccAWSCloudFormationStack_dataSource_yaml (59.40s)
```
…hashicorp#11819)

References
* hashicorp#11811

The AWS application-autoscaling service has eventual consistency
considerations. The `aws_appautoscaling_target` resource immediately
tries to read a scaling target after creation. If the target is not
found, the application-autoscaling service returns a 200 OK with an
empty list of scaling targets. Since no scaling target is present, the
`aws_appautoscaling_target` resource removes the created resource from
state, leading to a "produced an unexpected new value for was present,
but now absent" error.

With the changes in this commit, the empty list of scaling targets in
the response for the newly created resource will result in a
NotFoundError being returned and a retry of the read request. A
subsequent retry should hopefully be successful, leading to the state
being preserved.

Output from acceptance testing:

```
> make testacc TEST=./aws TESTARGS='-run=TestAccAWSAppautoScalingTarget_'
...
--- PASS: TestAccAWSAppautoScalingTarget_multipleTargets (30.77s)
--- PASS: TestAccAWSAppautoScalingTarget_optionalRoleArn (32.50s)
--- PASS: TestAccAWSAppautoScalingTarget_spotFleetRequest (77.50s)
--- PASS: TestAccAWSAppautoScalingTarget_basic (107.66s)
--- PASS: TestAccAWSAppautoScalingTarget_emrCluster (783.20s)
```
hashicorp#10952)

Output from acceptance testing:

```
--- PASS: TestAccAWSCodeBuildProject_ARMContainer (92.62s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_ArtifactIdentifier (47.04s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_EncryptionDisabled (66.34s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_Location (192.93s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_Name (52.07s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_NamespaceType (56.03s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_OverrideArtifactName (131.45s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_Packaging (43.52s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_Path (83.45s)
--- PASS: TestAccAWSCodeBuildProject_Artifacts_Type (52.39s)
--- PASS: TestAccAWSCodeBuildProject_BadgeEnabled (43.37s)
--- PASS: TestAccAWSCodeBuildProject_basic (44.80s)
--- PASS: TestAccAWSCodeBuildProject_BuildTimeout (157.79s)
--- PASS: TestAccAWSCodeBuildProject_Cache (144.10s)
--- PASS: TestAccAWSCodeBuildProject_Description (80.83s)
--- PASS: TestAccAWSCodeBuildProject_EncryptionKey (62.33s)
--- PASS: TestAccAWSCodeBuildProject_Environment_Certificate (56.64s)
--- PASS: TestAccAWSCodeBuildProject_Environment_EnvironmentVariable (133.92s)
--- PASS: TestAccAWSCodeBuildProject_Environment_EnvironmentVariable_Type (69.10s)
--- PASS: TestAccAWSCodeBuildProject_Environment_RegistryCredential (46.80s)
--- PASS: TestAccAWSCodeBuildProject_LogsConfig_CloudWatchLogs (277.31s)
--- PASS: TestAccAWSCodeBuildProject_LogsConfig_S3Logs (270.04s)
--- PASS: TestAccAWSCodeBuildProject_QueuedTimeout (55.61s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts (52.52s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_ArtifactIdentifier (114.04s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_EncryptionDisabled (50.52s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_Location (55.77s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_NamespaceType (70.16s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_OverrideArtifactName (46.25s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_Packaging (56.84s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_Path (39.60s)
--- PASS: TestAccAWSCodeBuildProject_SecondaryArtifacts_Type (77.54s)
--- PASS: TestAccAWSCodeBuildProject_SecondarySources_CodeCommit (28.46s)
--- PASS: TestAccAWSCodeBuildProject_SecondarySources_GitSubmodulesConfig (94.98s)
--- PASS: TestAccAWSCodeBuildProject_Source_GitCloneDepth (64.49s)
--- PASS: TestAccAWSCodeBuildProject_Source_GitSubmodulesConfig (253.86s)
--- PASS: TestAccAWSCodeBuildProject_Source_InsecureSSL (235.09s)
--- PASS: TestAccAWSCodeBuildProject_Source_ReportBuildStatus_Bitbucket (93.96s)
--- PASS: TestAccAWSCodeBuildProject_Source_ReportBuildStatus_GitHub (116.11s)
--- PASS: TestAccAWSCodeBuildProject_Source_ReportBuildStatus_GitHubEnterprise (103.51s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_Bitbucket (42.17s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_CodeCommit (28.32s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_CodePipeline (56.95s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_GitHubEnterprise (45.62s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_NoSource (27.93s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_NoSourceInvalid (11.59s)
--- PASS: TestAccAWSCodeBuildProject_Source_Type_S3 (85.86s)
--- PASS: TestAccAWSCodeBuildProject_Tags (102.04s)
--- PASS: TestAccAWSCodeBuildProject_VpcConfig (144.61s)
--- PASS: TestAccAWSCodeBuildProject_WindowsContainer (51.60s)
```
…letion eventual consistency (hashicorp#11671)

Output from acceptance testing:

```
--- PASS: TestAccAWSPlacementGroup_disappears (6.34s)
--- PASS: TestAccAWSPlacementGroup_basic (7.95s)
--- PASS: TestAccAWSPlacementGroup_tags (18.71s)
```
Output from acceptance testing:

```
--- PASS: TestAccAWSSsmPatchBaselineDataSource_existingBaseline (8.36s)
--- PASS: TestAccAWSSsmPatchBaselineDataSource_newBaseline (8.76s)
```
bflad added 3 commits February 3, 2020 15:12
)

Reference: https://www.terraform.io/docs/providers/aws/d/ebs_default_kms_key.html
Reference: https://www.terraform.io/docs/providers/aws/r/ssm_patch_baseline.html
Reference: hashicorp#11825

Disables all failing rules to start. MD031 and MD032 should be fixed and enabled shortly as they can cause formatting failures in terraform.io documentation.

Breakdown of all these disabled rules:

```console
$ docker run -v $(pwd):/markdown 06kellyjac/markdownlint-cli website/docs/ |& cut -d ' ' -f 2 | cut -d '/' -f 1 | sort | uniq -c
  10 MD001
   1 MD003
 246 MD004
 223 MD006
 263 MD007
  70 MD009
 243 MD010
 147 MD012
4968 MD013
 447 MD014
   1 MD018
   1 MD019
  51 MD022
   9 MD024
   8 MD026
   2 MD030
  20 MD031
  20 MD032
   7 MD033
  31 MD034
  10 MD038
 418 MD040
   2 MD046
  10 MD047
```
Previously in acceptance testing:

```
--- FAIL: TestAccAWSSSMMaintenanceWindow_Schedule (5.72s)
    testing.go:640: Step 0 error: errors during apply:

        Error: error creating SSM Maintenance Window: ResourceLimitExceededException: Window limit exceeded.
```

Output from sweeper in AWS Commercial:

```console
$ aws ssm describe-maintenance-windows | jq '.WindowIdentities | length'
47
$ go test ./aws -v -timeout=10h -sweep=us-west-2 -sweep-run=aws_ssm_maintenance_window -sweep-allow-failures
2020/01/21 09:15:42 [DEBUG] Running Sweepers for region (us-west-2):
2020/01/21 09:15:42 [DEBUG] Running Sweeper (aws_ssm_maintenance_window) in region (us-west-2)
...
2020/01/21 09:15:45 [INFO] Deleting SSM Maintenance Window: mw-0011d970655f367d9
...
2020/01/21 09:16:05 [INFO] Deleting SSM Maintenance Window: mw-0f1252954f94ae52c
2020/01/21 09:16:06 Sweeper Tests ran successfully:
	- aws_ssm_maintenance_window
ok  	github.com/terraform-providers/terraform-provider-aws/aws	25.323s
$ aws ssm describe-maintenance-windows | jq '.WindowIdentities | length'
0
```

Output from sweeper in AWS GovCloud (US):

```console
$ go test ./aws -v -timeout=10h -sweep=us-gov-west-1 -sweep-run=aws_ssm_maintenance_window -sweep-allow-failures
2020/01/21 09:19:12 [DEBUG] Running Sweepers for region (us-gov-west-1):
2020/01/21 09:19:12 [DEBUG] Running Sweeper (aws_ssm_maintenance_window) in region (us-gov-west-1)
...
2020/01/21 09:19:15 Sweeper Tests ran successfully:
	- aws_ssm_maintenance_window
ok  	github.com/terraform-providers/terraform-provider-aws/aws	4.883s
```
…letion (hashicorp#11692)

Previously in the acceptance testing:

```
--- FAIL: TestAccAWSDynamoDbGlobalTable_multipleRegions (67.39s)
    testing.go:701: Error destroying resource! WARNING: Dangling resources
        may exist. The full state and error is shown below.

        Error: errors during apply: error deleting DynamoDB Table (tf-acc-test-tyuvv): Error deleting DynamoDB table: ResourceNotFoundException: Requested resource not found: Table: tf-acc-test-tyuvv not found
```

The prior code would wrap the `awserr.Error` in a `fmt.Errorf()` which meant the error was returned by value. The calling code already handles the error message context, so we remove the error wrapping so consumers can work with the AWS error type correctly. Another solution here would be instead using the Go 1.13 `%w` format verb, which will be part of a future linting check.

Output from acceptance testing:

```
--- PASS: TestAccAWSDynamoDbGlobalTable_basic (86.21s)
--- PASS: TestAccAWSDynamoDbGlobalTable_multipleRegions (106.17s)

--- PASS: TestAccAWSDynamoDbTable_attributeUpdate (463.78s)
--- PASS: TestAccAWSDynamoDbTable_attributeUpdateValidation (6.14s)
--- PASS: TestAccAWSDynamoDbTable_basic (27.57s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_GSI_PayPerRequestToProvisioned (57.72s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_GSI_ProvisionedToPayPerRequest (1149.43s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_PayPerRequestToProvisioned (45.62s)
--- PASS: TestAccAWSDynamoDbTable_BillingMode_ProvisionedToPayPerRequest (1325.53s)
--- PASS: TestAccAWSDynamoDbTable_disappears (19.40s)
--- PASS: TestAccAWSDynamoDbTable_disappears_PayPerRequestWithGSI (100.90s)
--- PASS: TestAccAWSDynamoDbTable_enablePitr (133.02s)
--- PASS: TestAccAWSDynamoDbTable_encryption (62.77s)
--- PASS: TestAccAWSDynamoDbTable_extended (195.41s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateCapacity (56.73s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateNonKeyAttributes (157.72s)
--- PASS: TestAccAWSDynamoDbTable_gsiUpdateOtherAttributes (465.18s)
--- PASS: TestAccAWSDynamoDbTable_streamSpecification (67.08s)
--- PASS: TestAccAWSDynamoDbTable_streamSpecificationValidation (4.85s)
--- PASS: TestAccAWSDynamoDbTable_tags (36.51s)
--- PASS: TestAccAWSDynamoDbTable_Ttl_Disabled (41.27s)
--- PASS: TestAccAWSDynamoDbTable_Ttl_Enabled (29.97s)
```
bflad and others added 5 commits February 5, 2020 20:45
…ttachment resources (hashicorp#11612)

Output from acceptance testing:

```
    --- PASS: TestAccAWSOrganizations/Policy (138.40s)
        --- PASS: TestAccAWSOrganizations/Policy/basic (32.06s)
        --- PASS: TestAccAWSOrganizations/Policy/concurrent (32.60s)
        --- PASS: TestAccAWSOrganizations/Policy/Description (29.99s)
        --- PASS: TestAccAWSOrganizations/Policy/Type (43.75s)
    --- PASS: TestAccAWSOrganizations/PolicyAttachment (94.82s)
        --- PASS: TestAccAWSOrganizations/PolicyAttachment/Account (40.77s)
        --- PASS: TestAccAWSOrganizations/PolicyAttachment/OrganizationalUnit (27.87s)
        --- PASS: TestAccAWSOrganizations/PolicyAttachment/Root (26.17s)
```
…icorp#11617)

References:
* hashicorp#11611

The AWS logs service has eventual consistency considerations. The
`aws_cloudwatch_log_stream` resource immediately tries to read a stream
after creation. If the stream is not found, the logs service returns a 200
OK with an empty list of streams. Since no streams are present, the
`aws_cloudwatch_log_stream` resource removes the created resource from
state, leading to a "produced an unexpected new value for was present,
but now absent" error.

With the changes in this commit, the empty list of streams in the response
for the newly created resource will result in a NotFoundError being returned
and a retry of the read request. A subsequent retry should hopefully be
successful, leading to the state being preserved.

Output from acceptance testing:

```
make testacc TEST=./aws TESTARGS='-run=TestAccAWSCloudWatchLogStream_'
...
--- PASS: TestAccAWSCloudWatchLogStream_disappears_LogGroup (16.77s)
--- PASS: TestAccAWSCloudWatchLogStream_disappears (19.55s)
--- PASS: TestAccAWSCloudWatchLogStream_basic (19.91s)
```
camlow325 and others added 7 commits February 6, 2020 08:49
…ng (hashicorp#11649)

References:
* hashicorp#11305

If a processor has previously been added to the extended S3
configuration for a Kinesis firehose delivery stream and an attempt is
made to remove the processor for a subsequent apply, the stream resource
currently attempts to pass in a processor with empty data. The
UpdateDestination function in the AWS SDK rejects this processor as
invalid per its schema and fails the apply.

With the changes in this commit, the stream resource would remove empty
processor elements before passing them up to the UpdateDestination call.
This allows the empty processor elements to be removed successfully.

Output from acceptance testing:

```
make testacc TEST=./aws TESTARGS='-run=TestAccAWSKinesisFirehoseDeliveryStream_'
...
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_missingProcessingConfiguration (72.65s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_OpenXJsonSerDe_Empty (84.32s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_ParquetSerDe_Empty (84.82s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_OrcSerDe_Empty (86.81s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3WithCloudwatchLogging (92.66s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Serializer_Update (99.07s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_basic (100.02s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ErrorOutputPrefix (100.22s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Deserializer_Update (101.59s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3KmsKeyArn (104.93s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_HiveJsonSerDe_Empty (109.56s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basicWithTags (112.94s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_ExternalUpdate (114.35s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3KinesisStreamSource (117.80s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_SplunkConfigUpdates (125.21s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3Updates (141.99s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basic (77.82s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3basic (88.79s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3ConfigUpdates (175.05s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_s3basicWithSSE (199.39s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ExtendedS3_DataFormatConversionConfiguration_Enabled (124.94s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_RedshiftConfigUpdates (566.48s)
--- PASS: TestAccAWSKinesisFirehoseDeliveryStream_ElasticsearchConfigUpdates (706.62s)
```
@k24d k24d closed this Feb 14, 2020
@k24d k24d deleted the amplify branch February 14, 2020 03:35
@k24d k24d restored the amplify branch February 14, 2020 03:54
@k24d k24d deleted the amplify branch February 14, 2020 03:55
k24d pushed a commit that referenced this pull request Mar 12, 2020
ewbankkit pushed a commit that referenced this pull request Jun 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.