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

r/aws_redshift_logging: new resource #36862

Merged
merged 3 commits into from
Apr 11, 2024
Merged

r/aws_redshift_logging: new resource #36862

merged 3 commits into from
Apr 11, 2024

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented Apr 11, 2024

Description

This resource will allow practitioners to manage Amazon Redshift cluster logging configurations with Terraform. This standalone resource will replace the optional logging block within the aws_redshift_cluster resource, allowing logging configurations to be managed independent of the parent cluster.

The logging argument within the aws_redshift_cluster resource is now deprecated.

Relations

Closes #36651

References

Output from Acceptance Testing

% make testacc PKG=redshift TESTS=TestAccRedshiftLogging_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.21.8 test ./internal/service/redshift/... -v -count 1 -parallel 20 -run='TestAccRedshiftLogging_'  -timeout 360m

--- PASS: TestAccRedshiftLogging_disappears_Cluster (411.73s)
--- PASS: TestAccRedshiftLogging_basic (425.21s)
--- PASS: TestAccRedshiftLogging_disappears (437.79s)
--- PASS: TestAccRedshiftLogging_s3 (522.88s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/redshift   528.588s

This resource will allow practitioners to manage Amazon Redshift cluster logging configurations with Terraform. This standalone resource will replace the optional `logging` block within the `aws_redshift_cluster` resource, allowing logging configurations to be managed independent of the parent cluster.

```console
% make testacc PKG=redshift TESTS=TestAccRedshiftLogging_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.21.8 test ./internal/service/redshift/... -v -count 1 -parallel 20 -run='TestAccRedshiftLogging_'  -timeout 360m

--- PASS: TestAccRedshiftLogging_disappears_Cluster (411.73s)
--- PASS: TestAccRedshiftLogging_basic (425.21s)
--- PASS: TestAccRedshiftLogging_disappears (437.79s)
--- PASS: TestAccRedshiftLogging_s3 (522.88s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/redshift   528.588s
```
@jar-b jar-b added the new-resource Introduces a new resource. label Apr 11, 2024
Copy link

Community Note

Voting for Prioritization

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

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/redshift Issues and PRs that pertain to the redshift service. generators Relates to code generators. labels Apr 11, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Apr 11, 2024
This argument is deprecated in favor of the new, standalone `aws_redshift_logging` resource.
@gdavison gdavison self-assigned this Apr 11, 2024
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

A few comments on the id parameter and basic tests. The basic test isn't a blocker. Otherwise looks good.

--- PASS: TestAccRedshiftCluster_changeAvailabilityZone_availabilityZoneRelocationNotSet (387.37s)
--- PASS: TestAccRedshiftCluster_availabilityZoneRelocation_publiclyAccessible (398.85s)
--- PASS: TestAccRedshiftCluster_kmsKey (425.40s)
--- PASS: TestAccRedshiftCluster_disappears (430.00s)
--- PASS: TestAccRedshiftCluster_basic (433.48s)
--- PASS: TestAccRedshiftCluster_iamRoles (439.29s)
--- PASS: TestAccRedshiftLogging_disappears (442.28s)
--- FAIL: TestAccRedshiftCluster_snapshotCopy (445.79s)
--- PASS: TestAccRedshiftCluster_loggingEnabled (470.11s)
--- PASS: TestAccRedshiftCluster_withFinalSnapshot (492.94s)
--- PASS: TestAccRedshiftCluster_availabilityZoneRelocation (534.20s)
--- PASS: TestAccRedshiftCluster_enhancedVPCRoutingEnabled (548.49s)
--- PASS: TestAccRedshiftCluster_tags (591.88s)
--- PASS: TestAccRedshiftCluster_changeAvailabilityZoneAndSetAvailabilityZoneRelocation (735.42s)
--- PASS: TestAccRedshiftLogging_basic (424.98s)
--- PASS: TestAccRedshiftCluster_forceNewUsername (846.46s)
--- PASS: TestAccRedshiftLogging_s3 (424.41s)
--- PASS: TestAccRedshiftLogging_disappears_Cluster (420.53s)
--- PASS: TestAccRedshiftCluster_manageMasterPassword (419.58s)
--- PASS: TestAccRedshiftCluster_aqua (441.84s)
--- PASS: TestAccRedshiftCluster_changeAvailabilityZone (886.18s)
--- PASS: TestAccRedshiftCluster_publiclyAccessible (444.93s)
--- PASS: TestAccRedshiftCluster_restoreFromSnapshotARN (943.72s)
--- PASS: TestAccRedshiftCluster_restoreFromSnapshot (1004.78s)
--- PASS: TestAccRedshiftCluster_changeEncryption1 (1201.45s)
--- PASS: TestAccRedshiftCluster_multiAZ (831.77s)
--- PASS: TestAccRedshiftCluster_changeEncryption2 (1303.53s)
--- PASS: TestAccRedshiftCluster_updateNodeCount (1266.56s)
--- PASS: TestAccRedshiftCluster_updateNodeType (1447.71s)

TestAccRedshiftCluster_snapshotCopy is an intermittent failure

if resp.Diagnostics.HasError() {
return
}
plan.ID = types.StringValue(plan.ClusterIdentifier.ValueString())
Copy link
Contributor

Choose a reason for hiding this comment

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

id is redundant, since it's the same as cluster_identifier, so it's not needed for a Framework-based resource

Copy link
Member Author

Choose a reason for hiding this comment

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

Chatted offline on this topic. Will leave the id attribute for now until we decide on a standard across the provider for Terraform Plugin Framework-based resources.

testAccCheckLoggingExists(ctx, resourceName, &log),
resource.TestCheckResourceAttrPair(resourceName, "cluster_identifier", clusterResourceName, "id"),
resource.TestCheckResourceAttr(resourceName, "log_destination_type", string(types.LogDestinationTypeCloudwatch)),
),
Copy link
Contributor

Choose a reason for hiding this comment

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

The basic test should check the values of all parameters

Copy link
Member Author

@jar-b jar-b Apr 11, 2024

Choose a reason for hiding this comment

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

Addressed with 02d60ee

Comment on lines +245 to +246
log_destination_type = "cloudwatch"
log_exports = ["connectionlog", "useractivitylog", "userlog"]
Copy link
Contributor

Choose a reason for hiding this comment

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

A basic test shouldn't set Optional parameters, so that it tests defaults

Copy link
Member Author

Choose a reason for hiding this comment

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

While technically optional, this argument is required when the log_destination_type is cloudwatch.

```console
% make testacc PKG=redshift TESTS=TestAccRedshiftLogging_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.21.8 test ./internal/service/redshift/... -v -count 1 -parallel 20 -run='TestAccRedshiftLogging_'  -timeout 360m

--- PASS: TestAccRedshiftLogging_disappears_Cluster (419.18s)
--- PASS: TestAccRedshiftLogging_basic (427.15s)
--- PASS: TestAccRedshiftLogging_s3 (437.89s)
--- PASS: TestAccRedshiftLogging_disappears (472.92s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/redshift   478.531s
```
@jar-b
Copy link
Member Author

jar-b commented Apr 11, 2024

Test results after adding missing checks:

% make testacc PKG=redshift TESTS=TestAccRedshiftLogging_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.21.8 test ./internal/service/redshift/... -v -count 1 -parallel 20 -run='TestAccRedshiftLogging_'  -timeout 360m

--- PASS: TestAccRedshiftLogging_disappears_Cluster (419.18s)
--- PASS: TestAccRedshiftLogging_basic (427.15s)
--- PASS: TestAccRedshiftLogging_s3 (437.89s)
--- PASS: TestAccRedshiftLogging_disappears (472.92s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/redshift   478.531s

@jar-b jar-b merged commit 6d4505f into main Apr 11, 2024
44 checks passed
@jar-b jar-b deleted the f-redshift_logging branch April 11, 2024 20:21
@github-actions github-actions bot added this to the v5.45.0 milestone Apr 11, 2024
Copy link

This functionality has been released in v5.45.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. Thank you!

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Apr 11, 2024
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. generators Relates to code generators. new-resource Introduces a new resource. service/redshift Issues and PRs that pertain to the redshift service. size/XL 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.

[New Resource]: aws_redshift_logging
2 participants