fix: suppress perpetual diff for cloudwatch_logging_options when disabled#47474
Open
yosofbadr wants to merge 2 commits intohashicorp:mainfrom
Open
fix: suppress perpetual diff for cloudwatch_logging_options when disabled#47474yosofbadr wants to merge 2 commits intohashicorp:mainfrom
yosofbadr wants to merge 2 commits intohashicorp:mainfrom
Conversation
When cloudwatch_logging_options.enabled is false, the AWS API returns empty strings for log_group_name and log_stream_name. This causes a perpetual diff when users specify these values in their configuration but set enabled to false. Add a DiffSuppressFunc to both log_group_name and log_stream_name fields that suppresses the diff when the sibling enabled field is false, following the same pattern used in the Athena workgroup resource for its cloud_watch_logging_configuration. Fixes hashicorp#40446
Contributor
Community GuidelinesThis comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀 Voting for Prioritization
Pull Request Authors
|
Contributor
|
✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #40446
When
cloudwatch_logging_options.enabledisfalseon anaws_kinesis_firehose_delivery_stream, the AWS API returns empty strings forlog_group_nameandlog_stream_name. If the user specifies values for these fields in their configuration (which is common -- they may toggle logging on/off via a variable), Terraform detects a diff on every plan and continually reapplies the same settings.This PR adds a
DiffSuppressFuncto bothlog_group_nameandlog_stream_namewithin thecloudwatch_logging_optionsschema. When the siblingenabledfield isfalse, diffs on these fields are suppressed. This follows the same pattern used in the Athena workgroup resource (diffSuppressWorkGroupConfigurationMonitoringCloudWatchLogging).The fix applies to all destination types that use
cloudwatch_logging_options(Elasticsearch, Extended S3, HTTP Endpoint, Iceberg, OpenSearch, OpenSearch Serverless, Redshift, Snowflake, Splunk) since they all share the samecloudWatchLoggingOptionsSchema()function.Changes
internal/service/firehose/delivery_stream.go: AddeddiffSuppressCloudWatchLoggingOptionsDisabledfunction and wired it asDiffSuppressFunconlog_group_nameandlog_stream_namefields.Test plan
go build ./internal/service/firehose/passesgo vet ./internal/service/firehose/passescloudwatch_logging_optionswhereenabled = falseandlog_group_name/log_stream_nameare setterraform planand confirm no diff is detectedenabled = true, apply, then setenabled = falseagain and confirm no perpetual diffgo test ./internal/service/firehose/ -run TestAcc