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

resource/aws_redshift_cluster: Properly disable logging when using logging nested argument #5895

Merged
merged 1 commit into from
Sep 19, 2018

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Sep 16, 2018

Fixes #3196

This is a quick fix until the deprecated enabled_logging, etc. arguments are removed in the next major version. Previously, when switching from logging being enabled to disabled, the update function would errantly reference both the deprecated enable_logging value from state (which would be true) and the new value logging.0.enable from configuration (which would be false) with a logical OR to determine whether logging should be enabled or disabled. We now treat the handling between the logging and deprecated arguments separately.

The reason this was not previously handled was that the existing acceptance testing had a race condition that meant the EnableLogging call would not error if DeleteBucket had not been called yet, but otherwise could fail with:

--- FAIL: TestAccAWSRedshiftCluster_loggingEnabled (1157.85s)
    testing.go:527: Step 1 error: Error applying: 1 error occurred:
        	* aws_redshift_cluster.default: 1 error occurred:
        	* aws_redshift_cluster.default: BucketNotFoundFault: Could not find bucket with name tf-redshift-logging-5762787809933873609

Or as reported in the issue:

--- FAIL: TestAccAWSRedshiftCluster_loggingEnabled (778.30s)
    testing.go:513: Step 1 error: Error applying: 1 error(s) occurred:
        
        * aws_redshift_cluster.default: 1 error(s) occurred:
        
        * aws_redshift_cluster.default: InsufficientS3BucketPolicyFault: Cannot write to bucket tf-redshift-logging-7539553717947480075. Please ensure that your IAM permissions are set up correctly.
            status code: 400, request id: c76bef3d-0542-11e8-83d5-9ff431b02044

Now the testing passes and verified that DisableLogging is correctly called in both tests:

--- PASS: TestAccAWSRedshiftCluster_loggingEnabled (1377.47s)
--- PASS: TestAccAWSRedshiftCluster_loggingEnabledDeprecated (1587.61s)

…gging nested argument

This is a quick fix until the deprecated `enabled_logging`, etc. arguments are removed in the next major version. Previously, when switching from logging being enabled to disabled, the update function would errantly reference both the deprecated `enable_logging` value from state (which would be true) and the new value `logging.0.enable` from configuration (which would be false) with a logical OR to determine whether logging should be enabled or disabled. We now treat the handling between the logging and deprecated arguments separately.

The reason this was not previously handled was that the existing acceptance testing had a race condition that meant the EnableLogging call would not error if DeleteBucket had not been called yet, but otherwise could fail with:

```
--- FAIL: TestAccAWSRedshiftCluster_loggingEnabled (1157.85s)
    testing.go:527: Step 1 error: Error applying: 1 error occurred:
        	* aws_redshift_cluster.default: 1 error occurred:
        	* aws_redshift_cluster.default: BucketNotFoundFault: Could not find bucket with name tf-redshift-logging-5762787809933873609
```

Now the testing passes and verified that `DisableLogging` is correctly called in both tests:

```
--- PASS: TestAccAWSRedshiftCluster_loggingEnabled (1377.47s)
--- PASS: TestAccAWSRedshiftCluster_loggingEnabledDeprecated (1587.61s)
```
@bflad bflad added bug Addresses a defect in current functionality. service/redshift Issues and PRs that pertain to the redshift service. labels Sep 16, 2018
@bflad bflad requested a review from a team September 16, 2018 19:36
@ghost ghost added the size/M Managed by automation to categorize the size of a PR. label Sep 16, 2018
@bflad bflad added this to the v1.37.0 milestone Sep 19, 2018
@bflad bflad merged commit f2ecfa4 into master Sep 19, 2018
@bflad bflad deleted the b-aws_redshift_cluster-disablelogging branch September 19, 2018 00:47
bflad added a commit that referenced this pull request Sep 19, 2018
@bflad
Copy link
Contributor Author

bflad commented Sep 19, 2018

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

@ghost
Copy link

ghost commented Apr 3, 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 Apr 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/redshift Issues and PRs that pertain to the redshift service. size/M Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redshift InsufficientS3BucketPolicyFault error while disabling logging
2 participants