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

awsproviderlint: Enforce kms_key_id as ARN attribute in AWSAT001 check #13996

Merged
merged 1 commit into from
Jun 30, 2020

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Jun 30, 2020

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Release note for CHANGELOG:

NONE

Previously, test failures could include these outside AWS Commercial:

--- FAIL: TestAccAWSEBSSnapshot_withKms (88.99s)
testing.go:684: Step 0 error: Check failed: Check 2/2 error: aws_ebs_snapshot.test: Attribute 'kms_key_id' didn't match "^arn:aws:kms:[a-z]{2}-[a-z]+-\\d{1}:[0-9]{12}:key/[a-z0-9-]{36}$", got "arn:aws-us-gov:kms:us-gov-west-1:123456789012:key/59dff49a-68bc-407d-959c-deb91757d55b"

New AWSAT001 check test failures:

aws/resource_aws_db_instance_test.go:187:6: AWSAT001: prefer resource.TestCheckResourceAttrPair() or ARN check functions (e.g. testAccMatchResourceAttrRegionalARN)
aws/resource_aws_ebs_snapshot_test.go:127:6: AWSAT001: prefer resource.TestCheckResourceAttrPair() or ARN check functions (e.g. testAccMatchResourceAttrRegionalARN)
aws/resource_aws_fsx_windows_file_system_test.go:92:6: AWSAT001: prefer resource.TestCheckResourceAttrPair() or ARN check functions (e.g. testAccMatchResourceAttrRegionalARN)
aws/resource_aws_rds_cluster_instance_test.go:207:6: AWSAT001: prefer resource.TestCheckResourceAttrPair() or ARN check functions (e.g. testAccMatchResourceAttrRegionalARN)

Output from acceptance testing in AWS Commercial:

--- PASS: TestAccAWSEBSSnapshot_withKms (41.72s)
--- PASS: TestAccAWSDBInstance_kmsKey (486.55s)
--- PASS: TestAccAWSRDSClusterInstance_kmsKey (691.04s)
--- PASS: TestAccAWSFsxWindowsFileSystem_basic (3121.42s)

Output from acceptance testing in AWS GovCloud (US) (hardcoded AZ and service availability PreCheck test failures will be separately addressed in the future):

--- PASS: TestAccAWSEBSSnapshot_withKms (60.17s)
--- PASS: TestAccAWSDBInstance_kmsKey (479.81s)

--- FAIL: TestAccAWSRDSClusterInstance_kmsKey (17.37s)
    TestAccAWSRDSClusterInstance_kmsKey: testing.go:684: Step 0 error: errors during apply:

        Error: error creating RDS cluster: InvalidVPCNetworkStateFault: Availability zones '[us-west-2a, us-west-2b, us-west-2c]' are unavailable in this region, please choose another zone set.

--- FAIL: TestAccAWSFsxWindowsFileSystem_basic (1743.81s)
    TestAccAWSFsxWindowsFileSystem_basic: testing.go:684: Step 0 error: errors during apply:

        Error: Error creating FSx filesystem: RequestError: send request failed
        caused by: Post "https://fsx.us-gov-west-1.amazonaws.com/": dial tcp: lookup fsx.us-gov-west-1.amazonaws.com: no such host

Previously, test failures could include these outside AWS Commercial:

```
--- FAIL: TestAccAWSEBSSnapshot_withKms (88.99s)
testing.go:684: Step 0 error: Check failed: Check 2/2 error: aws_ebs_snapshot.test: Attribute 'kms_key_id' didn't match "^arn:aws:kms:[a-z]{2}-[a-z]+-\\d{1}:[0-9]{12}:key/[a-z0-9-]{36}$", got "arn:aws-us-gov:kms:us-gov-west-1:123456789012:key/59dff49a-68bc-407d-959c-deb91757d55b"
```

New AWSAT001 check test failures:

```
aws/resource_aws_db_instance_test.go:187:6: AWSAT001: prefer resource.TestCheckResourceAttrPair() or ARN check functions (e.g. testAccMatchResourceAttrRegionalARN)
aws/resource_aws_ebs_snapshot_test.go:127:6: AWSAT001: prefer resource.TestCheckResourceAttrPair() or ARN check functions (e.g. testAccMatchResourceAttrRegionalARN)
aws/resource_aws_fsx_windows_file_system_test.go:92:6: AWSAT001: prefer resource.TestCheckResourceAttrPair() or ARN check functions (e.g. testAccMatchResourceAttrRegionalARN)
aws/resource_aws_rds_cluster_instance_test.go:207:6: AWSAT001: prefer resource.TestCheckResourceAttrPair() or ARN check functions (e.g. testAccMatchResourceAttrRegionalARN)
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAWSEBSSnapshot_withKms (41.72s)
--- PASS: TestAccAWSDBInstance_kmsKey (486.55s)
--- PASS: TestAccAWSRDSClusterInstance_kmsKey (691.04s)
```

Output from acceptance testing in AWS GovCloud (US) (hardcoded AZ and service availability PreCheck test failures will be separately addressed in the future):

```
--- PASS: TestAccAWSEBSSnapshot_withKms (60.17s)
--- PASS: TestAccAWSDBInstance_kmsKey (479.81s)

--- FAIL: TestAccAWSRDSClusterInstance_kmsKey (17.37s)
    TestAccAWSRDSClusterInstance_kmsKey: testing.go:684: Step 0 error: errors during apply:

        Error: error creating RDS cluster: InvalidVPCNetworkStateFault: Availability zones '[us-west-2a, us-west-2b, us-west-2c]' are unavailable in this region, please choose another zone set.

--- FAIL: TestAccAWSFsxWindowsFileSystem_basic (1743.81s)
    TestAccAWSFsxWindowsFileSystem_basic: testing.go:684: Step 0 error: errors during apply:

        Error: Error creating FSx filesystem: RequestError: send request failed
        caused by: Post "https://fsx.us-gov-west-1.amazonaws.com/": dial tcp: lookup fsx.us-gov-west-1.amazonaws.com: no such host
```
@bflad bflad requested a review from a team June 30, 2020 14:13
@ghost ghost added size/S Managed by automation to categorize the size of a PR. service/ec2 Issues and PRs that pertain to the ec2 service. service/fsx Issues and PRs that pertain to the fsx service. service/rds Issues and PRs that pertain to the rds service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jun 30, 2020
@anGie44 anGie44 self-requested a review June 30, 2020 17:29
Copy link
Contributor

@anGie44 anGie44 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

Relevant output of acceptance tests:

--- PASS: TestAccAWSEBSSnapshot_withKms (36.25s)
--- PASS: TestAccAWSDBInstance_kmsKey (469.07s)
--- PASS: TestAccAWSFsxWindowsFileSystem_basic (3162.94s)
--- PASS: TestAccAWSRDSClusterInstance_kmsKey (698.58s)

@bflad bflad added this to the v2.69.0 milestone Jun 30, 2020
@bflad bflad merged commit 3f12b61 into master Jun 30, 2020
@bflad bflad deleted the t-AWSAT001-kms_key_id branch June 30, 2020 20:39
@ghost
Copy link

ghost commented Jul 3, 2020

This has been released in version 2.69.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Jul 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Jul 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/ec2 Issues and PRs that pertain to the ec2 service. service/fsx Issues and PRs that pertain to the fsx service. service/rds Issues and PRs that pertain to the rds service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants